summaryrefslogtreecommitdiff
path: root/libbcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-04-11 20:32:28 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-04-11 20:32:28 -0400
commit7923c2ee0616ef35d984e292dd9e799babe96662 (patch)
treef33b779ebb4375d958492644381281217334d72f /libbcachefs/alloc_background.c
parent74b88aa9be95eb7477d1a6699bb9235bf5562ea6 (diff)
Update bcachefs sources to e67d924a90 bcachefs: Introduce bch2_journal_keys_peek_(upto|slot)()
Diffstat (limited to 'libbcachefs/alloc_background.c')
-rw-r--r--libbcachefs/alloc_background.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libbcachefs/alloc_background.c b/libbcachefs/alloc_background.c
index c372385..a44d93b 100644
--- a/libbcachefs/alloc_background.c
+++ b/libbcachefs/alloc_background.c
@@ -1081,6 +1081,7 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca)
struct bkey_s_c k;
struct bkey_i_alloc_v4 *a;
u64 bucket, idx;
+ struct printbuf buf = PRINTBUF;
int ret;
bch2_trans_iter_init(trans, &lru_iter, BTREE_ID_lru,
@@ -1106,10 +1107,16 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca)
if (ret)
goto out;
- if (bch2_trans_inconsistent_on(idx != alloc_lru_idx(a->v), trans,
- "invalidating bucket with wrong lru idx (got %llu should be %llu",
- idx, alloc_lru_idx(a->v)))
+ if (idx != alloc_lru_idx(a->v)) {
+ pr_buf(&buf, "alloc key does not point back to lru entry when invalidating bucket:\n ");
+
+ bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(&a->k_i));
+ pr_buf(&buf, "\n ");
+ bch2_bkey_val_to_text(&buf, c, k);
+ bch2_trans_inconsistent(trans, "%s", buf.buf);
+ ret = -EINVAL;
goto out;
+ }
SET_BCH_ALLOC_V4_NEED_INC_GEN(&a->v, false);
a->v.gen++;
@@ -1124,6 +1131,7 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca)
out:
bch2_trans_iter_exit(trans, &alloc_iter);
bch2_trans_iter_exit(trans, &lru_iter);
+ printbuf_exit(&buf);
return ret;
}