summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2015-11-30 09:05:49 +0100
committerJens Axboe <axboe@fb.com>2015-11-30 21:02:36 +0100
commita88d32af18b8a6616128c971f766eaf545966405 (patch)
tree3cfc7528e641317aa7a56f82af569b03015ccdd1 /block
parentdirect-io: Fix negative return from dio read beyond eof (diff)
downloadlinux-a88d32af18b8a6616128c971f766eaf545966405.tar.xz
linux-a88d32af18b8a6616128c971f766eaf545966405.zip
blk-merge: fix computing bio->bi_seg_front_size in case of single segment
When bio has only one physical segment, we should set bio's bi_seg_front_size as the real(final) size of the single segment. Fixes: 02e707424c2ea(blk-merge: fix blk_bio_segment_split) Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de> Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de> Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-merge.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 41a55ba0d78e..e01405a3e8b3 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -103,6 +103,9 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
bvprv = bv;
bvprvp = &bvprv;
sectors += bv.bv_len >> 9;
+
+ if (nsegs == 1 && seg_size > front_seg_size)
+ front_seg_size = seg_size;
continue;
}
new_segment: