+static void
+traverse_prefetch_metadata(traverse_data_t *td,
+ arc_buf_t *pbuf, const blkptr_t *bp, const zbookmark_t *zb)
+{
+ uint32_t flags = ARC_NOWAIT | ARC_PREFETCH;
+
+ if (!(td->td_flags & TRAVERSE_PREFETCH_METADATA))
+ return;
+ /*
+ * If we are in the process of resuming, don't prefetch, because
+ * some children will not be needed (and in fact may have already
+ * been freed).
+ */
+ if (td->td_resume != NULL && !ZB_IS_ZERO(td->td_resume))
+ return;
+ if (BP_IS_HOLE(bp) || bp->blk_birth <= td->td_min_txg)
+ return;
+ if (BP_GET_LEVEL(bp) == 0 && BP_GET_TYPE(bp) != DMU_OT_DNODE)
+ return;
+
+ (void) arc_read(NULL, td->td_spa, bp,
+ pbuf, NULL, NULL, ZIO_PRIORITY_ASYNC_READ,
+ ZIO_FLAG_CANFAIL, &flags, zb);
+}
+