summaryrefslogtreecommitdiffstats
path: root/src/H5MFaggr.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2016-08-08 21:56:50 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2016-08-08 21:56:50 (GMT)
commit7de719287a6449cec0eab1e381d9a90f2ac8b8d1 (patch)
tree890b790ee1573c8c301a1c2c50c68bd4731fec80 /src/H5MFaggr.c
parent36c595e5ea604a815a259f439d7a36a7f026539b (diff)
downloadhdf5-7de719287a6449cec0eab1e381d9a90f2ac8b8d1.zip
hdf5-7de719287a6449cec0eab1e381d9a90f2ac8b8d1.tar.gz
hdf5-7de719287a6449cec0eab1e381d9a90f2ac8b8d1.tar.bz2
[svn-r30270] Fix an issue that could occur when allocating a chunked dataset in parallel,
with an alignment threshold set to be larger than the chunk size but smaller than the size of the small data aggregator. Tested: koala, ostrich (h5committest); jelly, ummon
Diffstat (limited to 'src/H5MFaggr.c')
-rw-r--r--src/H5MFaggr.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index f9bad97..c45b473 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -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 */