diff options
author | Kemeng Shi <shikemeng@huaweicloud.com> | 2023-01-18 17:37:25 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-02-06 09:22:29 -0700 |
commit | 27e8b2bb149aff7b7b673b46c7206f4f37c30093 (patch) | |
tree | f0946edf0e6a48d3e4b28cc394f3ff832312f311 /block/blk-mq.c | |
parent | f1ce99f7098d9e7a322caf48eb8af05be7999827 (diff) |
blk-mq: use switch/case to improve readability in blk_mq_try_issue_list_directly
Use switch/case handle error as other function do to improve
readability in blk_mq_try_issue_list_directly.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 002ed5547bd7..89b4dd81ae17 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2802,18 +2802,22 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, list_del_init(&rq->queuelist); ret = blk_mq_request_issue_directly(rq, list_empty(list)); - if (ret != BLK_STS_OK) { - if (ret == BLK_STS_RESOURCE || - ret == BLK_STS_DEV_RESOURCE) { - blk_mq_request_bypass_insert(rq, false, - list_empty(list)); - break; - } - blk_mq_end_request(rq, ret); - } else + switch (ret) { + case BLK_STS_OK: queued++; + break; + case BLK_STS_RESOURCE: + case BLK_STS_DEV_RESOURCE: + blk_mq_request_bypass_insert(rq, false, + list_empty(list)); + goto out; + default: + blk_mq_end_request(rq, ret); + break; + } } +out: if (ret != BLK_STS_OK) blk_mq_commit_rqs(hctx, queued, false); } |