aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-05-06 06:25:40 -0400
committerChristoph Hellwig <hch@lst.de>2014-07-25 07:38:48 -0400
commit3b5382c459b709845f43361225a2e3284e50752e (patch)
tree4c3e4cf603dc15252733b1472e013f9a2101b110 /drivers/scsi
parentd0d3bbf96ec21167e55a48ebb31912918a674e0d (diff)
scsi: set ->scsi_done before calling scsi_dispatch_cmd
The blk-mq code path will set this to a different function, so make the code simpler by setting it up in a legacy-request specific place. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Webb Scales <webbnh@hp.com> Acked-by: Jens Axboe <axboe@kernel.dk> Tested-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Robert Elliott <elliott@hp.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi.c23
-rw-r--r--drivers/scsi/scsi_lib.c20
2 files changed, 21 insertions, 22 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 2396e89dead0..6200a2615436 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -72,8 +72,6 @@
72#define CREATE_TRACE_POINTS 72#define CREATE_TRACE_POINTS
73#include <trace/events/scsi.h> 73#include <trace/events/scsi.h>
74 74
75static void scsi_done(struct scsi_cmnd *cmd);
76
77/* 75/*
78 * Definitions and constants. 76 * Definitions and constants.
79 */ 77 */
@@ -693,8 +691,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
693 } 691 }
694 692
695 trace_scsi_dispatch_cmd_start(cmd); 693 trace_scsi_dispatch_cmd_start(cmd);
696
697 cmd->scsi_done = scsi_done;
698 rtn = host->hostt->queuecommand(host, cmd); 694 rtn = host->hostt->queuecommand(host, cmd);
699 if (rtn) { 695 if (rtn) {
700 trace_scsi_dispatch_cmd_error(cmd, rtn); 696 trace_scsi_dispatch_cmd_error(cmd, rtn);
@@ -708,28 +704,11 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
708 704
709 return rtn; 705 return rtn;
710 done: 706 done:
711 scsi_done(cmd); 707 cmd->scsi_done(cmd);
712 return 0; 708 return 0;
713} 709}
714 710
715/** 711/**
716 * scsi_done - Invoke completion on finished SCSI command.
717 * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
718 * ownership back to SCSI Core -- i.e. the LLDD has finished with it.
719 *
720 * Description: This function is the mid-level's (SCSI Core) interrupt routine,
721 * which regains ownership of the SCSI command (de facto) from a LLDD, and
722 * calls blk_complete_request() for further processing.
723 *
724 * This function is interrupt context safe.
725 */
726static void scsi_done(struct scsi_cmnd *cmd)
727{
728 trace_scsi_dispatch_cmd_done(cmd);
729 blk_complete_request(cmd->request);
730}
731
732/**
733 * scsi_finish_command - cleanup and pass command back to upper layer 712 * scsi_finish_command - cleanup and pass command back to upper layer
734 * @cmd: the command 713 * @cmd: the command
735 * 714 *
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index bf7342748f32..b83269689542 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -29,6 +29,8 @@
29#include <scsi/scsi_eh.h> 29#include <scsi/scsi_eh.h>
30#include <scsi/scsi_host.h> 30#include <scsi/scsi_host.h>
31 31
32#include <trace/events/scsi.h>
33
32#include "scsi_priv.h" 34#include "scsi_priv.h"
33#include "scsi_logging.h" 35#include "scsi_logging.h"
34 36
@@ -1454,6 +1456,23 @@ static void scsi_softirq_done(struct request *rq)
1454 } 1456 }
1455} 1457}
1456 1458
1459/**
1460 * scsi_done - Invoke completion on finished SCSI command.
1461 * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
1462 * ownership back to SCSI Core -- i.e. the LLDD has finished with it.
1463 *
1464 * Description: This function is the mid-level's (SCSI Core) interrupt routine,
1465 * which regains ownership of the SCSI command (de facto) from a LLDD, and
1466 * calls blk_complete_request() for further processing.
1467 *
1468 * This function is interrupt context safe.
1469 */
1470static void scsi_done(struct scsi_cmnd *cmd)
1471{
1472 trace_scsi_dispatch_cmd_done(cmd);
1473 blk_complete_request(cmd->request);
1474}
1475
1457/* 1476/*
1458 * Function: scsi_request_fn() 1477 * Function: scsi_request_fn()
1459 * 1478 *
@@ -1556,6 +1575,7 @@ static void scsi_request_fn(struct request_queue *q)
1556 /* 1575 /*
1557 * Dispatch the command to the low-level driver. 1576 * Dispatch the command to the low-level driver.
1558 */ 1577 */
1578 cmd->scsi_done = scsi_done;
1559 rtn = scsi_dispatch_cmd(cmd); 1579 rtn = scsi_dispatch_cmd(cmd);
1560 if (rtn) { 1580 if (rtn) {
1561 scsi_queue_insert(cmd, rtn); 1581 scsi_queue_insert(cmd, rtn);