diff mbox series

[v2,2/2] block: use blk_mq_plug() wrapper consistently in the block layer

Message ID 20220929062425.91254-3-p.raghav@samsung.com (mailing list archive)
State New, archived
Headers show
Series plugging cleanup v2 | expand

Commit Message

Pankaj Raghav Sept. 29, 2022, 6:24 a.m. UTC
Use blk_mq_plug() wrapper to get the plug instead of directly accessing
it in the block layer.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 block/blk-core.c | 2 +-
 block/blk-mq.c   | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Christoph Hellwig Sept. 29, 2022, 6:56 a.m. UTC | #1
On Thu, Sep 29, 2022 at 08:24:25AM +0200, Pankaj Raghav wrote:
> Use blk_mq_plug() wrapper to get the plug instead of directly accessing
> it in the block layer.

I think this should explain why that is useful (or maybe even a bug
fix?).
Pankaj Raghav Sept. 29, 2022, 7:15 a.m. UTC | #2
On 2022-09-29 08:56, Christoph Hellwig wrote:
> On Thu, Sep 29, 2022 at 08:24:25AM +0200, Pankaj Raghav wrote:
>> Use blk_mq_plug() wrapper to get the plug instead of directly accessing
>> it in the block layer.
> 
> I think this should explain why that is useful (or maybe even a bug
> fix?).

I mentioned it in the commit header: to use this wrapper consistently
across block layer because I am not sure if either of the changes would
have led to a bug in zoned devices.

1) blk_execute_rq_nowait:
No issues here because only passthrough request can use this function.

2) calling blk_flush_plug in bio_poll:
As we don't plug the request that do a write or write zeroes to zoned
devices in the first place, flushing should not have any impact.

This is just a cleanup patch to use this helper consistently. Maybe I
should mention it explicitly again in the commit log to make it clear?

--
Pankaj
Christoph Hellwig Sept. 29, 2022, 7:19 a.m. UTC | #3
On Thu, Sep 29, 2022 at 09:15:12AM +0200, Pankaj Raghav wrote:
> I mentioned it in the commit header: to use this wrapper consistently
> across block layer because I am not sure if either of the changes would
> have led to a bug in zoned devices.

The only thing that goes into source control is the commit message,
so the rationale needs to go into that.
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 203be672da52..d0e97de216db 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -850,7 +850,7 @@  int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags)
 	    !test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
 		return 0;
 
-	blk_flush_plug(current->plug, false);
+	blk_flush_plug(blk_mq_plug(bio), false);
 
 	if (bio_queue_enter(bio))
 		return 0;
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c11949d66163..5bf245c4bf0a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1209,12 +1209,14 @@  static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq)
  */
 void blk_execute_rq_nowait(struct request *rq, bool at_head)
 {
+	struct blk_plug *plug = blk_mq_plug(rq->bio);
+
 	WARN_ON(irqs_disabled());
 	WARN_ON(!blk_rq_is_passthrough(rq));
 
 	blk_account_io_start(rq);
-	if (current->plug)
-		blk_add_rq_to_plug(current->plug, rq);
+	if (plug)
+		blk_add_rq_to_plug(plug, rq);
 	else
 		blk_mq_sched_insert_request(rq, at_head, true, false);
 }