[PATCH v3 2/4] bcachefs: track current fiemap offset in start variable

Brian Foster
2024-04-08T14:46:51Z

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/bcachefs/fs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 137ce028bc3c..9c86749b256e 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1015,6 +1015,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
bch2_bkey_buf_realloc(&prev, c, k.k->u64s);

sectors = min(sectors, k.k->size - offset_into_extent);
+ start = iter.pos.offset + sectors;

bch2_cut_front(POS(k.k->p.inode,
bkey_start_offset(k.k) +
@@ -1035,8 +1036,7 @@ static int bch2_fiemap(struct inode *vinode, struct fiemap_extent_info *info,
bkey_copy(prev.k, cur.k);
have_extent = true;

- bch2_btree_iter_set_pos(&iter,
- POS(iter.pos.inode, iter.pos.offset + sectors));
+ bch2_btree_iter_set_pos(&iter, POS(iter.pos.inode, start));
}
start = iter.pos.offset;
bch2_trans_iter_exit(trans, &iter);
--
2.44.0