summaryrefslogtreecommitdiffstats
path: root/src/H5MF.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-04-06 17:32:20 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-04-06 17:32:20 (GMT)
commit9678dcffbf02f3d944a16af9ec6249f5a858df75 (patch)
tree2adc080153d4a201f7764c407c5de5f50e9e5ae5 /src/H5MF.c
parentfd079a23574376214aedeff9625b49d7b3917a81 (diff)
downloadhdf5-9678dcffbf02f3d944a16af9ec6249f5a858df75.zip
hdf5-9678dcffbf02f3d944a16af9ec6249f5a858df75.tar.gz
hdf5-9678dcffbf02f3d944a16af9ec6249f5a858df75.tar.bz2
Make some changes to conserve filespace and ensure that all filespace is
eventually reclaimed. Defer reclamation of raw data filespace, only. XXX Deferring only raw-data reclamation isn't *quite* sufficient because XXX a writer could conceivably reuse metadata space as raw-data space XXX before max_lag ticks have elapsed. Readers could see metadata XXX corrupted by raw data. Once a file starts to close, stop deferring reclamation. In H5MF_free_aggrs(), perform all deferred reclamations if the file is closing.
Diffstat (limited to 'src/H5MF.c')
-rw-r--r--src/H5MF.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/H5MF.c b/src/H5MF.c
index a3b5765..99263b9 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -1200,8 +1200,11 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size)
HGOTO_DONE(SUCCEED)
HDassert(addr != 0); /* Can't deallocate the superblock :-) */
- if (!f->shared->vfd_swmr_writer) {
- // not a VFD SWMR writer, do not defer or process deferrals
+ if (!f->shared->vfd_swmr_writer || f->shared->closing ||
+ alloc_type != H5FD_MEM_DRAW) {
+ /* VFD SWMR writers defer raw-data allocations until the
+ * file starts to close.
+ */
ret_value = H5MF__xfree_impl(f, alloc_type, addr, size);
} else if (defer_free(f->shared, alloc_type, addr, size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "could not defer")