From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, amir73il@gmail.com
Subject: Re: [PATCH v2] xfs: update ctime and mtime on clone destinatation inodes
Date: Fri, 3 Feb 2017 10:08:26 -0800 [thread overview]
Message-ID: <20170203180826.GA31044@birch.djwong.org> (raw)
In-Reply-To: <20170203174541.GS9134@birch.djwong.org>
On Fri, Feb 03, 2017 at 09:45:41AM -0800, Darrick J. Wong wrote:
> [cc amir since he piped up about the v1 patch]
>
> On Fri, Feb 03, 2017 at 10:57:15AM +0100, Christoph Hellwig wrote:
> > We're changing both metadata and data, so we need to update the
> > timestamps for clone operations. Dedupe on the other hand does
> > not change file data, and only changes invisible metadata so the
> > timestamps should not be updated.
> >
> > This follows existing btrfs behavior.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> > fs/xfs/xfs_reflink.c | 13 ++++++++++---
> > 1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> > index d5a2cf2b469b..199ce0100bc6 100644
> > --- a/fs/xfs/xfs_reflink.c
> > +++ b/fs/xfs/xfs_reflink.c
> > @@ -961,13 +961,15 @@ STATIC int
> > xfs_reflink_update_dest(
> > struct xfs_inode *dest,
> > xfs_off_t newlen,
> > - xfs_extlen_t cowextsize)
> > + xfs_extlen_t cowextsize,
> > + bool is_dedupe)
> > {
> > struct xfs_mount *mp = dest->i_mount;
> > struct xfs_trans *tp;
> > int error;
> >
> > - if (newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0)
> > + if (is_dedupe &&
> > + newlen <= i_size_read(VFS_I(dest)) && cowextsize == 0 && is_dedupe)
> > return 0;
>
> Redundant is_dedupe tests here.
>
> I also wonder if we really /want/ to emulate the existing btrfs
> behavior, which seems to be:
>
> reflink: update mtime & ctime
> dedupe: do not update mtime or ctime
>
> In particular, dedupe changes the inode metadata, which should qualify
> for a ctime update, right?
OTOH, /me fishes out the discussion between mfasheh & zygo where they
discuss changing btrfs to avoid [cm]time updates on dedupe:
https://patchwork.kernel.org/patch/6683161/
So... <shrug> I'm willing to preserve the 'dedupe doesn't update
timestamps' behavior even though we're definitely changing di_nextents
(and possibly di_cowextsize).
(Though, you may note, I didn't write any code to update the timestamps
in the original patches, so clearly I'm not all that passionate either
way. :P)
--D
>
> --D
>
> > error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
> > @@ -988,6 +990,10 @@ xfs_reflink_update_dest(
> > dest->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE;
> > }
> >
> > + if (!is_dedupe) {
> > + xfs_trans_ichgtime(tp, dest,
> > + XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
> > + }
> > xfs_trans_log_inode(tp, dest, XFS_ILOG_CORE);
> >
> > error = xfs_trans_commit(tp);
> > @@ -1301,7 +1307,8 @@ xfs_reflink_remap_range(
> > !(dest->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
> > cowextsize = src->i_d.di_cowextsize;
> >
> > - ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize);
> > + ret = xfs_reflink_update_dest(dest, pos_out + len, cowextsize,
> > + is_dedupe);
> >
> > out_unlock:
> > xfs_iunlock(src, XFS_MMAPLOCK_EXCL);
> > --
> > 2.11.0
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-02-03 18:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 9:57 [PATCH v2] xfs: update ctime and mtime on clone destinatation inodes Christoph Hellwig
2017-02-03 17:45 ` Darrick J. Wong
2017-02-03 18:08 ` Darrick J. Wong [this message]
2017-02-03 19:50 ` Amir Goldstein
2017-02-03 20:13 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170203180826.GA31044@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=amir73il@gmail.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).