Starting with the linux kernel 4.11 a new system call was added
to enhance the file info available. This new functionality has
changed the getattr functions in the linux kernel. This patch
only provides the most basic support for now.
Linux-commit:
a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
Change-Id: Iee1b02bb94dab05a3197866af9eedd6f35cac7c5
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/27715
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
]) # LC_HAVE_VM_FAULT_ADDRESS
#
+# LC_INODEOPS_ENHANCED_GETATTR
+#
+# Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
+# expanded getattr to be able to get more stat information.
+#
+AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
+LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
+getattr_path, [
+ #include <linux/fs.h>
+],[
+ struct path path;
+
+ ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
+],[
+ AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
+ [inode_operations .getattr member function can gather advance stats])
+])
+]) # LC_INODEOPS_ENHANCED_GETATTR
+
+#
# LC_VM_OPERATIONS_REMOVE_VMF_ARG
#
# Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
LC_HAVE_VM_FAULT_ADDRESS
# 4.11
+ LC_INODEOPS_ENHANCED_GETATTR
LC_VM_OPERATIONS_REMOVE_VMF_ARG
#
return MKDEV(MAJOR(dev) & 0xff, MINOR(dev) & 0xff);
}
+#ifdef HAVE_INODEOPS_ENHANCED_GETATTR
+int ll_getattr(const struct path *path, struct kstat *stat,
+ u32 request_mask, unsigned int flags)
+
+{
+ struct dentry *de = path->dentry;
+#else
int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat)
{
+#endif
struct inode *inode = de->d_inode;
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ll_inode_info *lli = ll_i2info(inode);
extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
struct ll_file_data *file, loff_t pos,
size_t count, int rw);
+#ifdef HAVE_INODEOPS_ENHANCED_GETATTR
+int ll_getattr(const struct path *path, struct kstat *stat,
+ u32 request_mask, unsigned int flags);
+#else
int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
+#endif
struct posix_acl *ll_get_acl(struct inode *inode, int type);
#ifdef HAVE_IOP_SET_ACL
#ifdef CONFIG_FS_POSIX_ACL
return -EIO;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+#ifdef HAVE_INODEOPS_ENHANCED_GETATTR
+ rc = vfs_getattr(&fd->f_path, stbuf, STATX_INO, AT_STATX_SYNC_AS_STAT);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
rc = vfs_getattr(&fd->f_path, stbuf);
#else
rc = vfs_getattr(fd->f_path.mnt, fd->f_path.dentry, stbuf);