diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-02 03:16:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-02 03:16:14 (GMT) |
commit | 61817758ddefdfc6f6de628f4ef0f5d509774c4b (patch) | |
tree | b02297821e9a4a6f35e42a2fa5f9f62015a56404 /src/H5HFcache.c | |
parent | bacf7149e948c6c33401a9ecb0ad16e60805a9a2 (diff) | |
download | hdf5-61817758ddefdfc6f6de628f4ef0f5d509774c4b.zip hdf5-61817758ddefdfc6f6de628f4ef0f5d509774c4b.tar.gz hdf5-61817758ddefdfc6f6de628f4ef0f5d509774c4b.tar.bz2 |
[svn-r18499] Description:
Bring r18498 from trunk to 1.8 branch:
Bring r18497 from metadata journaling "merging" branch to trunk:
Extract data structure 'destroy' routines from metadata cache client
'destroy' callbacks.
Tested on:
FreeBSD/32 6.3 (duty) w/debug
(h5committested on trunk)
Diffstat (limited to 'src/H5HFcache.c')
-rw-r--r-- | src/H5HFcache.c | 60 |
1 files changed, 18 insertions, 42 deletions
diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 4251f94..f1babd4 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -80,14 +80,17 @@ static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dt /* Metadata cache (H5AC) callbacks */ static H5HF_hdr_t *H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_hdr_t *hdr, unsigned UNUSED * flags_ptr); +static herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr); static herr_t H5HF_cache_hdr_clear(H5F_t *f, H5HF_hdr_t *hdr, hbool_t destroy); static herr_t H5HF_cache_hdr_size(const H5F_t *f, const H5HF_hdr_t *hdr, size_t *size_ptr); static H5HF_indirect_t *H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_indirect_t *iblock, unsigned UNUSED * flags_ptr); +static herr_t H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock); static herr_t H5HF_cache_iblock_clear(H5F_t *f, H5HF_indirect_t *iblock, hbool_t destroy); static herr_t H5HF_cache_iblock_size(const H5F_t *f, const H5HF_indirect_t *iblock, size_t *size_ptr); static H5HF_direct_t *H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_direct_t *dblock, unsigned UNUSED * flags_ptr); +static herr_t H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock); static herr_t H5HF_cache_dblock_clear(H5F_t *f, H5HF_direct_t *dblock, hbool_t destroy); static herr_t H5HF_cache_dblock_size(const H5F_t *f, const H5HF_direct_t *dblock, size_t *size_ptr); @@ -578,7 +581,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -605,6 +608,7 @@ H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr) /* Free the shared info itself */ if(H5HF_hdr_free(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "unable to release fractal heap header") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_cache_hdr_dest() */ @@ -864,7 +868,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows /* Allocate & initialize child indirect block pointer array */ if(NULL == (iblock->child_iblocks = H5FL_SEQ_CALLOC(H5HF_indirect_ptr_t, (size_t)(indir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block entries") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for block entries") } /* end if */ else iblock->child_iblocks = NULL; @@ -877,7 +881,8 @@ done: if(wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value && iblock) - (void)H5HF_cache_iblock_dest(f, iblock); + if(H5HF_man_iblock_dest(iblock) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap indirect block") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_cache_iblock_load() */ @@ -1083,7 +1088,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1112,26 +1117,9 @@ H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock) } /* end if */ } /* end if */ - /* Set the shared heap header's file context for this operation */ - iblock->hdr->f = f; - - /* Decrement reference count on shared info */ - if(H5HF_hdr_decr(iblock->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") - if(iblock->parent) - if(H5HF_iblock_decr(iblock->parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") - - /* Release entry tables */ - if(iblock->ents) - (void)H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents); - if(iblock->filt_ents) - (void)H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents); - if(iblock->child_iblocks) - (void)H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks); - - /* Free fractal heap indirect block info */ - (void)H5FL_FREE(H5HF_indirect_t, iblock); + /* Destroy fractal heap indirect block */ + if(H5HF_man_iblock_dest(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1376,7 +1364,8 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, done: if(!ret_value && dblock) - (void)H5HF_cache_dblock_dest(f, dblock); + if(H5HF_man_dblock_dest(dblock) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_cache_dblock_load() */ @@ -1668,7 +1657,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1698,22 +1687,9 @@ H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock) } /* end if */ } /* end if */ - /* Set the shared heap header's file context for this operation */ - dblock->hdr->f = f; - - /* Decrement reference count on shared fractal heap info */ - HDassert(dblock->hdr); - if(H5HF_hdr_decr(dblock->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") - if(dblock->parent) - if(H5HF_iblock_decr(dblock->parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") - - /* Free block's buffer */ - dblock->blk = H5FL_BLK_FREE(direct_block, dblock->blk); - - /* Free fractal heap direct block info */ - (void)H5FL_FREE(H5HF_direct_t, dblock); + /* Destroy fractal heap direct block */ + if(H5HF_man_dblock_dest(dblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") done: FUNC_LEAVE_NOAPI(ret_value) |