Skip to content

Commit

Permalink
fs/buffer.c: use bvec iterator to truncate the bio
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ming Lei authored and Jens Axboe committed Feb 15, 2019
1 parent 45a3fb9 commit f70f446
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3032,7 +3032,10 @@ void guard_bio_eod(int op, struct bio *bio)

/* ..and clear the end of the buffer for reads */
if (op == REQ_OP_READ) {
zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len,
struct bio_vec bv;

mp_bvec_last_segment(bvec, &bv);
zero_user(bv.bv_page, bv.bv_offset + bv.bv_len,
truncated_bytes);
}
}
Expand Down

0 comments on commit f70f446

Please sign in to comment.