Skip to content

Commit

Permalink
xfs: add a XFS_IS_CORRUPT macro
Browse files Browse the repository at this point in the history
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: Darrick J. Wong <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
  • Loading branch information
djwong committed Nov 13, 2019
1 parent 2713fef commit 1ec2861
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion fs/xfs/xfs_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,27 @@ 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_IS_CORRUPT(mp, expr) \
(unlikely(expr) ? assfail((mp), #expr, __FILE__, __LINE__), \
true : false)

#else /* !DEBUG */

#ifdef XFS_WARN

#define ASSERT(expr) \
(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 */

#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 /* DEBUG */
Expand Down

0 comments on commit 1ec2861

Please sign in to comment.