block: add rationale for not using blk_mq_plug() when applicable
authorPankaj Raghav <p.raghav@samsung.com>
Thu, 29 Sep 2022 14:41:41 +0000 (16:41 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Sep 2022 15:02:49 +0000 (09:02 -0600)
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/f6e54907-1035-2b2c-6387-ed178be05ccb@kernel.dk/

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Suggested-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20220929144141.140077-1-p.raghav@samsung.com
[axboe: fixup multi-line comment style]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-core.c
block/blk-mq.c

index dc1fa454ae3012369d828cecbcbfa76e1eebde8f..4bfc0d504b2d2696ceca3811e65874b9a6c3cdd6 100644 (file)
@@ -850,6 +850,12 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags)
            !test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
                return 0;
 
+       /*
+        * As the requests that require a zone lock are not plugged in the
+        * first place, directly accessing the plug instead of using
+        * blk_mq_plug() should not have any consequences during flushing for
+        * zoned devices.
+        */
        blk_flush_plug(current->plug, false);
 
        if (bio_queue_enter(bio))
index b2b318df4f69d51277ec99a19d02ec8151752e87..9dd3ec42613fc2560b7ee9e6f0f572d125c3726a 100644 (file)
@@ -1215,6 +1215,12 @@ void blk_execute_rq_nowait(struct request *rq, bool at_head)
        WARN_ON(!blk_rq_is_passthrough(rq));
 
        blk_account_io_start(rq);
+
+       /*
+        * As plugging can be enabled for passthrough requests on a zoned
+        * device, directly accessing the plug instead of using blk_mq_plug()
+        * should not have any consequences.
+        */
        if (current->plug)
                blk_add_rq_to_plug(current->plug, rq);
        else