diff --git a/src/emap.c b/src/emap.c index 11e4f4a1..95ff7b34 100644 --- a/src/emap.c +++ b/src/emap.c @@ -272,9 +272,6 @@ void emap_split_commit(tsdn_t *tsdn, emap_t *emap, emap_prepare_t *prepare, edata_t *lead, 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) { - edata_size_set(lead, size_a); - edata_szind_set(lead, szind_a); - emap_rtree_write_acquired(tsdn, emap, prepare->lead_elm_a, prepare->lead_elm_b, lead, szind_a, slab_a); emap_rtree_write_acquired(tsdn, emap, prepare->trail_elm_a, @@ -313,13 +310,6 @@ emap_merge_commit(tsdn_t *tsdn, emap_t *emap, emap_prepare_t *prepare, merged_b = prepare->trail_elm_a; } - edata_size_set(lead, edata_size_get(lead) + edata_size_get(trail)); - edata_szind_set(lead, SC_NSIZES); - edata_sn_set(lead, (edata_sn_get(lead) < edata_sn_get(trail)) ? - edata_sn_get(lead) : edata_sn_get(trail)); - edata_zeroed_set(lead, edata_zeroed_get(lead) - && edata_zeroed_get(trail)); - emap_rtree_write_acquired(tsdn, emap, prepare->lead_elm_a, merged_b, lead, SC_NSIZES, false); } diff --git a/src/extent.c b/src/extent.c index 0d87cffa..b0db91dc 100644 --- a/src/extent.c +++ b/src/extent.c @@ -1229,6 +1229,8 @@ extent_split_impl(tsdn_t *tsdn, edata_cache_t *edata_cache, ehooks_t *ehooks, goto label_error_c; } + edata_size_set(edata, size_a); + edata_szind_set(edata, szind_a); emap_split_commit(tsdn, &emap_global, &prepare, edata, size_a, szind_a, slab_a, trail, size_b, szind_b, slab_b); @@ -1278,6 +1280,13 @@ extent_merge_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_cache_t *edata_cache, emap_merge_prepare(tsdn, &emap_global, &prepare, a, b); emap_lock_edata2(tsdn, &emap_global, a, b); + + edata_size_set(a, edata_size_get(a) + edata_size_get(b)); + edata_szind_set(a, SC_NSIZES); + edata_sn_set(a, (edata_sn_get(a) < edata_sn_get(b)) ? + edata_sn_get(a) : edata_sn_get(b)); + edata_zeroed_set(a, edata_zeroed_get(a) && edata_zeroed_get(b)); + emap_merge_commit(tsdn, &emap_global, &prepare, a, b); emap_unlock_edata2(tsdn, &emap_global, a, b);