* [PATCH 1/1] block: Merge bio before checking ->cached_rq
@ 2023-02-09 3:19 Xiao Ni
2023-02-09 3:41 ` Ming Lei
2023-02-09 15:12 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Xiao Ni @ 2023-02-09 3:19 UTC (permalink / raw)
To: axboe; +Cc: linux-block, ming.lei
It checks if plug->cached_rq is empty before merging bio. But the merge action
doesn't have relationship with plug->cached_rq, it trys to merge bio with
requests within plug->mq_list. Now it checks if ->cached_rq is empty before
merging bio. If it's empty, it will miss the merge chances. So move the merge
function before checking ->cached_rq.
Signed-off-by: Xiao Ni <xni@redhat.com>
---
block/blk-mq.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9c8dc70020bc..63bd7a34fe6f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2894,15 +2894,16 @@ 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 &&
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] block: Merge bio before checking ->cached_rq
2023-02-09 3:19 [PATCH 1/1] block: Merge bio before checking ->cached_rq Xiao Ni
@ 2023-02-09 3:41 ` Ming Lei
2023-02-09 15:12 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2023-02-09 3:41 UTC (permalink / raw)
To: Xiao Ni; +Cc: axboe, linux-block
On Thu, Feb 09, 2023 at 11:19:30AM +0800, Xiao Ni wrote:
> It checks if plug->cached_rq is empty before merging bio. But the merge action
> doesn't have relationship with plug->cached_rq, it trys to merge bio with
> requests within plug->mq_list. Now it checks if ->cached_rq is empty before
> merging bio. If it's empty, it will miss the merge chances. So move the merge
> function before checking ->cached_rq.
>
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
> block/blk-mq.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Looks fine,
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] block: Merge bio before checking ->cached_rq
2023-02-09 3:19 [PATCH 1/1] block: Merge bio before checking ->cached_rq Xiao Ni
2023-02-09 3:41 ` Ming Lei
@ 2023-02-09 15:12 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-02-09 15:12 UTC (permalink / raw)
To: Xiao Ni; +Cc: linux-block, ming.lei
On Thu, 09 Feb 2023 11:19:30 +0800, Xiao Ni wrote:
> It checks if plug->cached_rq is empty before merging bio. But the merge action
> doesn't have relationship with plug->cached_rq, it trys to merge bio with
> requests within plug->mq_list. Now it checks if ->cached_rq is empty before
> merging bio. If it's empty, it will miss the merge chances. So move the merge
> function before checking ->cached_rq.
>
>
> [...]
Applied, thanks!
[1/1] block: Merge bio before checking ->cached_rq
commit: 23f3e3272e7a4d9fb870485cd6df1e4f9539282c
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-09 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 3:19 [PATCH 1/1] block: Merge bio before checking ->cached_rq Xiao Ni
2023-02-09 3:41 ` Ming Lei
2023-02-09 15:12 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.