summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_dir2_node.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-10-11 16:05:17 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-11-22 21:35:05 -0800
commit8f92bde008f2197631a337225e731e46a064eeff (patch)
treec66005c21b496ee0e0815c49043c3d4b179a2d67 /fs/xfs/libxfs/xfs_dir2_node.c
parent2e82c02cafbb8d14a50ee9c14f67d66f1b1e0b38 (diff)
xfs: convert open coded corruption check to use XFS_CORRUPT_ONrefactor-corruption-checks_2019-11-22
Convert the last of the open coded corruption check and report idioms to use the XFS_CORRUPT_ON macro. In a subsequent patch we are going to add health reporting to the code block under each corruption check, so we don't bother to clean out "{ return -EFSCORRUPTED; }". Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_dir2_node.c')
-rw-r--r--fs/xfs/libxfs/xfs_dir2_node.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
index 72d7ed17eef5..b0f616f8bc57 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -670,9 +670,8 @@ xfs_dir2_leafn_lookup_for_addname(
* If it has room, return it.
*/
bests = dp->d_ops->free_bests_p(free);
- if (unlikely(bests[fi] == cpu_to_be16(NULLDATAOFF))) {
- XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
- XFS_ERRLEVEL_LOW, mp);
+ if (XFS_CORRUPT_ON(mp,
+ bests[fi] == cpu_to_be16(NULLDATAOFF))) {
if (curfdb != newfdb)
xfs_trans_brelse(tp, curbp);
return -EFSCORRUPTED;
@@ -1671,7 +1670,8 @@ xfs_dir2_node_add_datablk(
if (error)
return error;
- if (dp->d_ops->db_to_fdb(args->geo, *dbno) != fbno) {
+ if (XFS_CORRUPT_ON(mp,
+ fbno != dp->d_ops->db_to_fdb(args->geo, *dbno))) {
xfs_alert(mp,
"%s: dir ino %llu needed freesp block %lld for data block %lld, got %lld",
__func__, (unsigned long long)dp->i_ino,
@@ -1685,7 +1685,6 @@ xfs_dir2_node_add_datablk(
} else {
xfs_alert(mp, " ... fblk is NULL");
}
- XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
return -EFSCORRUPTED;
}