summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/error.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-09 03:10:32 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2024-07-15 01:00:14 +0200
commita850bde6498b46d6e3143d8847f9aa9598491f9f (patch)
tree6669bfc8fbfe27d712c10d009235dc26314559a9 /fs/bcachefs/error.c
parentbcachefs: btree_types bitmask cleanups (diff)
downloadlinux-a850bde6498b46d6e3143d8847f9aa9598491f9f.tar.xz
linux-a850bde6498b46d6e3143d8847f9aa9598491f9f.zip
bcachefs: fsck_err() may now take a btree_trans
fsck_err() now optionally takes a btree_trans; if the current thread has one, it is required that it be passed. The next patch will use this to unlock when waiting for user input. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/error.c')
-rw-r--r--fs/bcachefs/error.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c
index 46cd9dcb48fc..3a9d0a03fecf 100644
--- a/fs/bcachefs/error.c
+++ b/fs/bcachefs/error.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h"
+#include "btree_iter.h"
#include "error.h"
#include "journal.h"
#include "recovery_passes.h"
@@ -198,7 +199,8 @@ static const u8 fsck_flags_extra[] = {
#undef x
};
-int bch2_fsck_err(struct bch_fs *c,
+int __bch2_fsck_err(struct bch_fs *c,
+ struct btree_trans *trans,
enum bch_fsck_flags flags,
enum bch_sb_error_id err,
const char *fmt, ...)
@@ -215,6 +217,11 @@ int bch2_fsck_err(struct bch_fs *c,
if (!WARN_ON(err >= ARRAY_SIZE(fsck_flags_extra)))
flags |= fsck_flags_extra[err];
+ if (!c)
+ c = trans->c;
+
+ WARN_ON(!trans && bch2_current_has_btree_trans(c));
+
if ((flags & FSCK_CAN_FIX) &&
test_bit(err, c->sb.errors_silent))
return -BCH_ERR_fsck_fix;