summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/spa_config.c
diff options
context:
space:
mode:
authorMark J Musante <Mark.Musante@Sun.COM>2010-01-04 17:24:41 -0500
committerMark J Musante <Mark.Musante@Sun.COM>2010-01-04 17:24:41 -0500
commit1195e687f1c03c8d57417b5999578922e20a3554 (patch)
tree0ee99e0c83bed51074cd4abbf8fcdf58b0bd37e5 /usr/src/uts/common/fs/zfs/spa_config.c
parentb88604e3d674a4c82f27e5c41d05b8774a7547e4 (diff)
downloadillumos-gate-1195e687f1c03c8d57417b5999578922e20a3554.tar.gz
PSARC/2009/511 zpool split
5097228 provide 'zpool split' to create new pool by breaking all mirrors 6880831 memory leak in zpool add 6891438 zfs_ioc_userspace_upgrade could reference uninitialised error variable 6891441 zvol_create_minor sets local variable zv but never references it 6891442 spa_import() sets local variable spa but never references it 6895446 vdevs left open after removing slogs or offlining device/file
Diffstat (limited to 'usr/src/uts/common/fs/zfs/spa_config.c')
-rw-r--r--usr/src/uts/common/fs/zfs/spa_config.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr/src/uts/common/fs/zfs/spa_config.c b/usr/src/uts/common/fs/zfs/spa_config.c
index 176543c173..68a40bec89 100644
--- a/usr/src/uts/common/fs/zfs/spa_config.c
+++ b/usr/src/uts/common/fs/zfs/spa_config.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -335,6 +335,7 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
vdev_t *rvd = spa->spa_root_vdev;
unsigned long hostid = 0;
boolean_t locked = B_FALSE;
+ uint64_t split_guid;
if (vd == NULL) {
vd = rvd;
@@ -391,6 +392,14 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_IS_LOG,
1ULL) == 0);
vd = vd->vdev_top; /* label contains top config */
+ } else {
+ /*
+ * Only add the (potentially large) split information
+ * in the mos config, and not in the vdev labels
+ */
+ if (spa->spa_config_splitting != NULL)
+ VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_SPLIT,
+ spa->spa_config_splitting) == 0);
}
/*
@@ -400,6 +409,16 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
*/
vdev_top_config_generate(spa, config);
+ /*
+ * If we're splitting, record the original pool's guid.
+ */
+ if (spa->spa_config_splitting != NULL &&
+ nvlist_lookup_uint64(spa->spa_config_splitting,
+ ZPOOL_CONFIG_SPLIT_GUID, &split_guid) == 0) {
+ VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_SPLIT_GUID,
+ split_guid) == 0);
+ }
+
nvroot = vdev_config_generate(spa, vd, getstats, B_FALSE, B_FALSE);
VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, nvroot) == 0);
nvlist_free(nvroot);