Skip to contentSkip to conversation

block: add rationale for not using blk_mq_plug() when applicable

PATCH Applied Pankaj Raghav 2 participants 3 messages Sep 29, 2022 1 message not in the archive Block layer

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20220929144143eucas1p2a68d7cb3f5e347954e3a5a5e335cf620@eucas1p2.samsung.com

#1 lore raw

PATCH 1/1 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]/

---
 block/blk-core.c | 5 +++++
 block/blk-mq.c   | 5 +++++
 2 files changed, 10 insertions(+)
block/blk-core.c +5 -0
index 203be672da52..c19d084b2a74 100644
@@ -850,6 +850,11 @@ 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))
block/blk-mq.c +5 -0
index c11949d66163..c0b5b2c027f7 100644
@@ -1213,6 +1213,11 @@ 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
Signature · 1 line
2.25.1
maintainer
#2 lore raw
Quoted 22 lines · Pankaj Raghav

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]/

---
 block/blk-core.c | 5 +++++
 block/blk-mq.c   | 5 +++++
 2 files changed, 10 insertions(+)
block/blk-core.c +0 -0
index 203be672da52..c19d084b2a74 100644

block/blk-core.c int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags) · line 858

Quoted 9 lines
block/blk-core.c +5 -0
@@ -850,6 +850,11 @@ 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);

Multi-line comments should follow the style of:

/*
* This is a multi
* line comment
*/

I can fix that up while applying.

Signature · 1 line
Jens Axboe
maintainer Applied
#3 lore raw
In reply to Pankaj Raghav
Quoted 9 lines · Pankaj Raghav

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]

[...]

Applied, thanks!

[1/1] block: add rationale for not using blk_mq_plug() when applicable

      commit: 110fdb4486d3a5e67d55bc6866d6426e6d49ccfc

Best regards,

Signature · 1 line
Jens Axboe