static int idedisk_media_changed(struct gendisk *disk)
{
ide_drive_t *drive = disk->private_data;
+
+ /* do not scan partitions twice if this is a removable device */
+ if (drive->attach) {
+ drive->attach = 0;
+ return 0;
+ }
/* if removable, always assume it was changed */
return drive->removable;
}
g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
set_capacity(g, current_capacity(drive));
g->fops = &idedisk_ops;
+ drive->attach = 1;
add_disk(g);
return 0;
failed:
{
ide_drive_t *drive = disk->private_data;
idefloppy_floppy_t *floppy = drive->driver_data;
-
+
+ /* do not scan partitions twice if this is a removable device */
+ if (drive->attach) {
+ drive->attach = 0;
+ return 0;
+ }
return test_and_clear_bit(IDEFLOPPY_MEDIA_CHANGED, &floppy->flags);
}
strcpy(g->devfs_name, drive->devfs_name);
g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
g->fops = &idefloppy_ops;
+ drive->attach = 1;
add_disk(g);
return 0;
failed:
unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */
unsigned noprobe : 1; /* from: hdx=noprobe */
unsigned removable : 1; /* 1 if need to do check_media_change */
+ unsigned attach : 1; /* needed for removable devices */
unsigned is_flash : 1; /* 1 if probed as flash */
unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
unsigned no_unmask : 1; /* disallow setting unmask bit */