summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dmu.c17
-rw-r--r--module/zfs/dmu_objset.c35
2 files changed, 44 insertions, 8 deletions
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
index 103eec1d5..d8e5739f4 100644
--- a/module/zfs/dmu.c
+++ b/module/zfs/dmu.c
@@ -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.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
*/
@@ -1688,6 +1688,12 @@ dmu_object_set_compress(objset_t *os, uint64_t object, uint8_t compress,
int zfs_mdcomp_disable = 0;
+/*
+ * When the "redundant_metadata" property is set to "most", only indirect
+ * blocks of this level and higher will have an additional ditto block.
+ */
+int zfs_redundant_metadata_most_ditto_level = 2;
+
void
dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
{
@@ -1727,6 +1733,13 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
if (zio_checksum_table[checksum].ci_correctable < 1 ||
zio_checksum_table[checksum].ci_eck)
checksum = ZIO_CHECKSUM_FLETCHER_4;
+
+ if (os->os_redundant_metadata == ZFS_REDUNDANT_METADATA_ALL ||
+ (os->os_redundant_metadata ==
+ ZFS_REDUNDANT_METADATA_MOST &&
+ (level >= zfs_redundant_metadata_most_ditto_level ||
+ DMU_OT_IS_METADATA(type) || (wp & WP_SPILL))))
+ copies++;
} else if (wp & WP_NOFILL) {
ASSERT(level == 0);
@@ -1774,7 +1787,7 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
zp->zp_compress = compress;
zp->zp_type = (wp & WP_SPILL) ? dn->dn_bonustype : type;
zp->zp_level = level;
- zp->zp_copies = MIN(copies + ismd, spa_max_replication(os->os_spa));
+ zp->zp_copies = MIN(copies, spa_max_replication(os->os_spa));
zp->zp_dedup = dedup;
zp->zp_dedup_verify = dedup && dedup_verify;
zp->zp_nopwrite = nopwrite;
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
index fc7c80365..b82783098 100644
--- a/module/zfs/dmu_objset.c
+++ b/module/zfs/dmu_objset.c
@@ -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.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
*/
@@ -114,13 +114,13 @@ dmu_objset_id(objset_t *os)
return (ds ? ds->ds_object : 0);
}
-uint64_t
+zfs_sync_type_t
dmu_objset_syncprop(objset_t *os)
{
return (os->os_sync);
}
-uint64_t
+zfs_logbias_op_t
dmu_objset_logbias(objset_t *os)
{
return (os->os_logbias);
@@ -229,6 +229,20 @@ sync_changed_cb(void *arg, uint64_t newval)
}
static void
+redundant_metadata_changed_cb(void *arg, uint64_t newval)
+{
+ objset_t *os = arg;
+
+ /*
+ * Inheritance and range checking should have been done by now.
+ */
+ ASSERT(newval == ZFS_REDUNDANT_METADATA_ALL ||
+ newval == ZFS_REDUNDANT_METADATA_MOST);
+
+ os->os_redundant_metadata = newval;
+}
+
+static void
logbias_changed_cb(void *arg, uint64_t newval)
{
objset_t *os = arg;
@@ -363,6 +377,12 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
zfs_prop_to_name(ZFS_PROP_SYNC),
sync_changed_cb, os);
}
+ if (err == 0) {
+ err = dsl_prop_register(ds,
+ zfs_prop_to_name(
+ ZFS_PROP_REDUNDANT_METADATA),
+ redundant_metadata_changed_cb, os);
+ }
}
if (err != 0) {
VERIFY(arc_buf_remove_ref(os->os_phys_buf,
@@ -376,9 +396,9 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
os->os_compress = ZIO_COMPRESS_LZJB;
os->os_copies = spa_max_replication(spa);
os->os_dedup_checksum = ZIO_CHECKSUM_OFF;
- os->os_dedup_verify = 0;
- os->os_logbias = 0;
- os->os_sync = 0;
+ os->os_dedup_verify = B_FALSE;
+ os->os_logbias = ZFS_LOGBIAS_LATENCY;
+ os->os_sync = ZFS_SYNC_STANDARD;
os->os_primary_cache = ZFS_CACHE_ALL;
os->os_secondary_cache = ZFS_CACHE_ALL;
}
@@ -623,6 +643,9 @@ dmu_objset_evict(objset_t *os)
VERIFY0(dsl_prop_unregister(ds,
zfs_prop_to_name(ZFS_PROP_SYNC),
sync_changed_cb, os));
+ VERIFY0(dsl_prop_unregister(ds,
+ zfs_prop_to_name(ZFS_PROP_REDUNDANT_METADATA),
+ redundant_metadata_changed_cb, os));
}
VERIFY0(dsl_prop_unregister(ds,
zfs_prop_to_name(ZFS_PROP_PRIMARYCACHE),