2.5 PATCH: test for media-change like "popular" OSes..
This patch changes how media-change is detected to use a mechanism more similar to what 'popular' OSes use.
The motive for this change is that more and more emulated-SCSI devices (sbp2, usb-storage, etc) don't support START_STOP unless they need it. Other OSes won't send a START_STOP unless the device reports NOT_READY, indicating that it needs an explicit command to start up.
One could argue that these devices are out-of-spec, but they are so common that they basically define the de facto spec.
Basically, any device that needs a START_STOP should still get it, but ones that don't need it won't.
Linus, please apply.
Matt
drivers/scsi/sd.c +8 -7
@@ -697,15 +697,17 @@* check_disk_change */ } -/* Using Start/Stop enables differentiation between drive with +/* Using TEST_UNIT_READY enables differentiation between drive with * no cartridge loaded - NOT READY, drive with changed cartridge - * UNIT ATTENTION, or with same cartridge - GOOD STATUS. -* This also handles drives that auto spin down. eg iomega jaz 1GB -* as this will spin up the drive. +* +* Drives that auto spin down. eg iomega jaz 1G, will be started +* by sd_spinup_disk() from sd_init_onedisk(), which happens whenever +* sd_revalidate() is called. */ retval = -ENODEV ;if (scsi_block_when_processing_errors (sdp)) - retval =scsi_ioctl (sdp,SCSI_IOCTL_START_UNIT ,NULL ); + retval =scsi_ioctl (sdp,SCSI_IOCTL_TEST_UNIT_READY ,NULL );if (retval) {/* Unable to test, unit probably not ready. * This usually means there is no disc in the
@@ -791,10 +793,9 @@if (sd_media_not_present (sdkp, SRpnt))return ; -/* Look for non-removable devices that return NOT_READY. +/* Look for devices that return NOT_READY. * Issue command to spin up drive for these cases. */ -if (the_result && !sdp->removable && - SRpnt->sr_sense_buffer[2 ] ==NOT_READY ) { +if (the_result && SRpnt->sr_sense_buffer[2 ] ==NOT_READY ) {unsigned long time1;if (!spintime) { printk(KERN_NOTICE "%s: Spinning up disk...",
Signature · 6 lines
Matthew Dharm Home: [email protected] Maintainer, Linux USB Mass Storage Driver Stef, you just got beaten by a ball of DIRT. -- Greg User Friendly, 12/7/1997