Thread (25 messages) 25 messages, 3 authors, 2019-01-22
STALE2702d REVIEWED: 5 (4M)
Revisions (7)
  1. v8 [diff vs current]
  2. v9 [diff vs current]
  3. v10 [diff vs current]
  4. v11 [diff vs current]
  5. v12 [diff vs current]
  6. v14 current
  7. v15 [diff vs current]

[PATCH V14 09/18] fs/buffer.c: use bvec iterator to truncate the bio

From: Ming Lei <hidden>
Date: 2019-01-21 08:23:16
Also in: dm-devel, linux-bcache, linux-btrfs, linux-ext4, linux-fsdevel, linux-mm, linux-raid, linux-xfs, lkml
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

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 <redacted>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <redacted>
---
 fs/buffer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
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)
 
 	/* ..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);
 	}
 }
-- 
2.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help