diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-09-14 21:02:43 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-09-14 21:02:43 (GMT) |
commit | 7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4 (patch) | |
tree | e18b6cefc2cc51c58ebacec1d6a9051742754f71 /src/H5MFaggr.c | |
parent | c1c384878ba58193120c3da804d761542c47bd7d (diff) | |
parent | 052efd9bde06ea2427beffd3ea493cbc53a17608 (diff) | |
download | hdf5-7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4.zip hdf5-7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4.tar.gz hdf5-7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4.tar.bz2 |
Merge branch 'develop' into evict_on_close
Diffstat (limited to 'src/H5MFaggr.c')
-rw-r--r-- | src/H5MFaggr.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index f2c5936..c45b473 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -201,7 +201,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz alignment = 0; /* no alignment */ /* Generate fragment if aggregator is mis-aligned */ - if(alignment && aggr->addr > 0 && aggr->size > 0 && (aggr_mis_align = (aggr->addr + H5FD_get_base_addr(f->shared->lf)) % alignment)) { + if(alignment && aggr->addr > 0 && (aggr_mis_align = (aggr->addr + H5FD_get_base_addr(f->shared->lf)) % alignment)) { aggr_frag_addr = aggr->addr; aggr_frag_size = alignment - aggr_mis_align; } /* end if */ @@ -295,10 +295,26 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); if(H5MF_xfree(f, alloc_type, dxpl_id, aggr->addr, aggr->size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") - /* Point the aggregator at the newly allocated block */ - aggr->addr = new_space; - aggr->size = aggr->alloc_size; - aggr->tot_size = aggr->alloc_size; + /* If the block is not to be aligned, fold the eoa fragment + * into the newly allocated aggregator, as it could have + * been allocated in an aligned manner if the aggregator + * block is larger than the threshold */ + if(eoa_frag_size && !alignment) { + HDassert(eoa_frag_addr + eoa_frag_size == new_space); + aggr->addr = eoa_frag_addr; + aggr->size = aggr->alloc_size + eoa_frag_size; + aggr->tot_size = aggr->size; + + /* Reset EOA fragment */ + eoa_frag_addr = HADDR_UNDEF; + eoa_frag_size = 0; + } /* end if */ + else { + /* Point the aggregator at the newly allocated block */ + aggr->addr = new_space; + aggr->size = aggr->alloc_size; + aggr->tot_size = aggr->alloc_size; + } } /* end else */ /* Allocate space out of the metadata block */ |