Re: [PATCH V10 07/19] btrfs: use bvec_last_segment to get bio's last page

From
Ming Lei <hidden>
Date
2018-11-19 08:09:00
Also in
dm-devel, linux-bcache, linux-block, linux-btrfs, linux-ext4, linux-fsdevel, linux-mm, linux-xfs, lkml
Reply to
Christoph Hellwig, 2018-11-16
On Fri, Nov 16, 2018 at 02:37:10PM +0100, Christoph Hellwig wrote:
On Thu, Nov 15, 2018 at 04:52:54PM +0800, Ming Lei wrote:
quoted
index 2955a4ea2fa8..161e14b8b180 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -400,8 +400,11 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
 static u64 bio_end_offset(struct bio *bio)
 {
 	struct bio_vec *last = bio_last_bvec_all(bio);
+	struct bio_vec bv;
 
-	return page_offset(last->bv_page) + last->bv_len + last->bv_offset;
+	bvec_last_segment(last, &bv);
+
+	return page_offset(bv.bv_page) + bv.bv_len + bv.bv_offset;
I don't think we need this.  If last is a multi-page bvec bv_offset
will already contain the correct offset from the first page.
Yeah, it is true for this specific case, looks we can drop this patch.


thanks,
Ming
Thread (102 messages) 102 messages, 8 authors, last reply 2018-11-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help