]> Git Repo - linux.git/commitdiff
block: fix updating bio's front segment size
authorMing Lei <[email protected]>
Sat, 2 Mar 2019 08:43:44 +0000 (16:43 +0800)
committerJens Axboe <[email protected]>
Sat, 2 Mar 2019 19:45:37 +0000 (12:45 -0700)
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 <[email protected]>
Cc: Omar Sandoval <[email protected]>
Fixes: dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count")
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-merge.c

index 9402a7c3ba221304dbd26e043d334a5287e56b70..22467f475ab412c345379db97313414a19eaeb16 100644 (file)
@@ -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:
This page took 0.057427 seconds and 4 git commands to generate.