diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-10-11 09:32:28 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-11-22 21:35:05 -0800 |
commit | 518593d30a81b1845f30ac9771a2e8e3f87e98e2 (patch) | |
tree | 77c09401ada7d9c0a7bf66b534944d9e96b484b3 /fs | |
parent | fc30f889efe55c751e173b5b3144d26cff33294e (diff) |
xfs: add a XFS_CORRUPT_ON macro
Add a new macro, XFS_CORRUPT_ON, 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: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_linux.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index 2271db4e8d66..f605deae5b6d 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -229,6 +229,10 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, #define ASSERT(expr) \ (likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__)) +#define XFS_CORRUPT_ON(mp, expr) \ + (unlikely(expr) ? assfail((mp), #expr, __FILE__, __LINE__), \ + true : false) + #else /* !DEBUG */ #ifdef XFS_WARN @@ -236,9 +240,16 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, #define ASSERT(expr) \ (likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__)) +#define XFS_CORRUPT_ON(mp, expr) \ + (unlikely(expr) ? asswarn((mp), #expr, __FILE__, __LINE__), \ + true : false) + #else /* !DEBUG && !XFS_WARN */ -#define ASSERT(expr) ((void)0) +#define ASSERT(expr) ((void)0) +#define XFS_CORRUPT_ON(mp, expr) \ + (unlikely(expr) ? XFS_ERROR_REPORT(#expr, XFS_ERRLEVEL_HIGH, (mp)), \ + true : false) #endif /* XFS_WARN */ #endif /* DEBUG */ |