xfs: convert open coded corruption check to use XFS_IS_CORRUPT

Convert the last of the open coded corruption check and report idioms to
use the XFS_IS_CORRUPT macro.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong
2019-11-11 12:53:22 -08:00
parent f9e0370648
commit a71895c5da
16 changed files with 116 additions and 202 deletions

View File

@@ -728,10 +728,9 @@ xfs_dir2_leafn_lookup_for_addname(
* If it has room, return it.
*/
xfs_dir2_free_hdr_from_disk(mp, &freehdr, free);
if (unlikely(
freehdr.bests[fi] == cpu_to_be16(NULLDATAOFF))) {
XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
XFS_ERRLEVEL_LOW, mp);
if (XFS_IS_CORRUPT(mp,
freehdr.bests[fi] ==
cpu_to_be16(NULLDATAOFF))) {
if (curfdb != newfdb)
xfs_trans_brelse(tp, curbp);
return -EFSCORRUPTED;
@@ -1722,7 +1721,9 @@ xfs_dir2_node_add_datablk(
if (error)
return error;
if (xfs_dir2_db_to_fdb(args->geo, *dbno) != fbno) {
if (XFS_IS_CORRUPT(mp,
xfs_dir2_db_to_fdb(args->geo, *dbno) !=
fbno)) {
xfs_alert(mp,
"%s: dir ino %llu needed freesp block %lld for data block %lld, got %lld",
__func__, (unsigned long long)dp->i_ino,
@@ -1736,7 +1737,6 @@ xfs_dir2_node_add_datablk(
} else {
xfs_alert(mp, " ... fblk is NULL");
}
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp);
return -EFSCORRUPTED;
}