aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu_objset.c
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2014-05-23 08:21:07 -0800
committerBrian Behlendorf <[email protected]>2014-07-31 09:49:34 -0700
commitfaf0f58c69607a15e2d1563567afb815842805de (patch)
treebd2cfbb4296353792f34d11c09cbd108b7757ed1 /module/zfs/dmu_objset.c
parent603cb25ca51ff89366886f9a4ed58f68b6aba2da (diff)
Illumos 3835 zfs need not store 2 copies of all metadata
Reviewed by: George Wilson <[email protected]> Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Dan McDonald <[email protected]> Approved by: Richard Lowe <[email protected]> Description from Matt Ahrens's bug report at Delphix: Add a new zfs property, "redundant_metadata" which can have values "all" or "most". The default will be "all", which is the current behavior. Setting to "most" will cause us to only store 1 copy of level-1 indirect blocks of user data files. Additional notes: The new man page section for this property states "The exact behavior of which metadata blocks are stored redundantly may change in future releases." and: "When set to most, ZFS stores an extra copy of most types of metadata. This can improve performance of random writes, because less metadata must be written." The current implementation is as described above in Matt's blog. It is controlled by a new global integer "zfs_redundant_metadata_most_ditto_level", currently initialized to 2. When "redundant_metadata" is set to "most", only indirect blocks of the specified level and higher will have additional ditto blocks created. Ported by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2542
Diffstat (limited to 'module/zfs/dmu_objset.c')
-rw-r--r--module/zfs/dmu_objset.c35
1 files changed, 29 insertions, 6 deletions
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),