Commit 84befe8e authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Use bch2_trans_inconsistent_on() in more places

This gets us better error messages.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 3518e6fa
...@@ -520,7 +520,7 @@ static int bch2_bucket_do_index(struct btree_trans *trans, ...@@ -520,7 +520,7 @@ static int bch2_bucket_do_index(struct btree_trans *trans,
goto err; goto err;
if (ca->mi.freespace_initialized && if (ca->mi.freespace_initialized &&
bch2_fs_inconsistent_on(old.k->type != old_type, c, bch2_trans_inconsistent_on(old.k->type != old_type, trans,
"incorrect key when %s %s btree (got %s should be %s)\n" "incorrect key when %s %s btree (got %s should be %s)\n"
" for %s", " for %s",
set ? "setting" : "clearing", set ? "setting" : "clearing",
...@@ -950,7 +950,7 @@ static int bch2_clear_need_discard(struct btree_trans *trans, struct bpos pos, ...@@ -950,7 +950,7 @@ static int bch2_clear_need_discard(struct btree_trans *trans, struct bpos pos,
goto write; goto write;
} }
if (bch2_fs_inconsistent_on(a->v.journal_seq > c->journal.flushed_seq_ondisk, c, if (bch2_trans_inconsistent_on(a->v.journal_seq > c->journal.flushed_seq_ondisk, trans,
"clearing need_discard but journal_seq %llu > flushed_seq %llu\n" "clearing need_discard but journal_seq %llu > flushed_seq %llu\n"
"%s", "%s",
a->v.journal_seq, a->v.journal_seq,
...@@ -960,7 +960,7 @@ static int bch2_clear_need_discard(struct btree_trans *trans, struct bpos pos, ...@@ -960,7 +960,7 @@ static int bch2_clear_need_discard(struct btree_trans *trans, struct bpos pos,
goto out; goto out;
} }
if (bch2_fs_inconsistent_on(a->v.data_type != BCH_DATA_need_discard, c, if (bch2_trans_inconsistent_on(a->v.data_type != BCH_DATA_need_discard, trans,
"bucket incorrectly set in need_discard btree\n" "bucket incorrectly set in need_discard btree\n"
"%s", "%s",
(bch2_bkey_val_to_text(&buf, c, k), buf.buf))) { (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) {
...@@ -1089,7 +1089,7 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca) ...@@ -1089,7 +1089,7 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca)
if (!k.k || k.k->p.inode != ca->dev_idx) if (!k.k || k.k->p.inode != ca->dev_idx)
goto out; goto out;
if (bch2_fs_inconsistent_on(k.k->type != KEY_TYPE_lru, c, if (bch2_trans_inconsistent_on(k.k->type != KEY_TYPE_lru, trans,
"non lru key in lru btree")) "non lru key in lru btree"))
goto out; goto out;
...@@ -1102,7 +1102,7 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca) ...@@ -1102,7 +1102,7 @@ static int invalidate_one_bucket(struct btree_trans *trans, struct bch_dev *ca)
if (ret) if (ret)
goto out; goto out;
if (bch2_fs_inconsistent_on(idx != alloc_lru_idx(a->v), c, if (bch2_trans_inconsistent_on(idx != alloc_lru_idx(a->v), trans,
"invalidating bucket with wrong lru idx (got %llu should be %llu", "invalidating bucket with wrong lru idx (got %llu should be %llu",
idx, alloc_lru_idx(a->v))) idx, alloc_lru_idx(a->v)))
goto out; goto out;
......
...@@ -32,7 +32,6 @@ void bch2_lru_to_text(struct printbuf *out, struct bch_fs *c, ...@@ -32,7 +32,6 @@ void bch2_lru_to_text(struct printbuf *out, struct bch_fs *c,
static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time) static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time)
{ {
struct bch_fs *c = trans->c;
struct btree_iter iter; struct btree_iter iter;
struct bkey_s_c k; struct bkey_s_c k;
u64 existing_idx; u64 existing_idx;
...@@ -51,7 +50,7 @@ static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time) ...@@ -51,7 +50,7 @@ static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time)
goto err; goto err;
if (k.k->type != KEY_TYPE_lru) { if (k.k->type != KEY_TYPE_lru) {
bch2_fs_inconsistent(c, bch2_trans_inconsistent(trans,
"pointer to nonexistent lru %llu:%llu", "pointer to nonexistent lru %llu:%llu",
id, time); id, time);
ret = -EIO; ret = -EIO;
...@@ -60,7 +59,7 @@ static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time) ...@@ -60,7 +59,7 @@ static int lru_delete(struct btree_trans *trans, u64 id, u64 idx, u64 time)
existing_idx = le64_to_cpu(bkey_s_c_to_lru(k).v->idx); existing_idx = le64_to_cpu(bkey_s_c_to_lru(k).v->idx);
if (existing_idx != idx) { if (existing_idx != idx) {
bch2_fs_inconsistent(c, bch2_trans_inconsistent(trans,
"lru %llu:%llu with wrong backpointer: got %llu, should be %llu", "lru %llu:%llu with wrong backpointer: got %llu, should be %llu",
id, time, existing_idx, idx); id, time, existing_idx, idx);
ret = -EIO; ret = -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment