diff options
author | Jeff Layton <jlayton@redhat.com> | 2016-12-04 17:29:46 +0300 |
---|---|---|
committer | Jeff Layton <jlayton@kernel.org> | 2023-01-26 15:00:06 +0300 |
commit | a1175d6b1bdaf4f74eda47ab18eb44194f9cb796 (patch) | |
tree | 119118d44cd9bb0ad0b9ac5407b91dac9ec3d3da /include/linux/stat.h | |
parent | a3bb710383cbca2a0f1f4e5a1c7ef8dde14eff95 (diff) | |
download | linux-a1175d6b1bdaf4f74eda47ab18eb44194f9cb796.tar.xz |
vfs: plumb i_version handling into struct kstat
The NFS server has a lot of special handling for different types of
change attribute access, depending on the underlying filesystem. In
most cases, it's doing a getattr anyway and then fetching that value
after the fact.
Rather that do that, add a new STATX_CHANGE_COOKIE flag that is a
kernel-only symbol (for now). If requested and getattr can implement it,
it can fill out this field. For IS_I_VERSION inodes, add a generic
implementation in vfs_getattr_nosec. Take care to mask
STATX_CHANGE_COOKIE off in requests from userland and in the result
mask.
Since not all filesystems can give the same guarantees of monotonicity,
claim a STATX_ATTR_CHANGE_MONOTONIC flag that filesystems can set to
indicate that they offer an i_version value that can never go backward.
Eventually if we decide to make the i_version available to userland, we
can just designate a field for it in struct statx, and move the
STATX_CHANGE_COOKIE definition to the uapi header.
Reviewed-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Diffstat (limited to 'include/linux/stat.h')
-rw-r--r-- | include/linux/stat.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/stat.h b/include/linux/stat.h index ff277ced50e9..52150570d37a 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -52,6 +52,15 @@ struct kstat { u64 mnt_id; u32 dio_mem_align; u32 dio_offset_align; + u64 change_cookie; }; +/* These definitions are internal to the kernel for now. Mainly used by nfsd. */ + +/* mask values */ +#define STATX_CHANGE_COOKIE 0x40000000U /* Want/got stx_change_attr */ + +/* file attribute values */ +#define STATX_ATTR_CHANGE_MONOTONIC 0x8000000000000000ULL /* version monotonically increases */ + #endif |