* [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP
@ 2026-10-29 16:28 Jeff Layton
2026-11-02 21:46 ` Jan Kara
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jeff Layton @ 2026-10-29 16:28 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Jan Kara
Cc: Christoph Hellwig, linux-fsdevel, linux-kernel, linux-api,
Jeff Layton
Userland has no way to tell whether a file's timestamps are multigrain,
i.e. whether successive changes after a query are guaranteed to yield
distinct timestamps.
Add STATX_ATTR_MULTIGRAIN_TIMESTAMP and set it in vfs_getattr_nosec()
when is_mgtime() is true (IOP_MGTIME is set from FS_MGTIME at inode
init). Always advertise it in attributes_mask.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
HCH suggested this when I posted the fstest for multigrain timestamps. I
think it makes sense. If this looks good, I'll plan to send a manpage
update for statx(2).
---
fs/stat.c | 6 +++++-
include/uapi/linux/stat.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/stat.c b/fs/stat.c
index a2e63c6c45b7..67b9f1784b23 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -206,9 +206,13 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
if (IS_VERITY(inode))
stat->attributes |= STATX_ATTR_VERITY;
+ if (is_mgtime(inode))
+ stat->attributes |= STATX_ATTR_MULTIGRAIN_TIMESTAMP;
+
stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT |
STATX_ATTR_DAX |
- STATX_ATTR_VERITY);
+ STATX_ATTR_VERITY |
+ STATX_ATTR_MULTIGRAIN_TIMESTAMP);
idmap = mnt_idmap(path->mnt);
if (inode->i_op->getattr) {
diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
index 1686861aae20..b978860590b1 100644
--- a/include/uapi/linux/stat.h
+++ b/include/uapi/linux/stat.h
@@ -255,6 +255,7 @@ struct statx {
#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
+#define STATX_ATTR_MULTIGRAIN_TIMESTAMP 0x00800000 /* File uses multigrain timestamps */
#endif /* _UAPI_LINUX_STAT_H */
---
base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
change-id: 20261029-mgtime-statx-26a229f9c3b4
Best regards,
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP
2026-10-29 16:28 [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP Jeff Layton
@ 2026-11-02 21:46 ` Jan Kara
2026-11-03 7:46 ` Christoph Hellwig
2026-11-05 21:53 ` Christian Brauner
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2026-11-02 21:46 UTC (permalink / raw)
To: Jeff Layton
Cc: Alexander Viro, Christian Brauner, Jan Kara, Christoph Hellwig,
linux-fsdevel, linux-kernel, linux-api
On Thu 29-10-26 12:28:16, Jeff Layton wrote:
> Userland has no way to tell whether a file's timestamps are multigrain,
> i.e. whether successive changes after a query are guaranteed to yield
> distinct timestamps.
>
> Add STATX_ATTR_MULTIGRAIN_TIMESTAMP and set it in vfs_getattr_nosec()
> when is_mgtime() is true (IOP_MGTIME is set from FS_MGTIME at inode
> init). Always advertise it in attributes_mask.
>
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Makes sense to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> HCH suggested this when I posted the fstest for multigrain timestamps. I
> think it makes sense. If this looks good, I'll plan to send a manpage
> update for statx(2).
> ---
> fs/stat.c | 6 +++++-
> include/uapi/linux/stat.h | 1 +
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/stat.c b/fs/stat.c
> index a2e63c6c45b7..67b9f1784b23 100644
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -206,9 +206,13 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
> if (IS_VERITY(inode))
> stat->attributes |= STATX_ATTR_VERITY;
>
> + if (is_mgtime(inode))
> + stat->attributes |= STATX_ATTR_MULTIGRAIN_TIMESTAMP;
> +
> stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT |
> STATX_ATTR_DAX |
> - STATX_ATTR_VERITY);
> + STATX_ATTR_VERITY |
> + STATX_ATTR_MULTIGRAIN_TIMESTAMP);
>
> idmap = mnt_idmap(path->mnt);
> if (inode->i_op->getattr) {
> diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
> index 1686861aae20..b978860590b1 100644
> --- a/include/uapi/linux/stat.h
> +++ b/include/uapi/linux/stat.h
> @@ -255,6 +255,7 @@ struct statx {
> #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
> #define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
> #define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */
> +#define STATX_ATTR_MULTIGRAIN_TIMESTAMP 0x00800000 /* File uses multigrain timestamps */
>
>
> #endif /* _UAPI_LINUX_STAT_H */
>
> ---
> base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
> change-id: 20261029-mgtime-statx-26a229f9c3b4
>
> Best regards,
> --
> Jeff Layton <jlayton@kernel.org>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP
2026-10-29 16:28 [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP Jeff Layton
2026-11-02 21:46 ` Jan Kara
@ 2026-11-03 7:46 ` Christoph Hellwig
2026-11-05 21:53 ` Christian Brauner
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-11-03 7:46 UTC (permalink / raw)
To: Jeff Layton
Cc: Alexander Viro, Christian Brauner, Jan Kara, Christoph Hellwig,
linux-fsdevel, linux-kernel, linux-api
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP
2026-10-29 16:28 [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP Jeff Layton
2026-11-02 21:46 ` Jan Kara
2026-11-03 7:46 ` Christoph Hellwig
@ 2026-11-05 21:53 ` Christian Brauner
2 siblings, 0 replies; 4+ messages in thread
From: Christian Brauner @ 2026-11-05 21:53 UTC (permalink / raw)
To: Alexander Viro, Jan Kara, Jeff Layton
Cc: Christoph Hellwig, linux-fsdevel, linux-kernel, linux-api
On Thu, 29 Oct 2026 12:28:16 -0400, Jeff Layton wrote:
> Userland has no way to tell whether a file's timestamps are multigrain,
> i.e. whether successive changes after a query are guaranteed to yield
> distinct timestamps.
>
> Add STATX_ATTR_MULTIGRAIN_TIMESTAMP and set it in vfs_getattr_nosec()
> when is_mgtime() is true (IOP_MGTIME is set from FS_MGTIME at inode
> init). Always advertise it in attributes_mask.
>
> [...]
Applied to the vfs-7.5.misc branch of the vfs/vfs.git tree.
Patches in the vfs-7.5.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.5.misc
[1/1] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP
https://git.kernel.org/vfs/vfs/c/81f2cc03b537
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-05 21:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 16:28 [PATCH] statx: add STATX_ATTR_MULTIGRAIN_TIMESTAMP Jeff Layton
2026-11-02 21:46 ` Jan Kara
2026-11-03 7:46 ` Christoph Hellwig
2026-11-05 21:53 ` Christian Brauner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.