aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-01-23 07:55:38 -0500
committerChristoph Hellwig <hch@lst.de>2014-07-25 07:38:35 -0400
commitde3e8bf3315c9c7c7ffd2f9b2f299b4205feefb9 (patch)
tree2865c04ae3b68c97841211232728ccde410f92a3
parent6af7a4ffa2775c452c77eccc6bb6a4e2b71c2371 (diff)
scsi: split __scsi_queue_insert
Factor out a helper to set the _blocked values, which we'll reuse for the blk-mq code path. 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>
-rw-r--r--drivers/scsi/scsi_lib.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 04c368470c8a..3ac677c48168 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -75,28 +75,12 @@ struct kmem_cache *scsi_sdb_cache;
75 */ 75 */
76#define SCSI_QUEUE_DELAY 3 76#define SCSI_QUEUE_DELAY 3
77 77
78/** 78static void
79 * __scsi_queue_insert - private queue insertion 79scsi_set_blocked(struct scsi_cmnd *cmd, int reason)
80 * @cmd: The SCSI command being requeued
81 * @reason: The reason for the requeue
82 * @unbusy: Whether the queue should be unbusied
83 *
84 * This is a private queue insertion. The public interface
85 * scsi_queue_insert() always assumes the queue should be unbusied
86 * because it's always called before the completion. This function is
87 * for a requeue after completion, which should only occur in this
88 * file.
89 */
90static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy)
91{ 80{
92 struct Scsi_Host *host = cmd->device->host; 81 struct Scsi_Host *host = cmd->device->host;
93 struct scsi_device *device = cmd->device; 82 struct scsi_device *device = cmd->device;
94 struct scsi_target *starget = scsi_target(device); 83 struct scsi_target *starget = scsi_target(device);
95 struct request_queue *q = device->request_queue;
96 unsigned long flags;
97
98 SCSI_LOG_MLQUEUE(1, scmd_printk(KERN_INFO, cmd,
99 "Inserting command %p into mlqueue\n", cmd));
100 84
101 /* 85 /*
102 * Set the appropriate busy bit for the device/host. 86 * Set the appropriate busy bit for the device/host.
@@ -123,6 +107,30 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy)
123 starget->target_blocked = starget->max_target_blocked; 107 starget->target_blocked = starget->max_target_blocked;
124 break; 108 break;
125 } 109 }
110}
111
112/**
113 * __scsi_queue_insert - private queue insertion
114 * @cmd: The SCSI command being requeued
115 * @reason: The reason for the requeue
116 * @unbusy: Whether the queue should be unbusied
117 *
118 * This is a private queue insertion. The public interface
119 * scsi_queue_insert() always assumes the queue should be unbusied
120 * because it's always called before the completion. This function is
121 * for a requeue after completion, which should only occur in this
122 * file.
123 */
124static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy)
125{
126 struct scsi_device *device = cmd->device;
127 struct request_queue *q = device->request_queue;
128 unsigned long flags;
129
130 SCSI_LOG_MLQUEUE(1, scmd_printk(KERN_INFO, cmd,
131 "Inserting command %p into mlqueue\n", cmd));
132
133 scsi_set_blocked(cmd, reason);
126 134
127 /* 135 /*
128 * Decrement the counters, since these commands are no longer 136 * Decrement the counters, since these commands are no longer