diff options
author | Olaf Faaland <[email protected]> | 2017-03-20 17:51:16 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-03-20 17:51:16 -0700 |
commit | a3478c074752610814f894375c3d947ece4938fe (patch) | |
tree | d6697b5fd25dd47ca92b7579e92b1886ee687797 /config | |
parent | f974e414268448fbb5507e91ed98be7fdf45054b (diff) |
Linux 4.11 compat: iops.getattr and friends
In torvalds/linux@a528d35, there are changes to the getattr family of functions,
struct kstat, and the interface of inode_operations .getattr.
The inode_operations .getattr and simple_getattr() interface changed to:
int (*getattr) (const struct path *, struct dentry *, struct kstat *,
u32 request_mask, unsigned int query_flags)
The request_mask argument indicates which field(s) the caller intends to use.
Fields the caller has not specified via request_mask may be set in the returned
struct anyway, but their values may be approximate.
The query_flags argument indicates whether the filesystem must update
the attributes from the backing store.
Currently both fields are ignored. It is possible that getattr-related
functions within zfs could be optimized based on the request_mask.
struct kstat includes new fields:
u32 result_mask; /* What fields the user got */
u64 attributes; /* See STATX_ATTR_* flags */
struct timespec btime; /* File creation time */
Fields attribute and btime are cleared; the result_mask reflects this. These
appear to be optional based on simple_getattr() and vfs_getattr() within the
kernel, which take the same approach.
Reviewed-by: Chunwei Chen <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Olaf Faaland <[email protected]>
Closes #5875
Diffstat (limited to 'config')
-rw-r--r-- | config/kernel-inode-getattr.m4 | 67 | ||||
-rw-r--r-- | config/kernel.m4 | 1 |
2 files changed, 68 insertions, 0 deletions
diff --git a/config/kernel-inode-getattr.m4 b/config/kernel-inode-getattr.m4 new file mode 100644 index 000000000..f10e0b251 --- /dev/null +++ b/config/kernel-inode-getattr.m4 @@ -0,0 +1,67 @@ +dnl # +dnl # Linux 4.11 API +dnl # See torvalds/linux@a528d35 +dnl # +AC_DEFUN([ZFS_AC_PATH_KERNEL_IOPS_GETATTR], [ + AC_MSG_CHECKING([whether iops->getattr() takes a path]) + ZFS_LINUX_TRY_COMPILE([ + #include <linux/fs.h> + + int test_getattr( + const struct path *p, struct kstat *k, + u32 request_mask, unsigned int query_flags) + { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .getattr = test_getattr, + }; + ],[ + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, + [iops->getattr() takes a path]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + + + +dnl # +dnl # Linux 3.9 - 4.10 API +dnl # +AC_DEFUN([ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR], [ + AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) + ZFS_LINUX_TRY_COMPILE([ + #include <linux/fs.h> + + int test_getattr( + struct vfsmount *mnt, struct dentry *d, + struct kstat *k) + { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .getattr = test_getattr, + }; + ],[ + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, + [iops->getattr() takes a vfsmount]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + + +dnl # +dnl # The interface of the getattr callback from the inode_operations +dnl # structure changed. Also, the interface of the simple_getattr() +dnl # function provided by the kernel changed. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR], [ + ZFS_AC_PATH_KERNEL_IOPS_GETATTR + ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index 0b50a54e3..25271cedc 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -59,6 +59,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL + ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR ZFS_AC_KERNEL_INODE_SET_FLAGS ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE ZFS_AC_KERNEL_SHOW_OPTIONS |