]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
blk-mq: remove hctx_lock and hctx_unlock
authorMing Lei <ming.lei@redhat.com>
Fri, 3 Dec 2021 13:15:31 +0000 (21:15 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Dec 2021 21:51:29 +0000 (14:51 -0700)
commit2a904d00855f94cb85751e45fa494f225d44ae0d
tree0bcc141b19e61b4d536115e274c68da183ae9ff2
parent0a467d0fdd9594fbb449ebc93852533332c528fd
blk-mq: remove hctx_lock and hctx_unlock

Remove hctx_lock and hctx_unlock, and add one helper of
blk_mq_run_dispatch_ops() to run code block defined in dispatch_ops
with rcu/srcu read held.

Compared with hctx_lock()/hctx_unlock():

1) remove 2 branch to 1, so we just need to check
(hctx->flags & BLK_MQ_F_BLOCKING) once when running one dispatch_ops

2) srcu_idx needn't to be touched in case of non-blocking

3) might_sleep_if() can be moved to the blocking branch

Also put the added blk_mq_run_dispatch_ops() in private header, so that
the following patch can use it out of blk-mq.c.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20211203131534.3668411-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c
block/blk-mq.h