mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
bcachefs: Fix bch2_btree_iter_rewind()
We'd hit a BUG() when rewinding at the start of the btree on btrees with snapshots. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
914f2786b8
commit
71f892a482
@ -1622,7 +1622,9 @@ inline bool bch2_btree_iter_advance(struct btree_iter *iter)
|
||||
inline bool bch2_btree_iter_rewind(struct btree_iter *iter)
|
||||
{
|
||||
struct bpos pos = bkey_start_pos(&iter->k);
|
||||
bool ret = bpos_cmp(pos, POS_MIN) != 0;
|
||||
bool ret = (iter->flags & BTREE_ITER_ALL_SNAPSHOTS
|
||||
? bpos_cmp(pos, POS_MIN)
|
||||
: bkey_cmp(pos, POS_MIN)) != 0;
|
||||
|
||||
if (ret && !(iter->flags & BTREE_ITER_IS_EXTENTS))
|
||||
pos = bkey_predecessor(iter, pos);
|
||||
|
Loading…
Reference in New Issue
Block a user