ide-gd: stop using the disk events mechanism
[linux-2.6-block.git] / drivers / ide / ide-gd.c
index 05c26986637ba3ad8d29d46387d8cb9f45219402..661e2aa9c96784fcd71626a9fed7093b83b29f5f 100644 (file)
@@ -225,8 +225,12 @@ static int ide_gd_open(struct block_device *bdev, fmode_t mode)
                 * and the door_lock is irrelevant at this point.
                 */
                drive->disk_ops->set_doorlock(drive, disk, 1);
-               drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
-               check_disk_change(bdev);
+               if (__invalidate_device(bdev, true))
+                       pr_warn("VFS: busy inodes on changed media %s\n",
+                               bdev->bd_disk->disk_name);
+               drive->disk_ops->get_capacity(drive);
+               set_capacity(disk, ide_gd_capacity(drive));
+               set_bit(BDEV_NEED_PART_SCAN, &bdev->bd_flags);
        } else if (drive->dev_flags & IDE_DFLAG_FORMAT_IN_PROGRESS) {
                ret = -EBUSY;
                goto out_put_idkp;
@@ -284,32 +288,6 @@ static int ide_gd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
        return 0;
 }
 
-static unsigned int ide_gd_check_events(struct gendisk *disk,
-                                       unsigned int clearing)
-{
-       struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
-       ide_drive_t *drive = idkp->drive;
-       bool ret;
-
-       /* do not scan partitions twice if this is a removable device */
-       if (drive->dev_flags & IDE_DFLAG_ATTACH) {
-               drive->dev_flags &= ~IDE_DFLAG_ATTACH;
-               return 0;
-       }
-
-       /*
-        * The following is used to force revalidation on the first open on
-        * removeable devices, and never gets reported to userland as
-        * DISK_EVENT_FLAG_UEVENT isn't set in genhd->event_flags.
-        * This is intended as removable ide disk can't really detect
-        * MEDIA_CHANGE events.
-        */
-       ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED;
-       drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;
-
-       return ret ? DISK_EVENT_MEDIA_CHANGE : 0;
-}
-
 static void ide_gd_unlock_native_capacity(struct gendisk *disk)
 {
        struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
@@ -320,18 +298,6 @@ static void ide_gd_unlock_native_capacity(struct gendisk *disk)
                disk_ops->unlock_native_capacity(drive);
 }
 
-static int ide_gd_revalidate_disk(struct gendisk *disk)
-{
-       struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
-       ide_drive_t *drive = idkp->drive;
-
-       if (ide_gd_check_events(disk, 0))
-               drive->disk_ops->get_capacity(drive);
-
-       set_capacity(disk, ide_gd_capacity(drive));
-       return 0;
-}
-
 static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode,
                             unsigned int cmd, unsigned long arg)
 {
@@ -364,9 +330,7 @@ static const struct block_device_operations ide_gd_ops = {
        .compat_ioctl           = ide_gd_compat_ioctl,
 #endif
        .getgeo                 = ide_gd_getgeo,
-       .check_events           = ide_gd_check_events,
        .unlock_native_capacity = ide_gd_unlock_native_capacity,
-       .revalidate_disk        = ide_gd_revalidate_disk
 };
 
 static int ide_gd_probe(ide_drive_t *drive)