]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
block: bio: introduce helpers to get the 1st and last bvec
authorMing Lei <ming.lei@canonical.com>
Fri, 26 Feb 2016 15:40:50 +0000 (23:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Mar 2016 23:34:52 +0000 (15:34 -0800)
commit7adb5cc0f39be29c16fae035d9e30e332095bbbc
tree332fe6ad98f5b66afd357533a55b9ccd453c4514
parentcea2cbff57c5b65375adb6fe65612c10a7301327
block: bio: introduce helpers to get the 1st and last bvec

commit 7bcd79ac50d9d83350a835bdb91c04ac9e098412 upstream.

The bio passed to bio_will_gap() may be fast cloned from upper
layer(dm, md, bcache, fs, ...), or from bio splitting in block
core.

Unfortunately bio_will_gap() just figures out the last bvec via
'bi_io_vec[prev->bi_vcnt - 1]' directly, and this way is obviously
wrong.

This patch introduces two helpers for getting the first and last
bvec of one bio for fixing the issue.

Reported-by: Sagi Grimberg <sagig@dev.mellanox.co.il>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/bio.h