diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 4 | ||||
-rw-r--r-- | block/blk-mq-tag.c | 28 | ||||
-rw-r--r-- | block/blk-mq.c | 2 | ||||
-rw-r--r-- | block/scsi_ioctl.c | 2 |
4 files changed, 33 insertions, 3 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 0421b53e6431..2e7424b42947 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1266,7 +1266,7 @@ void blk_requeue_request(struct request_queue *q, struct request *rq) | |||
1266 | blk_clear_rq_complete(rq); | 1266 | blk_clear_rq_complete(rq); |
1267 | trace_block_rq_requeue(q, rq); | 1267 | trace_block_rq_requeue(q, rq); |
1268 | 1268 | ||
1269 | if (blk_rq_tagged(rq)) | 1269 | if (rq->cmd_flags & REQ_QUEUED) |
1270 | blk_queue_end_tag(q, rq); | 1270 | blk_queue_end_tag(q, rq); |
1271 | 1271 | ||
1272 | BUG_ON(blk_queued_rq(rq)); | 1272 | BUG_ON(blk_queued_rq(rq)); |
@@ -2554,7 +2554,7 @@ EXPORT_SYMBOL_GPL(blk_unprep_request); | |||
2554 | */ | 2554 | */ |
2555 | void blk_finish_request(struct request *req, int error) | 2555 | void blk_finish_request(struct request *req, int error) |
2556 | { | 2556 | { |
2557 | if (blk_rq_tagged(req)) | 2557 | if (req->cmd_flags & REQ_QUEUED) |
2558 | blk_queue_end_tag(req->q, req); | 2558 | blk_queue_end_tag(req->q, req); |
2559 | 2559 | ||
2560 | BUG_ON(blk_queued_rq(req)); | 2560 | BUG_ON(blk_queued_rq(req)); |
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 8317175a3009..728b9a4d5f56 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c | |||
@@ -584,6 +584,34 @@ int blk_mq_tag_update_depth(struct blk_mq_tags *tags, unsigned int tdepth) | |||
584 | return 0; | 584 | return 0; |
585 | } | 585 | } |
586 | 586 | ||
587 | /** | ||
588 | * blk_mq_unique_tag() - return a tag that is unique queue-wide | ||
589 | * @rq: request for which to compute a unique tag | ||
590 | * | ||
591 | * The tag field in struct request is unique per hardware queue but not over | ||
592 | * all hardware queues. Hence this function that returns a tag with the | ||
593 | * hardware context index in the upper bits and the per hardware queue tag in | ||
594 | * the lower bits. | ||
595 | * | ||
596 | * Note: When called for a request that is queued on a non-multiqueue request | ||
597 | * queue, the hardware context index is set to zero. | ||
598 | */ | ||
599 | u32 blk_mq_unique_tag(struct request *rq) | ||
600 | { | ||
601 | struct request_queue *q = rq->q; | ||
602 | struct blk_mq_hw_ctx *hctx; | ||
603 | int hwq = 0; | ||
604 | |||
605 | if (q->mq_ops) { | ||
606 | hctx = q->mq_ops->map_queue(q, rq->mq_ctx->cpu); | ||
607 | hwq = hctx->queue_num; | ||
608 | } | ||
609 | |||
610 | return (hwq << BLK_MQ_UNIQUE_TAG_BITS) | | ||
611 | (rq->tag & BLK_MQ_UNIQUE_TAG_MASK); | ||
612 | } | ||
613 | EXPORT_SYMBOL(blk_mq_unique_tag); | ||
614 | |||
587 | ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page) | 615 | ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page) |
588 | { | 616 | { |
589 | char *orig_page = page; | 617 | char *orig_page = page; |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 1d016fc9a8b6..92ceef0d2ab9 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -2049,6 +2049,8 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) | |||
2049 | */ | 2049 | */ |
2050 | int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) | 2050 | int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) |
2051 | { | 2051 | { |
2052 | BUILD_BUG_ON(BLK_MQ_MAX_DEPTH > 1 << BLK_MQ_UNIQUE_TAG_BITS); | ||
2053 | |||
2052 | if (!set->nr_hw_queues) | 2054 | if (!set->nr_hw_queues) |
2053 | return -EINVAL; | 2055 | return -EINVAL; |
2054 | if (!set->queue_depth) | 2056 | if (!set->queue_depth) |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index b0c2a616c8f9..28163fad3c5d 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -142,7 +142,7 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter) | |||
142 | __set_bit(GPCMD_VERIFY_10, filter->read_ok); | 142 | __set_bit(GPCMD_VERIFY_10, filter->read_ok); |
143 | __set_bit(VERIFY_16, filter->read_ok); | 143 | __set_bit(VERIFY_16, filter->read_ok); |
144 | __set_bit(REPORT_LUNS, filter->read_ok); | 144 | __set_bit(REPORT_LUNS, filter->read_ok); |
145 | __set_bit(SERVICE_ACTION_IN, filter->read_ok); | 145 | __set_bit(SERVICE_ACTION_IN_16, filter->read_ok); |
146 | __set_bit(RECEIVE_DIAGNOSTIC, filter->read_ok); | 146 | __set_bit(RECEIVE_DIAGNOSTIC, filter->read_ok); |
147 | __set_bit(MAINTENANCE_IN, filter->read_ok); | 147 | __set_bit(MAINTENANCE_IN, filter->read_ok); |
148 | __set_bit(GPCMD_READ_BUFFER_CAPACITY, filter->read_ok); | 148 | __set_bit(GPCMD_READ_BUFFER_CAPACITY, filter->read_ok); |