diff options
author | avg <avg@FreeBSD.org> | 2014-02-17 17:11:38 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2014-02-17 17:11:38 +0000 |
commit | 51714698c30564bf94b9e62fd46b2a1d5616c7e5 (patch) | |
tree | a610550b00fbf853249cb8cdfdc2400785ca1069 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c | |
parent | 92000681d74b0aa6a7484fbba39edf34a2ec6a96 (diff) | |
download | FreeBSD-src-51714698c30564bf94b9e62fd46b2a1d5616c7e5.zip FreeBSD-src-51714698c30564bf94b9e62fd46b2a1d5616c7e5.tar.gz |
MFC r258717: MFV r258371,r258372: 4101 metaslab_debug should allow for
fine-grained control
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c index 3954b68..6b51705 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c @@ -1275,6 +1275,15 @@ spa_unload(spa_t *spa) bpobj_close(&spa->spa_deferred_bpobj); + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); + + /* + * Close all vdevs. + */ + if (spa->spa_root_vdev) + vdev_free(spa->spa_root_vdev); + ASSERT(spa->spa_root_vdev == NULL); + /* * Close the dsl pool. */ @@ -1286,20 +1295,12 @@ spa_unload(spa_t *spa) ddt_unload(spa); - spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); /* * Drop and purge level 2 cache */ spa_l2cache_drop(spa); - /* - * Close all vdevs. - */ - if (spa->spa_root_vdev) - vdev_free(spa->spa_root_vdev); - ASSERT(spa->spa_root_vdev == NULL); - for (i = 0; i < spa->spa_spares.sav_count; i++) vdev_free(spa->spa_spares.sav_vdevs[i]); if (spa->spa_spares.sav_vdevs) { @@ -4765,7 +4766,9 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing) vdev_dirty(tvd, VDD_DTL, newvd, txg); /* - * Restart the resilver + * Schedule the resilver to restart in the future. We do this to + * ensure that dmu_sync-ed blocks have been stitched into the + * respective datasets. */ dsl_resilver_restart(spa->spa_dsl_pool, dtl_max_txg); @@ -5394,7 +5397,7 @@ spa_vdev_remove_evacuate(spa_t *spa, vdev_t *vd) ASSERT0(vd->vdev_stat.vs_alloc); txg = spa_vdev_config_enter(spa); vd->vdev_removing = B_TRUE; - vdev_dirty(vd, 0, NULL, txg); + vdev_dirty_leaves(vd, VDD_DTL, txg); vdev_config_dirty(vd); spa_vdev_config_exit(spa, NULL, txg, 0, FTAG); @@ -6238,7 +6241,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx) ASSERT(zpool_prop_feature(nvpair_name(elem))); fname = strchr(nvpair_name(elem), '@') + 1; - VERIFY3U(0, ==, zfeature_lookup_name(fname, &feature)); + VERIFY0(zfeature_lookup_name(fname, &feature)); spa_feature_enable(spa, feature, tx); spa_history_log_internal(spa, "set", tx, @@ -6246,7 +6249,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx) break; case ZPOOL_PROP_VERSION: - VERIFY(nvpair_value_uint64(elem, &intval) == 0); + intval = fnvpair_value_uint64(elem); /* * The version is synced seperatly before other * properties and should be correct by now. @@ -6270,7 +6273,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx) */ break; case ZPOOL_PROP_COMMENT: - VERIFY(nvpair_value_string(elem, &strval) == 0); + strval = fnvpair_value_string(elem); if (spa->spa_comment != NULL) spa_strfree(spa->spa_comment); spa->spa_comment = spa_strdup(strval); @@ -6302,23 +6305,23 @@ spa_sync_props(void *arg, dmu_tx_t *tx) if (nvpair_type(elem) == DATA_TYPE_STRING) { ASSERT(proptype == PROP_TYPE_STRING); - VERIFY(nvpair_value_string(elem, &strval) == 0); - VERIFY(zap_update(mos, + strval = fnvpair_value_string(elem); + VERIFY0(zap_update(mos, spa->spa_pool_props_object, propname, - 1, strlen(strval) + 1, strval, tx) == 0); + 1, strlen(strval) + 1, strval, tx)); spa_history_log_internal(spa, "set", tx, "%s=%s", nvpair_name(elem), strval); } else if (nvpair_type(elem) == DATA_TYPE_UINT64) { - VERIFY(nvpair_value_uint64(elem, &intval) == 0); + intval = fnvpair_value_uint64(elem); if (proptype == PROP_TYPE_INDEX) { const char *unused; - VERIFY(zpool_prop_index_to_string( - prop, intval, &unused) == 0); + VERIFY0(zpool_prop_index_to_string( + prop, intval, &unused)); } - VERIFY(zap_update(mos, + VERIFY0(zap_update(mos, spa->spa_pool_props_object, propname, - 8, 1, &intval, tx) == 0); + 8, 1, &intval, tx)); spa_history_log_internal(spa, "set", tx, "%s=%lld", nvpair_name(elem), intval); } else { |