summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache_image.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-12-09 16:30:58 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-12-09 16:30:58 (GMT)
commitc8f533cfc33ac743227cbed8eba361c715a2976f (patch)
treebcae5320f80bac774647cacbbd8493604f9384d2 /src/H5Ocache_image.c
parentadcf8a315e82c0848d126e7e46b662930c081896 (diff)
downloadhdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.zip
hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.gz
hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.bz2
Merge all of my changes from merge-back-to-feature-vfd_swmr-attempt-1,
including the merge of `hdffv/hdf5/develop`, back to the branch that Vailin and I share. Now I need to put this branch on a fork with a less confusing name than vchoi_fork!
Diffstat (limited to 'src/H5Ocache_image.c')
-rw-r--r--src/H5Ocache_image.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c
index 591ac4a..70d9ef5 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -27,11 +27,12 @@
*/
#include "H5Omodule.h" /* This source code file is part of the H5O module */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
+#include "H5Fpkg.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Opkg.h" /* Object headers */
#include "H5MFprivate.h" /* File space management */
@@ -275,16 +276,16 @@ H5O__mdci_free(void *mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__mdci_delete(H5F_t *f, H5O_t *open_oh, void *_mesg)
+H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg)
{
H5O_mdci_t *mesg = (H5O_mdci_t *)_mesg;
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t final_eoa; /* For sanity check */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* check args */
HDassert(f);
- HDassert(open_oh);
HDassert(mesg);
/* Free file space for cache image */
@@ -321,16 +322,24 @@ H5O__mdci_delete(H5F_t *f, H5O_t *open_oh, void *_mesg)
* before the first metadata cache access. However, given
* time constraints, I don't want to go there now.
*/
- if(H5F_FIRST_ALLOC_DEALLOC(f)) {
- HDassert(HADDR_UNDEF != H5F_EOA_PRE_FSM_FSALLOC(f));
- HDassert(H5F_addr_ge(mesg->addr, H5F_EOA_PRE_FSM_FSALLOC(f)));
- if(H5MF_tidy_self_referential_fsm_hack(f) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed")
- } /* end if */
- else {
+
+
+
+ if(f->shared->closing) {
+
+ /* Get the eoa, and verify that it has the expected value */
+ if(HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size")
+
+ HDassert(H5F_addr_eq(final_eoa, mesg->addr + mesg->size));
+
+ if(H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image")
+ } else {
if(H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block")
- } /* end else */
+ }
+
} /* end if */
done: