block: bio: introduce helpers to get the 1st and last bvec
authorMing Lei <[email protected]>
Fri, 26 Feb 2016 15:40:50 +0000 (23:40 +0800)
committerJens Axboe <[email protected]>
Thu, 3 Mar 2016 21:42:49 +0000 (14:42 -0700)
commit7bcd79ac50d9d83350a835bdb91c04ac9e098412
treeb8161854b8ec9825e7b9fabf2299231130eaf574
parente3c2ef41f88e50c8557270868600d3132028af3b
block: bio: introduce helpers to get the 1st and last bvec

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.

Cc: [email protected]
Reported-by: Sagi Grimberg <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
include/linux/bio.h