diff mbox series

[57/84] nsp32: Call scsi_done() directly

Message ID 20210918000607.450448-58-bvanassche@acm.org (mailing list archive)
State Superseded
Headers show
Series Call scsi_done() directly | expand

Commit Message

Bart Van Assche Sept. 18, 2021, 12:05 a.m. UTC
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(-)

Comments

Masanori Goto Sept. 18, 2021, 1:10 a.m. UTC | #1
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
Bart Van Assche Sept. 18, 2021, 3:08 a.m. UTC | #2
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.
diff mbox series

Patch

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