Skip to content

Commit 39b1cfd

Browse files
committed
xfs: fix inode ag walk predicate function return values
There are a number of predicate functions that help the incore inode walking code decide if we really want to apply the iteration function to the inode. These are boolean decisions, so change the return types to boolean to match. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Brian Foster <[email protected]>
1 parent a91bf99 commit 39b1cfd

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

fs/xfs/xfs_icache.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,12 @@ xfs_icache_inode_is_allocated(
761761
*/
762762
#define XFS_LOOKUP_BATCH 32
763763

764-
STATIC int
764+
/*
765+
* Decide if the given @ip is eligible to be a part of the inode walk, and
766+
* grab it if so. Returns true if it's ready to go or false if we should just
767+
* ignore it.
768+
*/
769+
STATIC bool
765770
xfs_inode_ag_walk_grab(
766771
struct xfs_inode *ip,
767772
int flags)
@@ -792,18 +797,18 @@ xfs_inode_ag_walk_grab(
792797

793798
/* nothing to sync during shutdown */
794799
if (XFS_FORCED_SHUTDOWN(ip->i_mount))
795-
return -EFSCORRUPTED;
800+
return false;
796801

797802
/* If we can't grab the inode, it must on it's way to reclaim. */
798803
if (!igrab(inode))
799-
return -ENOENT;
804+
return false;
800805

801806
/* inode is valid */
802-
return 0;
807+
return true;
803808

804809
out_unlock_noent:
805810
spin_unlock(&ip->i_flags_lock);
806-
return -ENOENT;
811+
return false;
807812
}
808813

809814
STATIC int
@@ -855,7 +860,7 @@ xfs_inode_ag_walk(
855860
for (i = 0; i < nr_found; i++) {
856861
struct xfs_inode *ip = batch[i];
857862

858-
if (done || xfs_inode_ag_walk_grab(ip, iter_flags))
863+
if (done || !xfs_inode_ag_walk_grab(ip, iter_flags))
859864
batch[i] = NULL;
860865

861866
/*
@@ -1412,48 +1417,48 @@ xfs_reclaim_inodes_count(
14121417
return reclaimable;
14131418
}
14141419

1415-
STATIC int
1420+
STATIC bool
14161421
xfs_inode_match_id(
14171422
struct xfs_inode *ip,
14181423
struct xfs_eofblocks *eofb)
14191424
{
14201425
if ((eofb->eof_flags & XFS_EOF_FLAGS_UID) &&
14211426
!uid_eq(VFS_I(ip)->i_uid, eofb->eof_uid))
1422-
return 0;
1427+
return false;
14231428

14241429
if ((eofb->eof_flags & XFS_EOF_FLAGS_GID) &&
14251430
!gid_eq(VFS_I(ip)->i_gid, eofb->eof_gid))
1426-
return 0;
1431+
return false;
14271432

14281433
if ((eofb->eof_flags & XFS_EOF_FLAGS_PRID) &&
14291434
ip->i_d.di_projid != eofb->eof_prid)
1430-
return 0;
1435+
return false;
14311436

1432-
return 1;
1437+
return true;
14331438
}
14341439

14351440
/*
14361441
* A union-based inode filtering algorithm. Process the inode if any of the
14371442
* criteria match. This is for global/internal scans only.
14381443
*/
1439-
STATIC int
1444+
STATIC bool
14401445
xfs_inode_match_id_union(
14411446
struct xfs_inode *ip,
14421447
struct xfs_eofblocks *eofb)
14431448
{
14441449
if ((eofb->eof_flags & XFS_EOF_FLAGS_UID) &&
14451450
uid_eq(VFS_I(ip)->i_uid, eofb->eof_uid))
1446-
return 1;
1451+
return true;
14471452

14481453
if ((eofb->eof_flags & XFS_EOF_FLAGS_GID) &&
14491454
gid_eq(VFS_I(ip)->i_gid, eofb->eof_gid))
1450-
return 1;
1455+
return true;
14511456

14521457
if ((eofb->eof_flags & XFS_EOF_FLAGS_PRID) &&
14531458
ip->i_d.di_projid == eofb->eof_prid)
1454-
return 1;
1459+
return true;
14551460

1456-
return 0;
1461+
return false;
14571462
}
14581463

14591464
/*
@@ -1466,7 +1471,7 @@ xfs_inode_matches_eofb(
14661471
struct xfs_inode *ip,
14671472
struct xfs_eofblocks *eofb)
14681473
{
1469-
int match;
1474+
bool match;
14701475

14711476
if (!eofb)
14721477
return true;

0 commit comments

Comments
 (0)