Commit 9842b56c authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: make the assertion message functions take a mount parameter

Make the assfail and asswarn functions take a struct xfs_mount so that
we can start tying debugging and corruption messages to a particular
mount.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 110f09cb
...@@ -223,18 +223,18 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, ...@@ -223,18 +223,18 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
char *data, unsigned int op); char *data, unsigned int op);
#define ASSERT_ALWAYS(expr) \ #define ASSERT_ALWAYS(expr) \
(likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
#ifdef DEBUG #ifdef DEBUG
#define ASSERT(expr) \ #define ASSERT(expr) \
(likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
#else /* !DEBUG */ #else /* !DEBUG */
#ifdef XFS_WARN #ifdef XFS_WARN
#define ASSERT(expr) \ #define ASSERT(expr) \
(likely(expr) ? (void)0 : asswarn(#expr, __FILE__, __LINE__)) (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
#else /* !DEBUG && !XFS_WARN */ #else /* !DEBUG && !XFS_WARN */
......
...@@ -86,17 +86,25 @@ xfs_alert_tag( ...@@ -86,17 +86,25 @@ xfs_alert_tag(
} }
void void
asswarn(char *expr, char *file, int line) asswarn(
struct xfs_mount *mp,
char *expr,
char *file,
int line)
{ {
xfs_warn(NULL, "Assertion failed: %s, file: %s, line: %d", xfs_warn(mp, "Assertion failed: %s, file: %s, line: %d",
expr, file, line); expr, file, line);
WARN_ON(1); WARN_ON(1);
} }
void void
assfail(char *expr, char *file, int line) assfail(
struct xfs_mount *mp,
char *expr,
char *file,
int line)
{ {
xfs_emerg(NULL, "Assertion failed: %s, file: %s, line: %d", xfs_emerg(mp, "Assertion failed: %s, file: %s, line: %d",
expr, file, line); expr, file, line);
if (xfs_globals.bug_on_assert) if (xfs_globals.bug_on_assert)
BUG(); BUG();
......
...@@ -57,8 +57,8 @@ do { \ ...@@ -57,8 +57,8 @@ do { \
#define xfs_debug_ratelimited(dev, fmt, ...) \ #define xfs_debug_ratelimited(dev, fmt, ...) \
xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__) xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
extern void assfail(char *expr, char *f, int l); void assfail(struct xfs_mount *mp, char *expr, char *f, int l);
extern void asswarn(char *expr, char *f, int l); void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);
extern void xfs_hex_dump(const void *p, int length); extern void xfs_hex_dump(const void *p, int length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment