summaryrefslogtreecommitdiffstats
path: root/module/zfs/spa.c
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2017-01-12 12:52:56 -0700
committerBrian Behlendorf <[email protected]>2017-01-12 11:52:56 -0800
commit4e21fd060a567a9c8a1bd0e640985412181c1e33 (patch)
tree622424c5f98ac43cd93d8af221775a77df161856 /module/zfs/spa.c
parent5727b00e06a4208a7040489d582f13bc3c183384 (diff)
OpenZFS 7303 - dynamic metaslab selection
This change introduces a new weighting algorithm to improve metaslab selection. The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a result, the metaslab weight now encodes the type of weighting algorithm used (size-based vs segment-based). Porting Notes: The metaslab allocation tracing code is conditionally removed on linux (dependent on mdb debugger). Authored by: George Wilson <[email protected]> Reviewed by: Alex Reece <[email protected]> Reviewed by: Chris Siden <[email protected]> Reviewed by: Dan Kimmel <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Pavel Zakharov [email protected] Reviewed by: Prakash Surya <[email protected]> Reviewed by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: Don Brady <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7303 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d5190931bd Closes #5404
Diffstat (limited to 'module/zfs/spa.c')
-rw-r--r--module/zfs/spa.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index f3d821f79..b4ca3c4d3 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -1313,7 +1313,7 @@ spa_config_parse(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent,
static void
spa_unload(spa_t *spa)
{
- int i;
+ int i, c;
ASSERT(MUTEX_HELD(&spa_namespace_lock));
@@ -1331,6 +1331,19 @@ spa_unload(spa_t *spa)
}
/*
+ * Even though vdev_free() also calls vdev_metaslab_fini, we need
+ * to call it earlier, before we wait for async i/o to complete.
+ * This ensures that there is no async metaslab prefetching, by
+ * calling taskq_wait(mg_taskq).
+ */
+ if (spa->spa_root_vdev != NULL) {
+ spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
+ for (c = 0; c < spa->spa_root_vdev->vdev_children; c++)
+ vdev_metaslab_fini(spa->spa_root_vdev->vdev_child[c]);
+ spa_config_exit(spa, SCL_ALL, FTAG);
+ }
+
+ /*
* Wait for any outstanding async I/O to complete.
*/
if (spa->spa_async_zio_root != NULL) {