From: Nathaniel Clark Date: Thu, 31 Mar 2016 15:12:38 +0000 (-0400) Subject: LU-7863 osd-zfs: dmu_prefetch change in ZFS master X-Git-Tag: 2.8.56~11 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=349c2be0e608c9afe85253192a4c1450306e9629 LU-7863 osd-zfs: dmu_prefetch change in ZFS master 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 Change-Id: Ia06e5605b06ef1f51817418183e479d591231e5a Reviewed-on: http://review.whamcloud.com/19293 Tested-by: Jenkins Reviewed-by: Christopher J. Morrone Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/config/lustre-build-zfs.m4 b/config/lustre-build-zfs.m4 index 3aa9314..ff7f115 100644 --- a/config/lustre-build-zfs.m4 +++ b/config/lustre-build-zfs.m4 @@ -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 + ],[ + 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]) diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index 4e5a5b4..8c1ffbf 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -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++; } diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h index 56203e6..c39a461 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h @@ -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 */ diff --git a/lustre/osd-zfs/osd_oi.c b/lustre/osd-zfs/osd_oi.c index 0802bf4..560c90f 100644 --- a/lustre/osd-zfs/osd_oi.c +++ b/lustre/osd-zfs/osd_oi.c @@ -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); }