Since we now have LOOKUP_CACHED to only perform a fast lookup of the dentry cache for path resolution, expose this as AT_STATX_CACHED to provide the same functionality on the statx side. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- fs/stat.c | 4 +++- include/uapi/linux/fcntl.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/stat.c b/fs/stat.c index dacecdda2e79..f42d6fa1ec20 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -171,7 +171,7 @@ static int vfs_statx(int dfd, const char __user *filename, int flags, int error; if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH | - AT_STATX_SYNC_TYPE)) + AT_STATX_SYNC_TYPE | AT_STATX_CACHED)) return -EINVAL; if (!(flags & AT_SYMLINK_NOFOLLOW)) @@ -180,6 +180,8 @@ static int vfs_statx(int dfd, const char __user *filename, int flags, lookup_flags |= LOOKUP_AUTOMOUNT; if (flags & AT_EMPTY_PATH) lookup_flags |= LOOKUP_EMPTY; + if (flags & AT_STATX_CACHED) + lookup_flags |= LOOKUP_CACHED; retry: error = user_path_at(dfd, filename, lookup_flags, &path); diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h index 2f86b2ad6d7e..19d5059393e7 100644 --- a/include/uapi/linux/fcntl.h +++ b/include/uapi/linux/fcntl.h @@ -111,4 +111,6 @@ #define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ +#define AT_STATX_CACHED 0x10000 /* Only succeeds if inode/dentry is already cached */ + #endif /* _UAPI_LINUX_FCNTL_H */ -- 2.30.0