summaryrefslogtreecommitdiff
path: root/fs/bcachefs/error.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-03 06:18:56 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:27 +0300
commit2158fe463b9d78c7cf90f74b8b5e9b81249d4347 (patch)
tree97e92efe370a0ae8531d63dc61efa908140bb43b /fs/bcachefs/error.h
parent0576ba9ae7c7939d2402cdad9614f39785b70d2b (diff)
downloadlinux-2158fe463b9d78c7cf90f74b8b5e9b81249d4347.tar.xz
bcachefs: bch2_trans_inconsistent()
Add a new error macro that also dumps transaction updates in addition to doing an emergency shutdown - when a transaction update discovers or is causing a fs inconsistency, it's helpful to see what updates it was doing. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/error.h')
-rw-r--r--fs/bcachefs/error.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/bcachefs/error.h b/fs/bcachefs/error.h
index 4ab3cfe1292c..6e63c38186f3 100644
--- a/fs/bcachefs/error.h
+++ b/fs/bcachefs/error.h
@@ -67,6 +67,26 @@ do { \
})
/*
+ * When a transaction update discovers or is causing a fs inconsistency, it's
+ * helpful to also dump the pending updates:
+ */
+#define bch2_trans_inconsistent(trans, ...) \
+({ \
+ bch_err(trans->c, __VA_ARGS__); \
+ bch2_inconsistent_error(trans->c); \
+ bch2_dump_trans_updates(trans); \
+})
+
+#define bch2_trans_inconsistent_on(cond, trans, ...) \
+({ \
+ bool _ret = unlikely(!!(cond)); \
+ \
+ if (_ret) \
+ bch2_trans_inconsistent(trans, __VA_ARGS__); \
+ _ret; \
+})
+
+/*
* Fsck errors: inconsistency errors we detect at mount time, and should ideally
* be able to repair:
*/