block, bfq: make bfq_has_work() more accurate
authorYu Kuai <yukuai3@huawei.com>
Fri, 13 May 2022 02:35:07 +0000 (10:35 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 May 2022 17:39:20 +0000 (11:39 -0600)
commitddc25c86b466d2359b57bc7798f167baa1735a44
tree42e97d04b7d1155d8c68e00b876780930ed7bc61
parent181490d5321806e537dc5386db5ea640b826bf78
block, bfq: make bfq_has_work() more accurate

bfq_has_work() is using busy_queues currently, which is not accurate
because bfq_queue is busy doesn't represent that it has requests. Since
bfqd aready has a counter 'queued' to record how many requests are in
bfq, use it instead of busy_queues.

Noted that bfq_has_work() can be called with 'bfqd->lock' held, thus the
lock can't be held in bfq_has_work() to protect 'bfqd->queued'.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220513023507.2625717-3-yukuai3@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c