From 7fec8266af12b655e98978050e716e12e8544fe6 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 15 Nov 2022 20:25:08 -0500 Subject: 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 --- fs/bcachefs/error.h | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'fs/bcachefs/error.h') 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; \ }) -- cgit v1.2.3