diff options
author | Serapheim Dimitropoulos <[email protected]> | 2019-01-31 09:17:52 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-01-31 09:17:52 -0800 |
commit | 6c926f426a26ffb6d7d8e563e33fc176164175cb (patch) | |
tree | 1f44965641a93e5587bfd5dfafd1e8802cc83584 /module/zfs/vdev_removal.c | |
parent | 7558997d2f808368867ca7e5234e5793446e8f3f (diff) |
Simplify log vdev removal code
Get rid of the majority metaslab metadata when removing log vdevs
in spa_vdev_remove_log() with a call to metaslab_fini() instead
of duplicating a lot of that in vdev_remove_empty_log().
Reviewed-by: Matt Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Serapheim Dimitropoulos <[email protected]>
Closes #8347
Diffstat (limited to 'module/zfs/vdev_removal.c')
-rw-r--r-- | module/zfs/vdev_removal.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 8d8900787..706204997 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -1858,6 +1858,7 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg) ASSERT(vd->vdev_islog); ASSERT(vd == vd->vdev_top); + ASSERT(MUTEX_HELD(&spa_namespace_lock)); /* * Stop allocating from this vdev. @@ -1872,15 +1873,14 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg) *txg + TXG_CONCURRENT_STATES + TXG_DEFER_SIZE, 0, FTAG); /* - * Evacuate the device. We don't hold the config lock as writer - * since we need to do I/O but we do keep the + * Evacuate the device. We don't hold the config lock as + * writer since we need to do I/O but we do keep the * spa_namespace_lock held. Once this completes the device * should no longer have any blocks allocated on it. */ - if (vd->vdev_islog) { - if (vd->vdev_stat.vs_alloc != 0) - error = spa_reset_logs(spa); - } + ASSERT(MUTEX_HELD(&spa_namespace_lock)); + if (vd->vdev_stat.vs_alloc != 0) + error = spa_reset_logs(spa); *txg = spa_vdev_config_enter(spa); @@ -1899,6 +1899,8 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg) vdev_dirty_leaves(vd, VDD_DTL, *txg); vdev_config_dirty(vd); + vdev_metaslab_fini(vd); + spa_vdev_config_exit(spa, NULL, *txg, 0, FTAG); /* Stop initializing */ @@ -1923,6 +1925,8 @@ spa_vdev_remove_log(vdev_t *vd, uint64_t *txg) if (list_link_active(&vd->vdev_config_dirty_node)) vdev_config_clean(vd); + ASSERT0(vd->vdev_stat.vs_alloc); + /* * Clean up the vdev namespace. */ |