]> www.infradead.org Git - users/jedix/linux-maple.git/commit
block: fix bio_will_gap() for first bvec with offset
authorMing Lei <ming.lei@redhat.com>
Fri, 14 Apr 2017 19:58:29 +0000 (13:58 -0600)
committerBrian Maly <brian.maly@oracle.com>
Mon, 23 Apr 2018 22:30:09 +0000 (18:30 -0400)
commit753ed2755efd712c7bae6f96c14113f7dd2a45ca
treeece4becaf531782719b594b4c498d8de60442004
parenta6f6b4fe4eef5fe497a2f1c3f75473e282ce09a6
block: fix bio_will_gap() for first bvec with offset

Commit 729204ef49ec("block: relax check on sg gap") allows us to merge
bios, if both are physically contiguous.  This change can merge a huge
number of small bios, through mkfs for example, mkfs.ntfs running time
can be decreased to ~1/10.

But if one rq starts with a non-aligned buffer (the 1st bvec's bv_offset
is non-zero) and if we allow the merge, it is quite difficult to respect
sg gap limit, especially the max segment size, or we risk having an
unaligned virtual boundary.  This patch tries to avoid the issue by
disallowing a merge, if the req starts with an unaligned buffer.

Also add comments to explain why the merged segment can't end in
unaligned virt boundary.

Fixes: 729204ef49ec ("block: relax check on sg gap")
Tested-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Rewrote parts of the commit message and comments.

Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 5a8d75a1b8c99bdc926ba69b7b7dbe4fae81a5af)

Orabug: 27775588

Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
include/linux/blkdev.h