All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: fix updating bio's front segment size
@ 2019-03-02  8:43 Ming Lei
  2019-03-02 19:47 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2019-03-02  8:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Christoph Hellwig, Omar Sandoval

When the current bvec can be merged to the 1st segment, the bio's front
segment size has to be updated.

However, dcebd755926b doesn't consider that case, then bio's front
segment size may not be correct.

This patch fixes this issue.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Omar Sandoval <osandov@fb.com>
Fixes: dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-merge.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 9402a7c3ba22..22467f475ab4 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -277,6 +277,9 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
 			bvprvp = &bvprv;
 			sectors += bv.bv_len >> 9;
 
+			if (nsegs == 1 && seg_size > front_seg_size)
+				front_seg_size = seg_size;
+
 			continue;
 		}
 new_segment:
@@ -401,6 +404,11 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
 
 				seg_size += bv.bv_len;
 				bvprv = bv;
+
+				if (nr_phys_segs == 1 && seg_size >
+						front_seg_size)
+					front_seg_size = seg_size;
+
 				continue;
 			}
 new_segment:
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: fix updating bio's front segment size
  2019-03-02  8:43 [PATCH] block: fix updating bio's front segment size Ming Lei
@ 2019-03-02 19:47 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-03-02 19:47 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-block, Christoph Hellwig, Omar Sandoval

On 3/2/19 1:43 AM, Ming Lei wrote:
> When the current bvec can be merged to the 1st segment, the bio's front
> segment size has to be updated.
> 
> However, dcebd755926b doesn't consider that case, then bio's front
> segment size may not be correct.
> 
> This patch fixes this issue.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-02 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-02  8:43 [PATCH] block: fix updating bio's front segment size Ming Lei
2019-03-02 19:47 ` 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.