Re: [PATCH 14/24] xfs: remove IO submission from xfs_reclaim_inode()

Christoph Hellwig
2020-05-23T09:40:56Z

> +out_ifunlock:
> + xfs_ifunlock(ip);
> +out:
> + xfs_iunlock(ip, XFS_ILOCK_EXCL);
> + xfs_iflags_clear(ip, XFS_IRECLAIM);
> + return false;
>
> reclaim:

I find the reordering of the error handling to sit before the actual
reclaim action here really weird to read. What about something like
this folded in instead?

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 9bb022a3570a3..6f873eca8c916 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1091,18 +1091,10 @@ xfs_reclaim_inode(
}
if (xfs_ipincount(ip))
goto out_ifunlock;
- if (xfs_iflags_test(ip, XFS_ISTALE) || xfs_inode_clean(ip)) {
- xfs_ifunlock(ip);
- goto reclaim;
- }
+ if (!xfs_inode_clean(ip) && !xfs_iflags_test(ip, XFS_ISTALE))
+ goto out_ifunlock;

-out_ifunlock:
xfs_ifunlock(ip);
-out_iunlock:
- xfs_iunlock(ip, XFS_ILOCK_EXCL);
-out:
- xfs_iflags_clear(ip, XFS_IRECLAIM);
- return false;

reclaim:
ASSERT(!xfs_isiflocked(ip));
@@ -1153,6 +1145,14 @@ xfs_reclaim_inode(

__xfs_inode_free(ip);
return true;
+
+out_ifunlock:
+ xfs_ifunlock(ip);
+out_iunlock:
+ xfs_iunlock(ip, XFS_ILOCK_EXCL);
+out:
+ xfs_iflags_clear(ip, XFS_IRECLAIM);
+ return false;
}

/*