]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: streamline handling of q->mq_ops->queue_rq result
authorMing Lei <ming.lei@redhat.com>
Wed, 1 Jul 2020 13:58:57 +0000 (21:58 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 8 Jul 2020 22:04:39 +0000 (16:04 -0600)
commitfa218d1ff14a383d1b181e3ddecd8bef000b1ffc
tree5762e0620cc50f1e02b615170b62f2fa9202a863
parent3e2c354e5fb407ae538db0805c08388ebe43e5a8
blk-mq: streamline handling of q->mq_ops->queue_rq result

Current handling of q->mq_ops->queue_rq result is a bit ugly:

- two branches which needs to 'continue' have to check if the
dispatch local list is empty, otherwise one bad request may
be retrieved via 'rq = list_first_entry(list, struct request, queuelist);'

- the branch of 'if (unlikely(ret != BLK_STS_OK))' isn't easy
to follow, since it is actually one error branch.

Streamline this handling, so the code becomes more readable, meantime
potential kernel oops can be avoided in case that the last request in
local dispatch list is failed.

Fixes: cbbc8e789ffc ("blk-mq: switch ->queue_rq return value to blk_status_t")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c