From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, tomas.winkler@intel.com,
emilne@redhat.com, bart.vanassche@sandisk.com
Subject: [PATCH v2 02/12] scsi_debug: ignore host lock option
Date: Fri, 29 Apr 2016 21:39:09 -0400 [thread overview]
Message-ID: <1461980359-4320-3-git-send-email-dgilbert@interlog.com> (raw)
In-Reply-To: <1461980359-4320-1-git-send-email-dgilbert@interlog.com>
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>
---
drivers/scsi/scsi_debug.c | 44 +++++++-------------------------------------
1 file changed, 7 insertions(+), 37 deletions(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 9172b1a..40aaaed 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4042,7 +4042,7 @@ MODULE_PARM_DESC(dsense, "use descriptor sense format(def=0 -> fixed)");
MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)");
MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)");
MODULE_PARM_DESC(guard, "protection checksum: 0=crc, 1=ip (def=0)");
-MODULE_PARM_DESC(host_lock, "use host_lock around all commands (def=0)");
+MODULE_PARM_DESC(host_lock, "host_lock is ignored (def=0)");
MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)");
MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)");
MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)");
@@ -4595,30 +4595,15 @@ static ssize_t host_lock_show(struct device_driver *ddp, char *buf)
{
return scnprintf(buf, PAGE_SIZE, "%d\n", !!sdebug_host_lock);
}
-/* Returns -EBUSY if host_lock is being changed and commands are queued */
+/* N.B. sdebug_host_lock does nothing, kept for backward compatibility */
static ssize_t host_lock_store(struct device_driver *ddp, const char *buf,
size_t count)
{
- int n, res;
+ int n;
if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) {
- bool new_host_lock = (n > 0);
-
- res = count;
- if (new_host_lock != sdebug_host_lock) {
- unsigned long iflags;
- int k;
-
- spin_lock_irqsave(&queued_arr_lock, iflags);
- k = find_first_bit(queued_in_use_bm,
- sdebug_max_queue);
- if (k != sdebug_max_queue)
- res = -EBUSY; /* have queued commands */
- else
- sdebug_host_lock = new_host_lock;
- spin_unlock_irqrestore(&queued_arr_lock, iflags);
- }
- return res;
+ sdebug_host_lock = (n > 0);
+ return count;
}
return -EINVAL;
}
@@ -5038,7 +5023,7 @@ check_inject(struct scsi_cmnd *scp)
}
static int
-scsi_debug_queuecommand(struct scsi_cmnd *scp)
+scsi_debug_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scp)
{
u8 sdeb_i;
struct scsi_device *sdp = scp->device;
@@ -5173,21 +5158,6 @@ check_cond:
return schedule_resp(scp, devip, check_condition_result, 0);
}
-static int
-sdebug_queuecommand_lock_or_not(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
-{
- if (sdebug_host_lock) {
- unsigned long iflags;
- int rc;
-
- spin_lock_irqsave(shost->host_lock, iflags);
- rc = scsi_debug_queuecommand(cmd);
- spin_unlock_irqrestore(shost->host_lock, iflags);
- return rc;
- } else
- return scsi_debug_queuecommand(cmd);
-}
-
static struct scsi_host_template sdebug_driver_template = {
.show_info = scsi_debug_show_info,
.write_info = scsi_debug_write_info,
@@ -5198,7 +5168,7 @@ static struct scsi_host_template sdebug_driver_template = {
.slave_configure = scsi_debug_slave_configure,
.slave_destroy = scsi_debug_slave_destroy,
.ioctl = scsi_debug_ioctl,
- .queuecommand = sdebug_queuecommand_lock_or_not,
+ .queuecommand = scsi_debug_queuecommand,
.change_queue_depth = sdebug_change_qdepth,
.eh_abort_handler = scsi_debug_abort,
.eh_device_reset_handler = scsi_debug_device_reset,
--
2.7.4
next prev parent reply other threads:[~2016-04-30 1:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-30 1:39 [PATCH v2 00/12] scsi_debug: multiple queue support and cleanup Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 01/12] scsi_debug: cleanup naming and bit crunching Douglas Gilbert
2016-04-30 1:39 ` Douglas Gilbert [this message]
2016-04-30 1:39 ` [PATCH v2 03/12] scsi_debug: replace jiffy timers with hr timers Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 04/12] scsi_debug: make jiffy delay name clearer Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 05/12] scsi_debug: replace tasklet with work queue Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 06/12] scsi_debug: re-order file scope declarations Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 07/12] scsi_debug: use likely hints on fast path Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 08/12] scsi_debug: rework resp_report_luns Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 09/12] scsi_debug: add multiple queue support Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 10/12] scsi_debug: vpd and mode page work Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 11/12] scsi_debug: uuid for lu name Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 12/12] scsi_debug: use locally assigned naa Douglas Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461980359-4320-3-git-send-email-dgilbert@interlog.com \
--to=dgilbert@interlog.com \
--cc=bart.vanassche@sandisk.com \
--cc=emilne@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).