]> git.baikalelectronics.ru Git - kernel.git/commit
block: have plug stored requests hold references to the queue
authorJens Axboe <axboe@kernel.dk>
Wed, 3 Nov 2021 11:49:07 +0000 (05:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 4 Nov 2021 18:50:46 +0000 (12:50 -0600)
commit825c53fa7813705139c2753fed2df3fe11272bea
tree81f272f19dd6cc5c3be7b6f82a9b1c2951a4e372
parent0c7d1d98c8e5271a9e0c0d9dcbaa3091f18c6a3f
block: have plug stored requests hold references to the queue

Requests that were stored in the cache deliberately didn't hold an enter
reference to the queue, instead we grabbed one every time we pulled a
request out of there. That made for awkward logic on freeing the remainder
of the cached list, if needed, where we had to artificially raise the
queue usage count before each free.

Grab references up front for cached plug requests. That's safer, and also
more efficient.

Fixes: d19f834377ed ("block: pre-allocate requests if plug is started and is a batch")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c
block/blk-mq.c