On Wed, Oct 13, 2021 at 10:49:34AM -0600, Jens Axboe wrote: > Instead of open-coding the list additions, traversal, and removal, > provide a basic set of helpers. > > Suggested-by: Christoph Hellwig <hch@xxxxxxxxxxxxx> > Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> > --- > block/blk-mq.c | 21 +++++---------------- > include/linux/blk-mq.h | 25 +++++++++++++++++++++++++ > 2 files changed, 30 insertions(+), 16 deletions(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 6dfd3aaa6073..46a91e5fabc5 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -426,10 +426,10 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) > tag = tag_offset + i; > tags &= ~(1UL << i); > rq = blk_mq_rq_ctx_init(data, tag, alloc_time_ns); > - rq->rq_next = *data->cached_rq; > - *data->cached_rq = rq; > + rq_list_add_tail(data->cached_rq, rq); > } This doesn't seem to match the code in the current for-5.6/block branch. > data->nr_tags -= nr; > + return rq_list_pop(data->cached_rq); > } else { But either way no need for an else after a return.