summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/error.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-16 02:25:08 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:09:46 +0200
commit7fec8266af12b655e98978050e716e12e8544fe6 (patch)
tree7634750a6ce6ebdbb72a836d26684f689f3f7e81 /fs/bcachefs/error.h
parentbcachefs: Improve a few warnings (diff)
downloadlinux-7fec8266af12b655e98978050e716e12e8544fe6.tar.xz
linux-7fec8266af12b655e98978050e716e12e8544fe6.zip
bcachefs: Error message improvement
- Centralize format strings in bcachefs.h - Add bch2_fmt_inum_offset() and related helpers - Switch error messages for inodes to also print out the offset, in bytes Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/error.h')
-rw-r--r--fs/bcachefs/error.h29
1 files changed, 9 insertions, 20 deletions
diff --git a/fs/bcachefs/error.h b/fs/bcachefs/error.h
index bbf9b6d85b4d..dae72620dae3 100644
--- a/fs/bcachefs/error.h
+++ b/fs/bcachefs/error.h
@@ -186,36 +186,25 @@ void bch2_io_error_work(struct work_struct *);
/* Does the error handling without logging a message */
void bch2_io_error(struct bch_dev *);
-/* Logs message and handles the error: */
-#define bch2_dev_io_error(ca, fmt, ...) \
-do { \
- printk_ratelimited(KERN_ERR "bcachefs (%s): " fmt, \
- (ca)->name, ##__VA_ARGS__); \
- bch2_io_error(ca); \
-} while (0)
-
-#define bch2_dev_inum_io_error(ca, _inum, _offset, fmt, ...) \
-do { \
- printk_ratelimited(KERN_ERR "bcachefs (%s inum %llu offset %llu): " fmt,\
- (ca)->name, (_inum), (_offset), ##__VA_ARGS__); \
- bch2_io_error(ca); \
-} while (0)
-
#define bch2_dev_io_err_on(cond, ca, ...) \
({ \
bool _ret = (cond); \
\
- if (_ret) \
- bch2_dev_io_error(ca, __VA_ARGS__); \
+ if (_ret) { \
+ bch_err_dev_ratelimited(ca, __VA_ARGS__); \
+ bch2_io_error(ca); \
+ } \
_ret; \
})
-#define bch2_dev_inum_io_err_on(cond, ca, _inum, _offset, ...) \
+#define bch2_dev_inum_io_err_on(cond, ca, ...) \
({ \
bool _ret = (cond); \
\
- if (_ret) \
- bch2_dev_inum_io_error(ca, _inum, _offset, __VA_ARGS__);\
+ if (_ret) { \
+ bch_err_inum_offset_ratelimited(ca, __VA_ARGS__); \
+ bch2_io_error(ca); \
+ } \
_ret; \
})