Whamcloud - gitweb
LU-1930 build: Back end file system fixes.
authorJames Simmons <uja.ornl@gmail.com>
Tue, 16 Oct 2012 11:44:03 +0000 (07:44 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 23 Oct 2012 22:46:35 +0000 (18:46 -0400)
Currently Lustre for ZFS requires the zfs development
rpm for its userland support to be installed on the
build machine so we can create the lustre zfs utilities.
What this patch does is allow a user to be able to build
against the zfs/spl source drops as well as the rpms.
A work around is provided so we can point the lustre
build system to were a user can temporary install the
zfs user land headers.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I8e5586ed22956a9dd4799826a442b8f5a895d872
Reviewed-on: http://review.whamcloud.com/3980
Reviewed-by: Brian J. Murrell <brian.murrell@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
build/autoconf/lustre-build-zfs.m4
lustre/osd-zfs/Makefile.in
lustre/utils/Makefile.am
lustre/utils/mkfs_lustre.c
lustre/utils/mount_lustre.c
lustre/utils/mount_utils.c
lustre/utils/mount_utils.h
lustre/utils/mount_utils_ldiskfs.c
lustre/utils/mount_utils_zfs.c

index b636cb3..bfc647f 100644 (file)
@@ -263,7 +263,6 @@ case x$with_zfs in
                                fi
                        fi
                fi
                                fi
                        fi
                fi
-
                ;;
        *)
                ZFS_DIR=$(readlink -f $with_zfs)
                ;;
        *)
                ZFS_DIR=$(readlink -f $with_zfs)
@@ -274,6 +273,24 @@ esac
 AC_MSG_CHECKING([whether to enable zfs])
 AC_MSG_RESULT([$with_zfs])
 
 AC_MSG_CHECKING([whether to enable zfs])
 AC_MSG_RESULT([$with_zfs])
 
+if test x$with_zfs = xyes; then
+       AC_MSG_CHECKING([for location of zfs library headers])
+       if test -e "$ZFS_DIR/include/libzfs.h"; then
+               EXTRA_LIBZFS_INCLUDE="$EXTRA_LIBZFS_INCLUDE -I $ZFS_DIR/lib/libspl/include -I $ZFS_DIR/include"
+               AC_MSG_RESULT([$ZFS_DIR])
+       elif test -e "$ZFS_DIR/libzfs/libzfs.h"; then
+               EXTRA_LIBZFS_INCLUDE="$EXTRA_LIBZFS_INCLUDE -I $ZFS_DIR/libspl -I $ZFS_DIR/libzfs"
+               AC_MSG_RESULT([$ZFS_DIR])
+       elif test -e "/usr/include/libzfs/libzfs.h"; then
+               AC_MSG_RESULT([/usr/include])
+               EXTRA_LIBZFS_INCLUDE="$EXTRA_LIBZFS_INCLUDE -I /usr/include/libspl -I /usr/include/libzfs"
+       else
+               AC_MSG_RESULT([unknown])
+               AC_MSG_ERROR([Could not locate zfs library headers.])
+       fi
+       AC_SUBST(EXTRA_LIBZFS_INCLUDE)
+fi
+
 AC_ARG_WITH([zfs-obj],
        AC_HELP_STRING([--with-zfs-obj=path], [set path to zfs objects]),
        [
 AC_ARG_WITH([zfs-obj],
        AC_HELP_STRING([--with-zfs-obj=path], [set path to zfs objects]),
        [
@@ -304,7 +321,6 @@ if test x$with_zfs = xyes; then
 
        LB_SPL_BUILD
        LB_ZFS_BUILD
 
        LB_SPL_BUILD
        LB_ZFS_BUILD
-
 fi
 
 AM_CONDITIONAL(SPL_BUILD, test x$enable_spl_build = xyes)
 fi
 
 AM_CONDITIONAL(SPL_BUILD, test x$enable_spl_build = xyes)
@@ -386,7 +402,7 @@ AC_DEFUN([LB_ZFS_RELEASE],
 AC_MSG_CHECKING([zfs source release])
 if test -r $ZFS_OBJ/zfs_config.h; then
        tmp_flags="$EXTRA_KCFLAGS"
 AC_MSG_CHECKING([zfs source release])
 if test -r $ZFS_OBJ/zfs_config.h; then
        tmp_flags="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="-I$ZFS_DIR $EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="-I$ZFS_OBJ $EXTRA_KCFLAGS"
        LB_LINUX_TRY_MAKE([
                #include <$ZFS_OBJ/zfs_config.h>
        ],[
        LB_LINUX_TRY_MAKE([
                #include <$ZFS_OBJ/zfs_config.h>
        ],[
index 2d8e190..0a2dceb 100644 (file)
@@ -4,7 +4,7 @@ osd_zfs-objs += osd_object.o osd_io.o osd_oi.o osd_xattr.o osd_index.o
 
 EXTRA_PRE_CFLAGS += -I@SPL_DIR@ -I@SPL_DIR@/include
 EXTRA_PRE_CFLAGS += -include @SPL_OBJ@/spl_config.h
 
 EXTRA_PRE_CFLAGS += -I@SPL_DIR@ -I@SPL_DIR@/include
 EXTRA_PRE_CFLAGS += -include @SPL_OBJ@/spl_config.h
-EXTRA_PRE_CFLAGS += -I@ZFS_DIR@ -I@ZFS_DIR@/include
+EXTRA_PRE_CFLAGS += -I@ZFS_OBJ@ -I@ZFS_OBJ@/include
 EXTRA_PRE_CFLAGS += -include @ZFS_OBJ@/zfs_config.h
 
 @INCLUDE_RULES@
 EXTRA_PRE_CFLAGS += -include @ZFS_OBJ@/zfs_config.h
 
 @INCLUDE_RULES@
index 5ab641d..e7c52a3 100644 (file)
@@ -130,7 +130,7 @@ endif
 if ZFS_ENABLED
 mount_lustre_SOURCES += mount_utils_zfs.c
 mount_lustre_CPPFLAGS = -DHAVE_IOCTL_IN_UNISTD_H
 if ZFS_ENABLED
 mount_lustre_SOURCES += mount_utils_zfs.c
 mount_lustre_CPPFLAGS = -DHAVE_IOCTL_IN_UNISTD_H
-mount_lustre_CPPFLAGS += -I /usr/include/libspl -I /usr/include/libzfs
+mount_lustre_CPPFLAGS += $(EXTRA_LIBZFS_INCLUDE)
 mount_lustre_LDFLAGS = -pthread -rdynamic -ldl
 endif
 
 mount_lustre_LDFLAGS = -pthread -rdynamic -ldl
 endif
 
@@ -146,7 +146,7 @@ endif
 if ZFS_ENABLED
 mkfs_lustre_SOURCES += mount_utils_zfs.c
 mkfs_lustre_CPPFLAGS += -DHAVE_IOCTL_IN_UNISTD_H
 if ZFS_ENABLED
 mkfs_lustre_SOURCES += mount_utils_zfs.c
 mkfs_lustre_CPPFLAGS += -DHAVE_IOCTL_IN_UNISTD_H
-mkfs_lustre_CPPFLAGS += -I /usr/include/libspl -I /usr/include/libzfs
+mkfs_lustre_CPPFLAGS += $(EXTRA_LIBZFS_INCLUDE)
 mkfs_lustre_LDFLAGS = -pthread -rdynamic -ldl
 endif
 
 mkfs_lustre_LDFLAGS = -pthread -rdynamic -ldl
 endif
 
@@ -160,7 +160,7 @@ endif
 if ZFS_ENABLED
 tunefs_lustre_SOURCES += mount_utils_zfs.c
 tunefs_lustre_CPPFLAGS += -DHAVE_IOCTL_IN_UNISTD_H
 if ZFS_ENABLED
 tunefs_lustre_SOURCES += mount_utils_zfs.c
 tunefs_lustre_CPPFLAGS += -DHAVE_IOCTL_IN_UNISTD_H
-tunefs_lustre_CPPFLAGS += -I /usr/include/libspl -I /usr/include/libzfs
+tunefs_lustre_CPPFLAGS += $(EXTRA_LIBZFS_INCLUDE)
 tunefs_lustre_LDFLAGS = -pthread -rdynamic -ldl
 endif
 
 tunefs_lustre_LDFLAGS = -pthread -rdynamic -ldl
 endif
 
index 45ad45f..e3cfa81 100644 (file)
@@ -47,6 +47,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#include "mount_utils.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -77,7 +78,6 @@
 #include <lustre_param.h>
 #include <lnet/lnetctl.h>
 #include <lustre_ver.h>
 #include <lustre_param.h>
 #include <lnet/lnetctl.h>
 #include <lustre_ver.h>
-#include "mount_utils.h"
 
 #ifndef PATH_MAX
 #define PATH_MAX 4096
 
 #ifndef PATH_MAX
 #define PATH_MAX 4096
index 042fac1..1df69b0 100644 (file)
@@ -42,6 +42,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#include "mount_utils.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -52,7 +53,6 @@
 #include <lustre_ver.h>
 #include <ctype.h>
 #include <limits.h>
 #include <lustre_ver.h>
 #include <ctype.h>
 #include <limits.h>
-#include "mount_utils.h"
 
 #define MAXOPT 4096
 #define MAX_RETRIES 99
 
 #define MAXOPT 4096
 #define MAX_RETRIES 99
index 565ed85..ae0316e 100644 (file)
@@ -37,6 +37,7 @@
 #  include "config.h"
 #endif /* HAVE_CONFIG_H */
 
 #  include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include "mount_utils.h"
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
@@ -45,7 +46,6 @@
 #include <lustre_ver.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include <lustre_ver.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
-#include "mount_utils.h"
 
 extern char *progname;
 extern int verbose;
 
 extern char *progname;
 extern int verbose;
index b583f5c..72e2f0a 100644 (file)
 #ifndef _MOUNT_UTILS_H_
 #define _MOUNT_UTILS_H_
 
 #ifndef _MOUNT_UTILS_H_
 #define _MOUNT_UTILS_H_
 
+/* Some of the userland headers for libzfs also require
+ * zfs/spl linux kernel headers, but including these pull
+ * in linux kernel headers which conflicts with the
+ * userland version of libcfs. So the solution is tell the
+ * libzfs user land headrs that the zfs/spl kernel headers
+ * are already included even if this is not the case.
+ */
+#ifdef HAVE_ZFS_OSD
+#define _SPL_ZFS_H
+#define _SPL_SIGNAL_H
+#endif
 #include <lustre_disk.h>
 #include <lustre_param.h>
 
 #include <lustre_disk.h>
 #include <lustre_param.h>
 
index c7f551f..c6e6e8c 100644 (file)
@@ -47,6 +47,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#include "mount_utils.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -78,7 +79,6 @@
 #include <lustre_param.h>
 #include <lnet/lnetctl.h>
 #include <lustre_ver.h>
 #include <lustre_param.h>
 #include <lnet/lnetctl.h>
 #include <lustre_ver.h>
-#include "mount_utils.h"
 
 #define MAX_HW_SECTORS_KB_PATH "queue/max_hw_sectors_kb"
 #define MAX_SECTORS_KB_PATH    "queue/max_sectors_kb"
 
 #define MAX_HW_SECTORS_KB_PATH "queue/max_hw_sectors_kb"
 #define MAX_SECTORS_KB_PATH    "queue/max_sectors_kb"
index 88d7a0c..d347d89 100644 (file)
 /*
  * Author: Brian Behlendorf <behlendorf1@llnl.gov>
  */
 /*
  * Author: Brian Behlendorf <behlendorf1@llnl.gov>
  */
-
+#include "mount_utils.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdio.h>
 #include <string.h>
-#include <libzfs/libzfs.h>
+#include <libzfs.h>
 #include <dlfcn.h>
 
 #include <dlfcn.h>
 
-#include "mount_utils.h"
-
 /* Persistent mount data is stored in these user  attributes */
 #define LDD_VERSION_PROP                "lustre:version"
 #define LDD_FLAGS_PROP                  "lustre:flags"
 /* Persistent mount data is stored in these user  attributes */
 #define LDD_VERSION_PROP                "lustre:version"
 #define LDD_FLAGS_PROP                  "lustre:flags"