diff usr/src/uts/common/fs/zfs/dsl_dataset.c @ 12450:c77e20e4e046

6938089 dedup-induced latency causes FC initiator logouts/FC port resets
author George Wilson <George.Wilson@Sun.COM>
date Wed, 19 May 2010 22:59:13 -0700
parents 7cf402a7f374
children 54258108784b
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/dsl_dataset.c	Wed May 19 22:33:49 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c	Wed May 19 22:59:13 2010 -0700
@@ -40,6 +40,11 @@
 #include <sys/zvol.h>
 #include <sys/dsl_scan.h>
 
+/*
+ * Enable/disable prefetching of dedup-ed blocks which are going to be freed.
+ */
+int zfs_dedup_prefetch = 1;
+
 static char *dsl_reaper = "the grim reaper";
 
 static dsl_checkfunc_t dsl_dataset_destroy_begin_check;
@@ -234,9 +239,16 @@
 }
 
 boolean_t
-dsl_dataset_block_freeable(dsl_dataset_t *ds, uint64_t blk_birth)
+dsl_dataset_block_freeable(dsl_dataset_t *ds, const blkptr_t *bp,
+    uint64_t blk_birth)
 {
-	return (blk_birth > dsl_dataset_prev_snap_txg(ds));
+	if (blk_birth <= dsl_dataset_prev_snap_txg(ds))
+		return (B_FALSE);
+
+	if (zfs_dedup_prefetch && bp && BP_GET_DEDUP(bp))
+		ddt_prefetch(dsl_dataset_get_spa(ds), bp);
+
+	return (B_TRUE);
 }
 
 /* ARGSUSED */