diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-08 15:30:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-08 15:30:10 (GMT) |
commit | 13d61651f8bfba0739aac1cad17d4b11affb59ae (patch) | |
tree | 78dd33346cc19aa02ade365659e2ba37b62c0d17 /src/H5B2cache.c | |
parent | 42efc1c2b591e4cd45ec6cb3bdf32044343118d2 (diff) | |
download | hdf5-13d61651f8bfba0739aac1cad17d4b11affb59ae.zip hdf5-13d61651f8bfba0739aac1cad17d4b11affb59ae.tar.gz hdf5-13d61651f8bfba0739aac1cad17d4b11affb59ae.tar.bz2 |
[svn-r18534] Description:
Bring r18446:18533 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5B2cache.c')
-rw-r--r-- | src/H5B2cache.c | 69 |
1 files changed, 22 insertions, 47 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 1d795ec..af329c7 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -71,14 +71,17 @@ /* Metadata cache callbacks */ static H5B2_hdr_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_hdr_t *hdr, unsigned UNUSED * flags_ptr); +static herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr); static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_hdr_t *hdr, hbool_t destroy); static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_hdr_t *hdr, size_t *size_ptr); static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *udata2); static herr_t H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_internal_t *i, unsigned UNUSED * flags_ptr); +static herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal); static herr_t H5B2_cache_internal_clear(H5F_t *f, H5B2_internal_t *i, hbool_t destroy); static herr_t H5B2_cache_internal_size(const H5F_t *f, const H5B2_internal_t *i, size_t *size_ptr); static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_hdr); static herr_t H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_leaf_t *l, unsigned UNUSED * flags_ptr); +static herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf); static herr_t H5B2_cache_leaf_clear(H5F_t *f, H5B2_leaf_t *l, hbool_t destroy); static herr_t H5B2_cache_leaf_size(const H5F_t *f, const H5B2_leaf_t *l, size_t *size_ptr); @@ -380,16 +383,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_dest) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(hdr); HDassert(hdr->rc == 0); @@ -606,7 +607,8 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda done: if(!ret_value && internal) - (void)H5B2_cache_internal_dest(f, internal); + if(H5B2_internal_free(internal) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree internal node") FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_cache_internal_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -722,16 +724,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_dest) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(internal); HDassert(internal->hdr); @@ -747,23 +747,9 @@ H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree internal node") } /* end if */ - /* Set the B-tree header's file context for this operation */ - internal->hdr->f = f; - - /* Release internal node's native key buffer */ - if(internal->int_native) - H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].nat_rec_fac, internal->int_native); - - /* Release internal node's node pointer buffer */ - if(internal->node_ptrs) - H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].node_ptr_fac, internal->node_ptrs); - - /* Decrement ref. count on B-tree header */ - if(H5B2_hdr_decr(internal->hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header") - - /* Free B-tree internal node info */ - internal = H5FL_FREE(H5B2_internal_t, internal); + /* Release v2 b-tree internal node */ + if(H5B2_internal_free(internal) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node") done: FUNC_LEAVE_NOAPI(ret_value) @@ -944,7 +930,8 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v done: if(!ret_value && leaf) - (void)H5B2_cache_leaf_dest(f, leaf); + if(H5B2_leaf_free(leaf) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree leaf node") FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_cache_leaf_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -1046,16 +1033,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_dest) - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(leaf); HDassert(leaf->hdr); @@ -1071,19 +1056,9 @@ H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree leaf node") } /* end if */ - /* Set the B-tree header's file context for this operation */ - leaf->hdr->f = f; - - /* Release leaf's native key buffer */ - if(leaf->leaf_native) - H5FL_FAC_FREE(leaf->hdr->node_info[0].nat_rec_fac, leaf->leaf_native); - - /* Decrement ref. count on B-tree header */ - if(H5B2_hdr_decr(leaf->hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header") - - /* Free B-tree leaf node info */ - leaf = H5FL_FREE(H5B2_leaf_t, leaf); + /* Destroy v2 b-tree leaf node */ + if(H5B2_leaf_free(leaf) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node") done: FUNC_LEAVE_NOAPI(ret_value) |