OSDN Git Service

scsi: scsi_debug: implement IMMED bit
authorDouglas Gilbert <dgilbert@interlog.com>
Sat, 10 Feb 2018 02:36:39 +0000 (21:36 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 14 Feb 2018 02:49:18 +0000 (21:49 -0500)
commit80c49563e2506731372c04eec6f8c853d8b0151f
tree4f5d711653e291b24ceabc9e7a7b0fc5063671db
parent91d4c7520d0c514f404b9098b467184421cb9cc5
scsi: scsi_debug: implement IMMED bit

The Start Stop Unit (SSU) command takes in the order of a second to complete
on some SAS SSDs and longer on hard disks. Synchronize Cache (SC) can also
take some time. Both commands have an IMMED bit in their cdbs for those apps
that don't want to wait. This patch introduces a long delay for those commands
when the IMMED bit is clear.  Since SC is a media access command then when the
fake_rw option is active, its cdb processing is skipped and it returns
immediately. The SSU command is not altered by the setting of the fake_rw
option. These actions are not changed by this patch.

Changes since v1:
  - clear the cdb mask of SYNCHRONIZE CACHE(16) cdb in byte 1, bit 0

Changes:
  - add the SYNCHRONIZE CACHE(16) command
  - together with the existing START STOP UNIT and SYNCHRONIZE CACHE(10)
    commands process the IMMED bit in their cdbs
  - if the IMMED bit is set, return immediately
  - if the IMMED bit is clear, treat the delay parameter as having
    a unit of one second
  - in the SYNCHRONIZE CACHE processing do a bounds check

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c