summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_trans_inode.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-06-27 10:04:59 +0400
committerBen Myers <bpm@sgi.com>2013-06-28 22:00:05 +0400
commitdc037ad7d24f3711e431a45c053b5d425995e9e4 (patch)
tree5a611ba5c6644992d3465d7f1b18267a9f5b43bf /fs/xfs/xfs_trans_inode.c
parentddf6ad01434e72bfc8423e1619abdaa0af9394a8 (diff)
downloadlinux-dc037ad7d24f3711e431a45c053b5d425995e9e4.tar.xz
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/xfs_trans_inode.c')
-rw-r--r--fs/xfs/xfs_trans_inode.c11
1 files changed, 11 insertions, 0 deletions
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(
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;