Skip to content

Commit a1e948b

Browse files
Christoph Hellwigaxboe
authored andcommitted
blk-mq: refactor the DONTPREP/SOFTBARRIER andling in blk_mq_requeue_work
Split the RQF_DONTPREP and RQF_SOFTBARRIER in separate branches to make the code more readable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20230413064057.707578-12-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 53548d2 commit a1e948b

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

block/blk-mq.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,20 +1427,21 @@ static void blk_mq_requeue_work(struct work_struct *work)
14271427
spin_unlock_irq(&q->requeue_lock);
14281428

14291429
list_for_each_entry_safe(rq, next, &rq_list, queuelist) {
1430-
if (!(rq->rq_flags & (RQF_SOFTBARRIER | RQF_DONTPREP)))
1431-
continue;
1432-
1433-
rq->rq_flags &= ~RQF_SOFTBARRIER;
1434-
list_del_init(&rq->queuelist);
14351430
/*
1436-
* If RQF_DONTPREP, rq has contained some driver specific
1437-
* data, so insert it to hctx dispatch list to avoid any
1438-
* merge.
1431+
* If RQF_DONTPREP ist set, the request has been started by the
1432+
* driver already and might have driver-specific data allocated
1433+
* already. Insert it into the hctx dispatch list to avoid
1434+
* block layer merges for the request.
14391435
*/
1440-
if (rq->rq_flags & RQF_DONTPREP)
1436+
if (rq->rq_flags & RQF_DONTPREP) {
1437+
rq->rq_flags &= ~RQF_SOFTBARRIER;
1438+
list_del_init(&rq->queuelist);
14411439
blk_mq_request_bypass_insert(rq, false, false);
1442-
else
1440+
} else if (rq->rq_flags & RQF_SOFTBARRIER) {
1441+
rq->rq_flags &= ~RQF_SOFTBARRIER;
1442+
list_del_init(&rq->queuelist);
14431443
blk_mq_insert_request(rq, true, false, false);
1444+
}
14441445
}
14451446

14461447
while (!list_empty(&rq_list)) {

0 commit comments

Comments
 (0)