summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2017-11-05 02:21:12 +0800
committerJens Axboe <axboe@kernel.dk>2017-11-04 12:31:08 -0600
commit88022d7201e96b43f1754b0358fc6bcd8dbdcde1 (patch)
treeec0b9e2d1227a7101040f954aef16511a5b6fa46 /block/blk-mq.c
parent826a70a08b1210bbfdbda812ab43eb986e25b5c2 (diff)
downloadlinux-88022d7201e96b43f1754b0358fc6bcd8dbdcde1.tar.gz
linux-88022d7201e96b43f1754b0358fc6bcd8dbdcde1.tar.bz2
linux-88022d7201e96b43f1754b0358fc6bcd8dbdcde1.zip
blk-mq: don't handle failure in .get_budget
It is enough to just check if we can get the budget via .get_budget(). And we don't need to deal with device state change in .get_budget(). For SCSI, one issue to be fixed is that we have to call scsi_mq_uninit_cmd() to free allocated ressources if SCSI device fails to handle the request. And it isn't enough to simply call blk_mq_end_request() to do that if this request is marked as RQF_DONTPREP. Fixes: 0df21c86bdbf(scsi: implement .get_budget and .put_budget for blk-mq) Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 13cdccef543c..c9fa4b294664 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1137,13 +1137,8 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
}
}
- if (!got_budget) {
- ret = blk_mq_get_dispatch_budget(hctx);
- if (ret == BLK_STS_RESOURCE)
- break;
- if (ret != BLK_STS_OK)
- goto fail_rq;
- }
+ if (!got_budget && !blk_mq_get_dispatch_budget(hctx))
+ break;
list_del_init(&rq->queuelist);
@@ -1170,7 +1165,6 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
break;
}
- fail_rq:
if (unlikely(ret != BLK_STS_OK)) {
errors++;
blk_mq_end_request(rq, BLK_STS_IOERR);
@@ -1642,12 +1636,10 @@ static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
if (!blk_mq_get_driver_tag(rq, NULL, false))
goto insert;
- ret = blk_mq_get_dispatch_budget(hctx);
- if (ret == BLK_STS_RESOURCE) {
+ if (!blk_mq_get_dispatch_budget(hctx)) {
blk_mq_put_driver_tag(rq);
goto insert;
- } else if (ret != BLK_STS_OK)
- goto fail_rq;
+ }
new_cookie = request_to_qc_t(hctx, rq);
@@ -1665,7 +1657,6 @@ static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
__blk_mq_requeue_request(rq);
goto insert;
default:
- fail_rq:
*cookie = BLK_QC_T_NONE;
blk_mq_end_request(rq, ret);
return;