Whamcloud - gitweb
LU-7863 osd-zfs: dmu_prefetch change in ZFS master 93/19293/8
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Thu, 31 Mar 2016 15:12:38 +0000 (11:12 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 6 Aug 2016 06:24:16 +0000 (06:24 +0000)
In ZFS master (post zfs-0.6.5-release) dmu_prefetch now has 6
arguments instead of 4.  This accounts for the new style dmu_prefetch,
while keeping backward compatibility (back to 0.6.2 which initially
exported dmu_prefetch).

Convert old behavior of SYNC_READ for prefetch to ASYNC_READ as a
better prefetch behavior.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: Ia06e5605b06ef1f51817418183e479d591231e5a
Reviewed-on: http://review.whamcloud.com/19293
Tested-by: Jenkins
Reviewed-by: Christopher J. Morrone <morrone2@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
config/lustre-build-zfs.m4
lustre/osd-zfs/osd_index.c
lustre/osd-zfs/osd_internal.h
lustre/osd-zfs/osd_oi.c

index 3aa9314..ff7f115 100644 (file)
@@ -450,6 +450,7 @@ 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
@@ -479,6 +480,29 @@ your distribution.
                        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])
index 4e5a5b4..8c1ffbf 100644 (file)
@@ -1515,10 +1515,8 @@ static void osd_zfs_otable_prefetch(const struct lu_env *env,
                if (unlikely(rc != 0))
                        break;
 
-               /* dmu_prefetch() was exported in 0.6.2, if you use with
-                * an older release, just comment it out - this is an
-                * optimization */
-               dmu_prefetch(dev->od_os, it->mit_prefetched_dnode, 0, 0);
+               osd_dmu_prefetch(dev->od_os, it->mit_prefetched_dnode,
+                                0, 0, 0, ZIO_PRIORITY_ASYNC_READ);
 
                it->mit_prefetched++;
        }
index 56203e6..c39a461 100644 (file)
@@ -648,4 +648,12 @@ osd_zap_create_flags(objset_t *os, int normflags, zap_flags_t flags,
 }
 #endif /* HAVE_DMU_OBJECT_ALLOC_DNSIZE */
 
+#ifdef HAVE_DMU_PREFETCH_6ARG
+#define osd_dmu_prefetch(os, obj, lvl, off, len, pri)  \
+       dmu_prefetch((os), (obj), (lvl), (off), (len), (pri))
+#else
+#define osd_dmu_prefetch(os, obj, lvl, off, len, pri)  \
+       dmu_prefetch((os), (obj), (lvl), (off))
+#endif
+
 #endif /* _OSD_INTERNAL_H */
index 0802bf4..560c90f 100644 (file)
@@ -487,7 +487,8 @@ int osd_fid_lookup(const struct lu_env *env, struct osd_device *dev,
        }
 
        if (rc == 0)
-               dmu_prefetch(dev->od_os, *oid, 0, 0);
+               osd_dmu_prefetch(dev->od_os, *oid, 0, 0, 0,
+                                ZIO_PRIORITY_ASYNC_READ);
 
        RETURN(rc);
 }