xfs
[Top] [All Lists]

[PATCH 05/28] xfs: always log timestamp updates in xfs_setattr_size

To: xfs@xxxxxxxxxxx
Subject: [PATCH 05/28] xfs: always log timestamp updates in xfs_setattr_size
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 07 Jul 2011 07:05:40 -0400
References: <20110707110535.205001532@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
Get rid of the special case where we use unlogged timestamp updates for
a truncate to the current inode size, and just call xfs_setattr_nonsize
for it to treat it like a utimes calls.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Alex Elder <aelder@xxxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

Index: xfs/fs/xfs/linux-2.6/xfs_iops.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_iops.c        2011-06-30 00:11:54.876715732 
+0200
+++ xfs/fs/xfs/linux-2.6/xfs_iops.c     2011-06-30 09:02:46.606760906 +0200
@@ -773,14 +773,15 @@ xfs_setattr_size(
         */
        if (iattr->ia_size == 0 &&
            ip->i_size == 0 && ip->i_d.di_nextents == 0) {
-               xfs_iunlock(ip, XFS_ILOCK_EXCL);
-               lock_flags &= ~XFS_ILOCK_EXCL;
-               if (mask & ATTR_CTIME) {
-                       inode->i_mtime = inode->i_ctime =
-                                       current_fs_time(inode->i_sb);
-                       xfs_mark_inode_dirty_sync(ip);
-               }
-               goto out_unlock;
+               if (!(mask & (ATTR_CTIME|ATTR_MTIME)))
+                       goto out_unlock;
+
+               /*
+                * Use the regular setattr path to update the timestamps.
+                */
+               xfs_iunlock(ip, lock_flags);
+               iattr->ia_valid &= ~ATTR_SIZE;
+               return xfs_setattr_nonsize(ip, iattr, 0);
        }
 
        /*

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