svn commit: r266766 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys/fs vendor/ill...
Xin LI
delphij at FreeBSD.org
Tue May 27 19:05:28 UTC 2014
Author: delphij
Date: Tue May 27 19:05:26 2014
New Revision: 266766
URL: http://svnweb.freebsd.org/changeset/base/266766
Log:
3835 zfs need not store 2 copies of all metadata
illumos/illumos-gate at edf345e6b8342e8627ec20ce821a977a62cee19d
Modified:
vendor-sys/illumos/dist/common/zfs/zfs_prop.c
vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h
vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h
Changes in other areas also in this revision:
Modified:
vendor/illumos/dist/man/man1m/zfs.1m
Modified: vendor-sys/illumos/dist/common/zfs/zfs_prop.c
==============================================================================
--- vendor-sys/illumos/dist/common/zfs/zfs_prop.c Tue May 27 19:04:38 2014 (r266765)
+++ vendor-sys/illumos/dist/common/zfs/zfs_prop.c Tue May 27 19:05:26 2014 (r266766)
@@ -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) 2011, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
@@ -198,7 +198,18 @@ zfs_prop_init(void)
{ NULL }
};
+ static zprop_index_t redundant_metadata_table[] = {
+ { "all", ZFS_REDUNDANT_METADATA_ALL },
+ { "most", ZFS_REDUNDANT_METADATA_MOST },
+ { NULL }
+ };
+
/* inherit index properties */
+ zprop_register_index(ZFS_PROP_REDUNDANT_METADATA, "redundant_metadata",
+ ZFS_REDUNDANT_METADATA_ALL,
+ PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
+ "all | most", "REDUND_MD",
+ redundant_metadata_table);
zprop_register_index(ZFS_PROP_SYNC, "sync", ZFS_SYNC_STANDARD,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"standard | always | disabled", "SYNC",
Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Tue May 27 19:04:38 2014 (r266765)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Tue May 27 19:05:26 2014 (r266766)
@@ -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. */
/* Copyright (c) 2013, Joyent, Inc. All rights reserved. */
@@ -1558,6 +1558,12 @@ dmu_object_set_compress(objset_t *os, ui
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)
{
@@ -1597,6 +1603,13 @@ dmu_write_policy(objset_t *os, dnode_t *
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);
@@ -1644,7 +1657,7 @@ dmu_write_policy(objset_t *os, dnode_t *
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;
Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Tue May 27 19:04:38 2014 (r266765)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu_objset.c Tue May 27 19:05:26 2014 (r266766)
@@ -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.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
@@ -115,13 +115,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);
@@ -230,6 +230,20 @@ sync_changed_cb(void *arg, uint64_t newv
}
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;
@@ -364,6 +378,12 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat
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,
@@ -377,9 +397,9 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat
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;
}
@@ -622,6 +642,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),
Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Tue May 27 19:04:38 2014 (r266765)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu.h Tue May 27 19:05:26 2014 (r266766)
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright 2013 DEY Storage Systems, Inc.
@@ -737,8 +737,8 @@ extern struct dsl_dataset *dmu_objset_ds
extern void dmu_objset_name(objset_t *os, char *buf);
extern dmu_objset_type_t dmu_objset_type(objset_t *os);
extern uint64_t dmu_objset_id(objset_t *os);
-extern uint64_t dmu_objset_syncprop(objset_t *os);
-extern uint64_t dmu_objset_logbias(objset_t *os);
+extern zfs_sync_type_t dmu_objset_syncprop(objset_t *os);
+extern zfs_logbias_op_t dmu_objset_logbias(objset_t *os);
extern int dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
uint64_t *id, uint64_t *offp, boolean_t *case_conflict);
extern int dmu_snapshot_realname(objset_t *os, char *name, char *real,
Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Tue May 27 19:04:38 2014 (r266765)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dmu_objset.h Tue May 27 19:05:26 2014 (r266766)
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
*/
@@ -85,15 +85,16 @@ struct objset {
zilog_t *os_zil;
/* can change, under dsl_dir's locks: */
- uint8_t os_checksum;
- uint8_t os_compress;
+ enum zio_checksum os_checksum;
+ enum zio_compress os_compress;
uint8_t os_copies;
- uint8_t os_dedup_checksum;
- uint8_t os_dedup_verify;
- uint8_t os_logbias;
- uint8_t os_primary_cache;
- uint8_t os_secondary_cache;
- uint8_t os_sync;
+ enum zio_checksum os_dedup_checksum;
+ boolean_t os_dedup_verify;
+ zfs_logbias_op_t os_logbias;
+ zfs_cache_type_t os_primary_cache;
+ zfs_cache_type_t os_secondary_cache;
+ zfs_sync_type_t os_sync;
+ zfs_redundant_metadata_type_t os_redundant_metadata;
/* no lock needed: */
struct dmu_tx *os_synctx; /* XXX sketchy */
Modified: vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h
==============================================================================
--- vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Tue May 27 19:04:38 2014 (r266765)
+++ vendor-sys/illumos/dist/uts/common/sys/fs/zfs.h Tue May 27 19:05:26 2014 (r266766)
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
@@ -146,6 +146,7 @@ typedef enum {
ZFS_PROP_SNAPSHOT_LIMIT,
ZFS_PROP_FILESYSTEM_COUNT,
ZFS_PROP_SNAPSHOT_COUNT,
+ ZFS_PROP_REDUNDANT_METADATA,
ZFS_NUM_PROPS
} zfs_prop_t;
@@ -339,6 +340,10 @@ typedef enum {
ZFS_SYNC_DISABLED = 2
} zfs_sync_type_t;
+typedef enum {
+ ZFS_REDUNDANT_METADATA_ALL,
+ ZFS_REDUNDANT_METADATA_MOST
+} zfs_redundant_metadata_type_t;
/*
* On-disk version number.
More information about the svn-src-all
mailing list