* [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-24 9:36 ` Benjamin Block
2021-09-28 16:54 ` Benjamin Block
2021-09-18 0:04 ` [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it Bart Van Assche
` (77 subsequent siblings)
78 siblings, 2 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, Ming Lei,
Christoph Hellwig, James E.J. Bottomley
Conditional statements are faster than indirect calls. Use a member variable
to track the SCSI command submitter such that later patches can call
scsi_done(scmd) instead of scmd->scsi_done(scmd).
The asymmetric behavior that scsi_send_eh_cmnd() sets the submission
context to the SCSI error handler and that it does not restore the
submission context to the SCSI core is retained.
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_error.c | 18 +++++++-----------
drivers/scsi/scsi_lib.c | 9 +++++++++
drivers/scsi/scsi_priv.h | 1 +
include/scsi/scsi_cmnd.h | 7 +++++++
4 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index b6c86cce57bf..f5841aa4a5a1 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -50,8 +50,6 @@
#include <asm/unaligned.h>
-static void scsi_eh_done(struct scsi_cmnd *scmd);
-
/*
* These should *probably* be handled by the host itself.
* Since it is allowed to sleep, it probably should.
@@ -520,7 +518,8 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)
/* handler does not care. Drop down to default handling */
}
- if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done)
+ if (scmd->cmnd[0] == TEST_UNIT_READY &&
+ scmd->submitter != SCSI_ERROR_HANDLER)
/*
* nasty: for mid-layer issued TURs, we need to return the
* actual sense data without any recovery attempt. For eh
@@ -782,7 +781,7 @@ static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd)
* scsi_eh_done - Completion function for error handling.
* @scmd: Cmd that is done.
*/
-static void scsi_eh_done(struct scsi_cmnd *scmd)
+void scsi_eh_done(struct scsi_cmnd *scmd)
{
struct completion *eh_action;
@@ -986,6 +985,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
ses->prot_op = scmd->prot_op;
ses->eh_eflags = scmd->eh_eflags;
+ WARN_ON_ONCE(scmd->submitter != BLOCK_LAYER);
scmd->prot_op = SCSI_PROT_NORMAL;
scmd->eh_eflags = 0;
scmd->cmnd = ses->eh_cmnd;
@@ -1082,7 +1082,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd,
shost->eh_action = &done;
scsi_log_send(scmd);
- scmd->scsi_done = scsi_eh_done;
+ scmd->submitter = SCSI_ERROR_HANDLER;
/*
* Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
@@ -1109,6 +1109,7 @@ static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd,
if (rtn) {
if (timeleft > stall_for) {
scsi_eh_restore_cmnd(scmd, &ses);
+
timeleft -= stall_for;
msleep(jiffies_to_msecs(stall_for));
goto retry;
@@ -2338,11 +2339,6 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)
}
EXPORT_SYMBOL(scsi_report_device_reset);
-static void
-scsi_reset_provider_done_command(struct scsi_cmnd *scmd)
-{
-}
-
/**
* scsi_ioctl_reset: explicitly reset a host/bus/target/device
* @dev: scsi_device to operate on
@@ -2379,7 +2375,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
scsi_init_command(dev, scmd);
scmd->cmnd = scsi_req(rq)->cmd;
- scmd->scsi_done = scsi_reset_provider_done_command;
+ scmd->submitter = SCSI_RESET_IOCTL;
memset(&scmd->sdb, 0, sizeof(scmd->sdb));
scmd->cmd_len = 0;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 572673873ddf..ba6d748a0246 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
static void scsi_mq_done(struct scsi_cmnd *cmd)
{
+ switch (cmd->submitter) {
+ case BLOCK_LAYER:
+ break;
+ case SCSI_ERROR_HANDLER:
+ return scsi_eh_done(cmd);
+ case SCSI_RESET_IOCTL:
+ return;
+ }
+
if (unlikely(blk_should_fake_timeout(scsi_cmd_to_rq(cmd)->q)))
return;
if (unlikely(test_and_set_bit(SCMD_STATE_COMPLETE, &cmd->state)))
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 6d9152031a40..b7f963149352 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -84,6 +84,7 @@ void scsi_eh_ready_devs(struct Scsi_Host *shost,
int scsi_eh_get_sense(struct list_head *work_q,
struct list_head *done_q);
int scsi_noretry_cmd(struct scsi_cmnd *scmd);
+void scsi_eh_done(struct scsi_cmnd *scmd);
/* scsi_lib.c */
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index eaf04c9a1dfc..365d47a66c18 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -65,6 +65,12 @@ struct scsi_pointer {
#define SCMD_STATE_COMPLETE 0
#define SCMD_STATE_INFLIGHT 1
+enum scsi_cmnd_submitter {
+ BLOCK_LAYER = 0,
+ SCSI_ERROR_HANDLER = 1,
+ SCSI_RESET_IOCTL = 2,
+} __packed;
+
struct scsi_cmnd {
struct scsi_request req;
struct scsi_device *device;
@@ -90,6 +96,7 @@ struct scsi_cmnd {
unsigned char prot_op;
unsigned char prot_type;
unsigned char prot_flags;
+ enum scsi_cmnd_submitter submitter;
unsigned short cmd_len;
enum dma_data_direction sc_data_direction;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter
2021-09-18 0:04 ` [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter Bart Van Assche
@ 2021-09-24 9:36 ` Benjamin Block
2021-09-25 3:38 ` Bart Van Assche
2021-09-28 16:54 ` Benjamin Block
1 sibling, 1 reply; 106+ messages in thread
From: Benjamin Block @ 2021-09-24 9:36 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Hannes Reinecke, Ming Lei,
Christoph Hellwig, James E.J. Bottomley
On Fri, Sep 17, 2021 at 05:04:44PM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Use a member variable
> to track the SCSI command submitter such that later patches can call
> scsi_done(scmd) instead of scmd->scsi_done(scmd).
>
> The asymmetric behavior that scsi_send_eh_cmnd() sets the submission
> context to the SCSI error handler and that it does not restore the
> submission context to the SCSI core is retained.
>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/scsi_error.c | 18 +++++++-----------
> drivers/scsi/scsi_lib.c | 9 +++++++++
> drivers/scsi/scsi_priv.h | 1 +
> include/scsi/scsi_cmnd.h | 7 +++++++
> 4 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 572673873ddf..ba6d748a0246 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
>
> static void scsi_mq_done(struct scsi_cmnd *cmd)
> {
> + switch (cmd->submitter) {
> + case BLOCK_LAYER:
> + break;
> + case SCSI_ERROR_HANDLER:
> + return scsi_eh_done(cmd);
> + case SCSI_RESET_IOCTL:
> + return;
> + }
> +
Hmm, I'm confused, you replace one kind of branch with different one. Why
would that increase IOPS by 5%?
Maybe its because the new `submitter` field in `struct scsi_cmnd` is now
on a hot cache line, whereas `*scsi_done` is not?
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter
2021-09-24 9:36 ` Benjamin Block
@ 2021-09-25 3:38 ` Bart Van Assche
2021-09-27 19:55 ` Benjamin Block
0 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-25 3:38 UTC (permalink / raw)
To: Benjamin Block
Cc: Martin K . Petersen, linux-scsi, Hannes Reinecke, Ming Lei,
Christoph Hellwig, James E.J. Bottomley
On 9/24/21 02:36, Benjamin Block wrote:
> On Fri, Sep 17, 2021 at 05:04:44PM -0700, Bart Van Assche wrote:
>> Conditional statements are faster than indirect calls. Use a member variable
>> to track the SCSI command submitter such that later patches can call
>> scsi_done(scmd) instead of scmd->scsi_done(scmd).
>>
>> The asymmetric behavior that scsi_send_eh_cmnd() sets the submission
>> context to the SCSI error handler and that it does not restore the
>> submission context to the SCSI core is retained.
>>
>> Cc: Hannes Reinecke <hare@suse.com>
>> Cc: Ming Lei <ming.lei@redhat.com>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>> ---
>> drivers/scsi/scsi_error.c | 18 +++++++-----------
>> drivers/scsi/scsi_lib.c | 9 +++++++++
>> drivers/scsi/scsi_priv.h | 1 +
>> include/scsi/scsi_cmnd.h | 7 +++++++
>> 4 files changed, 24 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
>> index 572673873ddf..ba6d748a0246 100644
>> --- a/drivers/scsi/scsi_lib.c
>> +++ b/drivers/scsi/scsi_lib.c
>> @@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
>>
>> static void scsi_mq_done(struct scsi_cmnd *cmd)
>> {
>> + switch (cmd->submitter) {
>> + case BLOCK_LAYER:
>> + break;
>> + case SCSI_ERROR_HANDLER:
>> + return scsi_eh_done(cmd);
>> + case SCSI_RESET_IOCTL:
>> + return;
>> + }
>> +
>
> Hmm, I'm confused, you replace one kind of branch with different one. Why
> would that increase IOPS by 5%?
>
> Maybe its because the new `submitter` field in `struct scsi_cmnd` is now
> on a hot cache line, whereas `*scsi_done` is not?
Hi Benjamin,
To be honest, the 5% improvement is more than I had expected. This is what I
know about indirect function calls vs. branches:
- The target of an indirect branch is predicted by the indirect branch
predictor. For direct branches the Branch Target Buffer (BTB) is used.
- The performance of indirect calls is negatively affected by security
mitigations (CONFIG_RETPOLINE) but not the performance of direct branches
My measurement was run with CONFIG_RETPOLINE off. I expect a larger
difference with CONFIG_RETPOLINE enabled.
Maybe I triggered inefficient behavior of the indirect branch predictor with
the workload I ran.
Bart.
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter
2021-09-25 3:38 ` Bart Van Assche
@ 2021-09-27 19:55 ` Benjamin Block
0 siblings, 0 replies; 106+ messages in thread
From: Benjamin Block @ 2021-09-27 19:55 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Hannes Reinecke, Ming Lei,
Christoph Hellwig, James E.J. Bottomley
On Fri, Sep 24, 2021 at 08:38:42PM -0700, Bart Van Assche wrote:
> On 9/24/21 02:36, Benjamin Block wrote:
> > On Fri, Sep 17, 2021 at 05:04:44PM -0700, Bart Van Assche wrote:
> > > Conditional statements are faster than indirect calls. Use a member variable
> > > to track the SCSI command submitter such that later patches can call
> > > scsi_done(scmd) instead of scmd->scsi_done(scmd).
> > >
> > > The asymmetric behavior that scsi_send_eh_cmnd() sets the submission
> > > context to the SCSI error handler and that it does not restore the
> > > submission context to the SCSI core is retained.
> > >
> > > Cc: Hannes Reinecke <hare@suse.com>
> > > Cc: Ming Lei <ming.lei@redhat.com>
> > > Cc: Christoph Hellwig <hch@lst.de>
> > > Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> > > ---
> > > drivers/scsi/scsi_error.c | 18 +++++++-----------
> > > drivers/scsi/scsi_lib.c | 9 +++++++++
> > > drivers/scsi/scsi_priv.h | 1 +
> > > include/scsi/scsi_cmnd.h | 7 +++++++
> > > 4 files changed, 24 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> > > index 572673873ddf..ba6d748a0246 100644
> > > --- a/drivers/scsi/scsi_lib.c
> > > +++ b/drivers/scsi/scsi_lib.c
> > > @@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
> > > static void scsi_mq_done(struct scsi_cmnd *cmd)
> > > {
> > > + switch (cmd->submitter) {
> > > + case BLOCK_LAYER:
> > > + break;
> > > + case SCSI_ERROR_HANDLER:
> > > + return scsi_eh_done(cmd);
> > > + case SCSI_RESET_IOCTL:
> > > + return;
> > > + }
> > > +
> >
> > Hmm, I'm confused, you replace one kind of branch with different one. Why
> > would that increase IOPS by 5%?
> >
> > Maybe its because the new `submitter` field in `struct scsi_cmnd` is now
> > on a hot cache line, whereas `*scsi_done` is not?
>
> Hi Benjamin,
>
> To be honest, the 5% improvement is more than I had expected. This is what I
> know about indirect function calls vs. branches:
> - The target of an indirect branch is predicted by the indirect branch
> predictor. For direct branches the Branch Target Buffer (BTB) is used.
> - The performance of indirect calls is negatively affected by security
> mitigations (CONFIG_RETPOLINE) but not the performance of direct branches
> My measurement was run with CONFIG_RETPOLINE off. I expect a larger
> difference with CONFIG_RETPOLINE enabled.
Ah ok, yeah, that sounds reasonable. Thanks.
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter
2021-09-18 0:04 ` [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter Bart Van Assche
2021-09-24 9:36 ` Benjamin Block
@ 2021-09-28 16:54 ` Benjamin Block
2021-09-28 18:51 ` Bart Van Assche
1 sibling, 1 reply; 106+ messages in thread
From: Benjamin Block @ 2021-09-28 16:54 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Hannes Reinecke, Ming Lei,
Christoph Hellwig, James E.J. Bottomley
On Fri, Sep 17, 2021 at 05:04:44PM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Use a member variable
> to track the SCSI command submitter such that later patches can call
> scsi_done(scmd) instead of scmd->scsi_done(scmd).
>
> The asymmetric behavior that scsi_send_eh_cmnd() sets the submission
> context to the SCSI error handler and that it does not restore the
> submission context to the SCSI core is retained.
>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/scsi_error.c | 18 +++++++-----------
> drivers/scsi/scsi_lib.c | 9 +++++++++
> drivers/scsi/scsi_priv.h | 1 +
> include/scsi/scsi_cmnd.h | 7 +++++++
> 4 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
> index eaf04c9a1dfc..365d47a66c18 100644
> --- a/include/scsi/scsi_cmnd.h
> +++ b/include/scsi/scsi_cmnd.h
> @@ -65,6 +65,12 @@ struct scsi_pointer {
> #define SCMD_STATE_COMPLETE 0
> #define SCMD_STATE_INFLIGHT 1
>
> +enum scsi_cmnd_submitter {
> + BLOCK_LAYER = 0,
> + SCSI_ERROR_HANDLER = 1,
> + SCSI_RESET_IOCTL = 2,
> +} __packed;
> +
Might be prudent to not make them as generic, especially `BLOCK_LAYER`
might easily clash without namespace. `SUBMITTED_BY_...`?
> struct scsi_cmnd {
> struct scsi_request req;
> struct scsi_device *device;
> @@ -90,6 +96,7 @@ struct scsi_cmnd {
> unsigned char prot_op;
> unsigned char prot_type;
> unsigned char prot_flags;
> + enum scsi_cmnd_submitter submitter;
Do you think it'd make much of a difference, if you initialized this in
scsi_init_command(), or somewhere around there, explicitly to
`BLOCK_LAYER`? Makes it easier to maintain, and to not forget, that it
needs to be done, if the memset() to 0 ever changes... after the
memset() the memory should be hot.
I just had to search a bit where this gets set to 0, as I didn't
remember exactly where it was.
>
> unsigned short cmd_len;
> enum dma_data_direction sc_data_direction;
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter
2021-09-28 16:54 ` Benjamin Block
@ 2021-09-28 18:51 ` Bart Van Assche
0 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-28 18:51 UTC (permalink / raw)
To: Benjamin Block
Cc: Martin K . Petersen, linux-scsi, Hannes Reinecke, Ming Lei,
Christoph Hellwig, James E.J. Bottomley
On 9/28/21 9:54 AM, Benjamin Block wrote:
> On Fri, Sep 17, 2021 at 05:04:44PM -0700, Bart Van Assche wrote:
>> +enum scsi_cmnd_submitter {
>> + BLOCK_LAYER = 0,
>> + SCSI_ERROR_HANDLER = 1,
>> + SCSI_RESET_IOCTL = 2,
>> +} __packed;
>> +
>
> Might be prudent to not make them as generic, especially `BLOCK_LAYER`
> might easily clash without namespace. `SUBMITTED_BY_...`?
Hi Benjamin,
I will insert the prefix SUBMITTED_BY_.
>
>> struct scsi_cmnd {
>> struct scsi_request req;
>> struct scsi_device *device;
>> @@ -90,6 +96,7 @@ struct scsi_cmnd {
>> unsigned char prot_op;
>> unsigned char prot_type;
>> unsigned char prot_flags;
>> + enum scsi_cmnd_submitter submitter;
>
> Do you think it'd make much of a difference, if you initialized this in
> scsi_init_command(), or somewhere around there, explicitly to
> `BLOCK_LAYER`? Makes it easier to maintain, and to not forget, that it
> needs to be done, if the memset() to 0 ever changes... after the
> memset() the memory should be hot.
>
> I just had to search a bit where this gets set to 0, as I didn't
> remember exactly where it was.
Performance-wise this probably won't make much difference. I'd like to add
that assignment in scsi_queue_rq() where the "cmd->scsi_done = scsi_done"
code was. That should be the approach that has the lowest probability of
introducing functional changes in the SCSI core.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
2021-09-18 0:04 ` [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-20 9:42 ` John Garry
2021-09-28 16:57 ` Benjamin Block
2021-09-18 0:04 ` [PATCH 03/84] scsi: core: Call scsi_done directly Bart Van Assche
` (76 subsequent siblings)
78 siblings, 2 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Since the removal of the legacy block layer there is only one completion
function left in the SCSI core, namely scsi_mq_done(). Rename it into
scsi_done(). Export that function to allow SCSI LLDs to call it directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_lib.c | 5 +++--
include/scsi/scsi_cmnd.h | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ba6d748a0246..c3a0283dbff0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1575,7 +1575,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
return scsi_cmd_to_driver(cmd)->init_command(cmd);
}
-static void scsi_mq_done(struct scsi_cmnd *cmd)
+void scsi_done(struct scsi_cmnd *cmd)
{
switch (cmd->submitter) {
case BLOCK_LAYER:
@@ -1593,6 +1593,7 @@ static void scsi_mq_done(struct scsi_cmnd *cmd)
trace_scsi_dispatch_cmd_done(cmd);
blk_mq_complete_request(scsi_cmd_to_rq(cmd));
}
+EXPORT_SYMBOL(scsi_done);
static void scsi_mq_put_budget(struct request_queue *q, int budget_token)
{
@@ -1692,7 +1693,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
scsi_set_resid(cmd, 0);
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
- cmd->scsi_done = scsi_mq_done;
+ cmd->scsi_done = scsi_done;
blk_mq_start_request(req);
reason = scsi_dispatch_cmd(cmd);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 365d47a66c18..5b230d06527f 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -172,6 +172,8 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
return *(struct scsi_driver **)rq->rq_disk->private_data;
}
+void scsi_done(struct scsi_cmnd *cmd);
+
extern void scsi_finish_command(struct scsi_cmnd *cmd);
extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it
2021-09-18 0:04 ` [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it Bart Van Assche
@ 2021-09-20 9:42 ` John Garry
2021-09-20 16:28 ` Bart Van Assche
2021-09-28 16:57 ` Benjamin Block
1 sibling, 1 reply; 106+ messages in thread
From: John Garry @ 2021-09-20 9:42 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen; +Cc: linux-scsi, James E.J. Bottomley
On 18/09/2021 01:04, Bart Van Assche wrote:
> Since the removal of the legacy block layer there is only one completion
> function left in the SCSI core, namely scsi_mq_done(). Rename it into
> scsi_done().
It would be nice to remove "mq" from other symbol naming in scsi_lib.c
as well then. Could be a separate job, I suppose.
Export that function to allow SCSI LLDs to call it directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/scsi_lib.c | 5 +++--
> include/scsi/scsi_cmnd.h | 2 ++
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index ba6d748a0246..c3a0283dbff0 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1575,7 +1575,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
> return scsi_cmd_to_driver(cmd)->init_command(cmd);
> }
>
> -static void scsi_mq_done(struct scsi_cmnd *cmd)
> +void scsi_done(struct scsi_cmnd *cmd)
> {
> switch (cmd->submitter) {
> case BLOCK_LAYER:
> @@ -1593,6 +1593,7 @@ static void scsi_mq_done(struct scsi_cmnd *cmd)
> trace_scsi_dispatch_cmd_done(cmd);
> blk_mq_complete_request(scsi_cmd_to_rq(cmd));
> }
> +EXPORT_SYMBOL(scsi_done);
>
> static void scsi_mq_put_budget(struct request_queue *q, int budget_token)
> {
> @@ -1692,7 +1693,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
>
> scsi_set_resid(cmd, 0);
> memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
> - cmd->scsi_done = scsi_mq_done;
> + cmd->scsi_done = scsi_done;
I have gone to the end of the series, and we still set
scsi_cmnd.scsi_done. So some drivers still rely on it. I thought that
the idea was that we don't need this callback pointer any longer.
As an aside, this is the current declaration of scsi_cmnd.scsi_done:
/* Low-level done function - can be used by low-level driver to point
* to completion function. Not used by mid/upper level code. */
void (*scsi_done) (struct scsi_cmnd *);
That does not sound right, as scsi_done is set by the mid-layer.
>
> blk_mq_start_request(req);
> reason = scsi_dispatch_cmd(cmd);
> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
> index 365d47a66c18..5b230d06527f 100644
> --- a/include/scsi/scsi_cmnd.h
> +++ b/include/scsi/scsi_cmnd.h
> @@ -172,6 +172,8 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
> return *(struct scsi_driver **)rq->rq_disk->private_data;
> }
>
> +void scsi_done(struct scsi_cmnd *cmd);
> +
> extern void scsi_finish_command(struct scsi_cmnd *cmd);
>
> extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
> .
>
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it
2021-09-20 9:42 ` John Garry
@ 2021-09-20 16:28 ` Bart Van Assche
2021-09-20 16:47 ` John Garry
0 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-20 16:28 UTC (permalink / raw)
To: John Garry, Martin K . Petersen; +Cc: linux-scsi, James E.J. Bottomley
On 9/20/21 2:42 AM, John Garry wrote:
> On 18/09/2021 01:04, Bart Van Assche wrote:
>> @@ -1692,7 +1693,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
>> scsi_set_resid(cmd, 0);
>> memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
>> - cmd->scsi_done = scsi_mq_done;
>> + cmd->scsi_done = scsi_done;
>
> I have gone to the end of the series, and we still set scsi_cmnd.scsi_done. So some drivers still rely on it. I thought that the idea was that we don't need this callback pointer any longer.
It seems like the email service I used to send out the patches (gmail)
dropped patches 79/84..84/84. The entire patch series is available here:
https://github.com/bvanassche/linux/tree/scsi-remove-done-callback
Patch 84/84 includes the following change:
@@ -1693,7 +1693,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
scsi_set_resid(cmd, 0);
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
- cmd->scsi_done = scsi_done;
blk_mq_start_request(req);
reason = scsi_dispatch_cmd(cmd);
> As an aside, this is the current declaration of scsi_cmnd.scsi_done:
>
> /* Low-level done function - can be used by low-level driver to point
> * to completion function. Not used by mid/upper level code. */
> void (*scsi_done) (struct scsi_cmnd *);
>
> That does not sound right, as scsi_done is set by the mid-layer.
"Not used" probably should have been "not called". Anyway, patch 84/84
removes that function pointer and also the comment above that function
pointer.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it
2021-09-20 16:28 ` Bart Van Assche
@ 2021-09-20 16:47 ` John Garry
0 siblings, 0 replies; 106+ messages in thread
From: John Garry @ 2021-09-20 16:47 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen; +Cc: linux-scsi, James E.J. Bottomley
On 20/09/2021 17:28, Bart Van Assche wrote:
>>
>> I have gone to the end of the series, and we still set
>> scsi_cmnd.scsi_done. So some drivers still rely on it. I thought that
>> the idea was that we don't need this callback pointer any longer.
>
> It seems like the email service I used to send out the patches (gmail)
> dropped patches 79/84..84/84. The entire patch series is available here:
> https://github.com/bvanassche/linux/tree/scsi-remove-done-callback
Hi Bart,
ok, I see. b4 am only picked up to 78/84 for me. If you resend, then I
can check again any changes to code which I may be familiar with.
Thanks,
John
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it
2021-09-18 0:04 ` [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it Bart Van Assche
2021-09-20 9:42 ` John Garry
@ 2021-09-28 16:57 ` Benjamin Block
1 sibling, 0 replies; 106+ messages in thread
From: Benjamin Block @ 2021-09-28 16:57 UTC (permalink / raw)
To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley
On Fri, Sep 17, 2021 at 05:04:45PM -0700, Bart Van Assche wrote:
> Since the removal of the legacy block layer there is only one completion
> function left in the SCSI core, namely scsi_mq_done(). Rename it into
> scsi_done(). Export that function to allow SCSI LLDs to call it directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/scsi_lib.c | 5 +++--
> include/scsi/scsi_cmnd.h | 2 ++
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 03/84] scsi: core: Call scsi_done directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
2021-09-18 0:04 ` [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter Bart Van Assche
2021-09-18 0:04 ` [PATCH 02/84] scsi: core: Rename scsi_mq_done() into scsi_done() and export it Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-28 16:59 ` Benjamin Block
2021-09-18 0:04 ` [PATCH 04/84] ata: Call scsi_done() directly Bart Van Assche
` (75 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/hosts.c | 2 +-
include/scsi/scsi_host.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 3f6f14f0cafb..de5f5949a7a9 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -666,7 +666,7 @@ static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd)
scsi_dma_unmap(scmd);
scmd->result = 0;
set_host_byte(scmd, status);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return true;
}
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 75363707b73f..3329dde02a2c 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -516,7 +516,7 @@ struct scsi_host_template {
unsigned long irq_flags; \
int rc; \
spin_lock_irqsave(shost->host_lock, irq_flags); \
- rc = func_name##_lck (cmd, cmd->scsi_done); \
+ rc = func_name##_lck (cmd, scsi_done); \
spin_unlock_irqrestore(shost->host_lock, irq_flags); \
return rc; \
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 03/84] scsi: core: Call scsi_done directly
2021-09-18 0:04 ` [PATCH 03/84] scsi: core: Call scsi_done directly Bart Van Assche
@ 2021-09-28 16:59 ` Benjamin Block
0 siblings, 0 replies; 106+ messages in thread
From: Benjamin Block @ 2021-09-28 16:59 UTC (permalink / raw)
To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley
On Fri, Sep 17, 2021 at 05:04:46PM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/hosts.c | 2 +-
> include/scsi/scsi_host.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 04/84] ata: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (2 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 03/84] scsi: core: Call scsi_done directly Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-21 1:02 ` Damien Le Moal
2021-09-18 0:04 ` [PATCH 05/84] firewire: sbp2: " Bart Van Assche
` (74 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, Damien Le Moal
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ata/libata-sata.c | 2 +-
drivers/ata/libata-scsi.c | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 8f3ff830ab0c..60418d872c12 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -1258,7 +1258,7 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
rc = __ata_scsi_queuecmd(cmd, ap->link.device);
else {
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
return rc;
}
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1fb4611f7eeb..4afe1abc4709 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -634,7 +634,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
if (qc) {
qc->scsicmd = cmd;
- qc->scsidone = cmd->scsi_done;
+ qc->scsidone = scsi_done;
qc->sg = scsi_sglist(cmd);
qc->n_elem = scsi_sg_count(cmd);
@@ -643,7 +643,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
qc->flags |= ATA_QCFLAG_QUIET;
} else {
cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
return qc;
@@ -1738,14 +1738,14 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
early_finish:
ata_qc_free(qc);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
DPRINTK("EXIT - early finish (good or error)\n");
return 0;
err_did:
ata_qc_free(qc);
cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
err_mem:
DPRINTK("EXIT - internal\n");
return 0;
@@ -4018,7 +4018,7 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
scmd->cmd_len, scsi_op, dev->cdb_len);
scmd->result = DID_ERROR << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -4060,7 +4060,7 @@ int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
rc = __ata_scsi_queuecmd(cmd, dev);
else {
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
spin_unlock_irqrestore(ap->lock, irq_flags);
@@ -4188,7 +4188,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
break;
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 04/84] ata: Call scsi_done() directly
2021-09-18 0:04 ` [PATCH 04/84] ata: Call scsi_done() directly Bart Van Assche
@ 2021-09-21 1:02 ` Damien Le Moal
0 siblings, 0 replies; 106+ messages in thread
From: Damien Le Moal @ 2021-09-21 1:02 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen; +Cc: linux-scsi
On 9/18/21 09:04, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/ata/libata-sata.c | 2 +-
> drivers/ata/libata-scsi.c | 14 +++++++-------
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> index 8f3ff830ab0c..60418d872c12 100644
> --- a/drivers/ata/libata-sata.c
> +++ b/drivers/ata/libata-sata.c
> @@ -1258,7 +1258,7 @@ int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
> rc = __ata_scsi_queuecmd(cmd, ap->link.device);
> else {
> cmd->result = (DID_BAD_TARGET << 16);
> - cmd->scsi_done(cmd);
> + scsi_done(cmd);
> }
> return rc;
> }
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 1fb4611f7eeb..4afe1abc4709 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -634,7 +634,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
> qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
> if (qc) {
> qc->scsicmd = cmd;
> - qc->scsidone = cmd->scsi_done;
> + qc->scsidone = scsi_done;
>
> qc->sg = scsi_sglist(cmd);
> qc->n_elem = scsi_sg_count(cmd);
> @@ -643,7 +643,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
> qc->flags |= ATA_QCFLAG_QUIET;
> } else {
> cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
> - cmd->scsi_done(cmd);
> + scsi_done(cmd);
> }
>
> return qc;
> @@ -1738,14 +1738,14 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
>
> early_finish:
> ata_qc_free(qc);
> - cmd->scsi_done(cmd);
> + scsi_done(cmd);
> DPRINTK("EXIT - early finish (good or error)\n");
> return 0;
>
> err_did:
> ata_qc_free(qc);
> cmd->result = (DID_ERROR << 16);
> - cmd->scsi_done(cmd);
> + scsi_done(cmd);
> err_mem:
> DPRINTK("EXIT - internal\n");
> return 0;
> @@ -4018,7 +4018,7 @@ int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev)
> DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
> scmd->cmd_len, scsi_op, dev->cdb_len);
> scmd->result = DID_ERROR << 16;
> - scmd->scsi_done(scmd);
> + scsi_done(scmd);
> return 0;
> }
>
> @@ -4060,7 +4060,7 @@ int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
> rc = __ata_scsi_queuecmd(cmd, dev);
> else {
> cmd->result = (DID_BAD_TARGET << 16);
> - cmd->scsi_done(cmd);
> + scsi_done(cmd);
> }
>
> spin_unlock_irqrestore(ap->lock, irq_flags);
> @@ -4188,7 +4188,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
> break;
> }
>
> - cmd->scsi_done(cmd);
> + scsi_done(cmd);
> }
>
> int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 05/84] firewire: sbp2: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (3 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 04/84] ata: Call scsi_done() directly Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 06/84] ib_srp: " Bart Van Assche
` (73 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, Stefan Richter
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/firewire/sbp2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 4d5054211550..aeed3f2273e8 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -1375,7 +1375,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,
sbp2_unmap_scatterlist(device->card->device, orb);
orb->cmd->result = result;
- orb->cmd->scsi_done(orb->cmd);
+ scsi_done(orb->cmd);
}
static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 06/84] ib_srp: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (4 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 05/84] firewire: sbp2: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 07/84] message: fusion: " Bart Van Assche
` (72 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Doug Ledford, Jason Gunthorpe
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/infiniband/ulp/srp/ib_srp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 71eda91e810c..f8765f96ec1e 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1266,7 +1266,7 @@ static void srp_finish_req(struct srp_rdma_ch *ch, struct srp_request *req,
if (scmnd) {
srp_free_req(ch, req, scmnd, 0);
scmnd->result = result;
- scmnd->scsi_done(scmnd);
+ scsi_done(scmnd);
}
}
@@ -1987,7 +1987,7 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp)
srp_free_req(ch, req, scmnd,
be32_to_cpu(rsp->req_lim_delta));
- scmnd->scsi_done(scmnd);
+ scsi_done(scmnd);
}
}
@@ -2239,7 +2239,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
err:
if (scmnd->result) {
- scmnd->scsi_done(scmnd);
+ scsi_done(scmnd);
ret = 0;
} else {
ret = SCSI_MLQUEUE_HOST_BUSY;
@@ -2811,7 +2811,7 @@ static int srp_abort(struct scsi_cmnd *scmnd)
if (ret == SUCCESS) {
srp_free_req(ch, req, scmnd, 0);
scmnd->result = DID_ABORT << 16;
- scmnd->scsi_done(scmnd);
+ scsi_done(scmnd);
}
return ret;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 07/84] message: fusion: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (5 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 06/84] ib_srp: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 08/84] zfcp_scsi: " Bart Van Assche
` (71 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/message/fusion/mptfc.c | 6 +++---
drivers/message/fusion/mptsas.c | 2 +-
drivers/message/fusion/mptscsih.c | 10 +++++-----
drivers/message/fusion/mptspi.c | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 572333fadd68..7a6278ae71d2 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -649,14 +649,14 @@ mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
if (!vdevice || !vdevice->vtarget) {
SCpnt->result = DID_NO_CONNECT << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
return 0;
}
err = fc_remote_port_chkready(rport);
if (unlikely(err)) {
SCpnt->result = err;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
return 0;
}
@@ -664,7 +664,7 @@ mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
ri = *((struct mptfc_rport_info **)rport->dd_data);
if (unlikely(!ri)) {
SCpnt->result = DID_IMM_RETRY << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
return 0;
}
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 85285ba8e817..38a7cb0a3ecc 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1929,7 +1929,7 @@ mptsas_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
if (!vdevice || !vdevice->vtarget || vdevice->vtarget->deleted) {
SCpnt->result = DID_NO_CONNECT << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
return 0;
}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index ce2e5b21978e..ab9611e775d3 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1009,7 +1009,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
/* Unmap the DMA buffers, if any. */
scsi_dma_unmap(sc);
- sc->scsi_done(sc); /* Issue the command callback */
+ scsi_done(sc); /* Issue the command callback */
/* Free Chain buffers */
mptscsih_freeChainBuffers(ioc, req_idx);
@@ -1054,7 +1054,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device, MYIOC_s_FMT
"completing cmds: fw_channel %d, fw_id %d, sc=%p, mf = %p, "
"idx=%x\n", ioc->name, channel, id, sc, mf, ii));
- sc->scsi_done(sc);
+ scsi_done(sc);
}
}
EXPORT_SYMBOL(mptscsih_flush_running_cmds);
@@ -1118,7 +1118,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
"fw_id %d, sc=%p, mf = %p, idx=%x\n", ioc->name,
vdevice->vtarget->channel, vdevice->vtarget->id,
sc, mf, ii));
- sc->scsi_done(sc);
+ scsi_done(sc);
spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
}
}
@@ -1693,7 +1693,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
*/
if ((hd = shost_priv(SCpnt->device->host)) == NULL) {
SCpnt->result = DID_RESET << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
printk(KERN_ERR MYNAM ": task abort: "
"can't locate host! (sc=%p)\n", SCpnt);
return FAILED;
@@ -1710,7 +1710,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
"task abort: device has been deleted (sc=%p)\n",
ioc->name, SCpnt));
SCpnt->result = DID_NO_CONNECT << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
retval = SUCCESS;
goto out;
}
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index af0ce5611e4a..44b7ce124ae1 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -782,14 +782,14 @@ mptspi_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
if (!vdevice || !vdevice->vtarget) {
SCpnt->result = DID_NO_CONNECT << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
return 0;
}
if (SCpnt->device->channel == 1 &&
mptscsih_is_phys_disk(ioc, 0, SCpnt->device->id) == 0) {
SCpnt->result = DID_NO_CONNECT << 16;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 08/84] zfcp_scsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (6 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 07/84] message: fusion: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-28 17:01 ` Benjamin Block
2021-09-18 0:04 ` [PATCH 09/84] 3w-9xxx: " Bart Van Assche
` (70 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Steffen Maier, Benjamin Block,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/s390/scsi/zfcp_fsf.c | 2 +-
drivers/s390/scsi/zfcp_scsi.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index c1f979296c1a..4f1e4385ce58 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2501,7 +2501,7 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req)
zfcp_dbf_scsi_result(scpnt, req);
scpnt->host_scribble = NULL;
- (scpnt->scsi_done) (scpnt);
+ scsi_done(scpnt);
/*
* We must hold this lock until scsi_done has been called.
* Otherwise we may call scsi_done after abort regarding this
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 9da9b2b2a580..e0a6d8c1f198 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -60,7 +60,7 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
{
set_host_byte(scpnt, result);
zfcp_dbf_scsi_fail_send(scpnt);
- scpnt->scsi_done(scpnt);
+ scsi_done(scpnt);
}
static
@@ -78,7 +78,7 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
if (unlikely(scsi_result)) {
scpnt->result = scsi_result;
zfcp_dbf_scsi_fail_send(scpnt);
- scpnt->scsi_done(scpnt);
+ scsi_done(scpnt);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 08/84] zfcp_scsi: Call scsi_done() directly
2021-09-18 0:04 ` [PATCH 08/84] zfcp_scsi: " Bart Van Assche
@ 2021-09-28 17:01 ` Benjamin Block
0 siblings, 0 replies; 106+ messages in thread
From: Benjamin Block @ 2021-09-28 17:01 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Steffen Maier, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger
On Fri, Sep 17, 2021 at 05:04:51PM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/s390/scsi/zfcp_fsf.c | 2 +-
> drivers/s390/scsi/zfcp_scsi.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
Acked-by: Benjamin Block <bblock@linux.ibm.com>
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 09/84] 3w-9xxx: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (7 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 08/84] zfcp_scsi: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 10/84] 3w-sas: " Bart Van Assche
` (69 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adam Radford, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/3w-9xxx.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index e41cc354cc8a..4ebc2c79f45f 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1352,7 +1352,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
/* Now complete the io */
if (twa_command_mapped(cmd))
scsi_dma_unmap(cmd);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
tw_dev->state[request_id] = TW_S_COMPLETED;
twa_free_request_id(tw_dev, request_id);
tw_dev->posted_request_count--;
@@ -1596,7 +1596,7 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
cmd->result = (DID_RESET << 16);
if (twa_command_mapped(cmd))
scsi_dma_unmap(cmd);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
}
@@ -1763,9 +1763,6 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
goto out;
}
- /* Save done function into scsi_cmnd struct */
- SCpnt->scsi_done = done;
-
/* Get a free request id */
twa_get_request_id(tw_dev, &request_id);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 10/84] 3w-sas: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (8 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 09/84] 3w-9xxx: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 11/84] 3w-xxxx: " Bart Van Assche
` (68 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adam Radford, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/3w-sas.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 4fde39da54e4..e6f51904f5b1 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1216,7 +1216,7 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)
/* Now complete the io */
scsi_dma_unmap(cmd);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
tw_dev->state[request_id] = TW_S_COMPLETED;
twl_free_request_id(tw_dev, request_id);
tw_dev->posted_request_count--;
@@ -1369,7 +1369,7 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
if (cmd) {
cmd->result = (DID_RESET << 16);
scsi_dma_unmap(cmd);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
}
@@ -1461,9 +1461,6 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
goto out;
}
- /* Save done function into scsi_cmnd struct */
- SCpnt->scsi_done = done;
-
/* Get a free request id */
twl_get_request_id(tw_dev, &request_id);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 11/84] 3w-xxxx: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (9 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 10/84] 3w-sas: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 12/84] 53c700: " Bart Van Assche
` (67 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adam Radford, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/3w-xxxx.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 4ee485ab2714..bdd3ab8875e2 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1160,7 +1160,7 @@ static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size,
tw_dev->state[request_id] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, request_id);
tw_dev->srb[request_id]->result = (DID_OK << 16);
- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
+ scsi_done(tw_dev->srb[request_id]);
}
command_packet->byte8.param.sgl[0].address = param_value;
command_packet->byte8.param.sgl[0].length = sizeof(TW_Sector);
@@ -1305,7 +1305,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
if (srb != NULL) {
srb->result = (DID_RESET << 16);
scsi_dma_unmap(srb);
- srb->scsi_done(srb);
+ scsi_done(srb);
}
}
}
@@ -1505,7 +1505,7 @@ static int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id)
tw_dev->state[request_id] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, request_id);
tw_dev->srb[request_id]->result = (DID_OK << 16);
- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
+ scsi_done(tw_dev->srb[request_id]);
return 0;
}
@@ -1796,7 +1796,7 @@ static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id)
/* If we got a request_sense, we probably want a reset, return error */
tw_dev->srb[request_id]->result = (DID_ERROR << 16);
- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
+ scsi_done(tw_dev->srb[request_id]);
return 0;
} /* End tw_scsiop_request_sense() */
@@ -1929,9 +1929,6 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
if (test_bit(TW_IN_RESET, &tw_dev->flags))
return SCSI_MLQUEUE_HOST_BUSY;
- /* Save done function into struct scsi_cmnd */
- SCpnt->scsi_done = done;
-
/* Queue the command and get a request id */
tw_state_request_start(tw_dev, &request_id);
@@ -2165,7 +2162,7 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)
/* Now complete the io */
if ((error != TW_ISR_DONT_COMPLETE)) {
scsi_dma_unmap(tw_dev->srb[request_id]);
- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
+ scsi_done(tw_dev->srb[request_id]);
tw_dev->state[request_id] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, request_id);
tw_dev->posted_request_count--;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 12/84] 53c700: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (10 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 11/84] 3w-xxxx: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 13/84] BusLogic: " Bart Van Assche
` (66 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/53c700.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index a12e3525977d..e7ed2fd6cdec 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -634,7 +634,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
SCp->host_scribble = NULL;
SCp->result = result;
- SCp->scsi_done(SCp);
+ scsi_done(SCp);
} else {
printk(KERN_ERR "53c700: SCSI DONE HAS NULL SCp\n");
}
@@ -1571,7 +1571,7 @@ NCR_700_intr(int irq, void *dev_id)
* deadlock on the
* hostdata->state_lock */
SCp->result = DID_RESET << 16;
- SCp->scsi_done(SCp);
+ scsi_done(SCp);
}
mdelay(25);
NCR_700_chip_setup(host);
@@ -1792,7 +1792,6 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
slot->cmnd = SCp;
- SCp->scsi_done = done;
SCp->host_scribble = (unsigned char *)slot;
SCp->SCp.ptr = NULL;
SCp->SCp.buffer = NULL;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 13/84] BusLogic: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (11 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 12/84] 53c700: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 14/84] NCR5380: " Bart Van Assche
` (65 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Khalid Aziz, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/BusLogic.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 40088dcb98cd..7287a9081684 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2624,7 +2624,7 @@ static void blogic_process_ccbs(struct blogic_adapter *adapter)
command->reset_chain;
command->reset_chain = NULL;
command->result = DID_RESET << 16;
- command->scsi_done(command);
+ scsi_done(command);
command = nxt_cmd;
}
#endif
@@ -2641,7 +2641,7 @@ static void blogic_process_ccbs(struct blogic_adapter *adapter)
blogic_dealloc_ccb(ccb, 1);
adapter->active_cmds[tgt_id]--;
command->result = DID_RESET << 16;
- command->scsi_done(command);
+ scsi_done(command);
}
adapter->bdr_pend[tgt_id] = NULL;
} else {
@@ -2713,7 +2713,7 @@ static void blogic_process_ccbs(struct blogic_adapter *adapter)
/*
Call the SCSI Command Completion Routine.
*/
- command->scsi_done(command);
+ scsi_done(command);
}
}
adapter->processing_ccbs = false;
@@ -3038,7 +3038,6 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,
return SCSI_MLQUEUE_HOST_BUSY;
}
ccb->sensedata = sense_buf;
- command->scsi_done = comp_cb;
if (blogic_multimaster_type(adapter)) {
/*
Place the CCB in an Outgoing Mailbox. The higher levels
@@ -3060,7 +3059,7 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,
blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter);
blogic_dealloc_ccb(ccb, 1);
command->result = DID_ERROR << 16;
- command->scsi_done(command);
+ scsi_done(command);
}
}
} else {
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 14/84] NCR5380: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (12 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 13/84] BusLogic: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 15/84] a100u2w: " Bart Van Assche
` (64 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Finn Thain, Michael Schmitz,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/NCR5380.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index a85589a2a8af..55af3e245a92 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -547,7 +547,7 @@ static void complete_cmd(struct Scsi_Host *instance,
hostdata->sensing = NULL;
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
/**
@@ -573,7 +573,7 @@ static int NCR5380_queue_command(struct Scsi_Host *instance,
case WRITE_10:
shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n");
cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
#endif /* (NDEBUG & NDEBUG_NO_WRITE) */
@@ -960,7 +960,7 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id)
* hostdata->connected will be set to cmd.
* SELECT interrupt will be disabled.
*
- * If failed (no target) : cmd->scsi_done() will be called, and the
+ * If failed (no target) : scsi_done() will be called, and the
* cmd->result host byte set to DID_BAD_TARGET.
*/
@@ -2262,7 +2262,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
dsprintk(NDEBUG_ABORT, instance,
"abort: removed %p from issue queue\n", cmd);
cmd->result = DID_ABORT << 16;
- cmd->scsi_done(cmd); /* No tag or busy flag to worry about */
+ scsi_done(cmd); /* No tag or busy flag to worry about */
goto out;
}
@@ -2357,7 +2357,7 @@ static void bus_reset_cleanup(struct Scsi_Host *instance)
list_for_each_entry(ncmd, &hostdata->autosense, list) {
struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
INIT_LIST_HEAD(&hostdata->autosense);
@@ -2400,7 +2400,7 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)
struct scsi_cmnd *scmd = NCR5380_to_scmd(ncmd);
scmd->result = DID_RESET << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
}
INIT_LIST_HEAD(&hostdata->unissued);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 15/84] a100u2w: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (13 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 14/84] NCR5380: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:04 ` [PATCH 16/84] aacraid: Introduce aac_scsi_done() Bart Van Assche
` (63 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/a100u2w.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 028af6b1057c..68343bcb4616 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -917,7 +917,6 @@ static int inia100_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_c
struct orc_host *host; /* Point to Host adapter control block */
host = (struct orc_host *) cmd->device->host->hostdata;
- cmd->scsi_done = done;
/* Get free SCSI control block */
if ((scb = orc_alloc_scb(host)) == NULL)
return SCSI_MLQUEUE_HOST_BUSY;
@@ -1042,7 +1041,7 @@ static void inia100_scb_handler(struct orc_host *host, struct orc_scb *scb)
}
cmd->result = scb->tastat | (scb->hastat << 16);
scsi_dma_unmap(cmd);
- cmd->scsi_done(cmd); /* Notify system DONE */
+ scsi_done(cmd); /* Notify system DONE */
orc_release_scb(host, scb); /* Release SCB for current channel */
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 16/84] aacraid: Introduce aac_scsi_done()
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (14 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 15/84] a100u2w: " Bart Van Assche
@ 2021-09-18 0:04 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 17/84] aacraid: Call scsi_done() directly Bart Van Assche
` (62 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:04 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
James E.J. Bottomley
This patch does not change any functionality but makes the next patch in
this series easier to read.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/aacraid/aachba.c | 39 ++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index c2d6f0a9e0b1..40b86acac17b 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -517,6 +517,11 @@ int aac_get_containers(struct aac_dev *dev)
return status;
}
+static void aac_scsi_done(struct scsi_cmnd *scmd)
+{
+ scmd->scsi_done(scmd);
+}
+
static void get_container_name_callback(void *context, struct fib * fibptr)
{
struct aac_get_name_resp * get_name_reply;
@@ -558,7 +563,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
aac_fib_complete(fibptr);
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
}
/*
@@ -614,7 +619,7 @@ static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd)
return aac_scsi_cmd(scsicmd);
scsicmd->result = DID_NO_CONNECT << 16;
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
@@ -1094,7 +1099,7 @@ static void get_container_serial_callback(void *context, struct fib * fibptr)
scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
aac_fib_complete(fibptr);
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
}
/*
@@ -1197,7 +1202,7 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba)
memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
SCSI_SENSE_BUFFERSIZE));
- cmd->scsi_done(cmd);
+ aac_scsi_done(cmd);
return 1;
}
return 0;
@@ -2392,7 +2397,7 @@ static void io_callback(void *context, struct fib * fibptr)
}
aac_fib_complete(fibptr);
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
}
static int aac_read(struct scsi_cmnd * scsicmd)
@@ -2463,7 +2468,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
SCSI_SENSE_BUFFERSIZE));
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
@@ -2489,7 +2494,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)
* For some reason, the Fib didn't queue, return QUEUE_FULL
*/
scsicmd->result = DID_OK << 16 | SAM_STAT_TASK_SET_FULL;
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
aac_fib_complete(cmd_fibcontext);
aac_fib_free(cmd_fibcontext);
return 0;
@@ -2554,7 +2559,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)
memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
SCSI_SENSE_BUFFERSIZE));
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
@@ -2580,7 +2585,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)
* For some reason, the Fib didn't queue, return QUEUE_FULL
*/
scsicmd->result = DID_OK << 16 | SAM_STAT_TASK_SET_FULL;
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
aac_fib_complete(cmd_fibcontext);
aac_fib_free(cmd_fibcontext);
@@ -2621,7 +2626,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
aac_fib_complete(fibptr);
aac_fib_free(fibptr);
- cmd->scsi_done(cmd);
+ aac_scsi_done(cmd);
}
static int aac_synchronize(struct scsi_cmnd *scsicmd)
@@ -2688,7 +2693,7 @@ static void aac_start_stop_callback(void *context, struct fib *fibptr)
aac_fib_complete(fibptr);
aac_fib_free(fibptr);
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
}
static int aac_start_stop(struct scsi_cmnd *scsicmd)
@@ -2702,7 +2707,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd)
if (!(aac->supplement_adapter_info.supported_options2 &
AAC_OPTION_POWER_MANAGEMENT)) {
scsicmd->result = DID_OK << 16 | SAM_STAT_GOOD;
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
@@ -3237,7 +3242,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
scsi_done_ret:
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
@@ -3546,7 +3551,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
scsicmd->result |= le32_to_cpu(srbreply->scsi_status);
aac_fib_complete(fibptr);
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
}
static void hba_resp_task_complete(struct aac_dev *dev,
@@ -3686,7 +3691,7 @@ void aac_hba_callback(void *context, struct fib *fibptr)
if (fibptr->flags & FIB_CONTEXT_FLAG_NATIVE_HBA_TMF)
scsicmd->SCp.sent_command = 1;
else
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
}
/**
@@ -3706,7 +3711,7 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
scsicmd->device->lun > 7) {
scsicmd->result = DID_NO_CONNECT << 16;
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
@@ -3747,7 +3752,7 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)
if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
scsicmd->device->lun > AAC_MAX_LUN - 1) {
scsicmd->result = DID_NO_CONNECT << 16;
- scsicmd->scsi_done(scsicmd);
+ aac_scsi_done(scsicmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 17/84] aacraid: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (15 preceding siblings ...)
2021-09-18 0:04 ` [PATCH 16/84] aacraid: Introduce aac_scsi_done() Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 18/84] acornscsi: " Bart Van Assche
` (61 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
James E.J. Bottomley
The aacraid driver invokes scmd->scsi_done(scmd) for two types of SCSI
commands:
* SCSI commands initialized by the SCSI mid-layer.
* SCSI commands initialized by aac_probe_container().
The processing sequence for SCSI commands allocated by
aac_probe_container() is as follows:
aac_probe_container()
-> _aac_probe_container(scmd, aac_probe_container_callback1)
-> scmd->SCp.ptr = aac_probe_container_callback1
-> aac_fib_send(..., _aac_probe_container1, scmd)
-> fibptr->callback = _aac_probe_container1
-> fibptr->callback_data = scmd
fibptr->callback(scmd)
-> _aac_probe_container1(scmd, fibptr)
[ ... ]
-> _aac_probe_container2(scmd, fibptr)
-> Call scmd->SCp.ptr == aac_probe_container_callback1
-> scmd->device = NULL;
The processing sequence for SCSI commands allocated by the SCSI mid-layer
if _aac_probe_container() is called is as follows:
aac_queuecommand()
-> aac_scsi_cmd()
-> _aac_probe_container(scmd, aac_probe_container_callback2)
-> scmd->SCp.ptr = aac_probe_container_callback2
-> aac_fib_send(..., _aac_probe_container1, scmd)
fibptr->callback(scmd)
-> _aac_probe_container1(scmd, fibptr)
[ ... ]
-> _aac_probe_container2(scmd, fibptr)
-> Call scmd->SCp.ptr == aac_probe_container_callback2
Preserve the existing call sequences by calling scsi_done() for commands
submitted by the mid-layer or aac_probe_container_scsi_done() for commands
submitted by aac_probe_container().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/aacraid/aachba.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 40b86acac17b..59f6b7b2a70a 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -223,6 +223,7 @@ static long aac_build_sghba(struct scsi_cmnd *scsicmd,
int sg_max, u64 sg_address);
static int aac_convert_sgraw2(struct aac_raw_io2 *rio2,
int pages, int nseg, int nseg_new);
+static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd);
static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
static int aac_send_hba_fib(struct scsi_cmnd *scsicmd);
#ifdef AAC_DETAILED_STATUS_INFO
@@ -332,7 +333,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
struct fib *fibptr) {
struct scsi_device *device;
- if (unlikely(!scsicmd || !scsicmd->scsi_done)) {
+ if (unlikely(!scsicmd)) {
dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"));
aac_fib_complete(fibptr);
return 0;
@@ -519,7 +520,13 @@ int aac_get_containers(struct aac_dev *dev)
static void aac_scsi_done(struct scsi_cmnd *scmd)
{
- scmd->scsi_done(scmd);
+ if (scmd->device->request_queue) {
+ /* SCSI command has been submitted by the SCSI mid-layer. */
+ scsi_done(scmd);
+ } else {
+ /* SCSI command has been submitted by aac_probe_container(). */
+ aac_probe_container_scsi_done(scmd);
+ }
}
static void get_container_name_callback(void *context, struct fib * fibptr)
@@ -809,8 +816,8 @@ static void aac_probe_container_scsi_done(struct scsi_cmnd *scsi_cmnd)
int aac_probe_container(struct aac_dev *dev, int cid)
{
- struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL);
- struct scsi_device *scsidev = kmalloc(sizeof(*scsidev), GFP_KERNEL);
+ struct scsi_cmnd *scsicmd = kzalloc(sizeof(*scsicmd), GFP_KERNEL);
+ struct scsi_device *scsidev = kzalloc(sizeof(*scsidev), GFP_KERNEL);
int status;
if (!scsicmd || !scsidev) {
@@ -818,7 +825,6 @@ int aac_probe_container(struct aac_dev *dev, int cid)
kfree(scsidev);
return -ENOMEM;
}
- scsicmd->scsi_done = aac_probe_container_scsi_done;
scsicmd->device = scsidev;
scsidev->sdev_state = 0;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 18/84] acornscsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (16 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 17/84] aacraid: Call scsi_done() directly Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 19/84] advansys: " Bart Van Assche
` (60 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Russell King, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/arm/acornscsi.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 4a84599ff491..bb6f287113a5 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -856,13 +856,10 @@ static void acornscsi_done(AS_Host *host, struct scsi_cmnd **SCpntp,
}
}
- if (!SCpnt->scsi_done)
- panic("scsi%d.H: null scsi_done function in acornscsi_done", host->host->host_no);
-
clear_bit(SCpnt->device->id * 8 +
(u8)(SCpnt->device->lun & 0x7), host->busyluns);
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
} else
printk("scsi%d: null command in acornscsi_done", host->host->host_no);
@@ -2479,7 +2476,6 @@ static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt,
}
#endif
- SCpnt->scsi_done = done;
SCpnt->host_scribble = NULL;
SCpnt->result = 0;
SCpnt->tag = 0;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 19/84] advansys: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (17 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 18/84] acornscsi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 20/84] aha152x: " Bart Van Assche
` (59 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Matthew Wilcox, Hannes Reinecke,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/advansys.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index ffb391967573..30d4935f297f 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -3592,7 +3592,7 @@ static void asc_scsi_done(struct scsi_cmnd *scp)
{
scsi_dma_unmap(scp);
ASC_STATS(scp->device->host, done);
- scp->scsi_done(scp);
+ scsi_done(scp);
}
static void AscSetBank(PortAddr iop_base, uchar bank)
@@ -8460,7 +8460,6 @@ advansys_queuecommand_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *
int asc_res, result = 0;
ASC_STATS(shost, queuecommand);
- scp->scsi_done = done;
asc_res = asc_execute_scsi_cmnd(scp);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 20/84] aha152x: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (18 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 19/84] advansys: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 21/84] aha1542: " Bart Van Assche
` (58 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Juergen E. Fischer, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() and reset_done() directly. The changes in this patch are as
follows:
- Remove the 'done' argument from aha152x_internal_queue().
- Change ptr->scsi_done(ptr) into aha152x_scsi_done(ptr).
- Inside aha152x_scsi_done(), check the 'resetting' flag of SCp.phase
since aha152x_internal_queue() specifies the 'reset_done' function
pointer if and only if the third argument has the value 'resetting'.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/aha152x.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index b13b5c85f3de..f07de9912790 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -905,13 +905,11 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt)
* Queue a command and setup interrupts for a free bus.
*/
static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,
- struct completion *complete,
- int phase, void (*done)(struct scsi_cmnd *))
+ struct completion *complete, int phase)
{
struct Scsi_Host *shpnt = SCpnt->device->host;
unsigned long flags;
- SCpnt->scsi_done = done;
SCpnt->SCp.phase = not_issued | phase;
SCpnt->SCp.Status = 0x1; /* Ilegal status by SCSI standard */
SCpnt->SCp.Message = 0;
@@ -980,7 +978,8 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt,
static int aha152x_queue_lck(struct scsi_cmnd *SCpnt,
void (*done)(struct scsi_cmnd *))
{
- return aha152x_internal_queue(SCpnt, NULL, 0, done);
+ WARN_ON_ONCE(done != scsi_done);
+ return aha152x_internal_queue(SCpnt, NULL, 0);
}
static DEF_SCSI_QCMD(aha152x_queue)
@@ -998,6 +997,14 @@ static void reset_done(struct scsi_cmnd *SCpnt)
}
}
+static void aha152x_scsi_done(struct scsi_cmnd *SCpnt)
+{
+ if (SCpnt->SCp.phase & resetting)
+ reset_done(SCpnt);
+ else
+ scsi_done(SCpnt);
+}
+
/*
* Abort a command
*
@@ -1064,7 +1071,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt)
SCpnt->cmd_len = 0;
- aha152x_internal_queue(SCpnt, &done, resetting, reset_done);
+ aha152x_internal_queue(SCpnt, &done, resetting);
timeleft = wait_for_completion_timeout(&done, 100*HZ);
if (!timeleft) {
@@ -1439,12 +1446,12 @@ static void busfree_run(struct Scsi_Host *shpnt)
scsi_eh_prep_cmnd(ptr, &sc->ses, NULL, 0, ~0);
DO_UNLOCK(flags);
- aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);
+ aha152x_internal_queue(ptr, NULL, check_condition);
DO_LOCK(flags);
}
}
- if(DONE_SC && DONE_SC->scsi_done) {
+ if (DONE_SC) {
struct scsi_cmnd *ptr = DONE_SC;
DONE_SC=NULL;
@@ -1453,13 +1460,13 @@ static void busfree_run(struct Scsi_Host *shpnt)
if (!HOSTDATA(shpnt)->commands)
SETPORT(PORTA, 0); /* turn led off */
- if(ptr->scsi_done != reset_done) {
+ if (!(ptr->SCp.phase & resetting)) {
kfree(ptr->host_scribble);
ptr->host_scribble=NULL;
}
DO_UNLOCK(flags);
- ptr->scsi_done(ptr);
+ aha152x_scsi_done(ptr);
DO_LOCK(flags);
}
@@ -2258,7 +2265,7 @@ static void rsti_run(struct Scsi_Host *shpnt)
ptr->host_scribble=NULL;
set_host_byte(ptr, DID_RESET);
- ptr->scsi_done(ptr);
+ aha152x_scsi_done(ptr);
}
ptr = next;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 21/84] aha1542: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (19 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 20/84] aha152x: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 22/84] aic7xxx: " Bart Van Assche
` (57 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/aha1542.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 584a59522038..8697f4720946 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -281,7 +281,6 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
{
struct Scsi_Host *sh = dev_id;
struct aha1542_hostdata *aha1542 = shost_priv(sh);
- void (*my_done)(struct scsi_cmnd *) = NULL;
int errstatus, mbi, mbo, mbistatus;
int number_serviced;
unsigned long flags;
@@ -369,14 +368,13 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
tmp_cmd = aha1542->int_cmds[mbo];
- if (!tmp_cmd || !tmp_cmd->scsi_done) {
+ if (!tmp_cmd) {
spin_unlock_irqrestore(sh->host_lock, flags);
shost_printk(KERN_WARNING, sh, "Unexpected interrupt\n");
shost_printk(KERN_WARNING, sh, "tarstat=%x, hastat=%x idlun=%x ccb#=%d\n", ccb[mbo].tarstat,
ccb[mbo].hastat, ccb[mbo].idlun, mbo);
return IRQ_HANDLED;
}
- my_done = tmp_cmd->scsi_done;
aha1542_free_cmd(tmp_cmd);
/*
* Fetch the sense data, and tuck it away, in the required slot. The
@@ -410,7 +408,7 @@ static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
aha1542->int_cmds[mbo] = NULL; /* This effectively frees up the mailbox slot, as
* far as queuecommand is concerned
*/
- my_done(tmp_cmd);
+ scsi_done(tmp_cmd);
number_serviced++;
};
}
@@ -431,7 +429,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
if (*cmd->cmnd == REQUEST_SENSE) {
/* Don't do the command - we have the sense data already */
cmd->result = 0;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
#ifdef DEBUG
@@ -488,7 +486,7 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
aha1542->aha1542_last_mbo_used = mbo;
#ifdef DEBUG
- shost_printk(KERN_DEBUG, sh, "Sending command (%d %p)...", mbo, cmd->scsi_done);
+ shost_printk(KERN_DEBUG, sh, "Sending command (%d)...", mbo);
#endif
/* This gets trashed for some reason */
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 22/84] aic7xxx: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (20 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 21/84] aha1542: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 23/84] arcmsr: " Bart Van Assche
` (56 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/aic7xxx/aic79xx_osm.c | 3 +--
drivers/scsi/aic7xxx/aic7xxx_osm.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 92ea24a075b8..af49c32cfaf7 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -581,7 +581,6 @@ ahd_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd
ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
- cmd->scsi_done = scsi_done;
cmd->result = CAM_REQ_INPROG << 16;
rtn = ahd_linux_run_command(ahd, dev, cmd);
@@ -2111,7 +2110,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
ahd_cmd_set_transaction_status(cmd, new_status);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
static void
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 8b3d472aa3cc..f2daca41f3f2 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -530,7 +530,6 @@ ahc_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd
ahc_lock(ahc, &flags);
if (ahc->platform_data->qfrozen == 0) {
- cmd->scsi_done = scsi_done;
cmd->result = CAM_REQ_INPROG << 16;
rtn = ahc_linux_run_command(ahc, dev, cmd);
}
@@ -1986,7 +1985,7 @@ ahc_linux_queue_cmd_complete(struct ahc_softc *ahc, struct scsi_cmnd *cmd)
ahc_cmd_set_transaction_status(cmd, new_status);
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
static void
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 23/84] arcmsr: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (21 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 22/84] aic7xxx: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 24/84] atp870u: " Bart Van Assche
` (55 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, ching Huang,
Hannes Reinecke, Vaibhav Gupta, Lee Jones, Kees Cook
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/arcmsr/arcmsr_hba.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index ec1a834c922d..e2692ca87a6e 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1318,7 +1318,7 @@ static void arcmsr_ccb_complete(struct CommandControlBlock *ccb)
spin_lock_irqsave(&acb->ccblist_lock, flags);
list_add_tail(&ccb->list, &acb->ccb_free_list);
spin_unlock_irqrestore(&acb->ccblist_lock, flags);
- pcmd->scsi_done(pcmd);
+ scsi_done(pcmd);
}
static void arcmsr_report_sense_info(struct CommandControlBlock *ccb)
@@ -1598,7 +1598,7 @@ static void arcmsr_remove_scsi_devices(struct AdapterControlBlock *acb)
if (ccb->startdone == ARCMSR_CCB_START) {
ccb->pcmd->result = DID_NO_CONNECT << 16;
arcmsr_pci_unmap_dma(ccb);
- ccb->pcmd->scsi_done(ccb->pcmd);
+ scsi_done(ccb->pcmd);
}
}
for (target = 0; target < ARCMSR_MAX_TARGETID; target++) {
@@ -3192,7 +3192,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
if (cmd->device->lun) {
cmd->result = (DID_TIME_OUT << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return;
}
inqdata[0] = TYPE_PROCESSOR;
@@ -3216,18 +3216,18 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
sg = scsi_sglist(cmd);
kunmap_atomic(buffer - sg->offset);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
break;
case WRITE_BUFFER:
case READ_BUFFER: {
if (arcmsr_iop_message_xfer(acb, cmd))
cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
break;
default:
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
@@ -3241,10 +3241,9 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
if (acb->acb_flags & ACB_F_ADAPTER_REMOVED) {
cmd->result = (DID_NO_CONNECT << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
- cmd->scsi_done = done;
cmd->host_scribble = NULL;
cmd->result = 0;
if (target == 16) {
@@ -3257,7 +3256,7 @@ static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
return SCSI_MLQUEUE_HOST_BUSY;
if (arcmsr_build_ccb( acb, ccb, cmd ) == FAILED) {
cmd->result = (DID_ERROR << 16) | SAM_STAT_RESERVATION_CONFLICT;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
arcmsr_post_ccb(acb, ccb);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 24/84] atp870u: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (22 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 23/84] arcmsr: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 25/84] bfa: " Bart Van Assche
` (54 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/atp870u.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 9d179cd15bb8..6e1595b32bc0 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -512,7 +512,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)
scsi_dma_unmap(workreq);
spin_lock_irqsave(dev->host->host_lock, flags);
- (*workreq->scsi_done) (workreq);
+ scsi_done(workreq);
#ifdef ED_DBGP
printk("workreq->scsi_done\n");
#endif
@@ -654,17 +654,6 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
return 0;
}
- if (done) {
- req_p->scsi_done = done;
- } else {
-#ifdef ED_DBGP
- printk( "atp870u_queuecommand: done can't be NULL\n");
-#endif
- req_p->result = 0;
- done(req_p);
- return 0;
- }
-
/*
* Count new command
*/
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 25/84] bfa: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (23 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 24/84] atp870u: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 26/84] bnx2fc: " Bart Van Assche
` (53 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Anil Gurumurthy, Sudarsana Kalluru,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/bfa/bfad_im.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 6b5841b1c06e..e12ae60efd33 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -96,7 +96,7 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio,
}
}
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
}
void
@@ -124,7 +124,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio)
}
}
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
}
void
@@ -226,7 +226,7 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd)
timeout *= 2;
}
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
bfa_trc(bfad, hal_io->iotag);
BFA_LOG(KERN_INFO, bfad, bfa_log_level,
"scsi%d: complete abort 0x%p iotag 0x%x\n",
@@ -1233,8 +1233,6 @@ bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd
if (sg_cnt < 0)
return SCSI_MLQUEUE_HOST_BUSY;
- cmnd->scsi_done = done;
-
spin_lock_irqsave(&bfad->bfad_lock, flags);
if (!(bfad->bfad_flags & BFAD_HAL_START_DONE)) {
printk(KERN_WARNING
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 26/84] bnx2fc: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (24 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 25/84] bfa: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 27/84] csiostor: " Bart Van Assche
` (52 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Saurav Kashyap, Javed Hasan,
GR-QLogic-Storage-Upstream, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/bnx2fc/bnx2fc_io.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index f2996a9b2f63..b9114113ee73 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -205,7 +205,7 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code)
sc_cmd->allowed);
scsi_set_resid(sc_cmd, scsi_bufflen(sc_cmd));
sc_cmd->SCp.ptr = NULL;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
}
struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
@@ -1610,7 +1610,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
}
sc_cmd->SCp.ptr = NULL;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
kref_put(&io_req->refcount, bnx2fc_cmd_release);
if (io_req->wait_for_abts_comp) {
@@ -1853,7 +1853,7 @@ int bnx2fc_queuecommand(struct Scsi_Host *host,
rval = fc_remote_port_chkready(rport);
if (rval) {
sc_cmd->result = rval;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
return 0;
}
@@ -2019,7 +2019,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
break;
}
sc_cmd->SCp.ptr = NULL;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
kref_put(&io_req->refcount, bnx2fc_cmd_release);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 27/84] csiostor: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (25 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 26/84] bnx2fc: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 28/84] cxlflash: " Bart Van Assche
` (51 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, Jiapeng Chong
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/csiostor/csio_scsi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 3b2eb6ce1fcf..3978c3d7eed5 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1720,7 +1720,7 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req)
}
cmnd->result = (((host_status) << 16) | scsi_status);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
/* Wake up waiting threads */
csio_scsi_cmnd(req) = NULL;
@@ -1748,7 +1748,7 @@ csio_scsi_cbfn(struct csio_hw *hw, struct csio_ioreq *req)
}
cmnd->result = (((host_status) << 16) | scsi_status);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
csio_scsi_cmnd(req) = NULL;
CSIO_INC_STATS(csio_hw_to_scsim(hw), n_tot_success);
} else {
@@ -1876,7 +1876,7 @@ csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)
return rv;
err_done:
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
@@ -1979,7 +1979,7 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
spin_unlock_irq(&hw->lock);
cmnd->result = (DID_ERROR << 16);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return FAILED;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 28/84] cxlflash: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (26 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 27/84] csiostor: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 29/84] dc395x: " Bart Van Assche
` (50 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/cxlflash/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index b2730e859df8..2943cdd83614 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -171,7 +171,7 @@ static void cmd_complete(struct afu_cmd *cmd)
dev_dbg_ratelimited(dev, "%s:scp=%p result=%08x ioasc=%08x\n",
__func__, scp, scp->result, cmd->sa.ioasc);
- scp->scsi_done(scp);
+ scsi_done(scp);
} else if (cmd->cmd_tmf) {
spin_lock_irqsave(&cfg->tmf_slock, lock_flags);
cfg->tmf_active = false;
@@ -205,7 +205,7 @@ static void flush_pending_cmds(struct hwq *hwq)
if (cmd->scp) {
scp = cmd->scp;
scp->result = (DID_IMM_RETRY << 16);
- scp->scsi_done(scp);
+ scsi_done(scp);
} else {
cmd->cmd_aborted = true;
@@ -601,7 +601,7 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp)
case STATE_FAILTERM:
dev_dbg_ratelimited(dev, "%s: device has failed\n", __func__);
scp->result = (DID_NO_CONNECT << 16);
- scp->scsi_done(scp);
+ scsi_done(scp);
rc = 0;
goto out;
default:
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 29/84] dc395x: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (27 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 28/84] cxlflash: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 30/84] dpt_i2o: " Bart Van Assche
` (49 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Oliver Neukum, Ali Akcaagac,
Jamie Lenehan, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/dc395x.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 24c7cefb0b78..7d6f2b3c7fd5 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -995,8 +995,6 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s
goto complete;
}
- /* set callback and clear result in the command */
- cmd->scsi_done = done;
set_host_byte(cmd, DID_OK);
set_status_byte(cmd, SAM_STAT_GOOD);
@@ -3336,7 +3334,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
dprintkl(KERN_ERR, "srb_done: ERROR! Completed cmd with tmp_srb\n");
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
waiting_process_next(acb);
}
@@ -3367,7 +3365,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,
if (force) {
/* For new EH, we normally don't need to give commands back,
* as they all complete or all time out */
- p->scsi_done(p);
+ scsi_done(p);
}
}
if (!list_empty(&dcb->srb_going_list))
@@ -3394,7 +3392,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,
if (force) {
/* For new EH, we normally don't need to give commands back,
* as they all complete or all time out */
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
if (!list_empty(&dcb->srb_waiting_list))
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 30/84] dpt_i2o: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (28 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 29/84] dc395x: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 31/84] esas2r: " Bart Van Assche
` (48 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/dpt_i2o.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 7af96d14c9bc..1f00afcfe440 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -421,7 +421,6 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
adpt_hba* pHba = NULL;
struct adpt_device* pDev = NULL; /* dpt per device information */
- cmd->scsi_done = done;
/*
* SCSI REQUEST_SENSE commands will be executed automatically by the
* Host Adapter for any errors, so they should not be executed
@@ -431,7 +430,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
if ((cmd->cmnd[0] == REQUEST_SENSE) && (cmd->sense_buffer[0] != 0)) {
cmd->result = (DID_OK << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
@@ -456,7 +455,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
// TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response
// with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue.
cmd->result = (DID_NO_CONNECT << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
cmd->device->hostdata = pDev;
@@ -2227,7 +2226,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
printk(KERN_WARNING"%s: scsi opcode 0x%x not supported.\n",
pHba->name, cmd->cmnd[0]);
cmd->result = (DID_ERROR <<16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
}
@@ -2451,9 +2450,7 @@ static void adpt_i2o_scsi_complete(void __iomem *reply, struct scsi_cmnd *cmd)
cmd->result |= (dev_status);
- if(cmd->scsi_done != NULL){
- cmd->scsi_done(cmd);
- }
+ scsi_done(cmd);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 31/84] esas2r: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (29 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 30/84] dpt_i2o: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 32/84] esp_scsi: " Bart Van Assche
` (47 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Bradley Grove, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/esas2r/esas2r_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 647f82898b6e..7a4eadad23d7 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -828,7 +828,7 @@ int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
if (unlikely(test_bit(AF_DEGRADED_MODE, &a->flags))) {
cmd->result = DID_NO_CONNECT << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
@@ -988,7 +988,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)
scsi_set_resid(cmd, 0);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return SUCCESS;
}
@@ -1054,7 +1054,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)
scsi_set_resid(cmd, 0);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return SUCCESS;
}
@@ -1535,7 +1535,7 @@ void esas2r_complete_request_cb(struct esas2r_adapter *a,
scsi_set_resid(rq->cmd, 0);
}
- rq->cmd->scsi_done(rq->cmd);
+ scsi_done(rq->cmd);
esas2r_free_request(a, rq);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 32/84] esp_scsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (30 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 31/84] esas2r: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 33/84] fas216: " Bart Van Assche
` (46 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/esp_scsi.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 9a8c037a2f21..f7c2d64f1cef 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -936,7 +936,7 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent,
}
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
list_del(&ent->list);
esp_put_ent(esp, ent);
@@ -965,8 +965,6 @@ static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_
ent->cmd = cmd;
- cmd->scsi_done = done;
-
spriv = ESP_CMD_PRIV(cmd);
spriv->num_sg = 0;
@@ -2038,7 +2036,7 @@ static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent)
if (ent->flags & ESP_CMD_FLAG_AUTOSENSE)
esp_unmap_sense(esp, ent);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
list_del(&ent->list);
esp_put_ent(esp, ent);
}
@@ -2061,7 +2059,7 @@ static void esp_reset_cleanup(struct esp *esp)
list_del(&ent->list);
cmd->result = DID_RESET << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
esp_put_ent(esp, ent);
}
@@ -2535,7 +2533,7 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
list_del(&ent->list);
cmd->result = DID_ABORT << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
esp_put_ent(esp, ent);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 33/84] fas216: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (31 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 32/84] esp_scsi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:25 ` Russell King (Oracle)
2021-09-18 0:05 ` [PATCH 34/84] fdomain: " Bart Van Assche
` (45 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Russell King, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/arm/fas216.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 9c4458a99025..170ec40a3ce7 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2027,7 +2027,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,
* correctly by fas216_std_done.
*/
scsi_eh_restore_cmnd(SCpnt, &info->ses);
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
}
/**
@@ -2098,14 +2098,8 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result)
}
done:
- if (SCpnt->scsi_done) {
- SCpnt->scsi_done(SCpnt);
- return;
- }
-
- panic("scsi%d.H: null scsi_done function in fas216_done",
- info->host->host_no);
-
+ scsi_done(SCpnt);
+ return;
request_sense:
if (SCpnt->cmnd[0] == REQUEST_SENSE)
@@ -2216,7 +2210,6 @@ static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt,
fas216_log_command(info, LOG_CONNECT, SCpnt,
"received command (%p)", SCpnt);
- SCpnt->scsi_done = done;
SCpnt->host_scribble = (void *)fas216_std_done;
SCpnt->result = 0;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 33/84] fas216: Call scsi_done() directly
2021-09-18 0:05 ` [PATCH 33/84] fas216: " Bart Van Assche
@ 2021-09-18 0:25 ` Russell King (Oracle)
2021-09-19 2:25 ` Bart Van Assche
0 siblings, 1 reply; 106+ messages in thread
From: Russell King (Oracle) @ 2021-09-18 0:25 UTC (permalink / raw)
To: Bart Van Assche; +Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley
On Fri, Sep 17, 2021 at 05:05:16PM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
NAK. I don't think you've bothered to read the driver code to check
that your change is safe to make.
SCpnt->scsi_done is not always "scsi_done" but may also be
fas216_internal_done().
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 33/84] fas216: Call scsi_done() directly
2021-09-18 0:25 ` Russell King (Oracle)
@ 2021-09-19 2:25 ` Bart Van Assche
0 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-19 2:25 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley
On 9/17/21 17:25, Russell King (Oracle) wrote:
> NAK. I don't think you've bothered to read the driver code to check
> that your change is safe to make.
>
> SCpnt->scsi_done is not always "scsi_done" but may also be
> fas216_internal_done().
Thanks for the quick feedback. How about replacing this patch by the
two patches below?
[PATCH 1/2] fas216: Introduce struct fas216_cmd_priv
Introduce a structure with driver-private data per SCSI command. This data
structure will be used by the next patch to store a function pointer.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/arm/arxescsi.c | 1 +
drivers/scsi/arm/cumana_2.c | 1 +
drivers/scsi/arm/eesox.c | 1 +
drivers/scsi/arm/fas216.h | 10 ++++++++++
drivers/scsi/arm/powertec.c | 2 +-
5 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index 591414120754..7f667c198f6d 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -243,6 +243,7 @@ static struct scsi_host_template arxescsi_template = {
.eh_bus_reset_handler = fas216_eh_bus_reset,
.eh_device_reset_handler = fas216_eh_device_reset,
.eh_abort_handler = fas216_eh_abort,
+ .cmd_size = sizeof(struct fas216_cmd_priv),
.can_queue = 0,
.this_id = 7,
.sg_tablesize = SG_ALL,
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index 9dcd912267e6..3c00d7773876 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -363,6 +363,7 @@ static struct scsi_host_template cumanascsi2_template = {
.eh_bus_reset_handler = fas216_eh_bus_reset,
.eh_device_reset_handler = fas216_eh_device_reset,
.eh_abort_handler = fas216_eh_abort,
+ .cmd_size = sizeof(struct fas216_cmd_priv),
.can_queue = 1,
.this_id = 7,
.sg_tablesize = SG_MAX_SEGMENTS,
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
index 5eb2415dda9d..1394590eecea 100644
--- a/drivers/scsi/arm/eesox.c
+++ b/drivers/scsi/arm/eesox.c
@@ -480,6 +480,7 @@ static struct scsi_host_template eesox_template = {
.eh_bus_reset_handler = fas216_eh_bus_reset,
.eh_device_reset_handler = fas216_eh_device_reset,
.eh_abort_handler = fas216_eh_abort,
+ .cmd_size = sizeof(struct fas216_cmd_priv),
.can_queue = 1,
.this_id = 7,
.sg_tablesize = SG_MAX_SEGMENTS,
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h
index 847413ce14cf..abf960487314 100644
--- a/drivers/scsi/arm/fas216.h
+++ b/drivers/scsi/arm/fas216.h
@@ -310,6 +310,16 @@ typedef struct {
unsigned long magic_end;
} FAS216_Info;
+/* driver-private data per SCSI command. */
+struct fas216_cmd_priv {
+ void (*scsi_done)(struct scsi_cmnd *cmd);
+};
+
+static inline struct fas216_cmd_priv *fas216_cmd_priv(struct scsi_cmnd *cmd)
+{
+ return scsi_cmd_priv(cmd);
+}
+
/* Function: int fas216_init (struct Scsi_Host *instance)
* Purpose : initialise FAS/NCR/AMD SCSI structures.
* Params : instance - a driver-specific filled-out structure
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index 9cc73da4e876..8fec435cee18 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -286,7 +286,7 @@ static struct scsi_host_template powertecscsi_template = {
.eh_bus_reset_handler = fas216_eh_bus_reset,
.eh_device_reset_handler = fas216_eh_device_reset,
.eh_abort_handler = fas216_eh_abort,
-
+ .cmd_size = sizeof(struct fas216_cmd_priv),
.can_queue = 8,
.this_id = 7,
.sg_tablesize = SG_MAX_SEGMENTS,
[PATCH 2/2] fas216: Stop using scsi_cmnd.scsi_done
Store the completion callback pointer in struct fas216_cmd_priv instead of in
struct scsi_cmnd. This patch prepares for removal of the scsi_done member
from struct scsi_cmnd.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/arm/fas216.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index bbb8635782b1..9926383f79ea 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2017,7 +2017,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,
* correctly by fas216_std_done.
*/
scsi_eh_restore_cmnd(SCpnt, &info->ses);
- SCpnt->scsi_done(SCpnt);
+ fas216_cmd_priv(SCpnt)->scsi_done(SCpnt);
}
/**
@@ -2088,8 +2088,8 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result)
}
done:
- if (SCpnt->scsi_done) {
- SCpnt->scsi_done(SCpnt);
+ if (fas216_cmd_priv(SCpnt)->scsi_done) {
+ fas216_cmd_priv(SCpnt)->scsi_done(SCpnt);
return;
}
@@ -2205,7 +2205,7 @@ static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt,
fas216_log_command(info, LOG_CONNECT, SCpnt,
"received command (%p)", SCpnt);
- SCpnt->scsi_done = done;
+ fas216_cmd_priv(SCpnt)->scsi_done = done;
SCpnt->host_scribble = (void *)fas216_std_done;
SCpnt->result = 0;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 34/84] fdomain: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (32 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 33/84] fas216: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 35/84] fnic: " Bart Van Assche
` (44 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/fdomain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index eda2be534aa7..9159b4057c5d 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -206,7 +206,7 @@ static void fdomain_finish_cmd(struct fdomain *fd)
{
outb(0, fd->base + REG_ICTL);
fdomain_make_bus_idle(fd);
- fd->cur_cmd->scsi_done(fd->cur_cmd);
+ scsi_done(fd->cur_cmd);
fd->cur_cmd = NULL;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 35/84] fnic: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (33 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 34/84] fdomain: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 36/84] hpsa: " Bart Van Assche
` (43 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Satish Kharat, Sesidhar Baddela,
Karan Tilak Kumar, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/fnic/fnic_scsi.c | 119 +++++++++++++++-------------------
1 file changed, 54 insertions(+), 65 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index f8afbfb468dc..1d6ad312c47b 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -560,7 +560,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
CMD_STATE(sc) = FNIC_IOREQ_CMD_PENDING;
CMD_SP(sc) = (char *)io_req;
CMD_FLAGS(sc) |= FNIC_IO_INITIALIZED;
- sc->scsi_done = done;
/* create copy wq desc and enqueue it */
wq = &fnic->wq_copy[0];
@@ -1051,8 +1050,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
}
/* Call SCSI completion function to complete the IO */
- if (sc->scsi_done)
- sc->scsi_done(sc);
+ scsi_done(sc);
}
/* fnic_fcpio_itmf_cmpl_handler
@@ -1193,28 +1191,25 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
fnic_release_ioreq_buf(fnic, io_req, sc);
mempool_free(io_req, fnic->io_req_pool);
- if (sc->scsi_done) {
- FNIC_TRACE(fnic_fcpio_itmf_cmpl_handler,
- sc->device->host->host_no, id,
- sc,
- jiffies_to_msecs(jiffies - start_time),
- desc,
- (((u64)hdr_status << 40) |
- (u64)sc->cmnd[0] << 32 |
- (u64)sc->cmnd[2] << 24 |
- (u64)sc->cmnd[3] << 16 |
- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
- (((u64)CMD_FLAGS(sc) << 32) |
- CMD_STATE(sc)));
- sc->scsi_done(sc);
- atomic64_dec(&fnic_stats->io_stats.active_ios);
- if (atomic64_read(&fnic->io_cmpl_skip))
- atomic64_dec(&fnic->io_cmpl_skip);
- else
- atomic64_inc(&fnic_stats->io_stats.io_completions);
- }
+ FNIC_TRACE(fnic_fcpio_itmf_cmpl_handler,
+ sc->device->host->host_no, id,
+ sc,
+ jiffies_to_msecs(jiffies - start_time),
+ desc,
+ (((u64)hdr_status << 40) |
+ (u64)sc->cmnd[0] << 32 |
+ (u64)sc->cmnd[2] << 24 |
+ (u64)sc->cmnd[3] << 16 |
+ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
+ (((u64)CMD_FLAGS(sc) << 32) |
+ CMD_STATE(sc)));
+ scsi_done(sc);
+ atomic64_dec(&fnic_stats->io_stats.active_ios);
+ if (atomic64_read(&fnic->io_cmpl_skip))
+ atomic64_dec(&fnic->io_cmpl_skip);
+ else
+ atomic64_inc(&fnic_stats->io_stats.io_completions);
}
-
} else if (id & FNIC_TAG_DEV_RST) {
/* Completion of device reset */
CMD_LR_STATUS(sc) = hdr_status;
@@ -1421,23 +1416,22 @@ static bool fnic_cleanup_io_iter(struct scsi_cmnd *sc, void *data,
atomic64_inc(&fnic_stats->io_stats.io_completions);
/* Complete the command to SCSI */
- if (sc->scsi_done) {
- if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED))
- shost_printk(KERN_ERR, fnic->lport->host,
- "Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n",
- tag, sc);
-
- FNIC_TRACE(fnic_cleanup_io,
- sc->device->host->host_no, tag, sc,
- jiffies_to_msecs(jiffies - start_time),
- 0, ((u64)sc->cmnd[0] << 32 |
- (u64)sc->cmnd[2] << 24 |
- (u64)sc->cmnd[3] << 16 |
- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
- (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
-
- sc->scsi_done(sc);
- }
+ if (!(CMD_FLAGS(sc) & FNIC_IO_ISSUED))
+ shost_printk(KERN_ERR, fnic->lport->host,
+ "Calling done for IO not issued to fw: tag:0x%x sc:0x%p\n",
+ tag, sc);
+
+ FNIC_TRACE(fnic_cleanup_io,
+ sc->device->host->host_no, tag, sc,
+ jiffies_to_msecs(jiffies - start_time),
+ 0, ((u64)sc->cmnd[0] << 32 |
+ (u64)sc->cmnd[2] << 24 |
+ (u64)sc->cmnd[3] << 16 |
+ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
+ (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
+
+ scsi_done(sc);
+
return true;
}
@@ -1495,17 +1489,15 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "wq_copy_cleanup_handler:"
" DID_NO_CONNECT\n");
- if (sc->scsi_done) {
- FNIC_TRACE(fnic_wq_copy_cleanup_handler,
- sc->device->host->host_no, id, sc,
- jiffies_to_msecs(jiffies - start_time),
- 0, ((u64)sc->cmnd[0] << 32 |
- (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 |
- (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
- (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
+ FNIC_TRACE(fnic_wq_copy_cleanup_handler,
+ sc->device->host->host_no, id, sc,
+ jiffies_to_msecs(jiffies - start_time),
+ 0, ((u64)sc->cmnd[0] << 32 |
+ (u64)sc->cmnd[2] << 24 | (u64)sc->cmnd[3] << 16 |
+ (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
+ (((u64)CMD_FLAGS(sc) << 32) | CMD_STATE(sc)));
- sc->scsi_done(sc);
- }
+ scsi_done(sc);
}
static inline int fnic_queue_abort_io_req(struct fnic *fnic, int tag,
@@ -1931,16 +1923,14 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
fnic_release_ioreq_buf(fnic, io_req, sc);
mempool_free(io_req, fnic->io_req_pool);
- if (sc->scsi_done) {
/* Call SCSI completion function to complete the IO */
- sc->result = (DID_ABORT << 16);
- sc->scsi_done(sc);
- atomic64_dec(&fnic_stats->io_stats.active_ios);
- if (atomic64_read(&fnic->io_cmpl_skip))
- atomic64_dec(&fnic->io_cmpl_skip);
- else
- atomic64_inc(&fnic_stats->io_stats.io_completions);
- }
+ sc->result = (DID_ABORT << 16);
+ scsi_done(sc);
+ atomic64_dec(&fnic_stats->io_stats.active_ios);
+ if (atomic64_read(&fnic->io_cmpl_skip))
+ atomic64_dec(&fnic->io_cmpl_skip);
+ else
+ atomic64_inc(&fnic_stats->io_stats.io_completions);
fnic_abort_cmd_end:
FNIC_TRACE(fnic_abort_cmd, sc->device->host->host_no, tag, sc,
@@ -2153,11 +2143,10 @@ static bool fnic_pending_aborts_iter(struct scsi_cmnd *sc,
* Any IO is returned during reset, it needs to call scsi_done
* to return the scsi_cmnd to upper layer.
*/
- if (sc->scsi_done) {
- /* Set result to let upper SCSI layer retry */
- sc->result = DID_RESET << 16;
- sc->scsi_done(sc);
- }
+ /* Set result to let upper SCSI layer retry */
+ sc->result = DID_RESET << 16;
+ scsi_done(sc);
+
return true;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 36/84] hpsa: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (34 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 35/84] fnic: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 37/84] hptiop: " Bart Van Assche
` (42 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Don Brace, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/hpsa.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3faa87fa296a..a1153449344a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2482,8 +2482,8 @@ static void hpsa_cmd_free_and_done(struct ctlr_info *h,
struct CommandList *c, struct scsi_cmnd *cmd)
{
hpsa_cmd_resolve_and_free(h, c);
- if (cmd && cmd->scsi_done)
- cmd->scsi_done(cmd);
+ if (cmd)
+ scsi_done(cmd);
}
static void hpsa_retry_cmd(struct ctlr_info *h, struct CommandList *c)
@@ -5671,7 +5671,7 @@ static void hpsa_command_resubmit_worker(struct work_struct *work)
* if it encountered a dma mapping failure.
*/
cmd->result = DID_IMM_RETRY << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
@@ -5691,19 +5691,19 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
dev = cmd->device->hostdata;
if (!dev) {
cmd->result = DID_NO_CONNECT << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
if (dev->removed) {
cmd->result = DID_NO_CONNECT << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
if (unlikely(lockup_detected(h))) {
cmd->result = DID_NO_CONNECT << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 37/84] hptiop: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (35 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 36/84] hpsa: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 38/84] ibmvscsi: " Bart Van Assche
` (41 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, HighPoint Linux Team, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/hptiop.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 61cda7b7624f..f18f6a677c1b 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -769,7 +769,7 @@ static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag,
skip_resid:
dprintk("scsi_done(%p)\n", scp);
- scp->scsi_done(scp);
+ scsi_done(scp);
free_req(hba, &hba->reqs[tag]);
}
@@ -1002,9 +1002,6 @@ static int hptiop_queuecommand_lck(struct scsi_cmnd *scp,
int sg_count = 0;
struct hptiop_request *_req;
- BUG_ON(!done);
- scp->scsi_done = done;
-
_req = get_req(hba);
if (_req == NULL) {
dprintk("hptiop_queuecmd : no free req\n");
@@ -1059,7 +1056,7 @@ static int hptiop_queuecommand_lck(struct scsi_cmnd *scp,
cmd_done:
dprintk("scsi_done(scp=%p)\n", scp);
- scp->scsi_done(scp);
+ scsi_done(scp);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 38/84] ibmvscsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (36 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 37/84] hptiop: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 39/84] imm: " Bart Van Assche
` (40 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Tyrel Datwyler, Michael Ellerman,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 1f1586ad48fe..63f42eebe0ba 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1046,7 +1046,7 @@ static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt)
if (cmnd) {
scsi_dma_unmap(cmnd);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
}
ibmvfc_free_event(evt);
@@ -1848,7 +1848,7 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
cmnd->result = (DID_ERROR << 16);
scsi_dma_unmap(cmnd);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
}
ibmvfc_free_event(evt);
@@ -1934,7 +1934,7 @@ static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
if (unlikely((rc = fc_remote_port_chkready(rport))) ||
unlikely((rc = ibmvfc_host_chkready(vhost)))) {
cmnd->result = rc;
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
@@ -1974,7 +1974,7 @@ static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
"Failed to map DMA buffer for command. rc=%d\n", rc);
cmnd->result = DID_ERROR << 16;
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 39/84] imm: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (37 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 38/84] ibmvscsi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 40/84] initio: " Bart Van Assche
` (39 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/imm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 943c9102a7eb..be8edcff0177 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -769,7 +769,7 @@ static void imm_interrupt(struct work_struct *work)
spin_lock_irqsave(host->host_lock, flags);
dev->cur_cmd = NULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
spin_unlock_irqrestore(host->host_lock, flags);
return;
}
@@ -922,7 +922,6 @@ static int imm_queuecommand_lck(struct scsi_cmnd *cmd,
dev->failed = 0;
dev->jstart = jiffies;
dev->cur_cmd = cmd;
- cmd->scsi_done = done;
cmd->result = DID_ERROR << 16; /* default return code */
cmd->SCp.phase = 0; /* bus free */
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 40/84] initio: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (38 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 39/84] imm: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 41/84] ipr: " Bart Van Assche
` (38 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/initio.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 9b75e19a9bab..183f95758636 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2615,8 +2615,6 @@ static int i91u_queuecommand_lck(struct scsi_cmnd *cmd,
struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata;
struct scsi_ctrl_blk *cmnd;
- cmd->scsi_done = done;
-
cmnd = initio_alloc_scb(host);
if (!cmnd)
return SCSI_MLQUEUE_HOST_BUSY;
@@ -2788,7 +2786,7 @@ static void i91uSCBPost(u8 * host_mem, u8 * cblk_mem)
cmnd->result = cblk->tastat | (cblk->hastat << 16);
i91u_unmap_scb(host->pci_dev, cmnd);
- cmnd->scsi_done(cmnd); /* Notify system DONE */
+ scsi_done(cmnd); /* Notify system DONE */
initio_release_scb(host, cblk); /* Release SCB for current channel */
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 41/84] ipr: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (39 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 40/84] initio: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 42/84] ips: " Bart Van Assche
` (37 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Brian King, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ipr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 5d78f7e939a3..aa44216dcf9a 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -866,7 +866,7 @@ static void __ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd)
scsi_cmd->result |= (DID_ERROR << 16);
scsi_dma_unmap(ipr_cmd->scsi_cmd);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
if (ipr_cmd->eh_comp)
complete(ipr_cmd->eh_comp);
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6065,7 +6065,7 @@ static void __ipr_erp_done(struct ipr_cmnd *ipr_cmd)
res->in_erp = 0;
}
scsi_dma_unmap(ipr_cmd->scsi_cmd);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
if (ipr_cmd->eh_comp)
complete(ipr_cmd->eh_comp);
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6502,7 +6502,7 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
}
scsi_dma_unmap(ipr_cmd->scsi_cmd);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
if (ipr_cmd->eh_comp)
complete(ipr_cmd->eh_comp);
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6531,7 +6531,7 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd)
scsi_dma_unmap(scsi_cmd);
spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
if (ipr_cmd->eh_comp)
complete(ipr_cmd->eh_comp);
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
@@ -6685,7 +6685,7 @@ static int ipr_queuecommand(struct Scsi_Host *shost,
spin_lock_irqsave(hrrq->lock, hrrq_flags);
memset(scsi_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
scsi_cmd->result = (DID_NO_CONNECT << 16);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
spin_unlock_irqrestore(hrrq->lock, hrrq_flags);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 42/84] ips: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (40 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 41/84] ipr: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 43/84] libfc: " Bart Van Assche
` (36 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Adaptec OEM Raid Solutions,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ips.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index cdd94fb2aab7..0c93ec359e9b 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -936,7 +936,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
scb->scsi_cmd->result = DID_ERROR << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
ips_freescb(ha, scb);
}
@@ -946,7 +946,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) {
scsi_cmd->result = DID_ERROR;
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
}
ha->active = FALSE;
@@ -965,7 +965,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
scb->scsi_cmd->result = DID_ERROR << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
ips_freescb(ha, scb);
}
@@ -975,7 +975,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) {
scsi_cmd->result = DID_ERROR << 16;
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
}
ha->active = FALSE;
@@ -994,7 +994,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
scb->scsi_cmd->result = DID_RESET << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
ips_freescb(ha, scb);
}
@@ -1064,8 +1064,6 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
return (0);
}
- SC->scsi_done = done;
-
DEBUG_VAR(2, "(%s%d): ips_queue: cmd 0x%X (%d %d %d)",
ips_name,
ha->host_num,
@@ -1099,7 +1097,7 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
ha->ioctl_reset = 1; /* This reset request is from an IOCTL */
__ips_eh_reset(SC);
SC->result = DID_OK << 16;
- SC->scsi_done(SC);
+ scsi_done(SC);
return (0);
}
@@ -2579,7 +2577,7 @@ ips_next(ips_ha_t * ha, int intr)
case IPS_FAILURE:
if (scb->scsi_cmd) {
scb->scsi_cmd->result = DID_ERROR << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
}
ips_freescb(ha, scb);
@@ -2587,7 +2585,7 @@ ips_next(ips_ha_t * ha, int intr)
case IPS_SUCCESS_IMM:
if (scb->scsi_cmd) {
scb->scsi_cmd->result = DID_OK << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
}
ips_freescb(ha, scb);
@@ -2712,7 +2710,7 @@ ips_next(ips_ha_t * ha, int intr)
case IPS_FAILURE:
if (scb->scsi_cmd) {
scb->scsi_cmd->result = DID_ERROR << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
}
if (scb->bus)
@@ -2723,7 +2721,7 @@ ips_next(ips_ha_t * ha, int intr)
break;
case IPS_SUCCESS_IMM:
if (scb->scsi_cmd)
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
if (scb->bus)
ha->dcdb_active[scb->bus - 1] &=
@@ -3206,7 +3204,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb)
case IPS_FAILURE:
if (scb->scsi_cmd) {
scb->scsi_cmd->result = DID_ERROR << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
}
ips_freescb(ha, scb);
@@ -3214,7 +3212,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb)
case IPS_SUCCESS_IMM:
if (scb->scsi_cmd) {
scb->scsi_cmd->result = DID_ERROR << 16;
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
}
ips_freescb(ha, scb);
@@ -3231,7 +3229,7 @@ ips_done(ips_ha_t * ha, ips_scb_t * scb)
ha->dcdb_active[scb->bus - 1] &= ~(1 << scb->target_id);
}
- scb->scsi_cmd->scsi_done(scb->scsi_cmd);
+ scsi_done(scb->scsi_cmd);
ips_freescb(ha, scb);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 43/84] libfc: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (41 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 42/84] ips: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 44/84] libiscsi: " Bart Van Assche
` (35 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/libfc/fc_fcp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 509eacd7893d..871b11edb586 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1870,7 +1870,7 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd)
rval = fc_remote_port_chkready(rport);
if (rval) {
sc_cmd->result = rval;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
return 0;
}
@@ -1880,7 +1880,7 @@ int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd)
* online
*/
sc_cmd->result = DID_IMM_RETRY << 16;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
goto out;
}
@@ -2087,7 +2087,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
list_del(&fsp->list);
sc_cmd->SCp.ptr = NULL;
spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
/* release ref from initial allocation in queue command */
fc_fcp_pkt_release(fsp);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 44/84] libiscsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (42 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 43/84] libfc: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 18:34 ` Lee Duncan
2021-09-18 0:05 ` [PATCH 45/84] libsas: " Bart Van Assche
` (34 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Lee Duncan, Chris Leech,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/libiscsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 712a45368385..7beedc59d0c6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -468,7 +468,7 @@ static void iscsi_free_task(struct iscsi_task *task)
* it will decide how to return sc to scsi-ml.
*/
if (oldstate != ISCSI_TASK_REQUEUE_SCSIQ)
- sc->scsi_done(sc);
+ scsi_done(sc);
}
}
@@ -1807,7 +1807,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
ISCSI_DBG_SESSION(session, "iscsi: cmd 0x%x is not queued (%d)\n",
sc->cmnd[0], reason);
scsi_set_resid(sc, scsi_bufflen(sc));
- sc->scsi_done(sc);
+ scsi_done(sc);
return 0;
}
EXPORT_SYMBOL_GPL(iscsi_queuecommand);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 44/84] libiscsi: Call scsi_done() directly
2021-09-18 0:05 ` [PATCH 44/84] libiscsi: " Bart Van Assche
@ 2021-09-18 18:34 ` Lee Duncan
0 siblings, 0 replies; 106+ messages in thread
From: Lee Duncan @ 2021-09-18 18:34 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Chris Leech, James E.J. Bottomley
On 9/17/21 5:05 PM, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/libiscsi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index 712a45368385..7beedc59d0c6 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -468,7 +468,7 @@ static void iscsi_free_task(struct iscsi_task *task)
> * it will decide how to return sc to scsi-ml.
> */
> if (oldstate != ISCSI_TASK_REQUEUE_SCSIQ)
> - sc->scsi_done(sc);
> + scsi_done(sc);
> }
> }
>
> @@ -1807,7 +1807,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
> ISCSI_DBG_SESSION(session, "iscsi: cmd 0x%x is not queued (%d)\n",
> sc->cmnd[0], reason);
> scsi_set_resid(sc, scsi_bufflen(sc));
> - sc->scsi_done(sc);
> + scsi_done(sc);
> return 0;
> }
> EXPORT_SYMBOL_GPL(iscsi_queuecommand);
>
Reviewed-by: Lee Duncan <lduncanb@suse.com>
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 45/84] libsas: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (43 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 44/84] libiscsi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-22 17:26 ` John Garry
2021-09-18 0:05 ` [PATCH 46/84] lpfc: " Bart Van Assche
` (33 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, John Garry,
Jason Yan, Yufen Yu
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/libsas/sas_scsi_host.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 2bf37151623e..d337fdf1b9ca 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -125,7 +125,7 @@ static void sas_scsi_task_done(struct sas_task *task)
}
sas_end_task(sc, task);
- sc->scsi_done(sc);
+ scsi_done(sc);
}
static struct sas_task *sas_create_task(struct scsi_cmnd *cmd,
@@ -198,7 +198,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
else
cmd->result = DID_ERROR << 16;
out_done:
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
EXPORT_SYMBOL_GPL(sas_queuecommand);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 45/84] libsas: Call scsi_done() directly
2021-09-18 0:05 ` [PATCH 45/84] libsas: " Bart Van Assche
@ 2021-09-22 17:26 ` John Garry
0 siblings, 0 replies; 106+ messages in thread
From: John Garry @ 2021-09-22 17:26 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, James E.J. Bottomley, Jason Yan, Yufen Yu
On 18/09/2021 01:05, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls.
Some might say safer as well
> Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche<bvanassche@acm.org>
Reviewed-by: John Garry <john.garry@huawei.com>
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 46/84] lpfc: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (44 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 45/84] libsas: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 47/84] mac53c94: " Bart Van Assche
` (32 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, James Smart, Dick Kennedy,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/lpfc/lpfc_scsi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 078fbea3f436..ca604ae166c6 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -564,7 +564,7 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba,
* scsi_done upcall.
*/
if (cmd)
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
/*
* We expect there is an abort thread waiting
@@ -4502,7 +4502,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,
goto out;
/* The sdev is not guaranteed to be valid post scsi_done upcall. */
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
/*
* If there is an abort thread waiting for command completion
@@ -4771,7 +4771,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
#endif
/* The sdev is not guaranteed to be valid post scsi_done upcall. */
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
/*
* If there is an abort thread waiting for command completion
@@ -5847,7 +5847,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
shost);
out_fail_command:
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 47/84] mac53c94: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (45 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 46/84] lpfc: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 48/84] megaraid: " Bart Van Assche
` (31 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/mac53c94.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index ec9840d322e5..9731855805f5 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -83,7 +83,6 @@ static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cm
}
#endif
- cmd->scsi_done = done;
cmd->host_scribble = NULL;
state = (struct fsc_state *) cmd->device->host->hostdata;
@@ -348,7 +347,7 @@ static void cmd_done(struct fsc_state *state, int result)
cmd = state->current_req;
if (cmd) {
cmd->result = result;
- (*cmd->scsi_done)(cmd);
+ scsi_done(cmd);
state->current_req = NULL;
}
state->phase = idle;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 48/84] megaraid: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (46 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 47/84] mac53c94: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 49/84] " Bart Van Assche
` (30 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Kashyap Desai, Sumit Saxena,
Shivasharan S, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/megaraid/megaraid_mbox.c | 9 ++++-----
drivers/scsi/megaraid/megaraid_sas_base.c | 16 ++++++++--------
drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +++---
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index d20c2e4ee793..705c5027ba91 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1440,7 +1440,6 @@ megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd
int if_busy;
adapter = SCP2ADAPTER(scp);
- scp->scsi_done = done;
scp->result = 0;
/*
@@ -2358,7 +2357,7 @@ megaraid_mbox_dpc(unsigned long devp)
megaraid_dealloc_scb(adapter, scb);
// send the scsi packet back to kernel
- scp->scsi_done(scp);
+ scsi_done(scp);
}
return;
@@ -2416,7 +2415,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
scb->sno, scb->dev_channel, scb->dev_target));
scp->result = (DID_ABORT << 16);
- scp->scsi_done(scp);
+ scsi_done(scp);
megaraid_dealloc_scb(adapter, scb);
@@ -2446,7 +2445,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
scb->dev_channel, scb->dev_target));
scp->result = (DID_ABORT << 16);
- scp->scsi_done(scp);
+ scsi_done(scp);
megaraid_dealloc_scb(adapter, scb);
@@ -2566,7 +2565,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
}
scb->scp->result = (DID_RESET << 16);
- scb->scp->scsi_done(scb->scp);
+ scsi_done(scb->scp);
megaraid_dealloc_scb(adapter, scb);
}
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index e4298bf4a482..4ae585a5b1a5 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1794,7 +1794,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
if (instance->unload == 1) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -1809,7 +1809,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
return SCSI_MLQUEUE_HOST_BUSY;
} else {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
}
@@ -1818,7 +1818,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
if (!mr_device_priv_data ||
(atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR)) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -1826,7 +1826,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
ld_tgt_id = MEGASAS_TARGET_ID(scmd->device);
if (instance->ld_tgtid_status[ld_tgt_id] == LD_TARGET_ID_DELETED) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
}
@@ -1857,7 +1857,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
return instance->instancet->build_and_issue_cmd(instance, scmd);
out_done:
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -2783,7 +2783,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
reset_index, reset_cmd,
reset_cmd->scmd->cmnd[0]);
- reset_cmd->scmd->scsi_done(reset_cmd->scmd);
+ scsi_done(reset_cmd->scmd);
megasas_return_cmd(instance, reset_cmd);
} else if (reset_cmd->sync_cmd) {
dev_notice(&instance->pdev->dev, "%p synch cmds"
@@ -3640,7 +3640,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
atomic_dec(&instance->fw_outstanding);
scsi_dma_unmap(cmd->scmd);
- cmd->scmd->scsi_done(cmd->scmd);
+ scsi_done(cmd->scmd);
megasas_return_cmd(instance, cmd);
break;
@@ -3686,7 +3686,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
atomic_dec(&instance->fw_outstanding);
scsi_dma_unmap(cmd->scmd);
- cmd->scmd->scsi_done(cmd->scmd);
+ scsi_done(cmd->scmd);
megasas_return_cmd(instance, cmd);
break;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 26d0cf9353dd..478af0260718 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -3493,7 +3493,7 @@ megasas_complete_r1_command(struct megasas_instance *instance,
megasas_return_cmd_fusion(instance, cmd);
scsi_dma_unmap(scmd_local);
megasas_sdev_busy_dec(instance, scmd_local);
- scmd_local->scsi_done(scmd_local);
+ scsi_done(scmd_local);
}
}
@@ -3597,7 +3597,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
megasas_return_cmd_fusion(instance, cmd_fusion);
scsi_dma_unmap(scmd_local);
megasas_sdev_busy_dec(instance, scmd_local);
- scmd_local->scsi_done(scmd_local);
+ scsi_done(scmd_local);
} else /* Optimal VD - R1 FP command completion. */
megasas_complete_r1_command(instance, cmd_fusion);
break;
@@ -4977,7 +4977,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
atomic_dec(&instance->ldio_outstanding);
megasas_return_cmd_fusion(instance, cmd_fusion);
scsi_dma_unmap(scmd_local);
- scmd_local->scsi_done(scmd_local);
+ scsi_done(scmd_local);
}
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 49/84] megaraid: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (47 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 48/84] megaraid: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 50/84] mesh: " Bart Van Assche
` (29 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Kashyap Desai, Sumit Saxena,
Shivasharan S, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/megaraid.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 56910e94dbf2..c4ea833586e0 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -380,9 +380,6 @@ megaraid_queue_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
adapter = (adapter_t *)scmd->device->host->hostdata;
- scmd->scsi_done = done;
-
-
/*
* Allocate and build a SCB request
* busy flag will be set if mega_build_cmd() command could not
@@ -586,7 +583,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
/* have just LUN 0 for each target on virtual channels */
if (cmd->device->lun) {
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
@@ -605,7 +602,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
if(ldrv_num > max_ldrv_num ) {
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
@@ -617,7 +614,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
* devices
*/
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
}
@@ -637,7 +634,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
*/
if( !adapter->has_cluster ) {
cmd->result = (DID_OK << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
@@ -655,7 +652,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
return scb;
#else
cmd->result = (DID_OK << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
#endif
@@ -670,7 +667,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
kunmap_atomic(buf - sg->offset);
cmd->result = (DID_OK << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
@@ -866,7 +863,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
if( ! adapter->has_cluster ) {
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
@@ -889,7 +886,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
default:
cmd->result = (DID_BAD_TARGET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return NULL;
}
}
@@ -1654,7 +1651,7 @@ mega_rundoneq (adapter_t *adapter)
struct scsi_pointer* spos = (struct scsi_pointer *)pos;
cmd = list_entry(spos, struct scsi_cmnd, SCp);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
INIT_LIST_HEAD(&adapter->completed_list);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 50/84] mesh: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (48 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 49/84] " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 51/84] mpi3mr: " Bart Van Assche
` (28 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/mesh.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 78b72bcf58fe..73a3e85802ad 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -342,15 +342,6 @@ static inline void mesh_flush_io(volatile struct mesh_regs __iomem *mr)
}
-/*
- * Complete a SCSI command
- */
-static void mesh_completed(struct mesh_state *ms, struct scsi_cmnd *cmd)
-{
- (*cmd->scsi_done)(cmd);
-}
-
-
/* Called with meshinterrupt disabled, initialize the chipset
* and eventually do the initial bus reset. The lock must not be
* held since we can schedule.
@@ -613,7 +604,7 @@ static void mesh_done(struct mesh_state *ms, int start_next)
#endif
}
cmd->SCp.this_residual -= ms->data_ptr;
- mesh_completed(ms, cmd);
+ scsi_done(cmd);
}
if (start_next) {
out_8(&ms->mesh->sequence, SEQ_ENBRESEL);
@@ -996,7 +987,7 @@ static void handle_reset(struct mesh_state *ms)
if ((cmd = tp->current_req) != NULL) {
set_host_byte(cmd, DID_RESET);
tp->current_req = NULL;
- mesh_completed(ms, cmd);
+ scsi_done(cmd);
}
ms->tgts[tgt].sdtr_state = do_sdtr;
ms->tgts[tgt].sync_params = ASYNC_PARAMS;
@@ -1005,7 +996,7 @@ static void handle_reset(struct mesh_state *ms)
while ((cmd = ms->request_q) != NULL) {
ms->request_q = (struct scsi_cmnd *) cmd->host_scribble;
set_host_byte(cmd, DID_RESET);
- mesh_completed(ms, cmd);
+ scsi_done(cmd);
}
ms->phase = idle;
ms->msgphase = msg_none;
@@ -1634,7 +1625,6 @@ static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *
{
struct mesh_state *ms;
- cmd->scsi_done = done;
cmd->host_scribble = NULL;
ms = (struct mesh_state *) cmd->device->host->hostdata;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 51/84] mpi3mr: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (49 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 50/84] mesh: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 52/84] mpt3sas: " Bart Van Assche
` (27 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Sathya Prakash Veerichetty,
Kashyap Desai, Sumit Saxena, Sreekanth Reddy,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/mpi3mr/mpi3mr_os.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 2197988333fe..6373a877f439 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -409,7 +409,7 @@ static bool mpi3mr_flush_scmd(struct request *rq,
scsi_dma_unmap(scmd);
scmd->result = DID_RESET << 16;
scsi_print_command(scmd);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
mrioc->flush_io_count++;
}
@@ -2312,7 +2312,7 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc,
}
mpi3mr_clear_scmd_priv(mrioc, scmd);
scsi_dma_unmap(scmd);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
out:
if (sense_buf)
mpi3mr_repost_sense_buf(mrioc,
@@ -3322,7 +3322,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
__func__);
scsi_print_command(scmd);
scmd->result = DID_OK << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return true;
}
@@ -3334,7 +3334,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x1A, 0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return true;
}
if (param_len != scsi_bufflen(scmd)) {
@@ -3345,7 +3345,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x1A, 0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return true;
}
buf = kzalloc(scsi_bufflen(scmd), GFP_ATOMIC);
@@ -3354,7 +3354,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x55, 0x03);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return true;
}
scsi_sg_copy_to_buffer(scmd, buf, scsi_bufflen(scmd));
@@ -3368,7 +3368,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x26, 0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
kfree(buf);
return true;
}
@@ -3438,14 +3438,14 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
sdev_priv_data = scmd->device->hostdata;
if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
goto out;
}
if (mrioc->stop_drv_processing &&
!(mpi3mr_allow_scmd_to_fw(scmd))) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
goto out;
}
@@ -3459,19 +3459,19 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
dev_handle = stgt_priv_data->dev_handle;
if (dev_handle == MPI3MR_INVALID_DEV_HANDLE) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
goto out;
}
if (stgt_priv_data->dev_removed) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
goto out;
}
if (atomic_read(&stgt_priv_data->block_io)) {
if (mrioc->stop_drv_processing) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
goto out;
}
retval = SCSI_MLQUEUE_DEVICE_BUSY;
@@ -3486,7 +3486,7 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
host_tag = mpi3mr_host_tag_for_scmd(mrioc, scmd);
if (host_tag == MPI3MR_HOSTTAG_INVALID) {
scmd->result = DID_ERROR << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
goto out;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 52/84] mpt3sas: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (50 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 51/84] mpi3mr: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 53/84] mvumi: " Bart Van Assche
` (26 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Sathya Prakash, Sreekanth Reddy,
Suganath Prabu Subramani, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 2f82b1e629af..ca4e91f09fca 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3314,7 +3314,7 @@ scsih_abort(struct scsi_cmnd *scmd)
sdev_printk(KERN_INFO, scmd->device,
"device been deleted! scmd(0x%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
r = SUCCESS;
goto out;
}
@@ -3390,7 +3390,7 @@ scsih_dev_reset(struct scsi_cmnd *scmd)
sdev_printk(KERN_INFO, scmd->device,
"device been deleted! scmd(0x%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
r = SUCCESS;
goto out;
}
@@ -3470,7 +3470,7 @@ scsih_target_reset(struct scsi_cmnd *scmd)
starget_printk(KERN_INFO, starget,
"target been deleted! scmd(0x%p)\n", scmd);
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
r = SUCCESS;
goto out;
}
@@ -5030,7 +5030,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc)
scmd->result = DID_NO_CONNECT << 16;
else
scmd->result = DID_RESET << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
}
dtmprintk(ioc, ioc_info(ioc, "completing %d cmds\n", count));
}
@@ -5139,13 +5139,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
sas_device_priv_data = scmd->device->hostdata;
if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
if (!(_scsih_allow_scmd_to_device(ioc, scmd))) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -5155,7 +5155,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
handle = sas_target_priv_data->handle;
if (handle == MPT3SAS_INVALID_DEVICE_HANDLE) {
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -5166,7 +5166,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
} else if (sas_target_priv_data->deleted) {
/* device has been deleted */
scmd->result = DID_NO_CONNECT << 16;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
} else if (sas_target_priv_data->tm_busy ||
sas_device_priv_data->block) {
@@ -5909,7 +5909,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
scsi_dma_unmap(scmd);
mpt3sas_base_free_smid(ioc, smid);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 53/84] mvumi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (51 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 52/84] mpt3sas: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 54/84] myrb: " Bart Van Assche
` (25 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/mvumi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 4d251bf630a3..904de62c974c 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -1328,7 +1328,7 @@ static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd,
dma_unmap_sg(&mhba->pdev->dev, scsi_sglist(scmd),
scsi_sg_count(scmd),
scmd->sc_data_direction);
- cmd->scmd->scsi_done(scmd);
+ scsi_done(scmd);
mvumi_return_cmd(mhba, cmd);
}
@@ -2104,7 +2104,7 @@ static int mvumi_queue_command(struct Scsi_Host *shost,
out_return_cmd:
mvumi_return_cmd(mhba, cmd);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
spin_unlock_irqrestore(shost->host_lock, irq_flags);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 54/84] myrb: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (52 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 53/84] mvumi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 55/84] myrs: " Bart Van Assche
` (24 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/myrb.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/scsi/myrb.c b/drivers/scsi/myrb.c
index a4a88323e020..e8a7bcce4674 100644
--- a/drivers/scsi/myrb.c
+++ b/drivers/scsi/myrb.c
@@ -1282,7 +1282,7 @@ static int myrb_pthru_queuecommand(struct Scsi_Host *shost,
if (nsge > 1) {
dma_pool_free(cb->dcdb_pool, dcdb, dcdb_addr);
scmd->result = (DID_ERROR << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -1436,13 +1436,13 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
dev_dbg(&shost->shost_gendev, "ldev %u in state %x, skip\n",
sdev->id, ldev_info ? ldev_info->state : 0xff);
scmd->result = (DID_BAD_TARGET << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
switch (scmd->cmnd[0]) {
case TEST_UNIT_READY:
scmd->result = (DID_OK << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case INQUIRY:
if (scmd->cmnd[1] & 1) {
@@ -1452,11 +1452,11 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
myrb_inquiry(cb, scmd);
scmd->result = (DID_OK << 16);
}
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case SYNCHRONIZE_CACHE:
scmd->result = (DID_OK << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case MODE_SENSE:
if ((scmd->cmnd[2] & 0x3F) != 0x3F &&
@@ -1467,25 +1467,25 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
myrb_mode_sense(cb, scmd, ldev_info);
scmd->result = (DID_OK << 16);
}
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case READ_CAPACITY:
if ((scmd->cmnd[1] & 1) ||
(scmd->cmnd[8] & 1)) {
/* Illegal request, invalid field in CDB */
scsi_build_sense(scmd, 0, ILLEGAL_REQUEST, 0x24, 0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
lba = get_unaligned_be32(&scmd->cmnd[2]);
if (lba) {
/* Illegal request, invalid field in CDB */
scsi_build_sense(scmd, 0, ILLEGAL_REQUEST, 0x24, 0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
myrb_read_capacity(cb, scmd, ldev_info);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case REQUEST_SENSE:
myrb_request_sense(cb, scmd);
@@ -1499,13 +1499,13 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
/* Assume good status */
scmd->result = (DID_OK << 16);
}
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case READ_6:
if (ldev_info->state == MYRB_DEVICE_WO) {
/* Data protect, attempt to read invalid data */
scsi_build_sense(scmd, 0, DATA_PROTECT, 0x21, 0x06);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
fallthrough;
@@ -1519,7 +1519,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
if (ldev_info->state == MYRB_DEVICE_WO) {
/* Data protect, attempt to read invalid data */
scsi_build_sense(scmd, 0, DATA_PROTECT, 0x21, 0x06);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
fallthrough;
@@ -1533,7 +1533,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
if (ldev_info->state == MYRB_DEVICE_WO) {
/* Data protect, attempt to read invalid data */
scsi_build_sense(scmd, 0, DATA_PROTECT, 0x21, 0x06);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
fallthrough;
@@ -1546,7 +1546,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
default:
/* Illegal request, invalid opcode */
scsi_build_sense(scmd, 0, ILLEGAL_REQUEST, 0x20, 0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
@@ -1610,7 +1610,7 @@ static int myrb_queuecommand(struct Scsi_Host *shost,
if (sdev->channel > myrb_logical_channel(shost)) {
scmd->result = (DID_BAD_TARGET << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
if (sdev->channel == myrb_logical_channel(shost))
@@ -2361,7 +2361,7 @@ static void myrb_handle_scsi(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk,
scmd->result = (DID_ERROR << 16);
break;
}
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
}
static void myrb_handle_cmdblk(struct myrb_hba *cb, struct myrb_cmdblk *cmd_blk)
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 55/84] myrs: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (53 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 54/84] myrb: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 56/84] ncr53c8xx: " Bart Van Assche
` (23 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Hannes Reinecke, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/myrs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 07f274afd7e5..2ffe3cadda66 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -1595,14 +1595,14 @@ static int myrs_queuecommand(struct Scsi_Host *shost,
if (!scmd->device->hostdata) {
scmd->result = (DID_NO_CONNECT << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
switch (scmd->cmnd[0]) {
case REPORT_LUNS:
scsi_build_sense(scmd, 0, ILLEGAL_REQUEST, 0x20, 0x0);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
case MODE_SENSE:
if (scmd->device->channel >= cs->ctlr_info->physchan_present) {
@@ -1616,7 +1616,7 @@ static int myrs_queuecommand(struct Scsi_Host *shost,
myrs_mode_sense(cs, scmd, ldev_info);
scmd->result = (DID_OK << 16);
}
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
break;
@@ -1756,7 +1756,7 @@ static int myrs_queuecommand(struct Scsi_Host *shost,
if (WARN_ON(!hw_sgl)) {
scsi_dma_unmap(scmd);
scmd->result = (DID_ERROR << 16);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
return 0;
}
hw_sgl->sge_addr = (u64)sg_dma_address(sgl);
@@ -2083,7 +2083,7 @@ static void myrs_handle_scsi(struct myrs_hba *cs, struct myrs_cmdblk *cmd_blk,
scmd->result = (DID_BAD_TARGET << 16);
else
scmd->result = (DID_OK << 16) | status;
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
}
static void myrs_handle_cmdblk(struct myrs_hba *cs, struct myrs_cmdblk *cmd_blk)
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 56/84] ncr53c8xx: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (54 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 55/84] myrs: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 57/84] nsp32: " Bart Van Assche
` (22 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ncr53c8xx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 7a4f5d4dd670..6c6cf111be5f 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -4006,7 +4006,7 @@ static inline void ncr_flush_done_cmds(struct scsi_cmnd *lcmd)
while (lcmd) {
cmd = lcmd;
lcmd = (struct scsi_cmnd *) cmd->host_scribble;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
@@ -7865,7 +7865,6 @@ static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd, void (*done)(stru
printk("ncr53c8xx_queue_command\n");
#endif
- cmd->scsi_done = done;
cmd->host_scribble = NULL;
cmd->__data_mapped = 0;
cmd->__data_mapping = 0;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 57/84] nsp32: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (55 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 56/84] ncr53c8xx: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 1:10 ` Masanori Goto
2021-09-18 0:05 ` [PATCH 58/84] pcmcia: " Bart Van Assche
` (21 subsequent siblings)
78 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, GOTO Masanori, YOKOTA Hiroshi,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/nsp32.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index bc9d29e5fdba..1057b6fd7569 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -945,7 +945,6 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt,
show_command(SCpnt);
- SCpnt->scsi_done = done;
data->CurrentSC = SCpnt;
SCpnt->SCp.Status = SAM_STAT_CHECK_CONDITION;
scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
@@ -1546,7 +1545,7 @@ static void nsp32_scsi_done(struct scsi_cmnd *SCpnt)
/*
* call scsi_done
*/
- (*SCpnt->scsi_done)(SCpnt);
+ scsi_done(SCpnt);
/*
* reset parameters
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 57/84] nsp32: Call scsi_done() directly
2021-09-18 0:05 ` [PATCH 57/84] nsp32: " Bart Van Assche
@ 2021-09-18 1:10 ` Masanori Goto
2021-09-18 3:08 ` Bart Van Assche
0 siblings, 1 reply; 106+ messages in thread
From: Masanori Goto @ 2021-09-18 1:10 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, YOKOTA Hiroshi, James E.J. Bottomley
I'm not sure this is a safe approach in general, but any background of
this change?
2021年9月18日(土) 9:07 Bart Van Assche <bvanassche@acm.org>:
>
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/nsp32.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
> index bc9d29e5fdba..1057b6fd7569 100644
> --- a/drivers/scsi/nsp32.c
> +++ b/drivers/scsi/nsp32.c
> @@ -945,7 +945,6 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt,
>
> show_command(SCpnt);
>
> - SCpnt->scsi_done = done;
> data->CurrentSC = SCpnt;
> SCpnt->SCp.Status = SAM_STAT_CHECK_CONDITION;
> scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
> @@ -1546,7 +1545,7 @@ static void nsp32_scsi_done(struct scsi_cmnd *SCpnt)
> /*
> * call scsi_done
> */
> - (*SCpnt->scsi_done)(SCpnt);
> + scsi_done(SCpnt);
>
> /*
> * reset parameters
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 57/84] nsp32: Call scsi_done() directly
2021-09-18 1:10 ` Masanori Goto
@ 2021-09-18 3:08 ` Bart Van Assche
0 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 3:08 UTC (permalink / raw)
To: Masanori Goto
Cc: Martin K . Petersen, linux-scsi, YOKOTA Hiroshi, James E.J. Bottomley
On 9/17/21 18:10, Masanori Goto wrote:
> I'm not sure this is a safe approach in general, but any background of
> this change?
This patch series realizes two improvements:
- It improves performance for SCSI drivers that can provide high performance
(millions of IOPS).
- It reduces the size of struct scsi_cmnd.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 58/84] pcmcia: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (56 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 57/84] nsp32: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 59/84] pmcraid: " Bart Van Assche
` (20 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, YOKOTA Hiroshi, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/pcmcia/nsp_cs.c | 4 +---
drivers/scsi/pcmcia/sym53c500_cs.c | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 7c0f931e55e8..0271d534133a 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -178,7 +178,7 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt)
data->CurrentSC = NULL;
- SCpnt->scsi_done(SCpnt);
+ scsi_done(SCpnt);
}
static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
@@ -197,8 +197,6 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
scsi_bufflen(SCpnt), scsi_sg_count(SCpnt));
//nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "before CurrentSC=0x%p", data->CurrentSC);
- SCpnt->scsi_done = done;
-
if (data->CurrentSC != NULL) {
nsp_msg(KERN_DEBUG, "CurrentSC!=NULL this can't be happen");
SCpnt->result = DID_BAD_TARGET << 16;
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index a366ff1a3959..d2adda815d7b 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -492,7 +492,7 @@ SYM53C500_intr(int irq, void *dev_id)
idle_out:
curSC->SCp.phase = idle;
- curSC->scsi_done(curSC);
+ scsi_done(curSC);
goto out;
}
@@ -556,7 +556,6 @@ SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
VDEB(printk("\n"));
data->current_SC = SCpnt;
- data->current_SC->scsi_done = done;
data->current_SC->SCp.phase = command_ph;
data->current_SC->SCp.Status = 0;
data->current_SC->SCp.Message = 0;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 59/84] pmcraid: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (57 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 58/84] pcmcia: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 60/84] ppa: " Bart Van Assche
` (19 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/pmcraid.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index bffd9a9349e7..11f36fd4e62f 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -837,7 +837,7 @@ static void pmcraid_erp_done(struct pmcraid_cmd *cmd)
scsi_dma_unmap(scsi_cmd);
pmcraid_return_cmd(cmd);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
}
/**
@@ -2017,7 +2017,7 @@ static void pmcraid_fail_outstanding_cmds(struct pmcraid_instance *pinstance)
le32_to_cpu(resp) >> 2,
cmd->ioa_cb->ioarcb.cdb[0],
scsi_cmd->result);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
} else if (cmd->cmd_done == pmcraid_internal_done ||
cmd->cmd_done == pmcraid_erp_done) {
cmd->cmd_done(cmd);
@@ -2814,7 +2814,7 @@ static int _pmcraid_io_done(struct pmcraid_cmd *cmd, int reslen, int ioasc)
if (rc == 0) {
scsi_dma_unmap(scsi_cmd);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
}
return rc;
@@ -3328,7 +3328,6 @@ static int pmcraid_queuecommand_lck(
pinstance =
(struct pmcraid_instance *)scsi_cmd->device->host->hostdata;
fw_version = be16_to_cpu(pinstance->inq_data->fw_version);
- scsi_cmd->scsi_done = done;
res = scsi_cmd->device->hostdata;
scsi_cmd->result = (DID_OK << 16);
@@ -3338,7 +3337,7 @@ static int pmcraid_queuecommand_lck(
if (pinstance->ioa_state == IOA_STATE_DEAD) {
pmcraid_info("IOA is dead, but queuecommand is scheduled\n");
scsi_cmd->result = (DID_NO_CONNECT << 16);
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
return 0;
}
@@ -3351,7 +3350,7 @@ static int pmcraid_queuecommand_lck(
*/
if (scsi_cmd->cmnd[0] == SYNCHRONIZE_CACHE) {
pmcraid_info("SYNC_CACHE(0x35), completing in driver itself\n");
- scsi_cmd->scsi_done(scsi_cmd);
+ scsi_done(scsi_cmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 60/84] ppa: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (58 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 59/84] pmcraid: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 61/84] ps3rom: " Bart Van Assche
` (18 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ppa.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 977315fdc254..799ad8562e24 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -665,7 +665,7 @@ static void ppa_interrupt(struct work_struct *work)
dev->cur_cmd = NULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
@@ -798,7 +798,6 @@ static int ppa_queuecommand_lck(struct scsi_cmnd *cmd,
dev->failed = 0;
dev->jstart = jiffies;
dev->cur_cmd = cmd;
- cmd->scsi_done = done;
cmd->result = DID_ERROR << 16; /* default return code */
cmd->SCp.phase = 0; /* bus free */
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 61/84] ps3rom: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (59 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 60/84] ppa: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 62/84] qedf: " Bart Van Assche
` (17 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Geoff Levand, James E.J. Bottomley,
Michael Ellerman
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ps3rom.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index 0f4b99d92f12..08e970300b3f 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -209,7 +209,6 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,
int res;
priv->curr_cmd = cmd;
- cmd->scsi_done = done;
opcode = cmd->cmnd[0];
/*
@@ -237,7 +236,7 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,
scsi_build_sense(cmd, 0, ILLEGAL_REQUEST, 0, 0);
cmd->result = res;
priv->curr_cmd = NULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
return 0;
@@ -321,7 +320,7 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data)
done:
priv->curr_cmd = NULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return IRQ_HANDLED;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 62/84] qedf: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (60 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 61/84] ps3rom: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 63/84] qla1280: " Bart Van Assche
` (16 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Saurav Kashyap, Javed Hasan,
GR-QLogic-Storage-Upstream, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qedf/qedf_io.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index 3404782988d5..14aa544b0bc3 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -947,7 +947,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)
"Number of SG elements %d exceeds what hardware limitation of %d.\n",
num_sgs, QEDF_MAX_BDS_PER_CMD);
sc_cmd->result = DID_ERROR;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
return 0;
}
@@ -957,7 +957,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)
"Returning DNC as unloading or stop io, flags 0x%lx.\n",
qedf->flags);
sc_cmd->result = DID_NO_CONNECT << 16;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
return 0;
}
@@ -966,7 +966,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)
"Completing sc_cmd=%p DID_NO_CONNECT as MSI-X is not enabled.\n",
sc_cmd);
sc_cmd->result = DID_NO_CONNECT << 16;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
return 0;
}
@@ -976,7 +976,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)
"fc_remote_port_chkready failed=0x%x for port_id=0x%06x.\n",
rval, rport->port_id);
sc_cmd->result = rval;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
return 0;
}
@@ -1313,7 +1313,7 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
io_req->sc_cmd = NULL;
sc_cmd->SCp.ptr = NULL;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
kref_put(&io_req->refcount, qedf_release_cmd);
}
@@ -1386,13 +1386,6 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
goto bad_scsi_ptr;
}
- if (!sc_cmd->scsi_done) {
- QEDF_ERR(&qedf->dbg_ctx,
- "sc_cmd->scsi_done for sc_cmd %p is NULL.\n",
- sc_cmd);
- goto bad_scsi_ptr;
- }
-
qedf_unmap_sg_list(qedf, io_req);
sc_cmd->result = result << 16;
@@ -1417,7 +1410,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
io_req->sc_cmd = NULL;
sc_cmd->SCp.ptr = NULL;
- sc_cmd->scsi_done(sc_cmd);
+ scsi_done(sc_cmd);
kref_put(&io_req->refcount, qedf_release_cmd);
return;
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 63/84] qla1280: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (61 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 62/84] qedf: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 64/84] qla2xxx: " Bart Van Assche
` (15 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Michael Reed, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qla1280.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index d0b4e063bfe1..c508a6e20519 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -697,7 +697,6 @@ qla1280_queuecommand_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
struct srb *sp = (struct srb *)CMD_SP(cmd);
int status;
- cmd->scsi_done = fn;
sp->cmd = cmd;
sp->flags = 0;
sp->wait = NULL;
@@ -755,7 +754,7 @@ _qla1280_wait_for_single_command(struct scsi_qla_host *ha, struct srb *sp,
sp->wait = NULL;
if(CMD_HANDLE(cmd) == COMPLETED_HANDLE) {
status = SUCCESS;
- (*cmd->scsi_done)(cmd);
+ scsi_done(cmd);
}
return status;
}
@@ -1277,7 +1276,7 @@ qla1280_done(struct scsi_qla_host *ha)
ha->actthreads--;
if (sp->wait == NULL)
- (*(cmd)->scsi_done)(cmd);
+ scsi_done(cmd);
else
complete(sp->wait);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 64/84] qla2xxx: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (62 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 63/84] qla1280: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 65/84] qla4xxx: " Bart Van Assche
` (14 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Nilesh Javali,
GR-QLogic-Storage-Upstream, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qla2xxx/qla_os.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 03ff2596715b..5d576a3ba14f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -737,7 +737,7 @@ void qla2x00_sp_compl(srb_t *sp, int res)
sp->free(sp);
cmd->result = res;
CMD_SP(cmd) = NULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
if (comp)
complete(comp);
}
@@ -828,7 +828,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res)
sp->free(sp);
cmd->result = res;
CMD_SP(cmd) = NULL;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
if (comp)
complete(comp);
}
@@ -950,7 +950,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
return SCSI_MLQUEUE_TARGET_BUSY;
qc24_fail_command:
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
@@ -1038,7 +1038,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
return SCSI_MLQUEUE_TARGET_BUSY;
qc24_fail_command:
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 65/84] qla4xxx: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (63 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 64/84] qla2xxx: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 66/84] qlogicfas408: " Bart Van Assche
` (13 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Nilesh Javali, Manish Rangankar,
GR-QLogic-Storage-Upstream, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qla4xxx/ql4_os.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f1ea65c6e5f5..76d0b59a9982 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4080,7 +4080,7 @@ void qla4xxx_srb_compl(struct kref *ref)
mempool_free(srb, ha->srb_mempool);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
/**
@@ -4154,7 +4154,7 @@ static int qla4xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
return SCSI_MLQUEUE_HOST_BUSY;
qc_fail_command:
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 66/84] qlogicfas408: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (64 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 65/84] qla4xxx: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 67/84] qlogicpti: " Bart Van Assche
` (12 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qlogicfas408.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index 3bbe0b5545d9..5471c046a4b7 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -442,7 +442,7 @@ static void ql_ihandl(void *dev_id)
* If result is CHECK CONDITION done calls qcommand to request
* sense
*/
- (icmd->scsi_done) (icmd);
+ scsi_done(icmd);
}
irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id)
@@ -473,7 +473,6 @@ static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd,
return 0;
}
- cmd->scsi_done = done;
/* wait for the last command's interrupt to finish */
while (priv->qlcmd != NULL) {
barrier();
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 67/84] qlogicpti: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (65 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 66/84] qlogicfas408: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 68/84] scsi_debug: " Bart Van Assche
` (11 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qlogicpti.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 8e7e833a36cc..30b5e98b5de0 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1021,8 +1021,6 @@ static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(struc
u_int out_ptr;
int in_ptr;
- Cmnd->scsi_done = done;
-
in_ptr = qpti->req_in_ptr;
cmd = (struct Command_Entry *) &qpti->req_cpu[in_ptr];
out_ptr = sbus_readw(qpti->qregs + MBOX4);
@@ -1214,7 +1212,7 @@ static irqreturn_t qpti_intr(int irq, void *dev_id)
struct scsi_cmnd *next;
next = (struct scsi_cmnd *) dq->host_scribble;
- dq->scsi_done(dq);
+ scsi_done(dq);
dq = next;
} while (dq != NULL);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 68/84] scsi_debug: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (66 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 67/84] qlogicpti: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 69/84] smartpqi: " Bart Van Assche
` (10 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_debug.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 66f507469a31..407f1ce15118 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4809,7 +4809,7 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp)
pr_info("bypassing scsi_done() due to aborted cmd\n");
return;
}
- scp->scsi_done(scp); /* callback to mid level */
+ scsi_done(scp); /* callback to mid level */
}
/* When high resolution timer goes off this function is called. */
@@ -5524,7 +5524,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
if (new_sd_dp)
kfree(sd_dp);
/* call scsi_done() from this thread */
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
/* otherwise reduce kt by elapsed time */
@@ -5604,7 +5604,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
cmnd->result &= ~SDEG_RES_IMMED_MASK;
if (cmnd->result == 0 && scsi_result != 0)
cmnd->result = scsi_result;
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
@@ -7363,7 +7363,7 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num)
}
sd_dp->defer_t = SDEB_DEFER_NONE;
spin_unlock_irqrestore(&sqp->qc_lock, iflags);
- scp->scsi_done(scp); /* callback to mid level */
+ scsi_done(scp); /* callback to mid level */
spin_lock_irqsave(&sqp->qc_lock, iflags);
num_entries++;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 69/84] smartpqi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (67 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 68/84] scsi_debug: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 70/84] snic: " Bart Van Assche
` (9 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Don Brace, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index ecb2af3f43ca..3b5601c0c537 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -194,7 +194,7 @@ static char *pqi_raid_level_to_string(u8 raid_level)
static inline void pqi_scsi_done(struct scsi_cmnd *scmd)
{
pqi_prep_for_scsi_done(scmd);
- scmd->scsi_done(scmd);
+ scsi_done(scmd);
}
static inline void pqi_disable_write_same(struct scsi_device *sdev)
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 70/84] snic: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (68 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 69/84] smartpqi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 71/84] stex: " Bart Van Assche
` (8 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Karan Tilak Kumar, Sesidhar Baddela,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/snic/snic_scsi.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 43a950185e24..5f17666f3e1d 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -342,7 +342,7 @@ snic_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc)
SNIC_HOST_ERR(shost, "Tgt %p id %d Not Ready.\n", tgt, tgt->id);
atomic64_inc(&snic->s_stats.misc.tgt_not_rdy);
sc->result = ret;
- sc->scsi_done(sc);
+ scsi_done(sc);
return 0;
}
@@ -676,8 +676,7 @@ snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq)
SNIC_TRC_CMD(sc), SNIC_TRC_CMD_STATE_FLAGS(sc));
- if (sc->scsi_done)
- sc->scsi_done(sc);
+ scsi_done(sc);
snic_stats_update_io_cmpl(&snic->s_stats);
} /* end of snic_icmnd_cmpl_handler */
@@ -855,14 +854,12 @@ snic_process_itmf_cmpl(struct snic *snic,
snic_release_req_buf(snic, rqi, sc);
- if (sc->scsi_done) {
- SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc,
- jiffies_to_msecs(jiffies - start_time),
- (ulong) fwreq, SNIC_TRC_CMD(sc),
- SNIC_TRC_CMD_STATE_FLAGS(sc));
+ SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc,
+ jiffies_to_msecs(jiffies - start_time),
+ (ulong) fwreq, SNIC_TRC_CMD(sc),
+ SNIC_TRC_CMD_STATE_FLAGS(sc));
- sc->scsi_done(sc);
- }
+ scsi_done(sc);
break;
@@ -1475,7 +1472,7 @@ snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc)
* Call scsi_done to complete the IO.
*/
sc->result = (DID_ERROR << 16);
- sc->scsi_done(sc);
+ scsi_done(sc);
break;
default:
@@ -1855,7 +1852,7 @@ snic_dr_clean_single_req(struct snic *snic,
snic_release_req_buf(snic, rqi, sc);
sc->result = (DID_ERROR << 16);
- sc->scsi_done(sc);
+ scsi_done(sc);
ret = 0;
@@ -2500,14 +2497,12 @@ snic_scsi_cleanup(struct snic *snic, int ex_tag)
/* Update IO stats */
snic_stats_update_io_cmpl(&snic->s_stats);
- if (sc->scsi_done) {
- SNIC_TRC(snic->shost->host_no, tag, (ulong) sc,
- jiffies_to_msecs(jiffies - st_time), 0,
- SNIC_TRC_CMD(sc),
- SNIC_TRC_CMD_STATE_FLAGS(sc));
+ SNIC_TRC(snic->shost->host_no, tag, (ulong) sc,
+ jiffies_to_msecs(jiffies - st_time), 0,
+ SNIC_TRC_CMD(sc),
+ SNIC_TRC_CMD_STATE_FLAGS(sc));
- sc->scsi_done(sc);
- }
+ scsi_done(sc);
}
} /* end of snic_scsi_cleanup */
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 71/84] stex: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (69 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 70/84] snic: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 72/84] storvsc_drv: " Bart Van Assche
` (7 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/stex.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index f1ba7f5b52a8..2f96a2fdaa40 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -574,7 +574,7 @@ static void return_abnormal_state(struct st_hba *hba, int status)
if (ccb->cmd) {
scsi_dma_unmap(ccb->cmd);
ccb->cmd->result = status << 16;
- ccb->cmd->scsi_done(ccb->cmd);
+ scsi_done(ccb->cmd);
ccb->cmd = NULL;
}
}
@@ -688,8 +688,6 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
break;
}
- cmd->scsi_done = done;
-
tag = scsi_cmd_to_rq(cmd)->tag;
if (unlikely(tag >= host->can_queue))
@@ -764,7 +762,7 @@ static void stex_scsi_done(struct st_ccb *ccb)
}
cmd->result = result;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
static void stex_copy_data(struct st_ccb *ccb,
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 72/84] storvsc_drv: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (70 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 71/84] stex: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 73/84] sym53c8xx_2: " Bart Van Assche
` (6 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Wei Liu, Dexuan Cui, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/storvsc_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index ebbbc1299c62..70d0b1dd0f75 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1154,7 +1154,7 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request,
scsi_set_resid(scmnd,
cmd_request->payload->range.len - data_transfer_length);
- scmnd->scsi_done(scmnd);
+ scsi_done(scmnd);
if (payload_sz >
sizeof(struct vmbus_channel_packet_multipage_buffer))
@@ -1753,7 +1753,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
* future versions of the host.
*/
if (!storvsc_scsi_cmd_ok(scmnd)) {
- scmnd->scsi_done(scmnd);
+ scsi_done(scmnd);
return 0;
}
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 73/84] sym53c8xx_2: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (71 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 72/84] storvsc_drv: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 74/84] ufs: " Bart Van Assche
` (5 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Matthew Wilcox, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/sym53c8xx_2/sym_glue.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 6d0b07b9cb31..76747e180b17 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -133,7 +133,7 @@ void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)
complete(ucmd->eh_done);
scsi_dma_unmap(cmd);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
/*
@@ -493,7 +493,6 @@ static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd,
struct sym_ucmd *ucp = SYM_UCMD_PTR(cmd);
int sts = 0;
- cmd->scsi_done = done;
memset(ucp, 0, sizeof(*ucp));
/*
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 74/84] ufs: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (72 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 73/84] sym53c8xx_2: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 75/84] virtio_scsi: " Bart Van Assche
` (4 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley, Can Guo,
Bean Huo, Stanley Chu, Avri Altman, Jaegeuk Kim, Asutosh Das,
Adrian Hunter
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/ufs/ufshcd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 3841ab49f556..ec9461d9977e 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2703,7 +2703,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
if (hba->pm_op_in_progress) {
hba->force_reset = true;
set_host_byte(cmd, DID_BAD_TARGET);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
goto out;
}
fallthrough;
@@ -2712,7 +2712,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
goto out;
case UFSHCD_STATE_ERROR:
set_host_byte(cmd, DID_ERROR);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
goto out;
}
@@ -5294,7 +5294,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
/* Mark completed command as NULL in LRB */
lrbp->cmd = NULL;
/* Do not touch lrbp after scsi done */
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
ufshcd_release(hba);
update_scaling = true;
} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 75/84] virtio_scsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (73 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 74/84] ufs: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:05 ` [PATCH 76/84] vmw_pvscsi: " Bart Van Assche
` (3 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Michael S. Tsirkin, Jason Wang,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly. Additionally, update a comment that refers to the
REQ_ATOM_COMPLETE flag since that flag has been removed a long time ago.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/virtio_scsi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index c25ce8f0e0af..574195cbd5c3 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -163,7 +163,7 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
VIRTIO_SCSI_SENSE_SIZE));
}
- sc->scsi_done(sc);
+ scsi_done(sc);
}
static void virtscsi_vq_done(struct virtio_scsi *vscsi,
@@ -619,9 +619,8 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
* we're using independent interrupts (e.g. MSI). Poll the
* virtqueues once.
*
- * In the abort case, sc->scsi_done will do nothing, because
- * the block layer must have detected a timeout and as a result
- * REQ_ATOM_COMPLETE has been set.
+ * In the abort case, scsi_done() will do nothing, because the
+ * command timed out and hence SCMD_STATE_COMPLETE has been set.
*/
virtscsi_poll_requests(vscsi);
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 76/84] vmw_pvscsi: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (74 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 75/84] virtio_scsi: " Bart Van Assche
@ 2021-09-18 0:05 ` Bart Van Assche
2021-09-18 0:06 ` [PATCH 77/84] wd33c93: " Bart Van Assche
` (2 subsequent siblings)
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:05 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Vishal Bhakta, VMware PV-Drivers,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/vmw_pvscsi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index ce1ba1b93629..7bfa023d0feb 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -643,7 +643,7 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
"cmd=%p %x ctx=%p result=0x%x status=0x%x,%x\n",
cmd, cmd->cmnd[0], ctx, cmd->result, btstat, sdstat);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
/*
@@ -786,7 +786,6 @@ static int pvscsi_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd
return SCSI_MLQUEUE_HOST_BUSY;
}
- cmd->scsi_done = done;
op = cmd->cmnd[0];
dev_dbg(&cmd->device->sdev_gendev,
@@ -860,7 +859,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
* Successfully aborted the command.
*/
cmd->result = (DID_ABORT << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
out:
spin_unlock_irqrestore(&adapter->hw_lock, flags);
@@ -887,7 +886,7 @@ static void pvscsi_reset_all(struct pvscsi_adapter *adapter)
pvscsi_patch_sense(cmd);
pvscsi_release_context(adapter, ctx);
cmd->result = (DID_RESET << 16);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
}
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 77/84] wd33c93: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (75 preceding siblings ...)
2021-09-18 0:05 ` [PATCH 76/84] vmw_pvscsi: " Bart Van Assche
@ 2021-09-18 0:06 ` Bart Van Assche
2021-09-18 0:06 ` [PATCH 78/84] wd719x: " Bart Van Assche
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:06 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/wd33c93.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 4468bc45aaa4..fe28d21c7e93 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -376,11 +376,9 @@ wd33c93_queuecommand_lck(struct scsi_cmnd *cmd,
/* Set up a few fields in the scsi_cmnd structure for our own use:
* - host_scribble is the pointer to the next cmd in the input queue
- * - scsi_done points to the routine we call when a cmd is finished
* - result is what you'd expect
*/
cmd->host_scribble = NULL;
- cmd->scsi_done = done;
cmd->result = 0;
/* We use the Scsi_Pointer structure that's included with each command
@@ -856,7 +854,7 @@ wd33c93_intr(struct Scsi_Host *instance)
cmd->result = DID_NO_CONNECT << 16;
hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
hostdata->state = S_UNCONNECTED;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
/* From esp.c:
* There is a window of time within the scsi_done() path
@@ -1183,7 +1181,7 @@ wd33c93_intr(struct Scsi_Host *instance)
scsi_msg_to_host_byte(cmd, cmd->SCp.Message);
set_status_byte(cmd, cmd->SCp.Status);
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
/* We are no longer connected to a target - check to see if
* there are commands waiting to be executed.
@@ -1270,7 +1268,7 @@ wd33c93_intr(struct Scsi_Host *instance)
scsi_msg_to_host_byte(cmd, cmd->SCp.Message);
set_status_byte(cmd, cmd->SCp.Status);
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
/* We are no longer connected to a target - check to see if
* there are commands waiting to be executed.
@@ -1306,7 +1304,7 @@ wd33c93_intr(struct Scsi_Host *instance)
scsi_msg_to_host_byte(cmd, cmd->SCp.Message);
set_status_byte(cmd, cmd->SCp.Status);
}
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
break;
case S_PRE_TMP_DISC:
case S_RUNNING_LEVEL2:
@@ -1636,7 +1634,7 @@ wd33c93_abort(struct scsi_cmnd * cmd)
("scsi%d: Abort - removing command from input_Q. ",
instance->host_no);
enable_irq(cmd->device->host->irq);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return SUCCESS;
}
prev = tmp;
@@ -1711,7 +1709,7 @@ wd33c93_abort(struct scsi_cmnd * cmd)
wd33c93_execute(instance);
enable_irq(cmd->device->host->irq);
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return SUCCESS;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 78/84] wd719x: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (76 preceding siblings ...)
2021-09-18 0:06 ` [PATCH 77/84] wd33c93: " Bart Van Assche
@ 2021-09-18 0:06 ` Bart Van Assche
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
78 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-18 0:06 UTC (permalink / raw)
To: Martin K . Petersen; +Cc: linux-scsi, Bart Van Assche, James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/wd719x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 6f10a43510fb..1a7947554581 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -200,7 +200,7 @@ static void wd719x_finish_cmd(struct wd719x_scb *scb, int result)
SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
cmd->result = result << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
}
/* Build a SCB and send it to the card */
@@ -295,7 +295,7 @@ static int wd719x_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
DMA_BIDIRECTIONAL);
out_error:
cmd->result = DID_ERROR << 16;
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 79/84] xen-scsifront: Call scsi_done() directly
2021-09-18 0:04 [PATCH 00/84] Call scsi_done() directly Bart Van Assche
` (77 preceding siblings ...)
2021-09-18 0:06 ` [PATCH 78/84] wd719x: " Bart Van Assche
@ 2021-09-22 16:25 ` Bart Van Assche
2021-09-22 16:25 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
` (5 more replies)
78 siblings, 6 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:25 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/xen-scsifront.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 0204e314b482..12c10a5e3d93 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -276,7 +276,7 @@ static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
if (sense_len)
memcpy(sc->sense_buffer, ring_rsp->sense_buffer, sense_len);
- sc->scsi_done(sc);
+ scsi_done(sc);
}
static void scsifront_sync_cmd_done(struct vscsifrnt_info *info,
@@ -558,7 +558,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,
if (err == -ENOMEM)
return SCSI_MLQUEUE_HOST_BUSY;
sc->result = DID_ERROR << 16;
- sc->scsi_done(sc);
+ scsi_done(sc);
return 0;
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 80/84] staging: rts5208: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
@ 2021-09-22 16:25 ` Bart Van Assche
2021-09-23 6:49 ` Greg Kroah-Hartman
2021-09-22 16:25 ` [PATCH 81/84] staging: unisys: visorhba: " Bart Van Assche
` (4 subsequent siblings)
5 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:25 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley, Greg Kroah-Hartman
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/staging/rts5208/rtsx.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 898add4d1fc8..f1136f6bcee2 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
}
/* enqueue the command and wake up the control thread */
- srb->scsi_done = done;
chip->srb = srb;
complete(&dev->cmnd_ready);
@@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)
/* indicate that the command is done */
else if (chip->srb->result != DID_ABORT << 16) {
- chip->srb->scsi_done(chip->srb);
+ scsi_done(chip->srb);
} else {
skip_for_abort:
dev_err(&dev->pci->dev, "scsi command aborted\n");
@@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
if (chip->srb) {
chip->srb->result = DID_NO_CONNECT << 16;
scsi_lock(host);
- chip->srb->scsi_done(dev->chip->srb);
+ scsi_done(dev->chip->srb);
chip->srb = NULL;
scsi_unlock(host);
}
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 80/84] staging: rts5208: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
@ 2021-09-23 6:49 ` Greg Kroah-Hartman
0 siblings, 0 replies; 106+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-23 6:49 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley
On Wed, Sep 22, 2021 at 09:25:58AM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/staging/rts5208/rtsx.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
> index 898add4d1fc8..f1136f6bcee2 100644
> --- a/drivers/staging/rts5208/rtsx.c
> +++ b/drivers/staging/rts5208/rtsx.c
> @@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
> }
>
> /* enqueue the command and wake up the control thread */
> - srb->scsi_done = done;
> chip->srb = srb;
> complete(&dev->cmnd_ready);
>
> @@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)
>
> /* indicate that the command is done */
> else if (chip->srb->result != DID_ABORT << 16) {
> - chip->srb->scsi_done(chip->srb);
> + scsi_done(chip->srb);
> } else {
> skip_for_abort:
> dev_err(&dev->pci->dev, "scsi command aborted\n");
> @@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
> if (chip->srb) {
> chip->srb->result = DID_NO_CONNECT << 16;
> scsi_lock(host);
> - chip->srb->scsi_done(dev->chip->srb);
> + scsi_done(dev->chip->srb);
> chip->srb = NULL;
> scsi_unlock(host);
> }
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 106+ messages in thread
* [PATCH 81/84] staging: unisys: visorhba: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
2021-09-22 16:25 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
@ 2021-09-22 16:25 ` Bart Van Assche
2021-09-22 16:26 ` [PATCH 82/84] target/tcm_loop: " Bart Van Assche
` (3 subsequent siblings)
5 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:25 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley, David Kershner, Greg Kroah-Hartman,
Song Chen, Fabio M. De Francesco, Dan Carpenter
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/staging/unisys/visorhba/visorhba_main.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 41f8a72a2a95..6a8fa0587280 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -327,7 +327,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)
rtn = forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsidev);
if (rtn == SUCCESS) {
scsicmd->result = DID_ABORT << 16;
- scsicmd->scsi_done(scsicmd);
+ scsi_done(scsicmd);
}
return rtn;
}
@@ -354,7 +354,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)
rtn = forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsidev);
if (rtn == SUCCESS) {
scsicmd->result = DID_RESET << 16;
- scsicmd->scsi_done(scsicmd);
+ scsi_done(scsicmd);
}
return rtn;
}
@@ -383,7 +383,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd)
rtn = forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsidev);
if (rtn == SUCCESS) {
scsicmd->result = DID_RESET << 16;
- scsicmd->scsi_done(scsicmd);
+ scsi_done(scsicmd);
}
return rtn;
}
@@ -476,8 +476,7 @@ static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,
*/
cmdrsp->scsi.handle = insert_location;
- /* save done function that we have call when cmd is complete */
- scsicmd->scsi_done = visorhba_cmnd_done;
+ WARN_ON_ONCE(visorhba_cmnd_done != scsi_done);
/* save destination */
cmdrsp->scsi.vdest.channel = scsidev->channel;
cmdrsp->scsi.vdest.id = scsidev->id;
@@ -686,8 +685,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)
case CMD_SCSI_TYPE:
scsicmd = pendingdel->sent;
scsicmd->result = DID_RESET << 16;
- if (scsicmd->scsi_done)
- scsicmd->scsi_done(scsicmd);
+ scsi_done(scsicmd);
break;
case CMD_SCSITASKMGMT_TYPE:
cmdrsp = pendingdel->sent;
@@ -853,7 +851,7 @@ static void complete_scsi_command(struct uiscmdrsp *cmdrsp,
else
do_scsi_nolinuxstat(cmdrsp, scsicmd);
- scsicmd->scsi_done(scsicmd);
+ scsi_done(scsicmd);
}
/*
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 82/84] target/tcm_loop: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
2021-09-22 16:25 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
2021-09-22 16:25 ` [PATCH 81/84] staging: unisys: visorhba: " Bart Van Assche
@ 2021-09-22 16:26 ` Bart Van Assche
2021-09-22 16:26 ` [PATCH 83/84] usb: " Bart Van Assche
` (2 subsequent siblings)
5 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:26 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley, Mike Christie, William Breathitt Gray,
Russell King (Oracle),
Dan Williams, Uwe Kleine-König, Hannes Reinecke,
Colin Ian King
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/target/loopback/tcm_loop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 52db28d868d5..4407b56aa6d1 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -71,7 +71,7 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd)
if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)
kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
else
- sc->scsi_done(sc);
+ scsi_done(sc);
}
static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host)
@@ -165,7 +165,7 @@ static void tcm_loop_target_queue_cmd(struct tcm_loop_cmd *tl_cmd)
return;
out_done:
- sc->scsi_done(sc);
+ scsi_done(sc);
}
/*
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 83/84] usb: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
` (2 preceding siblings ...)
2021-09-22 16:26 ` [PATCH 82/84] target/tcm_loop: " Bart Van Assche
@ 2021-09-22 16:26 ` Bart Van Assche
2021-09-22 16:26 ` [PATCH 84/84] scsi_lib: " Bart Van Assche
2021-09-23 8:15 ` [PATCH 79/84] xen-scsifront: " Juergen Gross
5 siblings, 0 replies; 106+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:26 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley, Alan Stern, Greg Kroah-Hartman,
Oliver Neukum
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/usb/storage/scsiglue.c | 1 -
drivers/usb/storage/uas.c | 10 ++++------
drivers/usb/storage/usb.c | 4 ++--
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index e5a971b83e3f..9dfea19e5a91 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -393,7 +393,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
}
/* enqueue the command and wake up the control thread */
- srb->scsi_done = done;
us->srb = srb;
complete(&us->cmnd_ready);
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index bef89c6bd1d7..774d18907f47 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -256,7 +256,7 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)
return -EBUSY;
devinfo->cmnd[cmdinfo->uas_tag - 1] = NULL;
uas_free_unsubmitted_urbs(cmnd);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
@@ -653,7 +653,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
memcpy(cmnd->sense_buffer, usb_stor_sense_invalidCDB,
sizeof(usb_stor_sense_invalidCDB));
cmnd->result = SAM_STAT_CHECK_CONDITION;
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
return 0;
}
@@ -661,7 +661,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
if (devinfo->resetting) {
set_host_byte(cmnd, DID_ERROR);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
goto zombie;
}
@@ -675,8 +675,6 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
return SCSI_MLQUEUE_DEVICE_BUSY;
}
- cmnd->scsi_done = done;
-
memset(cmdinfo, 0, sizeof(*cmdinfo));
cmdinfo->uas_tag = idx + 1; /* uas-tag == usb-stream-id, so 1 based */
cmdinfo->state = SUBMIT_STATUS_URB | ALLOC_CMD_URB | SUBMIT_CMD_URB;
@@ -706,7 +704,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
*/
if (err == -ENODEV) {
set_host_byte(cmnd, DID_ERROR);
- cmnd->scsi_done(cmnd);
+ scsi_done(cmnd);
goto zombie;
}
if (err) {
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 90aa9c12ffac..8b543f2c9857 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -388,7 +388,7 @@ static int usb_stor_control_thread(void * __us)
if (srb->result == DID_ABORT << 16) {
SkipForAbort:
usb_stor_dbg(us, "scsi command aborted\n");
- srb = NULL; /* Don't call srb->scsi_done() */
+ srb = NULL; /* Don't call scsi_done() */
}
/*
@@ -417,7 +417,7 @@ static int usb_stor_control_thread(void * __us)
if (srb) {
usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
srb->result);
- srb->scsi_done(srb);
+ scsi_done(srb);
}
} /* for (;;) */
^ permalink raw reply related [flat|nested] 106+ messages in thread
* [PATCH 84/84] scsi_lib: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
` (3 preceding siblings ...)
2021-09-22 16:26 ` [PATCH 83/84] usb: " Bart Van Assche
@ 2021-09-22 16:26 ` Bart Van Assche
2021-09-28 17:04 ` Benjamin Block
2021-09-23 8:15 ` [PATCH 79/84] xen-scsifront: " Juergen Gross
5 siblings, 1 reply; 106+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:26 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly. Since this patch removes the last user of the
scsi_done member, also remove that data structure member.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_lib.c | 3 +--
include/scsi/scsi_cmnd.h | 4 ----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c3a0283dbff0..be1a21cec54b 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1520,7 +1520,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
return rtn;
done:
- cmd->scsi_done(cmd);
+ scsi_done(cmd);
return 0;
}
@@ -1693,7 +1693,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
scsi_set_resid(cmd, 0);
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
- cmd->scsi_done = scsi_done;
blk_mq_start_request(req);
reason = scsi_dispatch_cmd(cmd);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 5b230d06527f..045f8c08ab70 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -124,10 +124,6 @@ struct scsi_cmnd {
* command (auto-sense). Length must be
* SCSI_SENSE_BUFFERSIZE bytes. */
- /* Low-level done function - can be used by low-level driver to point
- * to completion function. Not used by mid/upper level code. */
- void (*scsi_done) (struct scsi_cmnd *);
-
/*
* The following fields can be written to by the host specific code.
* Everything else should be left alone.
^ permalink raw reply related [flat|nested] 106+ messages in thread
* Re: [PATCH 84/84] scsi_lib: Call scsi_done() directly
2021-09-22 16:26 ` [PATCH 84/84] scsi_lib: " Bart Van Assche
@ 2021-09-28 17:04 ` Benjamin Block
0 siblings, 0 replies; 106+ messages in thread
From: Benjamin Block @ 2021-09-28 17:04 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Boris Ostrovsky, Juergen Gross,
James E.J. Bottomley
On Wed, Sep 22, 2021 at 09:26:02AM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly. Since this patch removes the last user of the
> scsi_done member, also remove that data structure member.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/scsi_lib.c | 3 +--
> include/scsi/scsi_cmnd.h | 4 ----
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 106+ messages in thread
* Re: [PATCH 79/84] xen-scsifront: Call scsi_done() directly
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
` (4 preceding siblings ...)
2021-09-22 16:26 ` [PATCH 84/84] scsi_lib: " Bart Van Assche
@ 2021-09-23 8:15 ` Juergen Gross
5 siblings, 0 replies; 106+ messages in thread
From: Juergen Gross @ 2021-09-23 8:15 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Boris Ostrovsky, James E.J. Bottomley
[-- Attachment #1.1.1: Type: text/plain, Size: 257 bytes --]
On 22.09.21 18:25, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 106+ messages in thread