summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r--src/H5Ocache.c64
1 files changed, 13 insertions, 51 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 0709e60..780d5bb 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -70,6 +70,7 @@
static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
void *_udata2);
static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh, unsigned UNUSED * flags_ptr);
+static herr_t H5O_dest(H5F_t *f, H5O_t *oh);
static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy);
static herr_t H5O_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr);
@@ -628,7 +629,7 @@ H5O_assert(oh);
done:
/* Release the [possibly partially initialized] object header on errors */
if(!ret_value && oh)
- if(H5O_dest(f, oh) < 0)
+ if(H5O_free(oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to destroy object header data")
FUNC_LEAVE_NOAPI(ret_value)
@@ -814,7 +815,7 @@ H5O_assert(oh);
/* Destroy the object header, if requested */
if(destroy)
- if(H5O_dest(f,oh) < 0)
+ if(H5O_dest(f, oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
done:
@@ -835,17 +836,12 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5O_dest(H5F_t *f, H5O_t *oh)
{
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_dest)
-#ifdef QAK
-HDfprintf(stderr, "%s: oh->cache_info.addr = %a\n", FUNC, oh->cache_info.addr);
-HDfprintf(stderr, "%s: oh->cache_info.free_file_space_on_destroy = %t\n", FUNC, oh->cache_info.free_file_space_on_destroy);
-#endif /* QAK */
/* check args */
HDassert(oh);
@@ -856,51 +852,17 @@ HDfprintf(stderr, "%s: oh->cache_info.free_file_space_on_destroy = %t\n", FUNC,
/* If we're going to free the space on disk, the address must be valid */
HDassert(!oh->cache_info.free_file_space_on_destroy || H5F_addr_defined(oh->cache_info.addr));
- /* destroy chunks */
- if(oh->chunk) {
- /* Check for releasing file space for object header */
- if(oh->cache_info.free_file_space_on_destroy) {
- /* Free main (first) object header "chunk" */
- /* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_dxpl_id, oh->chunk[0].addr, (hsize_t)oh->chunk[0].size) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header")
- } /* end if */
-
- /* Release buffer for each chunk */
- for(u = 0; u < oh->nchunks; u++) {
- /* Verify that chunk is clean */
- HDassert(oh->chunk[u].dirty == 0);
-
- oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
- } /* end for */
-
- /* Release array of chunk info */
- oh->chunk = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
- } /* end if */
-
- /* destroy messages */
- if(oh->mesg) {
- for(u = 0; u < oh->nmesgs; u++) {
- /* Verify that message is clean, unless it could have been marked
- * dirty by decoding */
-#ifndef NDEBUG
- if(oh->ndecode_dirtied && oh->mesg[u].dirty)
- oh->ndecode_dirtied--;
- else
- HDassert(oh->mesg[u].dirty == 0);
-#endif /* NDEBUG */
-
- H5O_msg_free_mesg(&oh->mesg[u]);
- } /* end for */
-
- /* Make sure we accounted for all the messages dirtied by decoding */
- HDassert(!oh->ndecode_dirtied);
-
- oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
+ /* Check for releasing file space for object header */
+ if(oh->chunk && oh->cache_info.free_file_space_on_destroy) {
+ /* Free main (first) object header "chunk" */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_OHDR, H5AC_dxpl_id, oh->chunk[0].addr, (hsize_t)oh->chunk[0].size) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header")
} /* end if */
- /* destroy object header */
- (void)H5FL_FREE(H5O_t, oh);
+ /* Destroy object header */
+ if(H5O_free(oh) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't destroy object header")
done:
FUNC_LEAVE_NOAPI(ret_value)