diff mbox series

[3/6] xfs: make the assertion message functions take a mount parameter

Message ID 157281986300.4151907.2698280321479729910.stgit@magnolia (mailing list archive)
State Superseded
Headers show
Series xfs: refactor corruption checking and reporting | expand

Commit Message

Darrick J. Wong Nov. 3, 2019, 10:24 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_linux.h   |    6 +++---
 fs/xfs/xfs_message.c |    8 ++++----
 fs/xfs/xfs_message.h |    4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

Comments

Christoph Hellwig Nov. 5, 2019, 12:45 a.m. UTC | #1
>  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);
>  	WARN_ON(1);
>  }
>  
>  void
> -assfail(char *expr, char *file, int line)
> +assfail(struct xfs_mount *mp, char *expr, char *file, int line)

Might be worth to change it to our usual prototype style while you're
at it.

> -extern void assfail(char *expr, char *f, int l);
> -extern void asswarn(char *expr, char *f, int l);
> +extern void assfail(struct xfs_mount *mp, char *expr, char *f, int l);
> +extern void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);

And drop the pointless externs?

Otherwise this looks sane to me.
Darrick J. Wong Nov. 5, 2019, 1:08 a.m. UTC | #2
On Mon, Nov 04, 2019 at 04:45:44PM -0800, Christoph Hellwig wrote:
> >  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);
> >  	WARN_ON(1);
> >  }
> >  
> >  void
> > -assfail(char *expr, char *file, int line)
> > +assfail(struct xfs_mount *mp, char *expr, char *file, int line)
> 
> Might be worth to change it to our usual prototype style while you're
> at it.
> 
> > -extern void assfail(char *expr, char *f, int l);
> > -extern void asswarn(char *expr, char *f, int l);
> > +extern void assfail(struct xfs_mount *mp, char *expr, char *f, int l);
> > +extern void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);
> 
> And drop the pointless externs?
> 
> Otherwise this looks sane to me.

Fixed both of those.

--D
diff mbox series

Patch

diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index ca15105681ca..2271db4e8d66 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -223,18 +223,18 @@  int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
 		char *data, unsigned int op);
 
 #define ASSERT_ALWAYS(expr)	\
-	(likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
+	(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
 
 #ifdef DEBUG
 #define ASSERT(expr)	\
-	(likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
+	(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
 
 #else	/* !DEBUG */
 
 #ifdef XFS_WARN
 
 #define ASSERT(expr)	\
-	(likely(expr) ? (void)0 : asswarn(#expr, __FILE__, __LINE__))
+	(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
 
 #else	/* !DEBUG && !XFS_WARN */
 
diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
index c57e8ad39712..333bc2e14f3f 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -86,17 +86,17 @@  xfs_alert_tag(
 }
 
 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);
 	WARN_ON(1);
 }
 
 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);
 	if (xfs_globals.bug_on_assert)
 		BUG();
diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
index 7f040b04b739..28bd6c0777ab 100644
--- a/fs/xfs/xfs_message.h
+++ b/fs/xfs/xfs_message.h
@@ -57,8 +57,8 @@  do {									\
 #define xfs_debug_ratelimited(dev, fmt, ...)				\
 	xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
 
-extern void assfail(char *expr, char *f, int l);
-extern void asswarn(char *expr, char *f, int l);
+extern void assfail(struct xfs_mount *mp, char *expr, char *f, int l);
+extern void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);
 
 extern void xfs_hex_dump(const void *p, int length);