aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2016-04-25 12:16:29 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-29 19:25:17 -0400
commit185dd2329785981d458690c78fd56b320fef4ea7 (patch)
treeadfb7c4db5c3315b9503445b8cffcb7333513cb3
parent773642d95b8220502555122578694deeee8af4af (diff)
scsi_debug: ignore host lock option
Remove logic to optionally hold host_lock while each command is queued. Keep module and sysfs host_lock parameters for backward compatibility. Note in module parameter description that host_lock is ignored. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/scsi_debug.c44
1 files changed, 7 insertions, 37 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index ac74cbde7adf..88bfe0fb72ee 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4040,7 +4040,7 @@ MODULE_PARM_DESC(dsense, "use descriptor sense format(def=0 -> fixed)");
4040MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)"); 4040MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)");
4041MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)"); 4041MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)");
4042MODULE_PARM_DESC(guard, "protection checksum: 0=crc, 1=ip (def=0)"); 4042MODULE_PARM_DESC(guard, "protection checksum: 0=crc, 1=ip (def=0)");
4043MODULE_PARM_DESC(host_lock, "use host_lock around all commands (def=0)"); 4043MODULE_PARM_DESC(host_lock, "host_lock is ignored (def=0)");
4044MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)"); 4044MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)");
4045MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)"); 4045MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)");
4046MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)"); 4046MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)");
@@ -4592,30 +4592,15 @@ static ssize_t host_lock_show(struct device_driver *ddp, char *buf)
4592{ 4592{
4593 return scnprintf(buf, PAGE_SIZE, "%d\n", !!sdebug_host_lock); 4593 return scnprintf(buf, PAGE_SIZE, "%d\n", !!sdebug_host_lock);
4594} 4594}
4595/* Returns -EBUSY if host_lock is being changed and commands are queued */ 4595/* N.B. sdebug_host_lock does nothing, kept for backward compatibility */
4596static ssize_t host_lock_store(struct device_driver *ddp, const char *buf, 4596static ssize_t host_lock_store(struct device_driver *ddp, const char *buf,
4597 size_t count) 4597 size_t count)
4598{ 4598{
4599 int n, res; 4599 int n;
4600 4600
4601 if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) { 4601 if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) {
4602 bool new_host_lock = (n > 0); 4602 sdebug_host_lock = (n > 0);
4603 4603 return count;
4604 res = count;
4605 if (new_host_lock != sdebug_host_lock) {
4606 unsigned long iflags;
4607 int k;
4608
4609 spin_lock_irqsave(&queued_arr_lock, iflags);
4610 k = find_first_bit(queued_in_use_bm,
4611 sdebug_max_queue);
4612 if (k != sdebug_max_queue)
4613 res = -EBUSY; /* have queued commands */
4614 else
4615 sdebug_host_lock = new_host_lock;
4616 spin_unlock_irqrestore(&queued_arr_lock, iflags);
4617 }
4618 return res;
4619 } 4604 }
4620 return -EINVAL; 4605 return -EINVAL;
4621} 4606}
@@ -5035,7 +5020,7 @@ check_inject(struct scsi_cmnd *scp)
5035} 5020}
5036 5021
5037static int 5022static int
5038scsi_debug_queuecommand(struct scsi_cmnd *scp) 5023scsi_debug_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scp)
5039{ 5024{
5040 u8 sdeb_i; 5025 u8 sdeb_i;
5041 struct scsi_device *sdp = scp->device; 5026 struct scsi_device *sdp = scp->device;
@@ -5170,21 +5155,6 @@ check_cond:
5170 return schedule_resp(scp, devip, check_condition_result, 0); 5155 return schedule_resp(scp, devip, check_condition_result, 0);
5171} 5156}
5172 5157
5173static int
5174sdebug_queuecommand_lock_or_not(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
5175{
5176 if (sdebug_host_lock) {
5177 unsigned long iflags;
5178 int rc;
5179
5180 spin_lock_irqsave(shost->host_lock, iflags);
5181 rc = scsi_debug_queuecommand(cmd);
5182 spin_unlock_irqrestore(shost->host_lock, iflags);
5183 return rc;
5184 } else
5185 return scsi_debug_queuecommand(cmd);
5186}
5187
5188static struct scsi_host_template sdebug_driver_template = { 5158static struct scsi_host_template sdebug_driver_template = {
5189 .show_info = scsi_debug_show_info, 5159 .show_info = scsi_debug_show_info,
5190 .write_info = scsi_debug_write_info, 5160 .write_info = scsi_debug_write_info,
@@ -5195,7 +5165,7 @@ static struct scsi_host_template sdebug_driver_template = {
5195 .slave_configure = scsi_debug_slave_configure, 5165 .slave_configure = scsi_debug_slave_configure,
5196 .slave_destroy = scsi_debug_slave_destroy, 5166 .slave_destroy = scsi_debug_slave_destroy,
5197 .ioctl = scsi_debug_ioctl, 5167 .ioctl = scsi_debug_ioctl,
5198 .queuecommand = sdebug_queuecommand_lock_or_not, 5168 .queuecommand = scsi_debug_queuecommand,
5199 .change_queue_depth = sdebug_change_qdepth, 5169 .change_queue_depth = sdebug_change_qdepth,
5200 .eh_abort_handler = scsi_debug_abort, 5170 .eh_abort_handler = scsi_debug_abort,
5201 .eh_device_reset_handler = scsi_debug_device_reset, 5171 .eh_device_reset_handler = scsi_debug_device_reset,