Re: [PATCH 01/13] xfs: xfs_iflock is no longer a completion

Christoph Hellwig
2020-08-22T07:41:19Z

On Wed, Aug 12, 2020 at 07:25:44PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> With the recent rework of the inode cluster flushing, we no longer
> ever wait on the the inode flush "lock". It was never a lock in the
> first place, just a completion to allow callers to wait for inode IO
> to complete. We now never wait for flush completion as all inode
> flushing is non-blocking. Hence we can get rid of all the iflock
> infrastructure and instead just set and check a state flag.
>
> Rename the XFS_IFLOCK flag to XFS_IFLUSHING, convert all the
> xfs_iflock_nowait() test-and-set operations on that flag, and
> replace all the xfs_ifunlock() calls to clear operations.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_icache.c | 17 ++++------
> fs/xfs/xfs_inode.c | 73 +++++++++++++++--------------------------
> fs/xfs/xfs_inode.h | 33 +------------------
> fs/xfs/xfs_inode_item.c | 15 ++++-----
> fs/xfs/xfs_inode_item.h | 4 +--
> fs/xfs/xfs_mount.c | 11 ++++---
> fs/xfs/xfs_super.c | 10 +++---
> 7 files changed, 55 insertions(+), 108 deletions(-)
>
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index 101028ebb571..aa6aad258670 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -52,7 +52,6 @@ xfs_inode_alloc(
>
> XFS_STATS_INC(mp, vn_active);
> ASSERT(atomic_read(&ip->i_pincount) == 0);
> - ASSERT(!xfs_isiflocked(ip));
> ASSERT(ip->i_ino == 0);
>
> /* initialise the xfs inode */
> @@ -123,7 +122,7 @@ void
> xfs_inode_free(
> struct xfs_inode *ip)
> {
> - ASSERT(!xfs_isiflocked(ip));
> + ASSERT(!xfs_iflags_test(ip, XFS_IFLUSHING));
>
> /*
> * Because we use RCU freeing we need to ensure the inode always
> @@ -1035,23 +1034,21 @@ xfs_reclaim_inode(
>
> if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL))
> goto out;
> - if (!xfs_iflock_nowait(ip))
> + if (xfs_iflags_test_and_set(ip, XFS_IFLUSHING))
> goto out_iunlock;
>
> if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
> xfs_iunpin_wait(ip);
> - /* xfs_iflush_abort() drops the flush lock */

Maybe keeps this as

/* xfs_iflush_abort() clears XFS_IFLUSHING */

> @@ -3661,7 +3643,6 @@ xfs_iflush_cluster(
> */
> if (XFS_FORCED_SHUTDOWN(mp)) {
> xfs_iunpin_wait(ip);
> - /* xfs_iflush_abort() drops the flush lock */

Same here.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>