Whamcloud - gitweb
LU-8364 ldiskfs: fixes for failover mode.
[fs/lustre-release.git] / config / lustre-build-zfs.m4
index 0d45ce4..ff7f115 100644 (file)
@@ -105,10 +105,13 @@ AC_DEFUN([LB_SPL], [
        dnl # The existence of the spl_config.h is used to identify a valid
        dnl # spl object directory.  In many cases the object and source
        dnl # directory are the same, however the objects may also reside
-       dnl # is a subdirectory named after the kernel version.
+       dnl # is a subdirectory named after the kernel version.  When
+       dnl # weak modules are used, the kernel version may not be the
+       dnl # same as the LINUXRELEASE against which we are building lustre.
        dnl #
        AC_MSG_CHECKING([spl build directory])
        AS_IF([test -z "$splobj"], [
+               last_spl_obj_dir=$(ls -d ${splsrc}/[[0-9]]*/ | tail -n 1 | sed 's|/$||')
                AS_IF([test "${splsrc}" = "${spldkms}/source"], [
                        AS_IF([test -e "${spldkms}/${LINUXRELEASE}/${target_cpu}/spl_config.h"], [
                                splobj=${spldkms}/${LINUXRELEASE}/${target_cpu}
@@ -119,6 +122,8 @@ AC_DEFUN([LB_SPL], [
                        splobj="${splsrc}/${LINUXRELEASE}"
                ], [test -e "${splsrc}/spl_config.h"], [
                        splobj="${splsrc}"
+               ], [test -e "${last_spl_obj_dir}/spl_config.h"], [
+                       splobj="${last_spl_obj_dir}"
                ], [
                        splobj="[Not found]"
                ])
@@ -218,10 +223,13 @@ AC_DEFUN([LB_ZFS], [
        dnl # The existence of the zfs_config.h is used to identify a valid
        dnl # zfs object directory.  In many cases the object and source
        dnl # directory are the same, however the objects may also reside
-       dnl # is a subdirectory named after the kernel version.
+       dnl # is a subdirectory named after the kernel version.  When
+       dnl # weak modules are used, the kernel version may not be the
+       dnl # same as the LINUXRELEASE against which we are building lustre.
        dnl #
        AC_MSG_CHECKING([zfs build directory])
        AS_IF([test -z "$zfsobj"], [
+               last_zfs_obj_dir=$(ls -d ${zfssrc}/[[0-9]]*/ | tail -n 1 | sed 's|/$||')
                AS_IF([test "${zfssrc}" = "${zfsdkms}/source"], [
                        AS_IF([test -e "${zfsdkms}/${LINUXRELEASE}/${target_cpu}/zfs_config.h"], [
                                zfsobj=${zfsdkms}/${LINUXRELEASE}/${target_cpu}
@@ -232,6 +240,8 @@ AC_DEFUN([LB_ZFS], [
                        zfsobj="${zfssrc}/${LINUXRELEASE}"
                ], [test -e "${zfssrc}/zfs_config.h"], [
                        zfsobj="${zfssrc}"
+               ], [test -e "${last_zfs_obj_dir}/zfs_config.h"], [
+                       zfsobj="${last_zfs_obj_dir}"
                ], [
                        zfsobj="[Not found]"
                ])
@@ -440,6 +450,59 @@ your distribution.
                        AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
                                [Have spa_maxblocksize in ZFS])
                ])
+
+               dnl #
+               dnl # ZFS 0.7.x adds support for large dnodes.  This
+               dnl # allows Lustre to optionally specify the size of a
+               dnl # dnode which ZFS will then use to store metadata such
+               dnl # as xattrs. The default dnode size specified by the
+               dnl # 'dnodesize' dataset property will be used unless a
+               dnl # specific value is provided.
+               dnl #
+               LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
+               dmu_object_alloc_dnsize, [
+                       #include <sys/dmu.h>
+                       #include <sys/dnode.h>
+               ],[
+                       objset_t *os = NULL;
+                       dmu_object_type_t objtype = DMU_OT_NONE;
+                       int blocksize = 0;
+                       dmu_object_type_t bonustype = DMU_OT_SA;
+                       int dnodesize = DNODE_MIN_SIZE;
+                       dmu_tx_t *tx = NULL;
+                       uint64_t id;
+
+                       id = dmu_object_alloc_dnsize(os, objtype, blocksize,
+                                                    bonustype,
+                                                    DN_BONUS_SIZE(dnodesize),
+                                                    dnodesize, tx);
+               ],[
+                       AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
+                               [Have dmu_object_alloc_dnsize in ZFS])
+               ])
+
+               dnl #
+               dnl # ZFS 0.7.x extended dmu_prefetch() to take an additional
+               dnl # 'level' and 'priority' argument.  Use a level of 0 and a
+               dnl # priority of ZIO_PRIORITY_SYNC_READ to replicate the
+               dnl # behavior of the four argument version.
+               dnl #
+               LB_CHECK_COMPILE([if ZFS has 'dmu_prefetch' with 6 args],
+               dmu_prefetch, [
+                       #include <sys/dmu.h>
+               ],[
+                       objset_t *os = NULL;
+                       uint64_t object = 0;
+                       int64_t level = 0;
+                       uint64_t offset = 0;
+                       uint64_t len = 0;
+                       enum zio_priority pri = ZIO_PRIORITY_SYNC_READ;
+
+                       dmu_prefetch(os, object, level, offset, len, pri);
+               ],[
+                       AC_DEFINE(HAVE_DMU_PREFETCH_6ARG, 1,
+                               [Have 6 argument dmu_pretch in ZFS])
+               ])
        ])
 
        AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])