Thread (58 messages) 58 messages, 3 authors, 2018-11-23

Re: [PATCH V11 07/19] fs/buffer.c: use bvec iterator to truncate the bio

From: Ming Lei <hidden>
Date: 2018-11-23 01:48:21
Also in: dm-devel, linux-bcache, linux-block, linux-btrfs, linux-ext4, linux-fsdevel, linux-mm, linux-xfs, lkml

On Thu, Nov 22, 2018 at 11:58:49AM +0100, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
Btw, given that this is the last user of bvec_last_segment after my
other patches I think we should kill bvec_last_segment and do something
like this here:

diff --git a/fs/buffer.c b/fs/buffer.c
index fa37ad52e962..af5e135d2b83 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2981,6 +2981,14 @@ static void end_bio_bh_io_sync(struct bio *bio)
 	bio_put(bio);
 }
 
+static void zero_trailing_sectors(struct bio_vec *bvec, unsigned bytes)
+{
+	unsigned last_page = (bvec->bv_offset + bvec->bv_len - 1) >> PAGE_SHIFT;
+
+	zero_user(nth_page(bvec->bv_page, last_page),
+		  bvec->bv_offset % PAGE_SIZE + bvec->bv_len, bytes);
+}
The above 'start' parameter is figured out as wrong, and the computation
isn't very obvious, so I'd suggest to keep bvec_last_segment().

Thanks,
Ming
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help