xfs
[Top] [All Lists]

Re: [PATCH 2/2] xfs: always log timestamp updates in xfs_setattr_size

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/2] xfs: always log timestamp updates in xfs_setattr_size
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 21 Jun 2011 11:22:31 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20110617131556.GA5682@xxxxxxxxxxxxx>
References: <20110617131519.GA2822@xxxxxxxxxxxxx> <20110617131556.GA5682@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
On Fri, Jun 17, 2011 at 09:15:56AM -0400, Christoph Hellwig wrote:
> 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_simple
> for it to treat it like a utimes calls.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 
> Index: xfs/fs/xfs/linux-2.6/xfs_iops.c
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_iops.c      2011-05-23 14:29:07.815944904 
> +0200
> +++ xfs/fs/xfs/linux-2.6/xfs_iops.c   2011-05-23 14:29:26.067946531 +0200
> @@ -776,14 +776,16 @@ 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))
> +                     goto out_unlock;
> +
> +             /*
> +              * Use the regular setattr path to update the timestamps.
> +              */
> +             xfs_iunlock(ip, lock_flags);
> +             iattr->ia_valid &= ~ATTR_SIZE;
> +             iattr->ia_valid |= ATTR_MTIME;
> +             return xfs_setattr_simple(ip, iattr, 0);
>       }

Seems like a sane thing to do to me ;)

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

-- 
Dave Chinner
david@xxxxxxxxxxxxx

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