xfs
[Top] [All Lists]

Re: [PATCH 15/15] xfs: implement inode change count

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 15/15] xfs: implement inode change count
From: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Date: Fri, 28 Jun 2013 11:07:11 -0500
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1372313099-8121-16-git-send-email-david@xxxxxxxxxxxxx>
Organization: IBM
References: <1372313099-8121-1-git-send-email-david@xxxxxxxxxxxxx> <1372313099-8121-16-git-send-email-david@xxxxxxxxxxxxx>
Reply-to: sekharan@xxxxxxxxxx
On Thu, 2013-06-27 at 16:04 +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> For CRC enabled filesystems, add support for the monotonic inode
> version change counter that is needed by protocols like NFSv4 for
> determining if the inode has changed in any way at all between two
> unrelated operations on the inode.
> 
> This bumps the change count the first time an inode is dirtied in a
> transaction. Since all modifications to the inode are logged, this
> will catch all changes that are made to the inode, including
> timestamp updates that occur during data writes.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>

Reviewed-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>

> ---
>  fs/xfs/xfs_super.c       |    4 ++++
>  fs/xfs/xfs_trans_inode.c |   11 +++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index f59e27f..a1587f9 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1482,6 +1482,10 @@ xfs_fs_fill_super(
>       sb->s_time_gran = 1;
>       set_posix_acl_flag(sb);
> 
> +     /* version 5 superblocks support inode version counters. */
> +     if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
> +             sb->s_flags |= MS_I_VERSION;
> +
>       error = xfs_mountfs(mp);
>       if (error)
>               goto out_filestream_unmount;
> diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
> index ac6d567..53dfe46 100644
> --- a/fs/xfs/xfs_trans_inode.c
> +++ b/fs/xfs/xfs_trans_inode.c
> @@ -112,6 +112,17 @@ xfs_trans_log_inode(
>       ASSERT(ip->i_itemp != NULL);
>       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> 
> +     /*
> +      * First time we log the inode in a transaction, bump the inode change
> +      * counter if it is configured for this to occur.
> +      */
> +     if (!(ip->i_itemp->ili_item.li_desc->lid_flags & XFS_LID_DIRTY) &&
> +         IS_I_VERSION(VFS_I(ip))) {
> +             inode_inc_iversion(VFS_I(ip));
> +             ip->i_d.di_changecount = VFS_I(ip)->i_version;
> +             flags |= XFS_ILOG_CORE;
> +     }
> +
>       tp->t_flags |= XFS_TRANS_DIRTY;
>       ip->i_itemp->ili_item.li_desc->lid_flags |= XFS_LID_DIRTY;
> 


<Prev in Thread] Current Thread [Next in Thread>