Geom_grow: Don't keep the mutex internal.

We're about to use it in ways that will have external synchronization.
This commit is contained in:
David Goldblatt 2020-08-11 10:18:31 -07:00 committed by David Goldblatt
parent c57494879f
commit 5e90fd006e
6 changed files with 19 additions and 43 deletions

View file

@ -68,7 +68,9 @@ pac_init(tsdn_t *tsdn, pac_t *pac, base_t *base, emap_t *emap,
ind, /* delay_coalesce */ false)) {
return true;
}
if (geom_grow_init(&pac->geom_grow)) {
geom_grow_init(&pac->geom_grow);
if (malloc_mutex_init(&pac->grow_mtx, "extent_grow",
WITNESS_RANK_EXTENT_GROW, malloc_mutex_rank_exclusive)) {
return true;
}
if (decay_init(&pac->decay_dirty, cur_time, dirty_decay_ms)) {
@ -203,14 +205,14 @@ pac_retain_grow_limit_get_set(tsdn_t *tsdn, pac_t *pac, size_t *old_limit,
}
}
malloc_mutex_lock(tsdn, &pac->geom_grow.mtx);
malloc_mutex_lock(tsdn, &pac->grow_mtx);
if (old_limit != NULL) {
*old_limit = sz_pind2sz(pac->geom_grow.limit);
}
if (new_limit != NULL) {
pac->geom_grow.limit = new_ind;
}
malloc_mutex_unlock(tsdn, &pac->geom_grow.mtx);
malloc_mutex_unlock(tsdn, &pac->grow_mtx);
return false;
}