Skip to content

Commit 353739f

Browse files
author
Kent Overstreet
committed
bcachefs: Fix btree_iter_peek_prev() at end of inode
At the end of the inode, on an extents iterator, peek_slot() has to advance to the next position to avoid returning a 0 size extent, which is not allowed. Changing iter->pos confuses peek_prev(), but we don't need to call peek_slot() in this case. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent c4f89a1 commit 353739f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/bcachefs/btree_iter.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,10 @@ struct bkey_s_c bch2_btree_iter_peek_prev_min(struct btree_trans *trans, struct
25772577
struct bpos end)
25782578
{
25792579
if ((iter->flags & (BTREE_ITER_is_extents|BTREE_ITER_filter_snapshots)) &&
2580-
!bkey_eq(iter->pos, POS_MAX)) {
2580+
!bkey_eq(iter->pos, POS_MAX) &&
2581+
!((iter->flags & BTREE_ITER_is_extents) &&
2582+
iter->pos.offset == U64_MAX)) {
2583+
25812584
/*
25822585
* bkey_start_pos(), for extents, is not monotonically
25832586
* increasing until after filtering for snapshots:

0 commit comments

Comments
 (0)