Message ID | 20230725-mgctime-v6-5-a794c2b7abca@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2550749vqg; Tue, 25 Jul 2023 08:30:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlEr4xoI9B57LTF2/UgobwLaZGBRAUNzUASdhH31GPE+oWm0n/loe5OF9C2hxcI86yRoswqG X-Received: by 2002:a05:6e02:1bc3:b0:348:e180:831d with SMTP id x3-20020a056e021bc300b00348e180831dmr2513646ilv.20.1690299057131; Tue, 25 Jul 2023 08:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690299057; cv=none; d=google.com; s=arc-20160816; b=zzbFrNBBm6KxULjDR2Zqshyawq9EG8R2XtY/gybBd/O0M3TogYT/X4Y9ou6SoiZc6a zV6N6pH4CqsEKneZ0eroP+d/0CaiQrF8xBkVKB/vtdBClycYXtCpancNAJUL6PteL9sa by64s995xM59Mr4q55goj557xUvL7ueMvzECnbUdN9Fxll7X1ZqCEETtI0tBu/flPzXb FqDy6aTGhgDDMB0ig/RbxJCACf2EBSdtqoFaLSHrssqcOmaxZPwFcrIdq6j6laaycwGs Uuz83In0/SxfKyYKLxcfJrBokaj0iPaQwiXvOb7IRkCYJPmL4YORd7EqF7Q0i+hXKtj7 Scnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=8tog9VQDhF1pkUSuCTCla4dx+TOV7kNYrS1AT7YdfDE=; fh=K9wjQ6SuOoTjgwO2Ijvv6kdOfz8IJvcrrlyk5lYYFhE=; b=XTzNo31nhmy9byvCeP1thrb6JcBtSZj2+AJozAbAwplpmGarbPtR93gqXqbW7zGpz3 GplqzD2rUsd9Edgvl56aPndWtzO/FeOpurmiLHCA0EaAkhsDQI4Lz5ag++v0odgLIRKv +LcppkXZLsYjvjYKtfaaED93jy17e9lrKuP+r0nBT4DokLogFyc0w8tG0/Hl+jdqt3I7 okm9/E9Db+Dv37pginAaSXaMwPVVp1Vx5pCr83v6Slq9LQ2yVL3XS1u9H9SxE/kr+1aj 1vAWJia0uwN3/0eXPVkDe+j36Wg9QdG3ra0nOS9ENsPT9ZHGHm/MUkr9tvDCRPadEYXy JaBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=alZ0gxYy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cq6-20020a056a00330600b0066d93ab678asi11744812pfb.16.2023.07.25.08.30.44; Tue, 25 Jul 2023 08:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=alZ0gxYy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbjGYPAe (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Tue, 25 Jul 2023 11:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbjGYO7o (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 10:59:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9BEA270E; Tue, 25 Jul 2023 07:59:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DC5D6178F; Tue, 25 Jul 2023 14:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B79EC43391; Tue, 25 Jul 2023 14:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690297163; bh=2wyPg6r9LV0rMw3rwiDdQz97NuQm6trs7Tz3krXz824=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=alZ0gxYy+IkbheJTJP3qA2iEk4eNxl7eSGrfIs+MxZSUI5FjVlgNKYG5ztKp3Air1 gU0wFT7ZCjZL97L1pSzjV2gLHwstvP7MB6Z34if0oOLpUl4yCyGO8lfYx/uM34yD1h 9LZWMe7lIPe5nXOW07yRzmCzjlvxPbX1ZXW44vy0Pu6/7l4Z9vUIrk0XHzxH7FLSn0 Zok2yVBZaZarTyEeN65Qsn24kYQ8HA3DH5VcBZbywjGCZx1K80THvInEU4Q0j5ZfkG j9JBRdKpKVrkp5Bentl7GIljUepcCHIJlPZHHNjpgnyCCT/2W0WCPCo/TCZpXZWlzT vUIjlakd0S9oA== From: Jeff Layton <jlayton@kernel.org> Date: Tue, 25 Jul 2023 10:58:18 -0400 Subject: [PATCH v6 5/7] xfs: switch to multigrain timestamps MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230725-mgctime-v6-5-a794c2b7abca@kernel.org> References: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> In-Reply-To: <20230725-mgctime-v6-0-a794c2b7abca@kernel.org> To: Eric Van Hensbergen <ericvh@kernel.org>, Latchesar Ionkov <lucho@ionkov.net>, Dominique Martinet <asmadeus@codewreck.org>, Christian Schoenebeck <linux_oss@crudebyte.com>, David Howells <dhowells@redhat.com>, Marc Dionne <marc.dionne@auristor.com>, Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>, David Sterba <dsterba@suse.com>, Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>, Jan Harkes <jaharkes@cs.cmu.edu>, coda@cs.cmu.edu, Tyler Hicks <code@tyhicks.com>, Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>, Yue Hu <huyue2@coolpad.com>, Jeffle Xu <jefflexu@linux.alibaba.com>, Namjae Jeon <linkinjeon@kernel.org>, Sungjong Seo <sj1557.seo@samsung.com>, Jan Kara <jack@suse.com>, Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca>, Jaegeuk Kim <jaegeuk@kernel.org>, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>, Miklos Szeredi <miklos@szeredi.hu>, Bob Peterson <rpeterso@redhat.com>, Andreas Gruenbacher <agruenba@redhat.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Tejun Heo <tj@kernel.org>, Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, Konstantin Komarov <almaz.alexandrovich@paragon-software.com>, Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>, Joseph Qi <joseph.qi@linux.alibaba.com>, Mike Marshall <hubcap@omnibond.com>, Martin Brandenburg <martin@omnibond.com>, Luis Chamberlain <mcgrof@kernel.org>, Kees Cook <keescook@chromium.org>, Iurii Zaikin <yzaikin@google.com>, Steve French <sfrench@samba.org>, Paulo Alcantara <pc@manguebit.com>, Ronnie Sahlberg <lsahlber@redhat.com>, Shyam Prasad N <sprasad@microsoft.com>, Tom Talpey <tom@talpey.com>, Sergey Senozhatsky <senozhatsky@chromium.org>, Richard Weinberger <richard@nod.at>, Hans de Goede <hdegoede@redhat.com>, Hugh Dickins <hughd@google.com>, Andrew Morton <akpm@linux-foundation.org>, "Darrick J. Wong" <djwong@kernel.org> Cc: Dave Chinner <david@fromorbit.com>, Anthony Iliopoulos <ailiop@suse.com>, v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2386; i=jlayton@kernel.org; h=from:subject:message-id; bh=2wyPg6r9LV0rMw3rwiDdQz97NuQm6trs7Tz3krXz824=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBkv+MkP4yvT+W3sEtTwUyKNN0Eo+qCCd0hAxl+0 h4C0zNUhdGJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZL/jJAAKCRAADmhBGVaC FeBjEACUyo8TVL0skmaKxmt9N9nKbRC1TSdvVtM4yiwxJ8jEsCm89ngnhuv/BuJpe41Lx5wb/iz dmMFWHzJRu2aCWptETR3OPCB2GrAR7iNntPS9+gNC6m+5BqrCE02YO3lUtUaRUAYl5OC8Ri6BBQ OEGhtGXHAEQdKV6DErIItzKARajHjYVOGXQMptrAmfVeqZrMgMdnjXv1BkrB7vTxPnEIiZvpXc6 teMkRXV34FsYAQxvcwm57Mmv+ZzhSEhzQj+7Hi5Fd+/iThWp2ImD7wKtbimsgjidI9ckdD0c5hK 1Xoqn16mf7rIUqDTVbuzYbGQI7meLwVcGOlqdqnPMN1HtuSDkogTkGd77hv9NxndH8aK+N90UKH Ks08xZN4yQjcuR2zIFRUCLsaC33fU+/2m8VEH3iIAIDEuqCogY30aCPWiBS4KwHktS1ry5SwFbm xZAhqbegcfX5h0NU2bjonVVMYypC3Ec8Hxs4E7nRLhsdTAF1PwzkcKRfJjflMTm3AVDbGhzr6a2 iNqi2cULBGY/OkiIc97k83/uxrYZSoRVPtrYbRcPDbTmukKm1rRd6io2dU5p1c3Q6EjIhCyoi2B JMPklYNmRVzbzK/y3yeiwwfKpR8AeSRX5pHEDo1ALd8eLd8NtlYkhsN0E3WvbTaYS8RS42Ee4xk v57B1AdBsJ4Ldbg== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772407023966520298 X-GMAIL-MSGID: 1772407023966520298 |
Series |
fs: implement multigrain timestamps
|
|
Commit Message
Jeff Layton
July 25, 2023, 2:58 p.m. UTC
Enable multigrain timestamps, which should ensure that there is an
apparent change to the timestamp whenever it has been written after
being actively observed via getattr.
Also, anytime the mtime changes, the ctime must also change, and those
are now the only two options for xfs_trans_ichgtime. Have that function
unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is
always set.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/xfs/libxfs/xfs_trans_inode.c | 6 +++---
fs/xfs/xfs_iops.c | 4 ++--
fs/xfs/xfs_super.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
Comments
On Tue, Jul 25, 2023 at 10:58:18AM -0400, Jeff Layton wrote: > Enable multigrain timestamps, which should ensure that there is an > apparent change to the timestamp whenever it has been written after > being actively observed via getattr. > > Also, anytime the mtime changes, the ctime must also change, and those > are now the only two options for xfs_trans_ichgtime. Have that function > unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is > always set. > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > --- > fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- > fs/xfs/xfs_iops.c | 4 ++-- > fs/xfs/xfs_super.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c > index 6b2296ff248a..ad22656376d3 100644 > --- a/fs/xfs/libxfs/xfs_trans_inode.c > +++ b/fs/xfs/libxfs/xfs_trans_inode.c > @@ -62,12 +62,12 @@ xfs_trans_ichgtime( > ASSERT(tp); > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); > > - tv = current_time(inode); > + /* If the mtime changes, then ctime must also change */ > + ASSERT(flags & XFS_ICHGTIME_CHG); > > + tv = inode_set_ctime_current(inode); > if (flags & XFS_ICHGTIME_MOD) > inode->i_mtime = tv; > - if (flags & XFS_ICHGTIME_CHG) > - inode_set_ctime_to_ts(inode, tv); > if (flags & XFS_ICHGTIME_CREATE) > ip->i_crtime = tv; > } > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > index 3a9363953ef2..3f89ef5a2820 100644 > --- a/fs/xfs/xfs_iops.c > +++ b/fs/xfs/xfs_iops.c > @@ -573,10 +573,10 @@ xfs_vn_getattr( > stat->gid = vfsgid_into_kgid(vfsgid); > stat->ino = ip->i_ino; > stat->atime = inode->i_atime; > - stat->mtime = inode->i_mtime; > - stat->ctime = inode_get_ctime(inode); > stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); > > + fill_mg_cmtime(request_mask, inode, stat); Huh. I would've thought @stat would come first since that's what we're acting upon, but ... eh. :) If everyone else is ok with the fill_mg_cmtime signature, Acked-by: Darrick J. Wong <djwong@kernel.org> --D > + > if (xfs_has_v3inodes(mp)) { > if (request_mask & STATX_BTIME) { > stat->result_mask |= STATX_BTIME; > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c > index 818510243130..4b10edb2c972 100644 > --- a/fs/xfs/xfs_super.c > +++ b/fs/xfs/xfs_super.c > @@ -2009,7 +2009,7 @@ static struct file_system_type xfs_fs_type = { > .init_fs_context = xfs_init_fs_context, > .parameters = xfs_fs_parameters, > .kill_sb = kill_block_super, > - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, > + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, > }; > MODULE_ALIAS_FS("xfs"); > > > -- > 2.41.0 >
On Wed, 2023-08-02 at 10:48 -0700, Darrick J. Wong wrote: > On Tue, Jul 25, 2023 at 10:58:18AM -0400, Jeff Layton wrote: > > Enable multigrain timestamps, which should ensure that there is an > > apparent change to the timestamp whenever it has been written after > > being actively observed via getattr. > > > > Also, anytime the mtime changes, the ctime must also change, and those > > are now the only two options for xfs_trans_ichgtime. Have that function > > unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is > > always set. > > > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > > --- > > fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- > > fs/xfs/xfs_iops.c | 4 ++-- > > fs/xfs/xfs_super.c | 2 +- > > 3 files changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c > > index 6b2296ff248a..ad22656376d3 100644 > > --- a/fs/xfs/libxfs/xfs_trans_inode.c > > +++ b/fs/xfs/libxfs/xfs_trans_inode.c > > @@ -62,12 +62,12 @@ xfs_trans_ichgtime( > > ASSERT(tp); > > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); > > > > - tv = current_time(inode); > > + /* If the mtime changes, then ctime must also change */ > > + ASSERT(flags & XFS_ICHGTIME_CHG); > > > > + tv = inode_set_ctime_current(inode); > > if (flags & XFS_ICHGTIME_MOD) > > inode->i_mtime = tv; > > - if (flags & XFS_ICHGTIME_CHG) > > - inode_set_ctime_to_ts(inode, tv); > > if (flags & XFS_ICHGTIME_CREATE) > > ip->i_crtime = tv; > > } > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > > index 3a9363953ef2..3f89ef5a2820 100644 > > --- a/fs/xfs/xfs_iops.c > > +++ b/fs/xfs/xfs_iops.c > > @@ -573,10 +573,10 @@ xfs_vn_getattr( > > stat->gid = vfsgid_into_kgid(vfsgid); > > stat->ino = ip->i_ino; > > stat->atime = inode->i_atime; > > - stat->mtime = inode->i_mtime; > > - stat->ctime = inode_get_ctime(inode); > > stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); > > > > + fill_mg_cmtime(request_mask, inode, stat); > > Huh. I would've thought @stat would come first since that's what we're > acting upon, but ... eh. :) > > If everyone else is ok with the fill_mg_cmtime signature, > Acked-by: Darrick J. Wong <djwong@kernel.org> > > Good point. We can change the signature. I think xfs is the only caller outside of the generic vfs right now, and it'd be best to do it now. Christian, would you prefer that I send an updated series, or patches on top of vfs.ctime that can be folded in?
On Wed, Aug 02, 2023 at 02:21:49PM -0400, Jeff Layton wrote: > On Wed, 2023-08-02 at 10:48 -0700, Darrick J. Wong wrote: > > On Tue, Jul 25, 2023 at 10:58:18AM -0400, Jeff Layton wrote: > > > Enable multigrain timestamps, which should ensure that there is an > > > apparent change to the timestamp whenever it has been written after > > > being actively observed via getattr. > > > > > > Also, anytime the mtime changes, the ctime must also change, and those > > > are now the only two options for xfs_trans_ichgtime. Have that function > > > unconditionally bump the ctime, and ASSERT that XFS_ICHGTIME_CHG is > > > always set. > > > > > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > > > --- > > > fs/xfs/libxfs/xfs_trans_inode.c | 6 +++--- > > > fs/xfs/xfs_iops.c | 4 ++-- > > > fs/xfs/xfs_super.c | 2 +- > > > 3 files changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c > > > index 6b2296ff248a..ad22656376d3 100644 > > > --- a/fs/xfs/libxfs/xfs_trans_inode.c > > > +++ b/fs/xfs/libxfs/xfs_trans_inode.c > > > @@ -62,12 +62,12 @@ xfs_trans_ichgtime( > > > ASSERT(tp); > > > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); > > > > > > - tv = current_time(inode); > > > + /* If the mtime changes, then ctime must also change */ > > > + ASSERT(flags & XFS_ICHGTIME_CHG); > > > > > > + tv = inode_set_ctime_current(inode); > > > if (flags & XFS_ICHGTIME_MOD) > > > inode->i_mtime = tv; > > > - if (flags & XFS_ICHGTIME_CHG) > > > - inode_set_ctime_to_ts(inode, tv); > > > if (flags & XFS_ICHGTIME_CREATE) > > > ip->i_crtime = tv; > > > } > > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > > > index 3a9363953ef2..3f89ef5a2820 100644 > > > --- a/fs/xfs/xfs_iops.c > > > +++ b/fs/xfs/xfs_iops.c > > > @@ -573,10 +573,10 @@ xfs_vn_getattr( > > > stat->gid = vfsgid_into_kgid(vfsgid); > > > stat->ino = ip->i_ino; > > > stat->atime = inode->i_atime; > > > - stat->mtime = inode->i_mtime; > > > - stat->ctime = inode_get_ctime(inode); > > > stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); > > > > > > + fill_mg_cmtime(request_mask, inode, stat); > > > > Huh. I would've thought @stat would come first since that's what we're > > acting upon, but ... eh. :) > > > > If everyone else is ok with the fill_mg_cmtime signature, > > Acked-by: Darrick J. Wong <djwong@kernel.org> > > > > > > Good point. We can change the signature. I think xfs is the only caller > outside of the generic vfs right now, and it'd be best to do it now. > > Christian, would you prefer that I send an updated series, or patches on > top of vfs.ctime that can be folded in? Let's fold instead of inundate everyone with almost 100 patches. When I'll apply I'll remind everyone where the series can be pulled from anyway.
diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c index 6b2296ff248a..ad22656376d3 100644 --- a/fs/xfs/libxfs/xfs_trans_inode.c +++ b/fs/xfs/libxfs/xfs_trans_inode.c @@ -62,12 +62,12 @@ xfs_trans_ichgtime( ASSERT(tp); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); - tv = current_time(inode); + /* If the mtime changes, then ctime must also change */ + ASSERT(flags & XFS_ICHGTIME_CHG); + tv = inode_set_ctime_current(inode); if (flags & XFS_ICHGTIME_MOD) inode->i_mtime = tv; - if (flags & XFS_ICHGTIME_CHG) - inode_set_ctime_to_ts(inode, tv); if (flags & XFS_ICHGTIME_CREATE) ip->i_crtime = tv; } diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 3a9363953ef2..3f89ef5a2820 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -573,10 +573,10 @@ xfs_vn_getattr( stat->gid = vfsgid_into_kgid(vfsgid); stat->ino = ip->i_ino; stat->atime = inode->i_atime; - stat->mtime = inode->i_mtime; - stat->ctime = inode_get_ctime(inode); stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks); + fill_mg_cmtime(request_mask, inode, stat); + if (xfs_has_v3inodes(mp)) { if (request_mask & STATX_BTIME) { stat->result_mask |= STATX_BTIME; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 818510243130..4b10edb2c972 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -2009,7 +2009,7 @@ static struct file_system_type xfs_fs_type = { .init_fs_context = xfs_init_fs_context, .parameters = xfs_fs_parameters, .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME, }; MODULE_ALIAS_FS("xfs");