From 0d0e77f45fe806a80af76501d5422437692e158b Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 14 May 2020 21:45:08 -0400 Subject: [PATCH] bcachefs: Fix another iterator counting bug We were marking the end of where we could insert incorrectly for indirect extents. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/extent_update.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c index d0af1bc17018..fd011df3cb99 100644 --- a/fs/bcachefs/extent_update.c +++ b/fs/bcachefs/extent_update.c @@ -76,7 +76,8 @@ static int count_iters_for_insert(struct btree_trans *trans, if (*nr_iters >= max_iters) { struct bpos pos = bkey_start_pos(k.k); - pos.offset += r_k.k->p.offset - idx; + pos.offset += min_t(u64, k.k->size, + r_k.k->p.offset - idx); *end = bpos_min(*end, pos); ret = 1; -- 2.39.5