#include <linux/namei.h>
#include <linux/pagemap.h>
#include <linux/bio.h>
+#include <linux/xattr.h>
#include <libcfs/libcfs.h>
#include <lustre_patchless_compat.h>
#ifdef HAVE_BVEC_ITER
#define bio_idx(bio) (bio->bi_iter.bi_idx)
#define bio_set_sector(bio, sector) (bio->bi_iter.bi_sector = sector)
-#define bvl_to_page(bvl) (bvl.bv_page)
+#define bvl_to_page(bvl) (bvl->bv_page)
#else
#define bio_idx(bio) (bio->bi_idx)
#define bio_set_sector(bio, sector) (bio->bi_sector = sector)
#define queue_max_hw_segments(rq) queue_max_segments(rq)
#endif
+#ifdef HAVE_BLK_PLUG
+#define DECLARE_PLUG(plug) struct blk_plug plug
+#else /* !HAVE_BLK_PLUG */
+#define DECLARE_PLUG(name)
+#define blk_start_plug(plug) do {} while (0)
+#define blk_finish_plug(plug) do {} while (0)
+#endif
+
#ifdef HAVE_KMAP_ATOMIC_HAS_1ARG
#define ll_kmap_atomic(a, b) kmap_atomic(a)
#define ll_kunmap_atomic(a, b) kunmap_atomic(a)
#endif
#endif
+#ifdef HAVE_PID_NS_FOR_CHILDREN
+# define ll_task_pid_ns(task) ((task)->nsproxy->pid_ns_for_children)
+#else
+# define ll_task_pid_ns(task) ((task)->nsproxy->pid_ns)
+#endif
+
+#ifdef HAVE_FULL_NAME_HASH_3ARGS
+# define ll_full_name_hash(salt, name, len) full_name_hash(salt, name, len)
+#else
+# define ll_full_name_hash(salt, name, len) full_name_hash(name, len)
+#endif
+
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry struct posix_acl_xattr_entry
+# define GET_POSIX_ACL_XATTR_ENTRY(head) ((void *)((head) + 1))
+#else
+# define GET_POSIX_ACL_XATTR_ENTRY(head) ((head)->a_entries)
+#endif
+
#endif /* _LUSTRE_COMPAT_H */