On 4/13/23 12:06?AM, Christoph Hellwig wrote: > __blk_mq_sched_dispatch_requests currently has duplicated logic > for the cases where requests are on the hctx dispatch list or not. > Merge the two with a new need_dispatch variable and remove a few > pointless local variables. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > block/blk-mq-sched.c | 31 ++++++++++++++----------------- > 1 file changed, 14 insertions(+), 17 deletions(-) > > diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c > index 06b312c691143f..f3257e1607a00c 100644 > --- a/block/blk-mq-sched.c > +++ b/block/blk-mq-sched.c > @@ -271,9 +271,7 @@ static int blk_mq_do_dispatch_ctx(struct blk_mq_hw_ctx *hctx) > > static int __blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx) > { > - struct request_queue *q = hctx->queue; > - const bool has_sched = q->elevator; > - int ret = 0; > + bool need_dispatch = false; > LIST_HEAD(rq_list); > > /* > @@ -302,23 +300,22 @@ static int __blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx) > */ > if (!list_empty(&rq_list)) { > blk_mq_sched_mark_restart_hctx(hctx); > - if (blk_mq_dispatch_rq_list(hctx, &rq_list, 0)) { > - if (has_sched) > - ret = blk_mq_do_dispatch_sched(hctx); > - else > - ret = blk_mq_do_dispatch_ctx(hctx); > - } > - } else if (has_sched) { > - ret = blk_mq_do_dispatch_sched(hctx); > - } else if (hctx->dispatch_busy) { > - /* dequeue request one by one from sw queue if queue is busy */ > - ret = blk_mq_do_dispatch_ctx(hctx); > + if (!blk_mq_dispatch_rq_list(hctx, &rq_list, 0)) There's some trailing whitespace here. Patch 5 also doesn't seem to apply, but I'll see what that's about and comment there if there's a concern. -- Jens Axboe