Skip to contentSkip to conversation

Revert "block: Merge bio before checking ->cached_rq"

PATCH Applied Ming Lei 2 participants 2 messages Apr 20, 2023 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 Revert "block: Merge bio before checking ->cached_rq"

This reverts commit 23f3e3272e7a4d9fb870485cd6df1e4f9539282c.

blk-mq sched bio merge still needs request to grab queue usage counter, so we can't simply call blk_mq_attempt_bio_merge() when queue usage counter isn't held.

Fixes 23f3e3272e7a ("block: Merge bio before checking ->cached_rq")
Cc Xiao Ni <[email protected]>
---
 block/blk-mq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
block/blk-mq.c +3 -4
index cf1a39adf9a5..27a628a8ee88 100644
@@ -2880,16 +2880,15 @@ static inline struct request *blk_mq_get_cached_request(struct request_queue *q,
 
 	if (!plug)
 		return NULL;
+	rq = rq_list_peek(&plug->cached_rq);
+	if (!rq || rq->q != q)
+		return NULL;
 
 	if (blk_mq_attempt_bio_merge(q, *bio, nsegs)) {
 		*bio = NULL;
 		return NULL;
 	}
 
-	rq = rq_list_peek(&plug->cached_rq);
-	if (!rq || rq->q != q)
-		return NULL;
-
 	type = blk_mq_get_hctx_type((*bio)->bi_opf);
 	hctx_type = rq->mq_hctx->type;
 	if (type != hctx_type &&
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 8 lines · Ming Lei

This reverts commit 23f3e3272e7a4d9fb870485cd6df1e4f9539282c.

blk-mq sched bio merge still needs request to grab queue usage counter, so we can't simply call blk_mq_attempt_bio_merge() when queue usage counter isn't held.

[...]

Applied, thanks!

[1/1] Revert "block: Merge bio before checking ->cached_rq"

      commit: 81ea1222f2fa5006f4b9759c2fe1ec154109622d

Best regards,

Signature · 1 line
Jens Axboe