Skip to content

Commit f70f446

Browse files
Ming Leiaxboe
authored andcommitted
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>
1 parent 45a3fb9 commit f70f446

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎fs/buffer.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3032,7 +3032,10 @@ void guard_bio_eod(int op, struct bio *bio)
30323032

30333033
/* ..and clear the end of the buffer for reads */
30343034
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,
30363039
truncated_bytes);
30373040
}
30383041
}

0 commit comments

Comments
 (0)