summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-10-16 13:48:12 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:30 -0400
commit71603f1ffe03d2409d591e4647377a415376a6b9 (patch)
treedef8dfc8cec0ccd1b2b7b3e1985896e89c40a40c
parentae93a628956c8eab915baa83be11d2a0300eebca (diff)
bcachefs: Fix an iterator counting bug
The iterator counting assumed we're doing an obvious optimization when only updating the refcount on indirect extents - but we're not doing it yet. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/extents.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 8b7d2b8759b0..16a328a20fb5 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -971,20 +971,7 @@ static int count_iters_for_insert(struct btree_trans *trans,
POS(0, idx + sectors)) >= 0)
break;
- *nr_iters += 1;
-
- if (overwrite &&
- r_k.k->type == KEY_TYPE_reflink_v) {
- struct bkey_s_c_reflink_v r = bkey_s_c_to_reflink_v(r_k);
-
- if (le64_to_cpu(r.v->refcount) == 1)
- *nr_iters += bch2_bkey_nr_alloc_ptrs(r_k);
- }
-
- /*
- * if we're going to be deleting an entry from
- * the reflink btree, need more iters...
- */
+ *nr_iters += 1 + bch2_bkey_nr_alloc_ptrs(r_k);
if (*nr_iters >= max_iters) {
struct bpos pos = bkey_start_pos(k.k);