aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-06-27 02:04:59 -0400
committerBen Myers <bpm@sgi.com>2013-06-28 14:00:05 -0400
commitdc037ad7d24f3711e431a45c053b5d425995e9e4 (patch)
tree5a611ba5c6644992d3465d7f1b18267a9f5b43bf /fs/xfs
parentddf6ad01434e72bfc8423e1619abdaa0af9394a8 (diff)
xfs: implement inode change count
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@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_super.c4
-rw-r--r--fs/xfs/xfs_trans_inode.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 30ef68f8a390..e5e8b5ee8bfa 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1477,6 +1477,10 @@ xfs_fs_fill_super(
1477 sb->s_time_gran = 1; 1477 sb->s_time_gran = 1;
1478 set_posix_acl_flag(sb); 1478 set_posix_acl_flag(sb);
1479 1479
1480 /* version 5 superblocks support inode version counters. */
1481 if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
1482 sb->s_flags |= MS_I_VERSION;
1483
1480 error = xfs_mountfs(mp); 1484 error = xfs_mountfs(mp);
1481 if (error) 1485 if (error)
1482 goto out_filestream_unmount; 1486 goto out_filestream_unmount;
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index ac6d567704db..53dfe46f3680 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -112,6 +112,17 @@ xfs_trans_log_inode(
112 ASSERT(ip->i_itemp != NULL); 112 ASSERT(ip->i_itemp != NULL);
113 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 113 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
114 114
115 /*
116 * First time we log the inode in a transaction, bump the inode change
117 * counter if it is configured for this to occur.
118 */
119 if (!(ip->i_itemp->ili_item.li_desc->lid_flags & XFS_LID_DIRTY) &&
120 IS_I_VERSION(VFS_I(ip))) {
121 inode_inc_iversion(VFS_I(ip));
122 ip->i_d.di_changecount = VFS_I(ip)->i_version;
123 flags |= XFS_ILOG_CORE;
124 }
125
115 tp->t_flags |= XFS_TRANS_DIRTY; 126 tp->t_flags |= XFS_TRANS_DIRTY;
116 ip->i_itemp->ili_item.li_desc->lid_flags |= XFS_LID_DIRTY; 127 ip->i_itemp->ili_item.li_desc->lid_flags |= XFS_LID_DIRTY;
117 128