History

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/f6e54907-1035-2b2c-6387-ed178be05ccb@kernel.dk/

Pankaj Raghav committed 4 years ago

Commit 110fdb41 parent 8cafdb52 files · +12 −0Browse files

Unified · Split

2 files
  1. block/blk-core.c +6 −0
  2. block/blk-mq.c +6 −0
block/blk-core.c+6−0
@@ -850,6 +850,12 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags) · 849 unmodified lines
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+6−0
@@ -1215,6 +1215,12 @@ void blk_execute_rq_nowait(struct request *rq, bool at_head) · 1214 unmodified lines
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