]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
block: fix bio_will_gap() for first bvec with offset
authorMing Lei <ming.lei@redhat.com>
Mon, 7 Aug 2017 12:43:00 +0000 (14:43 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 23 Aug 2017 15:28:24 +0000 (17:28 +0200)
commitcc03a7e0255e39b8b5efcc5932fa1eba5629df74
tree6a1484d52a3c81f681a83837e500b14bfaab074b
parent3ff14c67fd47c514e15f7c3675d654de6d20ffde
block: fix bio_will_gap() for first bvec with offset

BugLink: http://bugs.launchpad.net/bugs/1709073
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)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Marcelo Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
include/linux/blkdev.h