blk-mq: remove unnecessary error count and check in blk_mq_dispatch_rq_list
authorKemeng Shi <shikemeng@huaweicloud.com>
Wed, 18 Jan 2023 09:37:23 +0000 (17:37 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 6 Feb 2023 16:22:28 +0000 (09:22 -0700)
commit4ea58fe456c21bb259a7cbf8498946f86e9b84aa
tree68b5468eb9e269a2a3b1198064205a10b92b3c8f
parente4ef2e05e0020db0d61b2cf451ef38a2bba33910
blk-mq: remove unnecessary error count and check in blk_mq_dispatch_rq_list

blk_mq_dispatch_rq_list will notify if hctx is busy in return bool. It will
return true if we are not busy and can handle more and return false on the
opposite. Inside blk_mq_dispatch_rq_list, errors is only used if list is
empty and we will return true if list is empty and (errors + queued) != 0.

There are three types of status returned from request:
 -busy error BLK_STS*_RESOURCE: the failed request will be added back
to list and list will not be empty.
 -BLK_STS_OK: We count queued for BLK_STS_OK
 -rest error: We count errors for rest error

If list is empty, there is no request gets busy error then (errors +
queued) will be total requests in the list which is checked not empty at
beginning of blk_mq_dispatch_rq_list. So (errors + queued) != 0 is always
met if list is empty. Then the (errors + queued) != 0 check and errors
number count is not needed.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c