Author: delphij
Date: Tue Jul  1 07:56:07 2014
New Revision: 268082
URL: http://svnweb.freebsd.org/changeset/base/268082

Log:
  MFV r267567:
  
  4881 zfs send performance degradation when embedded block pointers are
       encountered
  
  illumos/illumos-gate@06315b795c0d54f0228e0b8af497a28752dd92da
  
  MFC after:    2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c  Tue Jul 
 1 07:54:12 2014        (r268081)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c  Tue Jul 
 1 07:56:07 2014        (r268082)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/zfs_context.h>
@@ -197,6 +197,16 @@ traverse_prefetch_metadata(traverse_data
            ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb);
 }
 
+static boolean_t
+prefetch_needed(prefetch_data_t *pfd, const blkptr_t *bp)
+{
+       ASSERT(pfd->pd_flags & TRAVERSE_PREFETCH_DATA);
+       if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp) ||
+           BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG)
+               return (B_FALSE);
+       return (B_TRUE);
+}
+
 static int
 traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
     const blkptr_t *bp, const zbookmark_t *zb)
@@ -242,16 +252,7 @@ traverse_visitbp(traverse_data_t *td, co
                return (0);
        }
 
-       if (BP_IS_HOLE(bp)) {
-               err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg);
-               if (err != 0)
-                       goto post;
-               return (0);
-       }
-
-       if (pd && !pd->pd_exited &&
-           ((pd->pd_flags & TRAVERSE_PREFETCH_DATA) ||
-           BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0)) {
+       if (pd != NULL && !pd->pd_exited && prefetch_needed(pd, bp)) {
                mutex_enter(&pd->pd_mtx);
                ASSERT(pd->pd_blks_fetched >= 0);
                while (pd->pd_blks_fetched == 0 && !pd->pd_exited)
@@ -261,6 +262,13 @@ traverse_visitbp(traverse_data_t *td, co
                mutex_exit(&pd->pd_mtx);
        }
 
+       if (BP_IS_HOLE(bp)) {
+               err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg);
+               if (err != 0)
+                       goto post;
+               return (0);
+       }
+
        if (td->td_flags & TRAVERSE_PRE) {
                err = td->td_func(td->td_spa, NULL, bp, zb, dnp,
                    td->td_arg);
@@ -444,10 +452,7 @@ traverse_prefetcher(spa_t *spa, zilog_t 
        if (pfd->pd_cancel)
                return (SET_ERROR(EINTR));
 
-       if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp) ||
-           !((pfd->pd_flags & TRAVERSE_PREFETCH_DATA) ||
-           BP_GET_TYPE(bp) == DMU_OT_DNODE || BP_GET_LEVEL(bp) > 0) ||
-           BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG)
+       if (!prefetch_needed(pfd, bp))
                return (0);
 
        mutex_enter(&pfd->pd_mtx);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to