#include <linux/slab.h>
#include <linux/security.h>
#include <libcfs/linux/linux-fs.h>
+#ifdef HAVE_XARRAY_SUPPORT
+#include <linux/xarray.h>
+#else
+#include <libcfs/linux/xarray.h>
+#endif
#include <obd_support.h>
#ifdef HAVE_4ARGS_VFS_SYMLINK
#define ll_xa_is_value xa_is_value
#endif
+/* Linux kernel version v5.0 commit fd9dc93e36231fb6d520e0edd467058fad4fd12d
+ * ("XArray: Change xa_insert to return -EBUSY")
+ * instead of -EEXIST
+ */
+static inline int __must_check ll_xa_insert(struct xarray *xa,
+ unsigned long index,
+ void *entry, gfp_t gpf)
+{
+ int rc = xa_insert(xa, index, entry, gpf);
+
+ if (rc == -EEXIST)
+ rc = -EBUSY;
+ return rc;
+}
+
#ifndef HAVE_TRUNCATE_INODE_PAGES_FINAL
static inline void truncate_inode_pages_final(struct address_space *map)
{