[PATCH] libata: improve FORMAT UNIT; minor code cleanups

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

 



commit ee67edb0e7701f8ae9114692837a8bbee9f99a35
Author: Jeff Garzik <jeff@xxxxxxxxxx>
Date:   Fri Sep 21 07:26:08 2007 -0400

    [libata] SCSI: improve FORMAT UNIT; minor code cleanups
    
    * SAT specifies that FORMAT UNIT should be translated into a series
      of READ and WRITE commands that zero the ATA device.  That is far too
      cumbersome to bother with.
    
      Since we don't actually format the device, the old behavior of
      always returning success was inaccurate.  Change FORMAT UNIT from
      returning success immediately (old behavior) to always returning
      an error (new behavior).
    
    * Add some comments around SYNCHRONIZE CACHE
    
    * Shuffle scsi command code around a bit, so that things are close
      to alphabetic order.
    
    Signed-off-by: Jeff Garzik <jeff@xxxxxxxxxx>

 drivers/ata/libata-scsi.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

ee67edb0e7701f8ae9114692837a8bbee9f99a35
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 456b75f..cd192c1 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2961,13 +2961,9 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
 	args.done = done;
 
 	switch(scsicmd[0]) {
-		/* no-op's, complete with success */
-		case SYNCHRONIZE_CACHE:
-		case REZERO_UNIT:
-		case SEEK_6:
-		case SEEK_10:
-		case FORMAT_UNIT:		/* FIXME: correct? */
-			ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
+		/* TODO: worth improving? */
+		case FORMAT_UNIT:
+			ata_scsi_invalid_field(cmd, done);
 			break;
 
 		case INQUIRY:
@@ -3025,6 +3021,19 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
 			done(cmd);
 			break;
 
+		/* if we reach this, then writeback caching is disabled,
+		 * turning this into a no-op.
+		 */
+		case SYNCHRONIZE_CACHE:
+			/* fall through */
+
+		/* no-op's, complete with success */
+		case REZERO_UNIT:
+		case SEEK_6:
+		case SEEK_10:
+			ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
+			break;
+
 		case SEND_DIAGNOSTIC:
 			tmp8 = scsicmd[1] & ~(1 << 3);
 			if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4]))
-
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