diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 1d3407d7e095..34b9441084f8 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -739,12 +739,9 @@ static void ide_disk_setup(ide_drive_t *drive) set_wcache(drive, 1); if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 && - (drive->head == 0 || drive->head > 16)) { + (drive->head == 0 || drive->head > 16)) printk(KERN_ERR "%s: invalid geometry: %d physical heads?\n", drive->name, drive->head); - drive->dev_flags &= ~IDE_DFLAG_ATTACH; - } else - drive->dev_flags |= IDE_DFLAG_ATTACH; } static void ide_disk_flush(ide_drive_t *drive) diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index af7503b47dbe..f5a2870aaf54 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -516,8 +516,6 @@ static void ide_floppy_setup(ide_drive_t *drive) (void) ide_floppy_get_capacity(drive); ide_proc_register_driver(drive, floppy->driver); - - drive->dev_flags |= IDE_DFLAG_ATTACH; } static void ide_floppy_flush(ide_drive_t *drive) diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 05c26986637b..661e2aa9c967 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c @@ -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) diff --git a/include/linux/ide.h b/include/linux/ide.h index a254841bd315..62653769509f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -490,8 +490,6 @@ enum { IDE_DFLAG_NOPROBE = BIT(9), /* need to do check_media_change() */ IDE_DFLAG_REMOVABLE = BIT(10), - /* needed for removable devices */ - IDE_DFLAG_ATTACH = BIT(11), IDE_DFLAG_FORCED_GEOM = BIT(12), /* disallow setting unmask bit */ IDE_DFLAG_NO_UNMASK = BIT(13),