From: Benjamin Coddington <bcodding@redhat.com>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org,
Lance Shelton <lance.shelton@hammerspace.com>,
Jeff Layton <jlayton@kernel.org>
Subject: Re: [PATCH v3 2/3] nfs: Add timecreate to nfs inode
Date: Thu, 12 Jun 2025 11:28:20 -0400 [thread overview]
Message-ID: <6D9EC0BF-E2C0-4644-BC33-6696DA66AE69@redhat.com> (raw)
In-Reply-To: <1e3677b0655fa2bbaba0817b41d111d94a06e5ee.1748515333.git.bcodding@redhat.com>
On 29 May 2025, at 6:45, Benjamin Coddington wrote:
> From: Anne Marie Merritt <annemarie.merritt@primarydata.com>
>
> Add tracking of the create time (a.k.a. btime) along with corresponding
> bitfields, request, and decode xdr routines.
>
> Signed-off-by: Anne Marie Merritt <annemarie.merritt@primarydata.com>
> Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
> fs/nfs/inode.c | 17 +++++++++++++++--
> fs/nfs/nfs4proc.c | 14 +++++++++++++-
> fs/nfs/nfs4xdr.c | 24 ++++++++++++++++++++++++
> fs/nfs/nfstrace.h | 3 ++-
> include/linux/nfs_fs.h | 8 ++++++++
> include/linux/nfs_xdr.h | 3 +++
> 6 files changed, 65 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index 160f3478a835..2e36188a855b 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -197,6 +197,7 @@ void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
> if (!(flags & NFS_INO_REVAL_FORCED))
> flags &= ~(NFS_INO_INVALID_MODE |
> NFS_INO_INVALID_OTHER |
> + NFS_INO_INVALID_BTIME |
> NFS_INO_INVALID_XATTR);
> flags &= ~(NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_SIZE);
> }
> @@ -522,6 +523,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
> inode_set_atime(inode, 0, 0);
> inode_set_mtime(inode, 0, 0);
> inode_set_ctime(inode, 0, 0);
> + memset(&nfsi->btime, 0, sizeof(nfsi->btime));
> inode_set_iversion_raw(inode, 0);
> inode->i_size = 0;
> clear_nlink(inode);
> @@ -545,6 +547,10 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
> inode_set_ctime_to_ts(inode, fattr->ctime);
> else if (fattr_supported & NFS_ATTR_FATTR_CTIME)
> nfs_set_cache_invalid(inode, NFS_INO_INVALID_CTIME);
> + if (fattr->valid & NFS_ATTR_FATTR_BTIME)
> + nfsi->btime = fattr->btime;
> + else if (fattr_supported & NFS_ATTR_FATTR_BTIME)
> + nfs_set_cache_invalid(inode, NFS_INO_INVALID_BTIME);
> if (fattr->valid & NFS_ATTR_FATTR_CHANGE)
> inode_set_iversion_raw(inode, fattr->change_attr);
> else
> @@ -1900,7 +1906,7 @@ static int nfs_inode_finish_partial_attr_update(const struct nfs_fattr *fattr,
> NFS_INO_INVALID_ATIME | NFS_INO_INVALID_CTIME |
> NFS_INO_INVALID_MTIME | NFS_INO_INVALID_SIZE |
> NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_OTHER |
> - NFS_INO_INVALID_NLINK;
> + NFS_INO_INVALID_NLINK | NFS_INO_INVALID_BTIME;
> unsigned long cache_validity = NFS_I(inode)->cache_validity;
> enum nfs4_change_attr_type ctype = NFS_SERVER(inode)->change_attr_type;
>
> @@ -2261,7 +2267,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
> | NFS_INO_INVALID_BLOCKS
> | NFS_INO_INVALID_NLINK
> | NFS_INO_INVALID_MODE
> - | NFS_INO_INVALID_OTHER;
> + | NFS_INO_INVALID_OTHER
> + | NFS_INO_INVALID_BTIME;
> if (S_ISDIR(inode->i_mode))
> nfs_force_lookup_revalidate(inode);
> attr_changed = true;
> @@ -2295,6 +2302,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
> nfsi->cache_validity |=
> save_cache_validity & NFS_INO_INVALID_CTIME;
>
> + if (fattr->valid & NFS_ATTR_FATTR_BTIME)
> + nfsi->btime = fattr->btime;
> + else if (fattr_supported & NFS_ATTR_FATTR_BTIME)
> + nfsi->cache_validity |=
> + save_cache_validity & NFS_INO_INVALID_BTIME;
> +
> /* Check if our cached file size is stale */
> if (fattr->valid & NFS_ATTR_FATTR_SIZE) {
> new_isize = nfs_size_to_loff_t(fattr->size);
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index b1d2122bd5a7..f7fb61f805a3 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -222,6 +222,7 @@ const u32 nfs4_fattr_bitmap[3] = {
> | FATTR4_WORD1_RAWDEV
> | FATTR4_WORD1_SPACE_USED
> | FATTR4_WORD1_TIME_ACCESS
> + | FATTR4_WORD1_TIME_CREATE
> | FATTR4_WORD1_TIME_METADATA
> | FATTR4_WORD1_TIME_MODIFY
> | FATTR4_WORD1_MOUNTED_ON_FILEID,
> @@ -243,6 +244,7 @@ static const u32 nfs4_pnfs_open_bitmap[3] = {
> | FATTR4_WORD1_RAWDEV
> | FATTR4_WORD1_SPACE_USED
> | FATTR4_WORD1_TIME_ACCESS
> + | FATTR4_WORD1_TIME_CREATE
> | FATTR4_WORD1_TIME_METADATA
> | FATTR4_WORD1_TIME_MODIFY,
> FATTR4_WORD2_MDSTHRESHOLD
> @@ -323,6 +325,9 @@ static void nfs4_bitmap_copy_adjust(__u32 *dst, const __u32 *src,
> if (!(cache_validity & NFS_INO_INVALID_OTHER))
> dst[1] &= ~(FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP);
>
> + if (!(cache_validity & NFS_INO_INVALID_BTIME))
> + dst[1] &= ~FATTR4_WORD1_TIME_CREATE;
> +
> if (nfs_have_delegated_mtime(inode)) {
> if (!(cache_validity & NFS_INO_INVALID_ATIME))
> dst[1] &= ~FATTR4_WORD1_TIME_ACCESS;
> @@ -1307,7 +1312,8 @@ nfs4_update_changeattr_locked(struct inode *inode,
> NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL |
> NFS_INO_INVALID_SIZE | NFS_INO_INVALID_OTHER |
> NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_NLINK |
> - NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR;
> + NFS_INO_INVALID_MODE | NFS_INO_INVALID_BTIME |
> + NFS_INO_INVALID_XATTR;
> nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
> }
> nfsi->attrtimeo_timestamp = jiffies;
> @@ -4047,6 +4053,10 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
> server->fattr_valid &= ~NFS_ATTR_FATTR_CTIME;
> if (!(res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY))
> server->fattr_valid &= ~NFS_ATTR_FATTR_MTIME;
> + if (!(res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY))
> + server->fattr_valid &= ~NFS_ATTR_FATTR_MTIME;
^^
I just noticed this duplicates the two lines right above -- not harmful, but
probably needs a cleanup.. let me know if I should repost or if this can be
fixed up in a maintainers tree.
Ben
next prev parent reply other threads:[~2025-06-12 15:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 10:45 [PATCH v3 0/3] NFS Client btime support Benjamin Coddington
2025-05-29 10:45 ` [PATCH v3 1/3] Expand the type of nfs_fattr->valid Benjamin Coddington
2025-05-29 10:45 ` [PATCH v3 2/3] nfs: Add timecreate to nfs inode Benjamin Coddington
2025-06-12 7:22 ` kernel test robot
2025-06-12 15:32 ` Benjamin Coddington
2025-06-17 8:48 ` Oliver Sang
2025-06-12 15:28 ` Benjamin Coddington [this message]
2025-05-29 10:45 ` [PATCH v3 3/3] NFS: Return the file btime in the statx results when appropriate Benjamin Coddington
2025-05-29 11:06 ` [PATCH v3 0/3] NFS Client btime support Jeff Layton
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=6D9EC0BF-E2C0-4644-BC33-6696DA66AE69@redhat.com \
--to=bcodding@redhat.com \
--cc=anna@kernel.org \
--cc=jlayton@kernel.org \
--cc=lance.shelton@hammerspace.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@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