Emap: Move out last edata state touching.

This commit is contained in:
David Goldblatt 2020-03-13 19:33:30 -07:00 committed by David Goldblatt
parent 0c96a2f03b
commit 883ab327cc
3 changed files with 11 additions and 20 deletions

View File

@ -87,12 +87,10 @@ struct emap_prepare_s {
};
/**
* These functions do some of the metadata management for merging, splitting,
* and reusing extents. In particular, they set the boundary mappings from
* addresses to edatas and fill in the szind, size, and slab values for the
* output edata (and, for splitting, *all* values for the trail). If the result
* is going to be used as a slab, you still need to call emap_register_interior
* on it, though.
* These functions the emap metadata management for merging, splitting, and
* reusing extents. In particular, they set the boundary mappings from
* addresses to edatas. If the result is going to be used as a slab, you
* still need to call emap_register_interior on it, though.
*
* Remap simply changes the szind and slab status of an extent's boundary
* mappings. If the extent is not a slab, it doesn't bother with updating the
@ -107,9 +105,8 @@ struct emap_prepare_s {
* and it returns true on failure (at which point the caller shouldn't commit).
*
* In all cases, "lead" refers to the lower-addressed extent, and trail to the
* higher-addressed one. Trail can contain garbage (except for its arena_ind
* and esn values) data for the split variants, and can be reused for any
* purpose by its given arena after a merge or a failed split.
* higher-addressed one. It's the caller's responsibility to set the edata
* state appropriately.
*/
void emap_remap(tsdn_t *tsdn, emap_t *emap, edata_t *edata, szind_t szind,
bool slab);

View File

@ -228,7 +228,6 @@ void emap_remap(tsdn_t *tsdn, emap_t *emap, edata_t *edata, szind_t szind,
szind, slab);
}
}
}
bool
@ -236,16 +235,6 @@ emap_split_prepare(tsdn_t *tsdn, emap_t *emap, emap_prepare_t *prepare,
edata_t *edata, size_t size_a, szind_t szind_a, bool slab_a, edata_t *trail,
size_t size_b, szind_t szind_b, bool slab_b) {
EMAP_DECLARE_RTREE_CTX;
/*
* Note that while the trail mostly inherits its attributes from the
* extent to be split, it maintains its own arena ind -- this allows
* cross-arena edata interactions, such as occur in the range ecache.
*/
edata_init(trail, edata_arena_ind_get(trail),
(void *)((uintptr_t)edata_base_get(edata) + size_a), size_b,
slab_b, szind_b, edata_sn_get(edata), edata_state_get(edata),
edata_zeroed_get(edata), edata_committed_get(edata),
edata_ranged_get(edata), EXTENT_NOT_HEAD);
/*
* We use incorrect constants for things like arena ind, zero, ranged,

View File

@ -1213,6 +1213,11 @@ extent_split_impl(tsdn_t *tsdn, edata_cache_t *edata_cache, ehooks_t *ehooks,
goto label_error_a;
}
edata_init(trail, edata_arena_ind_get(edata),
(void *)((uintptr_t)edata_base_get(edata) + size_a), size_b,
slab_b, szind_b, edata_sn_get(edata), edata_state_get(edata),
edata_zeroed_get(edata), edata_committed_get(edata),
edata_ranged_get(edata), EXTENT_NOT_HEAD);
emap_prepare_t prepare;
bool err = emap_split_prepare(tsdn, &emap_global, &prepare, edata,
size_a, szind_a, slab_a, trail, size_b, szind_b, slab_b);