From: Kemeng Shi Date: Wed, 18 Jan 2023 09:37:25 +0000 (+0800) Subject: blk-mq: use switch/case to improve readability in blk_mq_try_issue_list_directly X-Git-Tag: v6.6.17~5370^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27e8b2bb149aff7b7b673b46c7206f4f37c30093;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq.c b/block/blk-mq.c index 002ed55..89b4dd8 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); }