Commit 1ec28615 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: add a XFS_IS_CORRUPT macro

Add a new macro, XFS_IS_CORRUPT, which we will use to integrate some
corruption reporting when the corruption test expression is true.  This
will be used in the next patch to remove the ugly XFS_WANT_CORRUPT*
macros.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 2713fefa
...@@ -229,6 +229,10 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, ...@@ -229,6 +229,10 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
#define ASSERT(expr) \ #define ASSERT(expr) \
(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__)) (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
#define XFS_IS_CORRUPT(mp, expr) \
(unlikely(expr) ? assfail((mp), #expr, __FILE__, __LINE__), \
true : false)
#else /* !DEBUG */ #else /* !DEBUG */
#ifdef XFS_WARN #ifdef XFS_WARN
...@@ -236,9 +240,16 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, ...@@ -236,9 +240,16 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
#define ASSERT(expr) \ #define ASSERT(expr) \
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__)) (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
#define XFS_IS_CORRUPT(mp, expr) \
(unlikely(expr) ? asswarn((mp), #expr, __FILE__, __LINE__), \
true : false)
#else /* !DEBUG && !XFS_WARN */ #else /* !DEBUG && !XFS_WARN */
#define ASSERT(expr) ((void)0) #define ASSERT(expr) ((void)0)
#define XFS_IS_CORRUPT(mp, expr) \
(unlikely(expr) ? XFS_ERROR_REPORT(#expr, XFS_ERRLEVEL_LOW, (mp)), \
true : false)
#endif /* XFS_WARN */ #endif /* XFS_WARN */
#endif /* DEBUG */ #endif /* DEBUG */
......
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