diff options
author | Serapheim Dimitropoulos <[email protected]> | 2019-01-18 11:10:32 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-01-18 11:10:32 -0800 |
commit | b194fab0fb6caad18711abccaff3c69ad8b3f6d3 (patch) | |
tree | 7f8d8d3507dc910b505d442921b826f30b1e3e66 /module/zfs/vdev_initialize.c | |
parent | 960347d3a684a0063614eb293950f8f8c7dce7e1 (diff) |
Factor metaslab_load_wait() in metaslab_load()
Most callers that need to operate on a loaded metaslab, always
call metaslab_load_wait() before loading the metaslab just in
case someone else is already doing the work.
Factoring metaslab_load_wait() within metaslab_load() makes the
later more robust, as callers won't have to do the load-wait
check explicitly every time they need to load a metaslab.
Reviewed-by: Matt Ahrens <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Serapheim Dimitropoulos <[email protected]>
Closes #8290
Diffstat (limited to 'module/zfs/vdev_initialize.c')
-rw-r--r-- | module/zfs/vdev_initialize.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/module/zfs/vdev_initialize.c b/module/zfs/vdev_initialize.c index 939a5e938..e68f23e3f 100644 --- a/module/zfs/vdev_initialize.c +++ b/module/zfs/vdev_initialize.c @@ -363,16 +363,6 @@ vdev_initialize_ranges(vdev_t *vd, abd_t *data) } static void -vdev_initialize_ms_load(metaslab_t *msp) -{ - ASSERT(MUTEX_HELD(&msp->ms_lock)); - - metaslab_load_wait(msp); - if (!msp->ms_loaded) - VERIFY0(metaslab_load(msp)); -} - -static void vdev_initialize_mg_wait(metaslab_group_t *mg) { ASSERT(MUTEX_HELD(&mg->mg_ms_initialize_lock)); @@ -494,7 +484,7 @@ vdev_initialize_calculate_progress(vdev_t *vd) * metaslab. Load it and walk the free tree for more accurate * progress estimation. */ - vdev_initialize_ms_load(msp); + VERIFY0(metaslab_load(msp)); for (range_seg_t *rs = avl_first(&msp->ms_allocatable->rt_root); rs; rs = AVL_NEXT(&msp->ms_allocatable->rt_root, rs)) { @@ -630,7 +620,7 @@ vdev_initialize_thread(void *arg) vdev_initialize_ms_mark(msp); mutex_enter(&msp->ms_lock); - vdev_initialize_ms_load(msp); + VERIFY0(metaslab_load(msp)); range_tree_walk(msp->ms_allocatable, vdev_initialize_range_add, vd); |