]) # LIBCFS_CURRENT_TIME
#
+# LC_SUPER_SETUP_BDI_NAME
+#
+# Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
+# unified bdi handling
+#
+AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
+LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
+super_setup_bdi_name, [
+ #include <linux/fs.h>
+],[
+ super_setup_bdi_name(NULL, "lustre");
+],[
+ AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
+ ['super_setup_bdi_name' is available])
+])
+]) # LC_SUPER_SETUP_BDI_NAME
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# 4.12
LC_CURRENT_TIME
+ LC_SUPER_SETUP_BDI_NAME
#
AS_IF([test "x$enable_server" != xno], [
#include <linux/list.h>
#include <libcfs/libcfs.h>
#include <uapi/linux/lustre_disk.h>
+#include <lustre/lustre_idl.h>
#define IS_MDT(data) ((data)->lsi_flags & LDD_F_SV_TYPE_MDT)
#define IS_OST(data) ((data)->lsi_flags & LDD_F_SV_TYPE_OST)
};
#define LSI_UMOUNT_FAILOVER 0x00200000
-#define LSI_BDI_INITIALIZED 0x00400000
#define s2lsi(sb) ((struct lustre_sb_info *)((sb)->s_fs_info))
#define s2lsi_nocast(sb) ((sb)->s_fs_info)
memset(lli->lli_jobid, 0, LUSTRE_JOBID_SIZE);
}
-static inline int ll_bdi_register(struct backing_dev_info *bdi)
+#ifndef HAVE_SUPER_SETUP_BDI_NAME
+
+#define LSI_BDI_INITIALIZED 0x00400000
+
+#ifndef HAVE_BDI_CAP_MAP_COPY
+# define BDI_CAP_MAP_COPY 0
+#endif
+
+#define MAX_STRING_SIZE 128
+
+static int super_setup_bdi_name(struct super_block *sb, char *fmt, ...)
{
- static atomic_t ll_bdi_num = ATOMIC_INIT(0);
+ struct lustre_sb_info *lsi = s2lsi(sb);
+ char buf[MAX_STRING_SIZE];
+ va_list args;
+ int err;
+
+ err = bdi_init(&lsi->lsi_bdi);
+ if (err)
+ return err;
+
+ lsi->lsi_flags |= LSI_BDI_INITIALIZED;
+ lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
+ lsi->lsi_bdi.name = "lustre";
+ va_start(args, fmt);
+ vsnprintf(buf, MAX_STRING_SIZE, fmt, args);
+ va_end(args);
+ err = bdi_register(&lsi->lsi_bdi, NULL, "%s", buf);
+ va_end(args);
+ if (!err)
+ sb->s_bdi = &lsi->lsi_bdi;
- bdi->name = "lustre";
- return bdi_register(bdi, NULL, "lustre-%d",
- atomic_inc_return(&ll_bdi_num));
+ return err;
}
+#endif /* !HAVE_SUPER_SETUP_BDI_NAME */
int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
{
if (err)
GOTO(out_free, err);
- err = bdi_init(&lsi->lsi_bdi);
- if (err)
- GOTO(out_free, err);
- lsi->lsi_flags |= LSI_BDI_INITIALIZED;
-#ifdef HAVE_BDI_CAP_MAP_COPY
- lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY;
-#else
- lsi->lsi_bdi.capabilities = 0;
-#endif
- err = ll_bdi_register(&lsi->lsi_bdi);
+ err = super_setup_bdi_name(sb, "lustre-%p", sb);
if (err)
GOTO(out_free, err);
- sb->s_bdi = &lsi->lsi_bdi;
#ifndef HAVE_DCACHE_LOCK
/* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
sb->s_d_op = &ll_d_ops;
if (profilenm)
class_del_profile(profilenm);
+#ifndef HAVE_SUPER_SETUP_BDI_NAME
if (lsi->lsi_flags & LSI_BDI_INITIALIZED) {
bdi_destroy(&lsi->lsi_bdi);
lsi->lsi_flags &= ~LSI_BDI_INITIALIZED;
}
+#endif
ll_free_sbi(sb);
lsi->lsi_llsbi = NULL;