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 <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #8290
This commit is contained in:
Serapheim Dimitropoulos
2019-01-18 11:10:32 -08:00
committed by Brian Behlendorf
parent 960347d3a6
commit b194fab0fb
5 changed files with 53 additions and 55 deletions
-1
View File
@@ -49,7 +49,6 @@ int metaslab_init(metaslab_group_t *, uint64_t, uint64_t, uint64_t,
metaslab_t **);
void metaslab_fini(metaslab_t *);
void metaslab_load_wait(metaslab_t *);
int metaslab_load(metaslab_t *);
void metaslab_unload(metaslab_t *);
+2 -2
View File
@@ -369,8 +369,8 @@ struct metaslab {
uint64_t ms_initializing; /* leaves initializing this ms */
/*
* We must hold both ms_lock and ms_group->mg_lock in order to
* modify ms_loaded.
* We must always hold the ms_lock when modifying ms_loaded
* and ms_loading.
*/
boolean_t ms_loaded;
boolean_t ms_loading;