Author: avg
Date: Thu Nov  9 18:22:42 2017
New Revision: 325610
URL: https://svnweb.freebsd.org/changeset/base/325610

Log:
  MFV r325609: 7531 Assign correct flags to prefetched buffers
  
  illumos/illumos-gate@272952165423c254ad7708f1b3fe2ff0a6ce408b
  
https://github.com/illumos/illumos-gate/commit/272952165423c254ad7708f1b3fe2ff0a6ce408b
  
  https://www.illumos.org/issues/7531
    I found that some buffers that could be L2ARC eligible are not flagged
    such, leading to some performance impact.  As a test I ran the same IO
    workload 10 times in a raw.  It is a metadata only workload (files
    listing).  l2arc_noprefetch=0.
  
  Reviewed by: Matthew Ahrens <mahr...@delphix.com>
  Reviewed by: Prakash Surya <prakash.su...@delphix.com>
  Approved by: Dan McDonald <dan...@joyent.com>
  Author: benrubson <ben.rub...@gmail.com>
  
  MFC after:    8 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Thu Nov  9 
18:21:17 2017        (r325609)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Thu Nov  9 
18:22:42 2017        (r325610)
@@ -2373,6 +2373,10 @@ dbuf_prefetch_indirect_done(zio_t *zio, arc_buf_t *abu
                arc_flags_t iter_aflags = ARC_FLAG_NOWAIT;
                zbookmark_phys_t zb;
 
+               /* flag if L2ARC eligible, l2arc_noprefetch then decides */
+               if (dpa->dpa_aflags & ARC_FLAG_L2CACHE)
+                       iter_aflags |= ARC_FLAG_L2CACHE;
+
                ASSERT3U(dpa->dpa_curlevel, ==, BP_GET_LEVEL(bp));
 
                SET_BOOKMARK(&zb, dpa->dpa_zb.zb_objset,
@@ -2482,6 +2486,10 @@ dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blk
        dpa->dpa_epbs = epbs;
        dpa->dpa_zio = pio;
 
+       /* flag if L2ARC eligible, l2arc_noprefetch then decides */
+       if (DNODE_LEVEL_IS_L2CACHEABLE(dn, level))
+               dpa->dpa_aflags |= ARC_FLAG_L2CACHE;
+
        /*
         * If we have the indirect just above us, no need to do the asynchronous
         * prefetch chain; we'll just run the last step ourselves.  If we're at
@@ -2496,6 +2504,10 @@ dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blk
        } else {
                arc_flags_t iter_aflags = ARC_FLAG_NOWAIT;
                zbookmark_phys_t zb;
+
+               /* flag if L2ARC eligible, l2arc_noprefetch then decides */
+               if (DNODE_LEVEL_IS_L2CACHEABLE(dn, level))
+                       iter_aflags |= ARC_FLAG_L2CACHE;
 
                SET_BOOKMARK(&zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET,
                    dn->dn_object, curlevel, curblkid);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h      Thu Nov 
 9 18:21:17 2017        (r325609)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h      Thu Nov 
 9 18:22:42 2017        (r325610)
@@ -347,6 +347,12 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_t *db);
        (dbuf_is_metadata(_db) &&                                       \
        ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA)))
 
+#define        DNODE_LEVEL_IS_L2CACHEABLE(_dn, _level)                         
\
+       ((_dn)->dn_objset->os_secondary_cache == ZFS_CACHE_ALL ||       \
+       (((_level) > 0 ||                                               \
+       DMU_OT_IS_METADATA((_dn)->dn_handle->dnh_dnode->dn_type)) &&    \
+       ((_dn)->dn_objset->os_secondary_cache == ZFS_CACHE_METADATA)))
+
 #ifdef ZFS_DEBUG
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to