diff options
author | Ming Lei <ming.lei@redhat.com> | 2019-02-15 06:13:15 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-02-15 10:40:11 -0500 |
commit | f70f44640759728d6e31326acbee08ca22d1066f (patch) | |
tree | c8504310301fb51dbf8a28612385b69d40dcc29d | |
parent | 45a3fb95298b326ab8175f2bd97bd8666017b692 (diff) |
fs/buffer.c: use bvec iterator to truncate the bio
Once multi-page bvec is enabled, the last bvec may include more than one
page, this patch use mp_bvec_last_segment() to truncate the bio.
Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | fs/buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 52d024bfdbc1..817871274c77 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -3032,7 +3032,10 @@ void guard_bio_eod(int op, struct bio *bio) | |||
3032 | 3032 | ||
3033 | /* ..and clear the end of the buffer for reads */ | 3033 | /* ..and clear the end of the buffer for reads */ |
3034 | if (op == REQ_OP_READ) { | 3034 | if (op == REQ_OP_READ) { |
3035 | zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len, | 3035 | struct bio_vec bv; |
3036 | |||
3037 | mp_bvec_last_segment(bvec, &bv); | ||
3038 | zero_user(bv.bv_page, bv.bv_offset + bv.bv_len, | ||
3036 | truncated_bytes); | 3039 | truncated_bytes); |
3037 | } | 3040 | } |
3038 | } | 3041 | } |