Whamcloud - gitweb
LU-12137 llite: use ->iterate_shared() for readdir
[fs/lustre-release.git] / lustre / include / lustre_compat.h
index b8cfb06..31794a7 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/fs_struct.h>
 #include <linux/namei.h>
 #include <linux/pagemap.h>
+#include <linux/posix_acl_xattr.h>
 #include <linux/bio.h>
 #include <linux/xattr.h>
 #include <linux/workqueue.h>
@@ -242,6 +243,10 @@ static inline struct dentry *d_make_root(struct inode *root)
 }
 #endif
 
+#ifndef HAVE_FOP_ITERATE_SHARED
+#define iterate_shared iterate
+#endif
+
 #ifdef HAVE_DIRTY_INODE_HAS_FLAG
 # define ll_dirty_inode(inode, flag)   (inode)->i_sb->s_op->dirty_inode((inode), flag)
 #else
@@ -422,8 +427,22 @@ __vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
 }
 #endif /* HAVE_VFS_SETXATTR */
 
+#ifndef HAVE_POSIXACL_USER_NS
+/*
+ * Mask out &init_user_ns so we don't jump
+ * through hoops to define it somehow only
+ * to have it ignored anyway.
+ */
+#define posix_acl_from_xattr(a, b, c)  posix_acl_from_xattr(b, c)
+#define posix_acl_to_xattr(a, b, c, d) posix_acl_to_xattr(b, c, d)
+#endif
+
+#ifndef HAVE_POSIX_ACL_VALID_USER_NS
+#define posix_acl_valid(a,b)           posix_acl_valid(b)
+#endif
+
 #ifdef HAVE_IOP_SET_ACL
-#ifdef CONFIG_FS_POSIX_ACL
+#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
 #ifndef HAVE_POSIX_ACL_UPDATE_MODE
 static inline int posix_acl_update_mode(struct inode *inode, umode_t *mode_p,
                          struct posix_acl **acl)
@@ -740,8 +759,16 @@ static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw)
 #define page_tree i_pages
 #else
 #define i_pages tree_lock
-#define xa_lock_irq(lockp) spin_lock_irq(lockp)
-#define xa_unlock_irq(lockp) spin_unlock_irq(lockp)
+#endif
+
+#ifndef xa_lock_irqsave
+#define xa_lock_irqsave(lockp, flags) spin_lock_irqsave(lockp, flags)
+#define xa_unlock_irqrestore(lockp, flags) spin_unlock_irqrestore(lockp, flags)
+#endif
+
+#ifndef HAVE_LOCK_PAGE_MEMCG
+#define lock_page_memcg(page) do {} while (0)
+#define unlock_page_memcg(page) do {} while (0)
 #endif
 
 #ifndef KMEM_CACHE_USERCOPY