You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
+4
-13
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user