[PATCH] Reduce polling in sd.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a drive reports that no media is present, there's no point in
continuing to ask it about media status.  This patch (as696) cuts the
TUR polling short as soon as the drive reports no media instead of
going a full 3 iterations.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

---

On Wed, 11 Oct 2006, James Bottomley wrote:

> On Wed, 2006-10-11 at 10:32 -0400, Alan Stern wrote:
> > Andrew Morton says you rejected the patch below.  Any particular 
reason?
>
> I haven't said anything at all about this patch since my comments in
> June, which were basically
>
> - could we do more to reduce flag duplication
> - since the change impacts the cdrom layer we'll wait to see what the cd
> maintainers want to do.
 
Hmmm...  Well never mind that for now.  This particular patch has nothing
to do with flag duplication or the cdrom layer; it is entirely
self-contained.  I'd like to submit it on its own merits.

Alan Stern



Index: usb-2.6/drivers/scsi/sd.c
===================================================================
--- usb-2.6.orig/drivers/scsi/sd.c
+++ usb-2.6/drivers/scsi/sd.c
@@ -1051,6 +1051,14 @@
 						      &sshdr, SD_TIMEOUT,
 						      SD_MAX_RETRIES);
 
+			/*
+			 * If the drive has indicated to us that it
+			 * doesn't have any media in it, don't bother
+			 * with any more polling.
+			 */
+			if (media_not_present(sdkp, &sshdr))
+				return;
+
 			if (the_result)
 				sense_valid = scsi_sense_valid(&sshdr);
 			retries++;
@@ -1059,14 +1067,6 @@
 			  ((driver_byte(the_result) & DRIVER_SENSE) &&
 			  sense_valid && sshdr.sense_key == UNIT_ATTENTION)));
 
-		/*
-		 * If the drive has indicated to us that it doesn't have
-		 * any media in it, don't bother with any of the rest of
-		 * this crap.
-		 */
-		if (media_not_present(sdkp, &sshdr))
-			return;
-
 		if ((driver_byte(the_result) & DRIVER_SENSE) == 0) {
 			/* no sense, TUR either succeeded or failed
 			 * with a status error */

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux