summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-03-28 10:13:27 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:20 +0300
commitcccf4e6df36ffb4752b4c83efd0723281e629693 (patch)
treef6445507fbfbd8f052acd24ae85c7bb35c28d854
parentac7f0d77c24a20998c150b58caff321a4bbcc828 (diff)
downloadlinux-cccf4e6df36ffb4752b4c83efd0723281e629693.tar.xz
bcachefs: Convert gc errors to fsck errors
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/btree_gc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c
index 84ed3377f86e..4119f48281fb 100644
--- a/fs/bcachefs/btree_gc.c
+++ b/fs/bcachefs/btree_gc.c
@@ -476,25 +476,26 @@ static void bch2_gc_free(struct bch_fs *c)
c->usage[1] = NULL;
}
-static void bch2_gc_done(struct bch_fs *c, bool initial)
+static int bch2_gc_done(struct bch_fs *c, bool initial)
{
struct bch_dev *ca;
bool verify = !initial ||
(c->sb.compat & (1ULL << BCH_COMPAT_FEAT_ALLOC_INFO));
unsigned i;
+ int ret = 0;
#define copy_field(_f, _msg, ...) \
if (dst->_f != src->_f) { \
if (verify) \
- bch_err(c, _msg ": got %llu, should be %llu, fixing"\
+ fsck_err(c, _msg ": got %llu, should be %llu" \
, ##__VA_ARGS__, dst->_f, src->_f); \
dst->_f = src->_f; \
}
#define copy_stripe_field(_f, _msg, ...) \
if (dst->_f != src->_f) { \
if (verify) \
- bch_err_ratelimited(c, "stripe %zu has wrong "_msg\
- ": got %u, should be %u, fixing", \
+ fsck_err(c, "stripe %zu has wrong "_msg \
+ ": got %u, should be %u", \
dst_iter.pos, ##__VA_ARGS__, \
dst->_f, src->_f); \
dst->_f = src->_f; \
@@ -503,8 +504,8 @@ static void bch2_gc_done(struct bch_fs *c, bool initial)
#define copy_bucket_field(_f) \
if (dst->b[b].mark._f != src->b[b].mark._f) { \
if (verify) \
- bch_err_ratelimited(c, "dev %u bucket %zu has wrong " #_f\
- ": got %u, should be %u, fixing", i, b, \
+ fsck_err(c, "dev %u bucket %zu has wrong " #_f \
+ ": got %u, should be %u", i, b, \
dst->b[b].mark._f, src->b[b].mark._f); \
dst->b[b]._mark._f = src->b[b].mark._f; \
dst->b[b]._mark.dirty = true; \
@@ -620,6 +621,8 @@ static void bch2_gc_done(struct bch_fs *c, bool initial)
#undef copy_bucket_field
#undef copy_stripe_field
#undef copy_field
+fsck_err:
+ return ret;
}
static int bch2_gc_start(struct bch_fs *c)
@@ -750,7 +753,7 @@ out:
percpu_down_write(&c->mark_lock);
if (!ret)
- bch2_gc_done(c, initial);
+ ret = bch2_gc_done(c, initial);
/* Indicates that gc is no longer in progress: */
__gc_pos_set(c, gc_phase(GC_PHASE_NOT_RUNNING));