diff options
author | Bart Van Assche <bvanassche@acm.org> | 2014-10-30 09:46:00 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-12 05:16:10 -0500 |
commit | 1ee8e889d946b3b1c2cc8b99e29eac47d1581dfd (patch) | |
tree | 38747de3756a258112b5f9a2a73f0689d46c0bc5 /include/scsi | |
parent | efec4b90f1a9b4c80827e4b8c0863334e13b0bf1 (diff) |
scsi: add support for multiple hardware queues in scsi_(host_)find_tag
Modify scsi_find_tag() and scsi_host_find_tag() such that these
functions can translate a tag generated by blk_mq_unique_tag().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi_tcq.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index 56ed843969ca..7529c6acc231 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -111,18 +111,21 @@ static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg) | |||
111 | } | 111 | } |
112 | 112 | ||
113 | static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost, | 113 | static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost, |
114 | unsigned int hw_ctx, int tag) | 114 | int unique_tag) |
115 | { | 115 | { |
116 | struct request *req; | 116 | u16 hwq = blk_mq_unique_tag_to_hwq(unique_tag); |
117 | struct request *req = NULL; | ||
117 | 118 | ||
118 | req = blk_mq_tag_to_rq(shost->tag_set.tags[hw_ctx], tag); | 119 | if (hwq < shost->tag_set.nr_hw_queues) |
120 | req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq], | ||
121 | blk_mq_unique_tag_to_tag(unique_tag)); | ||
119 | return req ? (struct scsi_cmnd *)req->special : NULL; | 122 | return req ? (struct scsi_cmnd *)req->special : NULL; |
120 | } | 123 | } |
121 | 124 | ||
122 | /** | 125 | /** |
123 | * scsi_find_tag - find a tagged command by device | 126 | * scsi_find_tag - find a tagged command by device |
124 | * @SDpnt: pointer to the ScSI device | 127 | * @SDpnt: pointer to the ScSI device |
125 | * @tag: the tag number | 128 | * @tag: tag generated by blk_mq_unique_tag() |
126 | * | 129 | * |
127 | * Notes: | 130 | * Notes: |
128 | * Only works with tags allocated by the generic blk layer. | 131 | * Only works with tags allocated by the generic blk layer. |
@@ -133,9 +136,9 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag) | |||
133 | 136 | ||
134 | if (tag != SCSI_NO_TAG) { | 137 | if (tag != SCSI_NO_TAG) { |
135 | if (shost_use_blk_mq(sdev->host)) | 138 | if (shost_use_blk_mq(sdev->host)) |
136 | return scsi_mq_find_tag(sdev->host, 0, tag); | 139 | return scsi_mq_find_tag(sdev->host, tag); |
137 | 140 | ||
138 | req = blk_queue_find_tag(sdev->request_queue, tag); | 141 | req = blk_queue_find_tag(sdev->request_queue, tag); |
139 | return req ? (struct scsi_cmnd *)req->special : NULL; | 142 | return req ? (struct scsi_cmnd *)req->special : NULL; |
140 | } | 143 | } |
141 | 144 | ||
@@ -174,7 +177,7 @@ static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) | |||
174 | /** | 177 | /** |
175 | * scsi_host_find_tag - find the tagged command by host | 178 | * scsi_host_find_tag - find the tagged command by host |
176 | * @shost: pointer to scsi_host | 179 | * @shost: pointer to scsi_host |
177 | * @tag: tag of the scsi_cmnd | 180 | * @tag: tag generated by blk_mq_unique_tag() |
178 | * | 181 | * |
179 | * Notes: | 182 | * Notes: |
180 | * Only works with tags allocated by the generic blk layer. | 183 | * Only works with tags allocated by the generic blk layer. |
@@ -186,7 +189,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, | |||
186 | 189 | ||
187 | if (tag != SCSI_NO_TAG) { | 190 | if (tag != SCSI_NO_TAG) { |
188 | if (shost_use_blk_mq(shost)) | 191 | if (shost_use_blk_mq(shost)) |
189 | return scsi_mq_find_tag(shost, 0, tag); | 192 | return scsi_mq_find_tag(shost, tag); |
190 | req = blk_map_queue_find_tag(shost->bqt, tag); | 193 | req = blk_map_queue_find_tag(shost->bqt, tag); |
191 | return req ? (struct scsi_cmnd *)req->special : NULL; | 194 | return req ? (struct scsi_cmnd *)req->special : NULL; |
192 | } | 195 | } |