Skip to content

Commit 110fdb4

Browse files
Panky-codesaxboe
authored andcommitted
block: add rationale for not using blk_mq_plug() when applicable
There are two places in the block layer at the moment where blk_mq_plug() helper could be used instead of directly accessing the plug from struct current. In both these cases, directly accessing the plug should not have any consequences for zoned devices. Make the intent explicit by adding comments instead of introducing unwanted checks with blk_mq_plug() helper.[1] [1] https://lore.kernel.org/linux-block/[email protected]/ Signed-off-by: Pankaj Raghav <[email protected]> Suggested-by: Jens Axboe <[email protected]> Link: https://lore.kernel.org/r/[email protected] [axboe: fixup multi-line comment style] Signed-off-by: Jens Axboe <[email protected]>
1 parent 8cafdb5 commit 110fdb4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

block/blk-core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,12 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags)
850850
!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
851851
return 0;
852852

853+
/*
854+
* As the requests that require a zone lock are not plugged in the
855+
* first place, directly accessing the plug instead of using
856+
* blk_mq_plug() should not have any consequences during flushing for
857+
* zoned devices.
858+
*/
853859
blk_flush_plug(current->plug, false);
854860

855861
if (bio_queue_enter(bio))

block/blk-mq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,12 @@ void blk_execute_rq_nowait(struct request *rq, bool at_head)
12151215
WARN_ON(!blk_rq_is_passthrough(rq));
12161216

12171217
blk_account_io_start(rq);
1218+
1219+
/*
1220+
* As plugging can be enabled for passthrough requests on a zoned
1221+
* device, directly accessing the plug instead of using blk_mq_plug()
1222+
* should not have any consequences.
1223+
*/
12181224
if (current->plug)
12191225
blk_add_rq_to_plug(current->plug, rq);
12201226
else

0 commit comments

Comments
 (0)