From 113a60aac235b9c4fed65c952eda79bdbfbf9d8b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 17 Dec 2009 09:14:03 -0500 Subject: [svn-r18029] Description: Code cleanups & tweaks to converge branch toward trunk. Tested on: Mac OS X/32 10.6.2 (amazon) debug & production (h5committest not required on this branch) --- config/gnu-flags | 81 ++++++- src/H5A.c | 8 +- src/H5B.c | 12 +- src/H5B2.c | 22 +- src/H5B2cache.c | 79 ++----- src/H5B2dbg.c | 6 +- src/H5B2int.c | 26 +-- src/H5B2stat.c | 2 +- src/H5B2test.c | 4 +- src/H5Bcache.c | 9 +- src/H5C2.c | 4 +- src/H5C2journal.c | 250 ++++++++------------ src/H5C2private.h | 6 +- src/H5D.c | 2 +- src/H5Ddeprec.c | 2 +- src/H5Dint.c | 2 +- src/H5Dio.c | 2 +- src/H5E.c | 2 +- src/H5F.c | 191 ++++----------- src/H5FS.c | 6 +- src/H5FScache.c | 157 +++---------- src/H5FSdbg.c | 4 +- src/H5FSsection.c | 10 +- src/H5Fmount.c | 2 +- src/H5Fpublic.h | 2 +- src/H5Fsuper.c | 263 +++++---------------- src/H5G.c | 2 +- src/H5Gdeprec.c | 2 +- src/H5Gnode.c | 26 +-- src/H5Gpkg.h | 20 +- src/H5Gstab.c | 68 +++--- src/H5HF.c | 21 +- src/H5HFcache.c | 549 +++++++++++++------------------------------- src/H5HFdbg.c | 14 +- src/H5HFdblock.c | 168 ++------------ src/H5HFhdr.c | 191 +-------------- src/H5HFiblock.c | 131 +---------- src/H5HFiter.c | 16 -- src/H5HFman.c | 83 +------ src/H5HFpkg.h | 1 - src/H5HFsection.c | 350 ---------------------------- src/H5HG.c | 151 +----------- src/H5HGcache.c | 210 +++++++---------- src/H5HL.c | 2 +- src/H5I.c | 31 ++- src/H5L.c | 2 +- src/H5Lexternal.c | 2 +- src/H5MF.c | 66 +----- src/H5O.c | 3 - src/H5Omessage.c | 5 +- src/H5Pdcpl.c | 4 +- src/H5Pfapl.c | 61 ++--- src/H5R.c | 2 +- src/H5SM.c | 34 ++- src/H5SMcache.c | 60 ++--- src/H5SMtest.c | 2 +- src/H5T.c | 2 +- src/H5Tcommit.c | 2 +- src/H5Tdeprec.c | 2 +- src/H5err.txt | 1 - test/cache2_journal.c | 333 ++++++++++++--------------- test/testhdf5.c | 1 - tools/h5recover/h5recover.c | 2 +- 63 files changed, 983 insertions(+), 2791 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index a8e16cb..c1990e0 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -26,8 +26,10 @@ # cc_version: Version number: 2.91.60, 2.7.2.1 # if test X = "X$cc_flags_set"; then - cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 |grep 'gcc version' |\ - sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + # PathScale compiler spits out gcc version string too. Need to + # filter it out. + cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 | grep -v 'PathScale' |\ + grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` cc_version=`echo $cc_version |sed 's/[-a-z]//g'` if test X = "X$cc_vendor" -a X != "X$cc_version"; then @@ -145,7 +147,17 @@ case "$cc_vendor-$cc_version" in gcc-2.95.[34]) PROD_CFLAGS="-O3" ;; - gcc-3.[0-4]*|gcc-4.[0123]*) + gcc-4.[34]*) + # The optimization level is reduced for gcc 4.[34] due to problems + # with code generation for src/H5Tconv.c with the -O (same -O1) + # optimization levels (which shows up as failures for long double + # types -> signed char conversion in the test/dt_arith test). + # There's either a bug in gcc or our code. Need further investigation. + # Turn off all optimizations to allow the tests to pass for now. + # - AKC - 2009/04/19 + PROD_CFLAGS="-O0" + ;; + gcc-3.[0-4]*|gcc-4.[012]*) # The optimization level is reduced for gcc 3.* and 4.* due to problems # with code generation for src/H5Tconv.c with the -O2 & -O3 # optimization levels (which shows up as failures for various integer @@ -153,10 +165,6 @@ case "$cc_vendor-$cc_version" in # later versions of gcc will fix this bug... - QAK - 2003/10/20 PROD_CFLAGS="-O" ;; - gcc-4*) - # Be optimistic about future versions of gcc.. :-) - QAK - 2003/10/20 - PROD_CFLAGS="-O3" - ;; *) PROD_CFLAGS="-O" ;; @@ -184,9 +192,66 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# Closer to the gcc 4.4 release, we should check for additional flags to +# Closer to the gcc 4.5 release, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK + gcc-4.[45]*) + # Replace -ansi flag with -std=c99 flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" + + # Disable warnings about using 'long long' type + H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CFLAGS="$H5_CFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CFLAGS="$H5_CFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CFLAGS="$H5_CFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CFLAGS="$H5_CFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CFLAGS="$H5_CFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc4.0+ know about + H5_CFLAGS="$H5_CFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CFLAGS="$H5_CFLAGS -Wunsafe-loop-optimizations -Wc++-compat" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Try out the new "stack protector" feature in gcc 4.1 + # (Strictly speaking this isn't really a "warning" flag, so it's added to + # the debugging flags) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + ;; + gcc-4.3*) # Replace -ansi flag with -std=c99 flag H5_CFLAGS="`echo $H5_CFLAGS | sed -e 's/-ansi/-std=c99/g'`" diff --git a/src/H5A.c b/src/H5A.c index f7e571c..774b660 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1044,9 +1044,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id); if(tconv_buf && !tconv_owned) - H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_write() */ @@ -1188,9 +1188,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id); if(tconv_buf) - H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_read() */ diff --git a/src/H5B.c b/src/H5B.c index 12c0407..3536c96 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -1994,11 +1994,11 @@ H5B_copy(const H5B_t *old_bt) ret_value=new_node; done: - if(ret_value==NULL) { + if(ret_value == NULL) { if(new_node) { - H5FL_BLK_FREE (native_block,new_node->native); - H5FL_SEQ_FREE (haddr_t,new_node->child); - H5FL_FREE (H5B_t,new_node); + new_node->native = H5FL_BLK_FREE(native_block, new_node->native); + new_node->child = H5FL_SEQ_FREE(haddr_t, new_node->child); + new_node = H5FL_FREE(H5B_t, new_node); } /* end if */ } /* end if */ @@ -2189,9 +2189,9 @@ H5B_dest(H5B_t *bt) HDassert(bt->rc_shared); H5FL_SEQ_FREE(haddr_t, bt->child); - H5FL_BLK_FREE(native_block, bt->native); + bt->native = H5FL_BLK_FREE(native_block, bt->native); H5RC_DEC(bt->rc_shared); - H5FL_FREE(H5B_t, bt); + bt = H5FL_FREE(H5B_t, bt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5B_dest() */ diff --git a/src/H5B2.c b/src/H5B2.c index ed17d12..6e6962d 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -170,8 +170,8 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ unsigned bt2_flags = H5AC2__NO_FLAGS_SET; /* Metadata cache flags for B-tree header */ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_insert, FAIL) @@ -256,8 +256,8 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */ H5B2_node_ptr_t root_ptr; /* Node pointer info for root node */ unsigned depth; /* Current depth of the tree */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_iterate, FAIL) @@ -345,9 +345,9 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, unsigned depth; /* Current depth of the tree */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_find, FAIL) @@ -516,9 +516,9 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ unsigned depth; /* Current depth of the tree */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_index, FAIL) @@ -699,8 +699,8 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ unsigned bt2_flags = H5AC2__NO_FLAGS_SET; H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_remove, FAIL) @@ -786,8 +786,8 @@ H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ unsigned bt2_flags = H5AC2__NO_FLAGS_SET; H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_remove_by_idx, FAIL) @@ -878,8 +878,8 @@ H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, hsize_t *nrec) { H5B2_t *bt2=NULL; /* Pointer to the B-tree header */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_get_nrec, FAIL) @@ -939,8 +939,8 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, { H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_neighbor, FAIL) @@ -1012,8 +1012,8 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, { H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_delete, FAIL) @@ -1083,9 +1083,9 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, unsigned depth; /* Current depth of the tree */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_modify, FAIL) @@ -1267,8 +1267,8 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add hbool_t incr_rc = FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */ H5B2_node_ptr_t root_ptr; /* Node pointer info for root node */ unsigned depth; /* Current depth of the tree */ - herr_t ret_value = SUCCEED; H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5B2_iterate_size, FAIL) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 1f51eae..9a10ad9 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -149,11 +149,6 @@ const H5AC2_class_t H5AC2_BT2_LEAF[1] = {{ * koziol@ncsa.uiuc.edu * Feb 1 2005 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.prg - * June 18, 2008 - * Converted from H5B2_cache_hdr_load - * *------------------------------------------------------------------------- */ static void * @@ -234,7 +229,7 @@ H5B2_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't create shared B-tree info") /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (const uint8_t *)image) <= len); /* Set return value */ ret_value = bt2; @@ -257,16 +252,6 @@ done: * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Feb 1 2005 - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * June 18, 2008 - * Converted from H5B2_cache_hdr_flush * *------------------------------------------------------------------------- */ @@ -340,7 +325,7 @@ H5B2_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, *flags = 0; /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (uint8_t *)image) <= len); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2_cache_hdr_serialize() */ @@ -352,8 +337,7 @@ H5B2_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, * Purpose: Destroy/release an "in core representation" of a data * structure * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy * mcgreevy@hdfgroup.org @@ -388,11 +372,6 @@ H5B2_cache_hdr_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * koziol@ncsa.uiuc.edu * Feb 2 2005 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * June 18, 2008 - * Converted from H5B2_cache_internal_load - * *------------------------------------------------------------------------- */ static void * @@ -426,7 +405,7 @@ H5B2_cache_internal_deserialize(haddr_t UNUSED addr, size_t UNUSED len, H5RC_INC(internal->shared); /* Get the pointer to the shared B-tree info */ - shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared); + shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared); HDassert(shared); p = image; @@ -490,7 +469,7 @@ H5B2_cache_internal_deserialize(haddr_t UNUSED addr, size_t UNUSED len, UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (const uint8_t *)image) <= len); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -512,22 +491,11 @@ done: * * Purpose: Serializes a B-tree internal node for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Feb 3 2005 - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * June 18, 2008 - * Converted from H5B2_cache_internal_flush * *------------------------------------------------------------------------- */ @@ -569,7 +537,7 @@ H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, /* B-tree type */ *p++ = shared->type->id; - HDassert((size_t)(p - (const uint8_t *)image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); + HDassert((size_t)(p - (uint8_t *)image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ native = internal->int_native; @@ -597,7 +565,7 @@ H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, } /* end for */ /* Compute metadata checksum */ - metadata_chksum = H5_checksum_metadata(image, (size_t)(p - (const uint8_t *)image), 0); + metadata_chksum = H5_checksum_metadata(image, (size_t)(p - (uint8_t *)image), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); @@ -606,7 +574,7 @@ H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, *flags = 0; /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (uint8_t *)image) <= len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -619,8 +587,7 @@ done: * Purpose: Destroy/release an "in core representation" of a data * structure * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy * mcgreevy@hdfgroup.org @@ -655,11 +622,6 @@ H5B2_cache_internal_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing * koziol@ncsa.uiuc.edu * Feb 2 2005 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * June 18, 2008 - * Converted from H5B2_cache_leaf_load - * *------------------------------------------------------------------------- */ static void * @@ -742,7 +704,7 @@ H5B2_cache_leaf_deserialize(haddr_t UNUSED addr, size_t UNUSED len, HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 leaf node") /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (const uint8_t *)image) <= len); /* Set return value */ ret_value = leaf; @@ -760,24 +722,12 @@ done: * * Purpose: Serializes a B-tree leaf node for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Feb 2 2005 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * June 18, 2008 - * Converted from H5B2_cache_leaf_flush - * *------------------------------------------------------------------------- */ static herr_t @@ -841,7 +791,7 @@ H5B2_cache_leaf_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, *flags = 0; /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (uint8_t *)image) <= len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -854,8 +804,7 @@ done: * Purpose: Destroy/release an "in core representation" of a data * structure * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy * mcgreevy@hdfgroup.org diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 3946298..121c463 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -94,8 +94,8 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, H5B2_shared_t *shared; /* Shared B-tree information */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ - herr_t ret_value = SUCCEED; /* Return value */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_hdr_debug, FAIL) @@ -208,8 +208,8 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, H5B2_shared_t *shared; /* Shared B-tree information */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_int_debug, FAIL) @@ -341,8 +341,8 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, H5B2_shared_t *shared; /* Shared B-tree information */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_leaf_debug, FAIL) diff --git a/src/H5B2int.c b/src/H5B2int.c index 6b0b911..a6d85b4 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -377,8 +377,8 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ H5B2_shared_t *shared; /* B-tree's shared info */ unsigned mid_record; /* Index of "middle" record in current node */ unsigned old_node_nrec; /* Number of records in internal node split */ - herr_t ret_value = SUCCEED; /* Return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_split1) @@ -654,8 +654,8 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */ H5B2_shared_t *shared; /* B-tree's shared info */ hssize_t left_moved_nrec=0, right_moved_nrec=0; /* Number of records moved, for internal redistrib */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_redistribute2) @@ -891,8 +891,8 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *middle_node_ptrs=NULL;/* Pointers to childs' node pointer info */ hssize_t left_moved_nrec=0, right_moved_nrec=0; /* Number of records moved, for internal split */ hssize_t middle_moved_nrec=0; /* Number of records moved, for internal split */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_redistribute3) @@ -1270,8 +1270,8 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */ H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */ H5B2_shared_t *shared; /* B-tree's shared info */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_merge2) @@ -1438,8 +1438,8 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *middle_node_ptrs=NULL;/* Pointer to child's node pointer info */ H5B2_shared_t *shared; /* B-tree's shared info */ hsize_t middle_moved_nrec; /* Number of records moved, for internal split */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_merge3) @@ -1665,8 +1665,8 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth, void *child; /* Pointer to child node */ uint8_t *child_native; /* Pointer to child's native records */ H5B2_shared_t *shared; /* B-tree's shared info */ - herr_t ret_value=SUCCEED; /* Return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_swap_leaf) @@ -1761,8 +1761,8 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ - herr_t ret_value = SUCCEED; H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5B2_insert_leaf) @@ -2136,8 +2136,8 @@ H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr, unsigned nrec, unsigned depth, H5AC2_protect_t rw) { H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */ - H5B2_internal_t *ret_value; /* Return value */ H5B2_shared_t *shared; /* B-tree's shared info */ + H5B2_internal_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_protect_internal) @@ -2194,8 +2194,8 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth, uint8_t *native = NULL; /* Pointers to copy of node's native records */ H5B2_node_ptr_t *node_ptrs = NULL; /* Pointers to node's node pointers */ unsigned u; /* Local index */ - herr_t ret_value = H5_ITER_CONT; /* Iterator return value */ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = H5_ITER_CONT; /* Iterator return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_iterate_node) @@ -2313,8 +2313,8 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned leaf_flags = H5AC2__NO_FLAGS_SET; /* Flags for unprotecting leaf node */ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ unsigned idx; /* Location of record which matches key */ - herr_t ret_value = SUCCEED; H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_leaf) @@ -2621,8 +2621,8 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */ unsigned leaf_flags = H5AC2__NO_FLAGS_SET; /* Flags for unprotecting leaf node */ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_leaf_by_idx) @@ -2994,8 +2994,8 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ unsigned idx; /* Location of record which matches key */ int cmp=0; /* Comparison value of records */ - herr_t ret_value = SUCCEED; H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5B2_neighbor_leaf) @@ -3169,8 +3169,8 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth, const H5AC2_class_t *curr_node_class=NULL; /* Pointer to current node's class info */ void *node=NULL; /* Pointers to current node */ uint8_t *native; /* Pointers to node's native records */ - herr_t ret_value = SUCCEED; H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5B2_delete_node) diff --git a/src/H5B2stat.c b/src/H5B2stat.c index b837a43..4f3f53b 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -88,8 +88,8 @@ H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, { H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ - herr_t ret_value = SUCCEED; /* Return value */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_stat_info) diff --git a/src/H5B2test.c b/src/H5B2test.c index 4784a3b..8cc6e54 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -258,8 +258,8 @@ H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, haddr_t *root_addr) { H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ - herr_t ret_value = SUCCEED; /* Return value */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr_test) @@ -313,8 +313,8 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr unsigned depth; /* Current depth of the tree */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ - herr_t ret_value = SUCCEED; /* Return value */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B2_get_node_info_test, FAIL) diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 951068b..ac34564 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -89,8 +89,7 @@ const H5AC2_class_t H5AC2_BT[1] = {{ * * Purpose: Deserialize the data structure from disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -194,8 +193,7 @@ done: * * Purpose: Serialize the data structure for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -278,8 +276,7 @@ done: * * Purpose: Destroy/release an "in core representation" of a data structure * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@hdfgroup.org diff --git a/src/H5C2.c b/src/H5C2.c index 0c5323d..7a14184 100644 --- a/src/H5C2.c +++ b/src/H5C2.c @@ -1362,9 +1362,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C2_flush_cache(const H5F_t *f, - hid_t dxpl_id, - unsigned flags) +H5C2_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) { H5C2_t * cache_ptr; herr_t status; diff --git a/src/H5C2journal.c b/src/H5C2journal.c index 223a5ec..2aeedd4 100644 --- a/src/H5C2journal.c +++ b/src/H5C2journal.c @@ -60,6 +60,12 @@ hbool_t H5C2__check_for_journaling = TRUE; /**************************************************************************/ +/******************************* local macros *****************************/ +/**************************************************************************/ +#define H5C2__TRANS_NUM_SIZE 8 +#define H5C2__CHECKSUM_SIZE 4 + +/**************************************************************************/ /***************************** local prototypes ***************************/ /**************************************************************************/ @@ -111,7 +117,6 @@ static herr_t H5C2_jb_bjf__write_offset(H5C2_jbrb_t * struct_ptr, uint64_t trans_num); static herr_t H5C2_jb_bjf__write_sig_and_ver(H5C2_jbrb_t * struct_ptr, - size_t sig_size, const char * sig_ptr, const uint8_t version, hbool_t keep_chksum, @@ -665,7 +670,7 @@ done: */ herr_t -H5C2_journal_post_flush(const H5F_t * f, +H5C2_journal_post_flush(H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, hbool_t cache_is_clean) @@ -2202,21 +2207,16 @@ if ( H5C2_jb_bjf__write_offset((struct_ptr), (offset), (is_end_trans), \ } #define H5C2_JB_BJF__WRITE_SIG_AND_VER(struct_ptr, \ - sig_size, \ sig_ptr, \ version, \ keep_chksum, \ is_end_trans, \ trans_num, \ fail_return) \ -if ( H5C2_jb_bjf__write_sig_and_ver((struct_ptr), (sig_size), (sig_ptr), \ - (version), (keep_chksum), \ - (is_end_trans), (trans_num)) \ - != SUCCEED ) { \ - HDfprintf(stdout, "%s: H5C2_jb_bjf__write_sig_and_ver() failed.\n", \ - FUNC); \ - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (fail_return), \ - "H5C2_jb_bjf__write_sig_and_ver() failed."); \ +if(H5C2_jb_bjf__write_sig_and_ver((struct_ptr), (sig_ptr), (version), \ + (keep_chksum), (is_end_trans), (trans_num)) < 0) { \ + HDfprintf(stdout, "%s: H5C2_jb_bjf__write_sig_and_ver() failed.\n", FUNC); \ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (fail_return), "H5C2_jb_bjf__write_sig_and_ver() failed.") \ } #define H5C2_JB_BJF__WRITE_TRANS_NUM(struct_ptr, \ @@ -2329,7 +2329,6 @@ H5C2_jb_bjf__end_transaction(H5C2_jbrb_t * struct_ptr, /* Write end transaction message */ H5C2_JB_BJF__WRITE_SIG_AND_VER(struct_ptr, \ - H5C2_BJNL__SIG_LEN, \ H5C2_BJNL__END_TRANS_SIG, \ H5C2_BJNL__END_TRANS_VER, \ /* keep_chksum */ FALSE, \ @@ -2414,7 +2413,6 @@ H5C2_jb_bjf__eoa(H5C2_jbrb_t * struct_ptr, /* Write EOA message */ H5C2_JB_BJF__WRITE_SIG_AND_VER(struct_ptr, \ - H5C2_BJNL__SIG_LEN, \ H5C2_BJNL__END_ADDR_SPACE_SIG, \ H5C2_BJNL__END_ADDR_SPACE_VER, \ /* keep_chksum */ FALSE, \ @@ -2473,7 +2471,6 @@ H5C2_jb_bjf__journal_entry(H5C2_jbrb_t * struct_ptr, } /* end if */ H5C2_JB_BJF__WRITE_SIG_AND_VER(struct_ptr, \ - H5C2_BJNL__SIG_LEN, \ H5C2_BJNL__JOURNAL_ENTRY_SIG, \ H5C2_BJNL__JOURNAL_ENTRY_VER, \ /* keep_chksum */ TRUE, \ @@ -2585,7 +2582,6 @@ H5C2_jb_bjf__start_transaction(H5C2_jbrb_t * struct_ptr, /* Write start transaction message */ H5C2_JB_BJF__WRITE_SIG_AND_VER(struct_ptr, \ - H5C2_BJNL__SIG_LEN, \ H5C2_BJNL__BEGIN_TRANS_SIG, \ H5C2_BJNL__BEGIN_TRANS_VER, \ /* keep_chksum */ FALSE, \ @@ -2766,32 +2762,25 @@ done: * Returns: SUCCEED on success. * FAIL on failure. * - * Changes: None. - * ******************************************************************************/ - static herr_t -H5C2_jb_bjf__write_chksum(H5C2_jbrb_t * struct_ptr, - hbool_t is_end_trans, - uint64_t trans_num) +H5C2_jb_bjf__write_chksum(H5C2_jbrb_t * struct_ptr, hbool_t is_end_trans, + uint64_t trans_num) { + uint8_t *p; herr_t ret_value = SUCCEED; /* Return value */ - uint8_t * p; - const size_t chksum_size = 4; FUNC_ENTER_NOAPI(H5C2_jb_bjf__write_chksum, FAIL) - HDassert( struct_ptr != NULL ); - HDassert( struct_ptr->magic == H5C2__H5C2_JBRB_T_MAGIC ); - HDassert( trans_num > 0 ); - - if ( ! (struct_ptr->chksum_cur_msg) ) { + /* Sanity check */ + HDassert(struct_ptr != NULL); + HDassert(struct_ptr->magic == H5C2__H5C2_JBRB_T_MAGIC); + HDassert(trans_num > 0); - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "struct_ptr->chksum_cur_msg is false?!?!.") - } + if(!struct_ptr->chksum_cur_msg) + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "struct_ptr->chksum_cur_msg is false?!?!.") - if ( chksum_size < struct_ptr->cur_buf_free_space ) { + if(H5C2__CHECKSUM_SIZE < struct_ptr->cur_buf_free_space) { /* If the checksum will fit in the current buffer with space * left over, just write it directly into the buffer, and @@ -2808,34 +2797,32 @@ H5C2_jb_bjf__write_chksum(H5C2_jbrb_t * struct_ptr, UINT32ENCODE(p, struct_ptr->msg_chksum); - HDassert( p == ((uint8_t *)(struct_ptr->head + chksum_size)) ); + HDassert( p == ((uint8_t *)(struct_ptr->head + H5C2__CHECKSUM_SIZE)) ); /* increment bufs_in_use as necessary */ - if ( ( struct_ptr->bufs_in_use == 0 ) ) { - + if(struct_ptr->bufs_in_use == 0 ) struct_ptr->bufs_in_use++; - } /* update head pointer */ - struct_ptr->head = &(struct_ptr->head[chksum_size]); + struct_ptr->head = &(struct_ptr->head[H5C2__CHECKSUM_SIZE]); /* update rb_free_space */ - struct_ptr->rb_free_space -= chksum_size; + struct_ptr->rb_free_space -= H5C2__CHECKSUM_SIZE; /* update current buffer usage */ - struct_ptr->cur_buf_free_space -= chksum_size; + struct_ptr->cur_buf_free_space -= H5C2__CHECKSUM_SIZE; /* update end of buffer space */ - struct_ptr->rb_space_to_rollover -= chksum_size; - - if ( is_end_trans == TRUE ) { + struct_ptr->rb_space_to_rollover -= H5C2__CHECKSUM_SIZE; + if(is_end_trans) (*struct_ptr->trans_tracking)[struct_ptr->put] = trans_num; - } HDassert( struct_ptr->cur_buf_free_space > 0 ); - } else { + } /* end if */ + else { + uint8_t buf[H5C2__CHECKSUM_SIZE + 1]; /* Here, handle the case where the write will reach the edge * of a buffer. This gets a bit more complex, so for now at @@ -2844,32 +2831,21 @@ H5C2_jb_bjf__write_chksum(H5C2_jbrb_t * struct_ptr, * H5C2_jb__write_to_buffer(). If this proves too costly, * further optimizations will be necessary. */ - - uint8_t buf[chksum_size + 1]; - p = buf; - UINT32ENCODE(p, struct_ptr->msg_chksum); + HDassert( p == &(buf[H5C2__CHECKSUM_SIZE]) ); - HDassert( p == &(buf[chksum_size]) ); - - if ( H5C2_jb__write_to_buffer(struct_ptr, chksum_size, - (const char *)buf, - is_end_trans, trans_num) != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_jb__write_to_buffer() failed.") - } - } + if(H5C2_jb__write_to_buffer(struct_ptr, H5C2__CHECKSUM_SIZE, + (const char *)buf, is_end_trans, trans_num) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "H5C2_jb__write_to_buffer() failed.") + } /* end else */ /* re-set the checksum computation fields */ struct_ptr->chksum_cur_msg = FALSE; struct_ptr->msg_chksum = 0; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C2_jb_bjf__write_chksum() */ @@ -3020,14 +2996,11 @@ H5C2_jb_bjf__write_length(H5C2_jbrb_t * struct_ptr, * further optimizations will be necessary. */ - uint8_t buf[17]; // should be big enough for a long time. - - HDassert( length_width < 17 ) ; + uint8_t buf[17]; /* should be big enough for a long time. */ + HDassert(length_width < sizeof(buf)); p = buf; - - switch ( length_width ) - { + switch(length_width) { case 2: UINT16ENCODE(p, length); break; @@ -3041,34 +3014,25 @@ H5C2_jb_bjf__write_length(H5C2_jbrb_t * struct_ptr, break; default: - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "length_width out of range (2).") + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "length_width out of range (2).") break; - } + } /* end switch */ HDassert( p == &(buf[length_width]) ); - - if ( H5C2_jb__write_to_buffer(struct_ptr, length_width, + if(H5C2_jb__write_to_buffer(struct_ptr, length_width, (const char *)buf, - is_end_trans, trans_num) != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_jb__write_to_buffer() failed.") - } + is_end_trans, trans_num) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "H5C2_jb__write_to_buffer() failed.") /* Update the check sum if required */ - if ( struct_ptr->chksum_cur_msg ) { - + if(struct_ptr->chksum_cur_msg) struct_ptr->msg_chksum = H5_checksum_metadata((const void *)(buf), length_width, struct_ptr->msg_chksum); - } - } + } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C2_jb_bjf__write_length() */ @@ -3224,7 +3188,7 @@ H5C2_jb_bjf__write_offset(H5C2_jbrb_t * struct_ptr, * further optimizations will be necessary. */ - uint8_t buf[17]; // should be big enough for a long time. + uint8_t buf[17]; /* should be big enough for a long time. */ HDassert( offset_width < 17 ) ; @@ -3311,39 +3275,30 @@ done: * Returns: SUCCEED on success. * FAIL on failure. * - * Changes: None. - * ******************************************************************************/ - static herr_t -H5C2_jb_bjf__write_sig_and_ver(H5C2_jbrb_t * struct_ptr, - size_t sig_size, - const char * sig_ptr, - const uint8_t version, - hbool_t keep_chksum, - hbool_t is_end_trans, - uint64_t trans_num) +H5C2_jb_bjf__write_sig_and_ver(H5C2_jbrb_t *struct_ptr, const char *sig_ptr, + const uint8_t version, hbool_t keep_chksum, hbool_t is_end_trans, + uint64_t trans_num) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C2_jb_bjf__write_sig_and_ver, FAIL) - HDassert( struct_ptr != NULL ); - HDassert( struct_ptr->magic == H5C2__H5C2_JBRB_T_MAGIC ); - HDassert( sig_size > 0 ); - HDassert( sig_ptr != NULL ); - HDassert( sig_size == HDstrlen(sig_ptr) ); - HDassert( ! is_end_trans ); + HDassert(struct_ptr); + HDassert(struct_ptr->magic == H5C2__H5C2_JBRB_T_MAGIC); + HDassert(sig_ptr); + HDassert(H5C2_BJNL__SIG_LEN == HDstrlen(sig_ptr)); + HDassert(!is_end_trans); /* eoa messages can occur outside of transactions -- and thus it is * possible that we will have to process one before any transaction * has started -- in which case trans_num will be 0. Since the trans_num * isn't used unless is_end_trans is TRUE, we carve a small exception * for the eoa message. */ - HDassert( ( ! is_end_trans ) || ( trans_num > 0 ) ); - - if ( sig_size + 1 < struct_ptr->cur_buf_free_space ) { + HDassert((!is_end_trans) || (trans_num > 0)); + if((H5C2_BJNL__SIG_LEN + 1) < struct_ptr->cur_buf_free_space) { /* If the signature and version will fit in the current buffer * with space left over, just memcpy()/write it in and touch up * the ring bufferfields accordingly. @@ -3354,78 +3309,61 @@ H5C2_jb_bjf__write_sig_and_ver(H5C2_jbrb_t * struct_ptr, */ /* write the signature into journal buffer */ - HDmemcpy(struct_ptr->head, (const void *)sig_ptr, sig_size); + HDmemcpy(struct_ptr->head, (const void *)sig_ptr, H5C2_BJNL__SIG_LEN); - struct_ptr->head[sig_size] = (char)version; + struct_ptr->head[H5C2_BJNL__SIG_LEN] = (char)version; /* update head pointer */ - struct_ptr->head = &(struct_ptr->head[sig_size + 1]); + struct_ptr->head = &(struct_ptr->head[H5C2_BJNL__SIG_LEN + 1]); /* increment bufs_in_use as necessary */ - if ( ( struct_ptr->bufs_in_use == 0 ) ) { - + if(struct_ptr->bufs_in_use == 0) struct_ptr->bufs_in_use++; - } /* update rb_free_space */ - struct_ptr->rb_free_space -= sig_size + 1; + struct_ptr->rb_free_space -= H5C2_BJNL__SIG_LEN + 1; /* update current buffer usage */ - struct_ptr->cur_buf_free_space -= sig_size + 1; + struct_ptr->cur_buf_free_space -= H5C2_BJNL__SIG_LEN + 1; /* update end of buffer space */ - struct_ptr->rb_space_to_rollover -= sig_size + 1; + struct_ptr->rb_space_to_rollover -= H5C2_BJNL__SIG_LEN + 1; /* is_end_trans must be false in this call, so just throw an * error if it is TRUE. */ - - if ( is_end_trans ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "is_end_trans TRUE when writing signiture.") - } + if(is_end_trans) + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "is_end_trans TRUE when writing signiture.") HDassert( struct_ptr->cur_buf_free_space > 0 ); - - } else { + } /* end if */ + else { + uint8_t buf[H5C2_BJNL__SIG_LEN + 2]; /* Here, handle the case where the write will reach the edge * of a buffer. This gets a bit more complex, so for now at * least, we will call H5C2_jb__write_to_buffer(). If this * proves too costly, further optimizations will be necessary. */ + HDmemcpy(buf, (const void *)sig_ptr, H5C2_BJNL__SIG_LEN); + buf[H5C2_BJNL__SIG_LEN] = version; - uint8_t buf[sig_size + 2]; - - HDmemcpy(buf, (const void *)sig_ptr, sig_size); - buf[sig_size] = version; - - if ( H5C2_jb__write_to_buffer(struct_ptr, sig_size + 1, - (const char *)buf, - is_end_trans, trans_num) != SUCCEED ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_jb__write_to_buffer() failed.") - } - } - - if ( struct_ptr->chksum_cur_msg ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "struct_ptr->chksum_cur_msg is already TRUE") - } + if(H5C2_jb__write_to_buffer(struct_ptr, H5C2_BJNL__SIG_LEN + 1, + (const char *)buf, is_end_trans, trans_num) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "H5C2_jb__write_to_buffer() failed.") + } /* end else */ - if ( keep_chksum ) { + if(struct_ptr->chksum_cur_msg) + HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, "struct_ptr->chksum_cur_msg is already TRUE") + if(keep_chksum) { struct_ptr->chksum_cur_msg = TRUE; struct_ptr->msg_chksum = 0; - } + } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C2_jb_bjf__write_sig_and_ver() */ +} /* end H5C2_jb_bjf__write_sig_and_ver() */ /****************************************************************************** @@ -3467,7 +3405,6 @@ H5C2_jb_bjf__write_trans_num(H5C2_jbrb_t * struct_ptr, hbool_t is_end_trans, uint64_t trans_num) { - const size_t trans_num_size = 8; herr_t ret_value = SUCCEED; /* Return value */ uint8_t * p; @@ -3487,7 +3424,7 @@ H5C2_jb_bjf__write_trans_num(H5C2_jbrb_t * struct_ptr, "is_end_trans and struct_ptr->chksum_cur_msg both true.") } - if ( trans_num_size < struct_ptr->cur_buf_free_space ) { + if ( H5C2__TRANS_NUM_SIZE < struct_ptr->cur_buf_free_space ) { /* If the transaction number will fit in the current buffer with space * left over, just write it directly into the buffer, and touch up the @@ -3502,7 +3439,7 @@ H5C2_jb_bjf__write_trans_num(H5C2_jbrb_t * struct_ptr, p = (uint8_t *)(struct_ptr->head); UINT64ENCODE(p, trans_num); - HDassert( p == ((uint8_t *)(struct_ptr->head + trans_num_size)) ); + HDassert( p == ((uint8_t *)(struct_ptr->head + H5C2__TRANS_NUM_SIZE)) ); /* increment bufs_in_use as necessary */ if ( ( struct_ptr->bufs_in_use == 0 ) ) { @@ -3515,21 +3452,21 @@ H5C2_jb_bjf__write_trans_num(H5C2_jbrb_t * struct_ptr, struct_ptr->msg_chksum = H5_checksum_metadata((const void *)(struct_ptr->head), - trans_num_size, + H5C2__TRANS_NUM_SIZE, struct_ptr->msg_chksum); } /* update head pointer */ - struct_ptr->head = &(struct_ptr->head[trans_num_size]); + struct_ptr->head = &(struct_ptr->head[H5C2__TRANS_NUM_SIZE]); /* update rb_free_space */ - struct_ptr->rb_free_space -= trans_num_size; + struct_ptr->rb_free_space -= H5C2__TRANS_NUM_SIZE; /* update current buffer usage */ - struct_ptr->cur_buf_free_space -= trans_num_size; + struct_ptr->cur_buf_free_space -= H5C2__TRANS_NUM_SIZE; /* update end of buffer space */ - struct_ptr->rb_space_to_rollover -= trans_num_size; + struct_ptr->rb_space_to_rollover -= H5C2__TRANS_NUM_SIZE; if ( is_end_trans == TRUE ) { @@ -3547,15 +3484,15 @@ H5C2_jb_bjf__write_trans_num(H5C2_jbrb_t * struct_ptr, * If this proves too costly, further optimizations will be necessary. */ - uint8_t buf[trans_num_size + 1]; + uint8_t buf[H5C2__TRANS_NUM_SIZE + 1]; p = buf; UINT64ENCODE(p, trans_num); - HDassert( p == &(buf[trans_num_size]) ); + HDassert( p == &(buf[H5C2__TRANS_NUM_SIZE]) ); - if ( H5C2_jb__write_to_buffer(struct_ptr, trans_num_size, + if ( H5C2_jb__write_to_buffer(struct_ptr, H5C2__TRANS_NUM_SIZE, (const char *)buf, is_end_trans, trans_num) != SUCCEED ) { @@ -3567,7 +3504,7 @@ H5C2_jb_bjf__write_trans_num(H5C2_jbrb_t * struct_ptr, if ( struct_ptr->chksum_cur_msg ) { struct_ptr->msg_chksum = H5_checksum_metadata((const void *)(buf), - trans_num_size, + H5C2__TRANS_NUM_SIZE, struct_ptr->msg_chksum); } @@ -4719,12 +4656,7 @@ H5C2_jb__journal_entry(H5C2_jbrb_t * struct_ptr, size_t length, const uint8_t * body) { - - char * temp = NULL; - char * hexdata = NULL; - size_t hexlength; herr_t ret_value = SUCCEED; - uint8_t * bodydata; FUNC_ENTER_NOAPI(H5C2_jb__journal_entry, FAIL) diff --git a/src/H5C2private.h b/src/H5C2private.h index 5ed4254..8c9075c 100644 --- a/src/H5C2private.h +++ b/src/H5C2private.h @@ -1434,9 +1434,7 @@ H5_DLL herr_t H5C2_expunge_entry(H5F_t * f, const H5C2_class_t * type, haddr_t addr); -H5_DLL herr_t H5C2_flush_cache(const H5F_t *f, - hid_t dxpl_id, - unsigned flags); +H5_DLL herr_t H5C2_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5C2_flush_to_min_clean(H5F_t * f, @@ -1570,7 +1568,7 @@ H5_DLL herr_t H5C2_end_transaction(H5F_t * f, H5_DLL herr_t H5C2_get_journal_config(H5C2_t * cache_ptr, H5C2_mdj_config_t * config_ptr); -H5_DLL herr_t H5C2_journal_post_flush(const H5F_t * f, +H5_DLL herr_t H5C2_journal_post_flush(H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, hbool_t cache_is_clean); diff --git a/src/H5D.c b/src/H5D.c index 70745d6..e00dd2d 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -28,11 +28,11 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ -#include "H5AC2private.h" /* Metadata cache */ /****************/ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index ff45d63..dac3090 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -42,10 +42,10 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ -#include "H5AC2private.h" /* Metadata cache */ /****************/ diff --git a/src/H5Dint.c b/src/H5Dint.c index 31c2cb2..b45d7df 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2252,7 +2252,7 @@ H5D_vlen_get_buf_size_alloc(size_t size, void *info) H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)info; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_vlen_get_buf_size_alloc) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_vlen_get_buf_size_alloc) /* Get a temporary pointer to space for the VL data */ if((vlen_bufsize->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize->vl_tbuf, size)) != NULL) diff --git a/src/H5Dio.c b/src/H5Dio.c index bdbc560..2160190 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -24,11 +24,11 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ -#include "H5AC2private.h" /* Metadata cache */ #ifdef H5_HAVE_PARALLEL /* Remove this if H5R_DATASET_REGION is no longer used in this file */ diff --git a/src/H5E.c b/src/H5E.c index 6068fff..72f0619 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -334,7 +334,7 @@ H5E_get_stack(void) { H5E_t *estack; - FUNC_ENTER_NOAPI_NOINIT(H5E_get_stack) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_stack) estack = pthread_getspecific(H5TS_errstk_key_g); diff --git a/src/H5F.c b/src/H5F.c index 793b58f..6579dfe 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -944,9 +944,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) * version. For now, this is just for testing. Once we get it * fully in use, we will delete the old version. */ - if(H5AC2_create(f, - (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg)) < 0) - + if(H5AC2_create(f, (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache2") /* Create the file's "open object" information */ @@ -1021,11 +1019,9 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5AC_DUMP_STATS_ON_CLOSE */ /* shut down metadata journaling if it is enabled. */ - if ( H5C2_end_journaling(f, dxpl_id, f->shared->cache2) != SUCCEED ) { + if(H5C2_end_journaling(f, dxpl_id, f->shared->cache2) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to shutdown metadata journaling") - } + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to shutdown metadata journaling") /* Flush and invalidate all caches */ if(H5F_flush(f, dxpl_id, H5F_SCOPE_LOCAL, H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLOSING) < 0) @@ -1055,11 +1051,11 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) f->shared->root_grp = NULL; } /* end if */ - if(H5AC_dest(f, dxpl_id)) + if(H5AC_dest(f, dxpl_id) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") /* also destroy the new cache */ - if(H5AC2_dest(f, dxpl_id)) + if(H5AC2_dest(f, dxpl_id) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") if(H5FO_dest(f) < 0) @@ -1192,14 +1188,6 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) * To formulate path for later searching of target file for * external link via H5_build_extpath(). * - * John Mainzer, 2008-07-07 - * Added calls to H5AC2_check_for_journaling() and - * H5AC2_set_cache_journaling_config() at the end of - * H5F_open(). For now at least, both of these operations - * must be done just before H5F_open() returns, as the - * required information is not available when the metadata - * cache is created. - * *------------------------------------------------------------------------- */ H5F_t * @@ -1405,18 +1393,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d config_ptr = &(file->shared->initJnlCfg); - if ( H5AC2_check_for_journaling(file, dxpl_id, file->shared->cache2, - config_ptr->journal_recovered) < 0 ) { + if(H5AC2_check_for_journaling(file, dxpl_id, file->shared->cache2, + config_ptr->journal_recovered) < 0 ) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "H5AC2_check_for_journaling() reports failure.") - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, \ - "H5AC2_check_for_journaling() reports failure.") - } - - if ( H5AC2_set_jnl_config(file, dxpl_id, config_ptr, TRUE) < 0 ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, \ - "H5AC2_set_jnl_config() failed.") - } + if(H5AC2_set_jnl_config(file, dxpl_id, config_ptr, TRUE) < 0 ) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "H5AC2_set_jnl_config() failed.") } /* Success */ @@ -1773,11 +1755,9 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) nerrors++; /* Flush any cached dataset storage raw data */ - if(H5D_flush(f, dxpl_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") - /* flush (and invalidate, if requested) the entire metadata cache */ H5AC_flags = 0; if((flags & H5F_FLUSH_INVALIDATE) != 0 ) @@ -1801,7 +1781,6 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) } /* end if */ /* Write the superblock to disk */ - if(H5F_super_write(f, dxpl_id) != SUCCEED) HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file") @@ -3344,8 +3323,7 @@ H5F_is_journaling_enabled(const H5F_t *f) /* Retrieve the current cache information */ config.version = H5AC2__CURR_JNL_CONFIG_VER; if(H5AC2_get_jnl_config(f->shared->cache2, &config) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, \ - "can't retrieve journaling configuration") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve journaling configuration") /* Set return value */ ret_value = config.enable_journaling; @@ -3450,51 +3428,29 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * Reworked for the addition of the config_ptr parameter. - * JRM -- 4/7/05 - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_config(hid_t file_id, - H5AC_cache_config_t *config_ptr) +H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file=NULL; /* File object for file ID */ + H5F_t *file; /* File object for file ID */ herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; FUNC_ENTER_API(H5Fget_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - + if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } - - if ( ( NULL == config_ptr ) || - ( ! H5AC2_validate_cache_config_ver(config_ptr->version) ) ) { - + if((NULL == config_ptr) || !H5AC2_validate_cache_config_ver(config_ptr->version)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - } /* Go get the resize configuration */ - result = H5AC2_get_cache_auto_resize_config(file->shared->cache2, - config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC2_get_cache_auto_resize_config() failed."); - } + if(H5AC2_get_cache_auto_resize_config(file->shared->cache2, (H5AC2_cache_config_t *)config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC2_get_cache_auto_resize_config() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_config() */ @@ -3511,53 +3467,31 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fset_mdc_config(hid_t file_id, - H5AC_cache_config_t *config_ptr) +H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; + H5F_t *file; /* File object for file ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fset_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - + if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } /* set the resize configuration */ - result = H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "H5AC_set_cache_auto_resize_config() failed."); - } + if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") /* pass the resize configuration to the modified cache as well. */ - result = H5AC2_set_cache_auto_resize_config(file, - (H5AC2_cache_config_t *)config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "H5AC2_set_cache_auto_resize_config() failed."); - } + if(H5AC2_set_cache_auto_resize_config(file, (H5AC2_cache_config_t *)config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC2_set_cache_auto_resize_config() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fset_mdc_config() */ @@ -3575,46 +3509,29 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_hit_rate(hid_t file_id, - double *hit_rate_ptr) +H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; + H5F_t *file; /* File object for file ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_hit_rate, FAIL) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - + if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } - - if ( NULL == hit_rate_ptr ) { - + if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") - } /* Go get the current hit rate */ - result = H5AC2_get_cache_hit_rate(file->shared->cache2, hit_rate_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC2_get_cache_hit_rate() failed."); - } + if(H5AC2_get_cache_hit_rate(file->shared->cache2, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC2_get_cache_hit_rate() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_hit_rate() */ @@ -3633,56 +3550,34 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_size(hid_t file_id, - size_t *max_size_ptr, - size_t *min_clean_size_ptr, - size_t *cur_size_ptr, - int *cur_num_entries_ptr) +H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, + size_t *cur_size_ptr, int *cur_num_entries_ptr) { - H5F_t *file=NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; + H5F_t *file; /* File object for file ID */ int32_t cur_num_entries; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_size, FAIL) H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr); /* Check args */ - if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { - + if(NULL == (file = H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - } /* Go get the size data */ - result = H5AC2_get_cache_size(file->shared->cache2, - max_size_ptr, - min_clean_size_ptr, - cur_size_ptr, - &cur_num_entries); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC2_get_cache_size() failed."); - - } else if ( cur_num_entries_ptr != NULL ) { + if(H5AC2_get_cache_size(file->shared->cache2, max_size_ptr, + min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC2_get_cache_size() failed.") + if(cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; - } done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_size() */ @@ -3704,10 +3599,6 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FS.c b/src/H5FS.c index 73995c9..212fcbe 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -33,10 +33,10 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ -#include "H5AC2private.h" /* Metadata cache */ /****************/ /* Local Macros */ @@ -171,8 +171,8 @@ H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses, H5FS_t *fspace = NULL; /* New free space structure */ H5FS_prot_t fs_prot; /* Information for protecting free space manager */ unsigned fspace_status = 0; /* Free space header's status in the metadata cache */ - H5FS_t *ret_value; /* Return value */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + H5FS_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FS_open, NULL) #ifdef QAK @@ -244,8 +244,8 @@ H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr) { H5FS_t *fspace = NULL; /* Free space header loaded from file */ H5FS_prot_t fs_prot; /* Temporary information for protecting free space header */ - herr_t ret_value = SUCCEED; /* Return value */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FS_delete, FAIL) #ifdef QAK diff --git a/src/H5FScache.c b/src/H5FScache.c index 558405f..2d88011 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -34,11 +34,11 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5Vprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ -#include "H5AC2private.h" /* Metadata cache */ /****************/ /* Local Macros */ @@ -89,6 +89,7 @@ static herr_t H5FS_cache_sinfo_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5FS_cache_sinfo_free_icr(haddr_t addr, size_t len, void *thing); + /*********************/ /* Package Variables */ /*********************/ @@ -117,6 +118,7 @@ const H5AC2_class_t H5AC2_FSPACE_SINFO[1] = {{ NULL, }}; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -140,14 +142,8 @@ const H5AC2_class_t H5AC2_FSPACE_SINFO[1] = {{ * koziol@ncsa.uiuc.edu * May 2 2006 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * May 28 2008 - * Converted from H5FS_cache_hdr_load - * *------------------------------------------------------------------------- */ - static void * H5FS_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, void *_udata, hbool_t UNUSED *dirty) @@ -162,9 +158,6 @@ H5FS_cache_hdr_deserialize(haddr_t UNUSED addr, size_t UNUSED len, H5FS_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_deserialize) -#ifdef QAK -HDfprintf(stderr, "%s: Deserialize free space header, addr = %a\n", FUNC, addr); -#endif /* Check arguments */ HDassert(image); @@ -236,7 +229,7 @@ HDfprintf(stderr, "%s: Deserialize free space header, addr = %a\n", FUNC, addr); H5F_DECODE_LENGTH(udata->f, p, fspace->alloc_sect_size); /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); + computed_chksum = H5_checksum_metadata(image, (size_t)(p - (const uint8_t *)image), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); @@ -246,7 +239,7 @@ HDfprintf(stderr, "%s: Deserialize free space header, addr = %a\n", FUNC, addr); HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (const uint8_t *)image) <= len); /* Set return value */ ret_value = fspace; @@ -265,24 +258,12 @@ done: * * Purpose: Serializes the data structure for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * May 2 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * May 28, 2008 - * Converted from H5FS_cache_hdr_flush - * *------------------------------------------------------------------------- */ static herr_t @@ -297,9 +278,6 @@ H5FS_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, size_t size; /* Header size on disk */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_hdr_serialize) -#ifdef QAK -HDfprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); -#endif /* check arguments */ HDassert(f); @@ -360,7 +338,7 @@ HDfprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); H5F_ENCODE_LENGTH(f, p, fspace->alloc_sect_size); /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); + metadata_chksum = H5_checksum_metadata(image, (size_t)(p - (uint8_t *)image), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); @@ -369,7 +347,7 @@ HDfprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); *flags = 0; /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (uint8_t *)image) <= len); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_cache_hdr_serialize() */ @@ -380,8 +358,7 @@ HDfprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); * * Purpose: Destroy/release an "in core representation" of a data structure * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy * mcgreevy@hdfgroup.org @@ -409,18 +386,13 @@ H5FS_cache_hdr_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * * Purpose: Deserialize the data structure from disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Pointer to a new free space section info + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * July 31 2006 * - * Modified: Mike McGreevy - * mcgreevy@hdfgroup.org - * May 29, 2008 - * Converted from H5FS_cache_sinfo_load - * *------------------------------------------------------------------------- */ static void * @@ -437,9 +409,6 @@ H5FS_cache_sinfo_deserialize(haddr_t UNUSED addr, size_t UNUSED len, H5FS_sinfo_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_deserialize) -#ifdef QAK -HDfprintf(stderr, "%s: Deserialize free space sections, addr = %a\n", FUNC, addr); -#endif /* Check arguments */ HDassert(image); @@ -460,9 +429,6 @@ HDfprintf(stderr, "%s: Deserialize free space sections, addr = %a\n", FUNC, addr /* Allocate space for the buffer to serialize the sections into */ H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ udata->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); -#ifdef QAK -HDfprintf(stderr, "%s: udata->fspace->sect_size = %Hu\n", FUNC, udata->fspace->sect_size); -#endif /* QAK */ /* Deserialize free sections from buffer available */ p = image; @@ -478,9 +444,6 @@ HDfprintf(stderr, "%s: udata->fspace->sect_size = %Hu\n", FUNC, udata->fspace->s /* Address of free space header for these sections */ H5F_addr_decode(udata->f, &p, &fs_addr); -#ifdef QAK -HDfprintf(stderr, "%s: udata->fspace->addr = %a, fs_addr = %a\n", FUNC, udata->fspace->addr, fs_addr); -#endif /* QAK */ if(H5F_addr_ne(fs_addr, udata->fspace->addr)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") @@ -494,22 +457,12 @@ HDfprintf(stderr, "%s: udata->fspace->addr = %a, fs_addr = %a\n", FUNC, udata->f /* Compute the size of the section counts */ sect_cnt_size = H5V_limit_enc_size((uint64_t)udata->fspace->serial_sect_count); -#ifdef QAK -HDfprintf(stderr, "%s: sect_cnt_size = %u\n", FUNC, sect_cnt_size); -HDfprintf(stderr, "%s: udata->fspace->sect_len_size = %u\n", FUNC, udata->fspace->sect_len_size); -#endif /* QAK */ /* Reset the section count, the "add" routine will update it */ old_tot_sect_count = udata->fspace->tot_sect_count; old_serial_sect_count = udata->fspace->serial_sect_count; old_ghost_sect_count = udata->fspace->ghost_sect_count; old_tot_space = udata->fspace->tot_space; -#ifdef QAK -HDfprintf(stderr, "%s: udata->fspace->tot_sect_count = %Hu\n", FUNC, udata->fspace->tot_sect_count); -HDfprintf(stderr, "%s: udata->fspace->serial_sect_count = %Hu\n", FUNC, udata->fspace->serial_sect_count); -HDfprintf(stderr, "%s: udata->fspace->ghost_sect_count = %Hu\n", FUNC, udata->fspace->ghost_sect_count); -HDfprintf(stderr, "%s: udata->fspace->tot_space = %Hu\n", FUNC, udata->fspace->tot_space); -#endif /* QAK */ udata->fspace->tot_sect_count = 0; udata->fspace->serial_sect_count = 0; udata->fspace->ghost_sect_count = 0; @@ -523,16 +476,10 @@ HDfprintf(stderr, "%s: udata->fspace->tot_space = %Hu\n", FUNC, udata->fspace->t /* The number of sections of this node's size */ UINT64DECODE_VAR(p, node_count, sect_cnt_size); -#ifdef QAK -HDfprintf(stderr, "%s: node_count = %Zu\n", FUNC, node_count); -#endif /* QAK */ HDassert(node_count); /* The size of the sections for this node */ UINT64DECODE_VAR(p, sect_size, sinfo->sect_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size); -#endif /* QAK */ HDassert(sect_size); /* Loop over nodes of this size */ @@ -544,15 +491,9 @@ HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size); /* The address of the section */ UINT64DECODE_VAR(p, sect_addr, sinfo->sect_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_addr = %a\n", FUNC, sect_addr); -#endif /* QAK */ /* The type of this section */ sect_type = *p++; -#ifdef QAK -HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); -#endif /* QAK */ /* Call 'deserialize' callback for this section */ des_flags = 0; @@ -562,9 +503,6 @@ HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); /* Update offset in serialization buffer */ p += udata->fspace->sect_cls[sect_type].serial_size; -#ifdef QAK -HDfprintf(stderr, "%s: udata->fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_type, udata->fspace->sect_cls[sect_type].serial_size); -#endif /* QAK */ /* Insert section in free space manager, unless requested not to */ if(!(des_flags & H5FS_DESERIALIZE_NO_ADD)) @@ -583,7 +521,7 @@ HDfprintf(stderr, "%s: udata->fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, s } /* end if */ /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); + computed_chksum = H5_checksum_metadata(image, (size_t)(p - (const uint8_t *)image), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); @@ -593,7 +531,7 @@ HDfprintf(stderr, "%s: udata->fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, s HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (const uint8_t *)image) <= len); /* Set return value */ ret_value = sinfo; @@ -612,8 +550,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -642,15 +579,9 @@ H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *_udata) if(!(sect_cls->flags & H5FS_CLS_GHOST_OBJ)) { /* The address of the section */ UINT64ENCODE_VAR(*udata->p, sect->addr, udata->sinfo->sect_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->addr = %a\n", FUNC, sect->addr); -#endif /* QAK */ /* The type of this section */ *(*udata->p)++ = (uint8_t)sect->type; -#ifdef QAK -HDfprintf(stderr, "%s: sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ /* Call 'serialize' callback for this section */ if(sect_cls->serialize) { @@ -675,8 +606,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * in a bin * - * Return: Success: non-negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -701,15 +631,9 @@ H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata) if(fspace_node->serial_count > 0) { /* The number of serializable sections of this node's size */ UINT64ENCODE_VAR(*udata->p, fspace_node->serial_count, udata->sect_cnt_size); -#ifdef QAK -HDfprintf(stderr, "%s: fspace_node->serial_count = %Zu\n", FUNC, fspace_node->serial_count); -#endif /* QAK */ /* The size of the sections for this node */ UINT64ENCODE_VAR(*udata->p, fspace_node->sect_size, udata->sinfo->sect_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, fspace_node->sect_size); -#endif /* QAK */ /* Iterate through all the sections of this size */ HDassert(fspace_node->sect_list); @@ -727,42 +651,27 @@ done: * * Purpose: Serialize the data structure for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * July 31 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * May 29, 2008 - * Converted from H5FS_cache_sinfo_flush - * *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_sinfo_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t UNUSED addr, +H5FS_cache_sinfo_serialize(const H5F_t * f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { - herr_t ret_value = SUCCEED; /* Return value */ H5FS_sinfo_t * sinfo = (H5FS_sinfo_t *)_thing; - H5FS_iter_ud_t udata; /* User data for callbacks */ - uint8_t *p; /* Pointer into raw data buffer */ - uint32_t metadata_chksum; /* Computed metadata checksum value */ - unsigned bin; /* Current bin we are on */ + H5FS_iter_ud_t udata; /* User data for callbacks */ + uint8_t *p; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + unsigned bin; /* Current bin we are on */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_serialize) -#ifdef QAK -HDFprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); -#endif /* check arguments */ HDassert(f); @@ -788,23 +697,14 @@ HDFprintf(stderr, "%s: Serialize free space header, addr = %a\n", FUNC, addr); *p++ = H5FS_SINFO_VERSION; /* Address of free space header for these sections */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr); -#endif /* QAK */ H5F_addr_encode(f, &p, sinfo->fspace->addr); /* Set up user data for iterator */ udata.sinfo = sinfo; udata.p = &p; udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); -#ifdef QAK -HDfprintf(stderr, "%s: udata.sect_cnt_size = %u\n", FUNC, udata.sect_cnt_size); -#endif /* QAK */ /* Iterate over all the bins */ -#ifdef QAK -HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); -#endif /* QAK */ for(bin = 0; bin < sinfo->nbins; bin++) { /* Check if there are any sections in this bin */ if(sinfo->bins[bin].bin_list) { @@ -815,21 +715,17 @@ HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); } /* end for */ /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(image, (size_t)((const uint8_t *)p - (const uint8_t *)image), 0); + metadata_chksum = H5_checksum_metadata(image, (size_t)(p - (uint8_t *)image), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); /* Sanity check */ - HDassert((size_t)(p - (const uint8_t *)image) == sinfo->fspace->sect_size); + HDassert((size_t)(p - (uint8_t *)image) == sinfo->fspace->sect_size); HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->fspace->sect_size = %Hu\n", FUNC, sinfo->fspace->sect_size); -HDfprintf(stderr, "%s: sinfo->fspace->alloc_sect_size = %Hu\n", FUNC, sinfo->fspace->alloc_sect_size); -#endif /* QAK */ /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (uint8_t *)image) <= len); /* Reset the cache flags for this operation */ *flags = 0; @@ -844,8 +740,7 @@ done: * * Purpose: Destroy/release an "in core representation" of a data structure * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy * mcgreevy@hdfgroup.org diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 83da767..cb7dfe3 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -92,8 +92,8 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int { H5FS_t *fspace = NULL; /* Free space header info */ H5FS_prot_t fs_prot; /* Information for protecting free space manager */ - herr_t ret_value = SUCCEED; /* Return value */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FS_debug, FAIL) @@ -232,8 +232,8 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int H5FS_t *fspace = NULL; /* Free space header info */ H5FS_prot_t fs_prot; /* Information for protecting free space manager */ H5FS_client_t client; /* The client of the free space */ - herr_t ret_value = SUCCEED; /* Return value */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FS_sects_debug, FAIL) diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 3081c4f..6e1618f 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -26,6 +26,8 @@ /****************/ #define H5FS_PACKAGE /*suppress error about including H5FSpkg */ + + /***********/ /* Headers */ /***********/ @@ -35,6 +37,7 @@ #include "H5MFprivate.h" /* File memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ + /****************/ /* Local Macros */ /****************/ @@ -183,8 +186,8 @@ static H5FS_sinfo_t * H5FS_sinfo_pin(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace) { H5FS_sinfo_t *sinfo; /* Section information struct created */ - H5FS_sinfo_t *ret_value; /* Return value */ H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ + H5FS_sinfo_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_sinfo_pin) #ifdef QAK @@ -425,7 +428,7 @@ H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, sinfo->bins[bin].tot_sect_count--; #ifdef QAK HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif +#endif /* QAK */ /* Check for 'ghost' or 'serializable' section */ if(cls->flags & H5FS_CLS_GHOST_OBJ) { @@ -711,8 +714,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s */ #ifdef QAK HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif - +#endif /* QAK */ sinfo->bins[bin].tot_sect_count++; if(cls->flags & H5FS_CLS_GHOST_OBJ) { sinfo->bins[bin].ghost_sect_count++; diff --git a/src/H5Fmount.c b/src/H5Fmount.c index a86bc01..b67021f 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -21,13 +21,13 @@ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Pprivate.h" /* Property lists */ #include "H5MMprivate.h" /* Memory management */ -#include "H5AC2private.h" /* Metadata cache */ /* PRIVATE PROTOTYPES */ static herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index ad99539..1ad87d1 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -21,9 +21,9 @@ /* Public header files needed by this file */ #include "H5public.h" -#include "H5Cpublic.h" #include "H5ACpublic.h" #include "H5AC2public.h" +#include "H5Cpublic.h" #include "H5Ipublic.h" /* When this header is included from a private header, don't make calls to H5check() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 093f5b4..8cdca20 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -31,10 +31,9 @@ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5MMprivate.h" /* Memory management */ - /****************/ @@ -130,6 +129,7 @@ herr_t H5F_super_create_extension(H5F_t *f, /* Local Variables */ /*******************/ + /*-------------------------------------------------------------------------- NAME @@ -321,12 +321,6 @@ done: * wendling@ncsa.uiuc.edu * Sept 12, 2003 * - * Changes: Johm Mainzer - * 12/14/07 - * Added code to read in the metadata journaling config - * if it is present, and to initialize - * f->shared->journaling_enabled to FALSE if it isn't. - * *------------------------------------------------------------------------- */ herr_t @@ -662,13 +656,10 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) /* Read the file's superblock extension, if there is one. */ if(H5F_addr_defined(shared->extension_addr)) { - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */ H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */ - H5O_mdj_msg_t mdj_msg; /* metadata journaling message - * from superblock extension - */ + H5O_mdj_msg_t mdj_msg; /* metadata journaling message from superblock extension */ /* Sanity check - superblock extension should only be defined for * superblock version >= 2. @@ -736,78 +727,51 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) /* Read in the metadata journaling configuration message, * if it exists. */ - if(NULL == H5O_msg_read(&ext_loc, H5O_MDJ_MSG_ID, &mdj_msg, dxpl_id)) { - /* Reset error from "failed" message read */ - /* H5Eprint1(stdout); */ H5E_clear_stack(NULL); } /* end if */ else { - shared->mdc_jnl_enabled = mdj_msg.mdc_jnl_enabled; - - if ( shared->mdc_jnl_enabled ) { - + if(shared->mdc_jnl_enabled) { shared->mdc_jnl_magic = mdj_msg.mdc_jnl_magic; shared->mdc_jnl_file_name_len = mdj_msg.mdc_jnl_file_name_len; - if ( shared->mdc_jnl_file_name_len <= 0 ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, \ - "journaling enabled, but journal file path empty?!?") - } - - if ( shared->mdc_jnl_file_name_len > - H5C2__MAX_JOURNAL_FILE_NAME_LEN ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, \ - "journal file path too long") - } + /* Sanity check value */ + if(shared->mdc_jnl_file_name_len <= 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "journaling enabled, but journal file path empty?!?") + if(shared->mdc_jnl_file_name_len > H5C2__MAX_JOURNAL_FILE_NAME_LEN) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "journal file path too long") HDstrncpy(shared->mdc_jnl_file_name, mdj_msg.mdc_jnl_file_name, mdj_msg.mdc_jnl_file_name_len + 1); - if ( ( (shared->mdc_jnl_file_name) - [shared->mdc_jnl_file_name_len] != '\0' ) || - ( HDstrlen(shared->mdc_jnl_file_name) != - shared->mdc_jnl_file_name_len ) ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, \ - "bad journal file path and/or path len???") - } - } - else - { + if(((shared->mdc_jnl_file_name)[shared->mdc_jnl_file_name_len] != '\0') || + (HDstrlen(shared->mdc_jnl_file_name) != shared->mdc_jnl_file_name_len)) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "bad journal file path and/or path len???") + } /* end if */ + else { shared->mdc_jnl_magic = 0; shared->mdc_jnl_file_name_len = 0; (shared->mdc_jnl_file_name)[0] = '\0'; - } + } /* end else */ /* Reset metadata journaling config message */ H5O_msg_reset(H5O_MDJ_MSG_ID, &mdj_msg); - } + } /* end else */ /* Close the extension. Twiddle the number of open objects to avoid * closing the file (since this will be the only open object). */ f->nopen_objs++; - - if(H5O_close(&ext_loc) < 0) { - - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, \ - "unable to close superblock extension") - } - + if(H5O_close(&ext_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension") f->nopen_objs--; - } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* end H5F_super_read() */ @@ -825,13 +789,6 @@ done: * koziol@ncsa.uiuc.edu * Sept 15, 2003 * - * Changes: John Mainzer - * Dec. 14, 2007 - * Added initialization for the metadata journaling - * configuration fields. By default, these fields are - * initialized to indicate that we are not journaling - * metadata. - * *------------------------------------------------------------------------- */ herr_t @@ -915,7 +872,6 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) * in it. */ else if(super_vers >= HDF5_SUPERBLOCK_VERSION_2) { - /* make note of the fact that we can construct a superblock * extension later if we wish. */ @@ -937,7 +893,6 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) /* Create the superblock extension for "extra" superblock data, if necessary. */ if(need_ext) { - H5O_loc_t ext_loc; /* Superblock extension object location */ /* The superblock extension isn't actually a group, but the @@ -948,11 +903,8 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) * be tuned if more information is added to the superblock * extension. */ - if ( H5F_super_create_extension(f, dxpl_id, &ext_loc) != SUCCEED ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, \ - "unable to create superblock extension"); - } + if(H5F_super_create_extension(f, dxpl_id, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create superblock extension") /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. @@ -996,7 +948,6 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ - /* One might expect us to check to see if journaling is enabled * at this point, and write a metadata journaling message to the * super block extension if it is. @@ -1019,13 +970,11 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) * * JRM -- 2/19/09 */ - f->shared->mdc_jnl_enabled = FALSE; f->shared->mdc_jnl_magic = 0; f->shared->mdc_jnl_file_name_len = 0; (f->shared->mdc_jnl_file_name)[0] = '\0'; - /* Twiddle the number of open objects to avoid closing the file * (since this will be the only open object currently). */ @@ -1036,9 +985,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* end H5F_super_init() */ @@ -1188,9 +1135,7 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock") done: - FUNC_LEAVE_NOAPI(ret_value) - } /* end H5F_super_write() */ @@ -1216,57 +1161,37 @@ done: * Programmer: John Mainzer * 3/3/08 * - * Changes: JRM -- 2/17/09 - * Heavily re-worked the function to move the journal file - * name and journal file magic into the metadata journaling - * message. - * - * Note that this makes the metadata journaling message - * variable length, so we now delete any existing metadata - * journaling message, and then replace it with a new - * message if metadata journaling is enabled. - * *------------------------------------------------------------------------- */ herr_t -H5F_super_write_mdj_msg(H5F_t *f, - hid_t dxpl_id) +H5F_super_write_mdj_msg(H5F_t *f, hid_t dxpl_id) { - H5O_loc_t ext_loc; - herr_t result; - htri_t tri_result; - struct H5O_mdj_msg_t mdj_msg; - herr_t ret_value = SUCCEED; + H5O_loc_t ext_loc; /* Superblock extension object location */ + htri_t msg_exists; /* Whether the metadata journaling message exists already in the superblock extension */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_super_write_mdj_msg, FAIL) - HDassert( f != NULL ); - HDassert( f->shared != NULL ); - HDassert( f->shared->extension_ok ); - - if ( f->shared->extension_addr == HADDR_UNDEF ) { - - result = H5F_super_create_extension(f, dxpl_id, &ext_loc); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, \ - "unable to create superblock extension?!?!"); - } - } else { - + /* Sanity check */ + HDassert(f != NULL); + HDassert(f->shared != NULL); + HDassert(f->shared->extension_ok); + + /* Open the superblock extension, or create it if it doesn't exist */ + if(!H5F_addr_defined(f->shared->extension_addr)) { + if(H5F_super_create_extension(f, dxpl_id, &ext_loc) < 0) + HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, "unable to create superblock extension?!?!") + } /* end if */ + else { /* Set up "fake" object location for superblock extension */ H5O_loc_reset(&ext_loc); ext_loc.file = f; ext_loc.addr = f->shared->extension_addr; /* Open the superblock extension */ - if(H5O_open(&ext_loc) < 0) { - - HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, \ - "unable to open superblock extension?!?!"); - } - } + if(H5O_open(&ext_loc) < 0) + HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, "unable to open superblock extension?!?!") + } /* end else */ /* The metadata journaling message is a variable length message. * This raises the question of how to deal with any pre-existing @@ -1286,52 +1211,19 @@ H5F_super_write_mdj_msg(H5F_t *f, * and delete it if it does. If metadata data journaling is enabled, * we will replace it with a new message shortly. */ - - tri_result = H5O_msg_exists(&ext_loc, H5O_MDJ_MSG_ID, dxpl_id); - - if ( tri_result < 0 ) { /* failure */ - - HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, \ - "unable to determine if metadata journaling message exists?!?!"); - - } else if ( tri_result == TRUE ) { - + if((msg_exists = H5O_msg_exists(&ext_loc, H5O_MDJ_MSG_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to determine if metadata journaling message exists?!?!") + if(msg_exists == TRUE) { /* metadata journaling message exists -- delete it from the * super block extension now. We will replace it later if * metadata journaling is enabled. */ + if(H5O_msg_remove(&ext_loc, H5O_MDJ_MSG_ID, H5O_ALL, FALSE, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL, "unable to remove metadata journaling message") + } /* end if */ - result = H5O_msg_remove(&ext_loc, - H5O_MDJ_MSG_ID, - H5O_ALL, - /* the next parameter is the "adj_link" parameter, which is - * boolean. Unfortunately, its meaning is not documented - * in the code. The value gets stuffed into an instance of - * H5O_iter_rm_t, and then passed along somehow to a function - * whose address appears to be picked out of a table somewhere. - * - * The documentation on the adj_link field of H5O_iter_rm_t - * simply says that the value specifies "Whether to adjust - * links when removing messages" -- but unfortunately, I - * don't know what a "link" is in this context. - * - * Bottom line is that after spending over an hour dredging - * through the code, I haven't a clue as to what the value - * of this parameter should be. We will set it to FALSE and - * see if anything blows up. - * - * JRM -- 3/5/08 - */ - FALSE, - dxpl_id); - - } else if ( tri_result != FALSE ) { - - HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, \ - "unexpected return value from H5O_msg_exists()"); - } - - if ( f->shared->mdc_jnl_enabled ) { + if(f->shared->mdc_jnl_enabled) { + H5O_mdj_msg_t mdj_msg; /* Metadata journaling message to insert in superblock extension */ /* create a metadata journaling message and insert it in * the superblock extension. @@ -1340,67 +1232,37 @@ H5F_super_write_mdj_msg(H5F_t *f, mdj_msg.mdc_jnl_magic = f->shared->mdc_jnl_magic; mdj_msg.mdc_jnl_file_name_len = f->shared->mdc_jnl_file_name_len; - if ( f->shared->mdc_jnl_file_name_len == 0 ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, \ - "journaling enabled, but journal file path empty?!?") - - } - - if ( f->shared->mdc_jnl_file_name_len > - H5C2__MAX_JOURNAL_FILE_NAME_LEN ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, \ - "journal file path too long?!?") - - } + /* Sanity check journal file name */ + if(f->shared->mdc_jnl_file_name_len == 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "journaling enabled, but journal file path empty?!?") + if(f->shared->mdc_jnl_file_name_len > H5C2__MAX_JOURNAL_FILE_NAME_LEN) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "journal file path too long?!?") + /* Copy journal file name into message to store */ HDstrncpy(mdj_msg.mdc_jnl_file_name, f->shared->mdc_jnl_file_name, f->shared->mdc_jnl_file_name_len + 1); - if ( ( (mdj_msg.mdc_jnl_file_name)[mdj_msg.mdc_jnl_file_name_len] - != '\0' ) || - ( HDstrlen(mdj_msg.mdc_jnl_file_name) != - mdj_msg.mdc_jnl_file_name_len ) ) { - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, \ - "bad journal file path and/or path len???") - } + /* Sanity check copied name */ + if(((mdj_msg.mdc_jnl_file_name)[mdj_msg.mdc_jnl_file_name_len] != '\0') + || (HDstrlen(mdj_msg.mdc_jnl_file_name) != mdj_msg.mdc_jnl_file_name_len)) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "bad journal file path and/or path len???") - result = H5O_msg_create(&ext_loc, - H5O_MDJ_MSG_ID, - H5O_MSG_FLAG_DONTSHARE, - H5O_UPDATE_TIME, - &mdj_msg, - dxpl_id); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, \ - "unable to add mdj_msg to superblock extension?!?!"); - } - - } + /* Store the metadata journaling message in the superblock extension */ + if(H5O_msg_create(&ext_loc, H5O_MDJ_MSG_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &mdj_msg, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYSTEM, H5E_SYSERRSTR, FAIL, "unable to add mdj_msg to superblock extension?!?!") + } /* end if */ /* Close the extension. Twiddle the number of open objects to avoid * closing the file (since this may be the only open object). */ - f->nopen_objs++; - - if(H5O_close(&ext_loc) < 0) { - - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, - "unable to close superblock extension") - } - + if(H5O_close(&ext_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension") f->nopen_objs--; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* end H5F_super_write_mdj_msg() */ @@ -1413,6 +1275,7 @@ done: * * Programmer: Vailin Choi * July 11, 2007 + * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5G.c b/src/H5G.c index 6464dcb..320128e 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -83,6 +83,7 @@ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5Gpkg.h" /* Groups */ @@ -90,7 +91,6 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5AC2private.h" /* Metadata cache */ /* Local macros */ #define H5G_RESERVED_ATOMS 0 diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 60093f6..24dc549 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -41,12 +41,12 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Pprivate.h" /* Property lists */ -#include "H5AC2private.h" /* Metadata cache */ /****************/ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 4c44bd9..6f796d5 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -457,13 +457,13 @@ H5G_node_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, /* entries */ if(H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") - HDmemset(p, 0, size - (size_t)((const uint8_t *)p - (const uint8_t *)image)); + HDmemset(p, 0, size - (size_t)(p - (uint8_t *)image)); /* Reset the cache flags for this operation (metadata not resized or renamed) */ *flags = 0; /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + HDassert((size_t)(p - (uint8_t *)image) <= len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1494,13 +1494,13 @@ int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { - H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; - const H5O_loc_t *src_oloc = udata->src_oloc; - H5O_copy_t *cpy_info = udata->cpy_info; - H5HL_t *heap = NULL; - H5G_node_t *sn = NULL; - unsigned int i; /* Local index variable */ - int ret_value = H5_ITER_CONT; + H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; + const H5O_loc_t *src_oloc = udata->src_oloc; + H5O_copy_t *cpy_info = udata->cpy_info; + H5HL_t *heap = NULL; + H5G_node_t *sn = NULL; + unsigned int i; /* Local index variable */ + int ret_value = H5_ITER_CONT; FUNC_ENTER_NOAPI(H5G_node_copy, H5_ITER_ERROR) @@ -1734,10 +1734,10 @@ herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, haddr_t heap_addr) { - H5G_node_t *sn = NULL; - H5HL_t *heap = NULL; - unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_node_t *sn = NULL; + H5HL_t *heap = NULL; + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_node_debug, FAIL) diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 66cfaa7..2e1b6af 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -161,7 +161,7 @@ typedef struct { typedef struct H5G_bt_common_t { /* downward */ const char *name; /*points to temporary memory */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ } H5G_bt_common_t; /* @@ -180,8 +180,8 @@ typedef struct H5G_bt_ins_t { */ typedef struct H5G_bt_rm_t { /* downward */ - H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ + H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ + H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ } H5G_bt_rm_t; /* Typedef for B-tree 'find' operation */ @@ -193,9 +193,9 @@ typedef herr_t (*H5G_bt_find_op_t)(const H5G_entry_t *ent/*in*/, void *operator_ */ typedef struct H5G_bt_lkp_t { /* downward */ - H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ - void *op_data; /* Data to pass to operator */ + H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ + H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ + void *op_data; /* Data to pass to operator */ /* upward */ } H5G_bt_lkp_t; @@ -206,7 +206,7 @@ typedef struct H5G_bt_lkp_t { */ typedef struct H5G_bt_it_it_t { /* downward */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ hsize_t skip; /*initial entries to skip */ H5G_lib_iterate_t op; /*iteration operator */ void *op_data; /*user-defined operator data */ @@ -237,7 +237,7 @@ typedef struct H5G_bt_it_idx_common_t { typedef struct H5G_bt_it_bt_t { /* downward */ size_t alloc_nlinks; /* Number of links allocated in table */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /* Symbol table heap */ /* upward */ H5G_link_table_t *ltable; /* Link table to add information to */ @@ -402,8 +402,8 @@ H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n); H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, - FILE * stream, int indent, int fwidth, const H5HL_t *heap); +H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent, + int fwidth, const H5HL_t *heap); /* Functions that understand symbol table nodes */ H5_DLL herr_t H5G_node_init(H5F_t *f); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 9ca0c90..fcb573d 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -34,7 +34,7 @@ typedef struct { /* downward */ const char *name; /* Name to search for */ - H5HL_t *heap; /* Local heap for group */ + H5HL_t *heap; /* Local heap for group */ /* upward */ H5O_link_t *lnk; /* Caller's link location */ @@ -44,7 +44,7 @@ typedef struct { typedef struct H5G_bt_it_gnbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ /* upward */ char *name; /*member name to be returned */ @@ -66,7 +66,7 @@ typedef struct H5G_bt_it_gtbi_t { typedef struct H5G_bt_it_lbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ /* upward */ H5O_link_t *lnk; /*link to be returned */ @@ -98,9 +98,9 @@ typedef struct H5G_bt_it_lbi_t { herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - size_t name_offset; /* Offset of "" name */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + size_t name_offset; /* Offset of "" name */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_create_components, FAIL) @@ -222,9 +222,9 @@ herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_ins_t udata; /* Data to pass through B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_ins_t udata; /* Data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_insert_real, FAIL) @@ -313,10 +313,10 @@ herr_t H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /*symbol table message */ - H5G_bt_rm_t udata; /*data to pass through B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5O_stab_t stab; /*symbol table message */ + H5G_bt_rm_t udata; /*data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL) @@ -365,12 +365,12 @@ herr_t H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, H5_iter_order_t order, hsize_t n) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /* Symbol table message */ - H5G_bt_rm_t udata; /* Data to pass through B-tree */ - H5O_link_t obj_lnk; /* Object's link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5O_stab_t stab; /* Symbol table message */ + H5G_bt_rm_t udata; /* Data to pass through B-tree */ + H5O_link_t obj_lnk; /* Object's link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_remove_by_idx, FAIL) @@ -428,9 +428,9 @@ done: herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) { - H5HL_t *heap = NULL; /* Pointer to local heap */ + H5HL_t *heap = NULL; /* Pointer to local heap */ H5G_bt_rm_t udata; /*data to pass through B-tree */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL) @@ -485,10 +485,10 @@ herr_t H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { - H5HL_t *heap = NULL; /* Local heap for group */ - H5O_stab_t stab; /* Info about symbol table */ + H5HL_t *heap = NULL; /* Local heap for group */ + H5O_stab_t stab; /* Info about symbol table */ H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_iterate, FAIL) @@ -702,10 +702,10 @@ ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gnbi_t udata; /* Iteration information */ - ssize_t ret_value; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5O_stab_t stab; /* Info about local heap & B-tree */ + H5G_bt_it_gnbi_t udata; /* Iteration information */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL) @@ -821,10 +821,10 @@ herr_t H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ - H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ - H5O_stab_t stab; /* Symbol table message */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ + H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ + H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_lookup, FAIL) @@ -924,10 +924,10 @@ herr_t H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ + H5HL_t *heap = NULL; /* Pointer to local heap */ H5G_bt_it_lbi_t udata; /* Iteration information */ H5O_stab_t stab; /* Symbol table message */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_lookup_by_idx, FAIL) diff --git a/src/H5HF.c b/src/H5HF.c index 469b1bc..a9c4dda 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -152,9 +152,9 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) { H5HF_t *fh = NULL; /* Pointer to new fractal heap */ H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ haddr_t fh_addr; /* Heap header address */ H5HF_t *ret_value; /* Return value */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ FUNC_ENTER_NOAPI(H5HF_create, NULL) #ifdef QAK @@ -175,10 +175,11 @@ HDfprintf(stderr, "%s: Called\n", FUNC); if(NULL == (fh = H5FL_MALLOC(H5HF_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap info") + /* Set up userdata for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; - /* Lock the heap header into memory */ + /* Lock the heap header into memory */ if(NULL == (hdr = H5AC2_protect(f, dxpl_id, H5AC2_FHEAP_HDR, fh_addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load fractal heap header") @@ -227,8 +228,8 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { H5HF_t *fh = NULL; /* Pointer to new fractal heap */ H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - H5HF_t *ret_value; /* Return value */ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + H5HF_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5HF_open, NULL) @@ -238,10 +239,10 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) HDassert(f); HDassert(H5F_addr_defined(fh_addr)); + /* Set up userdata for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; - /* Load the heap header into memory */ #ifdef QAK HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr); @@ -793,10 +794,10 @@ done: herr_t H5HF_close(H5HF_t *fh, hid_t dxpl_id) { + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ hbool_t pending_delete = FALSE; /* Whether the heap is pending deletion */ haddr_t heap_addr = HADDR_UNDEF; /* Address of heap (for deletion) */ - herr_t ret_value = SUCCEED; - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_close, FAIL) @@ -804,6 +805,7 @@ H5HF_close(H5HF_t *fh, hid_t dxpl_id) * Check arguments. */ HDassert(fh); + /* Decrement file reference & check if this is the last open fractal heap using the shared heap header */ if(0 == H5HF_hdr_fuse_decr(fh->hdr)) { /* Set the shared heap header's file context for this operation */ @@ -862,6 +864,7 @@ HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr- if(pending_delete) { H5HF_hdr_t *hdr; /* Another pointer to fractal heap header */ + /* Set up userdata for protect call */ cache_udata.f = fh->f; cache_udata.dxpl_id = dxpl_id; @@ -898,13 +901,12 @@ done: * *------------------------------------------------------------------------- */ - herr_t H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - herr_t ret_value = SUCCEED; - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_delete, FAIL) @@ -914,6 +916,7 @@ H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) HDassert(f); HDassert(H5F_addr_defined(fh_addr)); + /* Set up userdata for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; diff --git a/src/H5HFcache.c b/src/H5HFcache.c index dfcf29c..3678b7c 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -34,13 +34,13 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" #include "H5Eprivate.h" /* Error handling */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ -#include "H5AC2private.h" /****************/ /* Local Macros */ @@ -77,25 +77,25 @@ static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dt static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable); /* Metadata cache (H5AC2) callbacks */ -static void *H5HF_cache_hdr_deserialize(haddr_t addr, size_t len, +static void *H5HF_cache_hdr_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5HF_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, - haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, +static herr_t H5HF_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_hdr_free_icr(haddr_t addr, size_t len, void *thing); static herr_t H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr); -static void *H5HF_cache_iblock_deserialize(haddr_t addr, size_t len, +static void *H5HF_cache_iblock_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, hid_t dxpl_id, - haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, +static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_iblock_free_icr(haddr_t addr, size_t len, void *thing); -static void *H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, +static void *H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5HF_cache_dblock_serialize(const H5F_t * f, hid_t dxpl_id, - haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, +static herr_t H5HF_cache_dblock_serialize(const H5F_t * f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_dblock_free_icr(haddr_t addr, size_t len, void *thing); @@ -267,15 +267,10 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) * koziol@ncsa.uiuc.edu * Feb 24 2006 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * July 25, 2008 - * Converted from H5HF_cache_hdr_load - * *------------------------------------------------------------------------- */ static void * -H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, +H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, const void *image, void *_udata, hbool_t UNUSED *dirty) { H5HF_hdr_t *hdr = NULL; /* Fractal heap info */ @@ -354,7 +349,6 @@ H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, /* Check for I/O filter information to decode */ if(hdr->filter_len > 0) { - size_t filter_info_off; /* Offset in header of filter information */ size_t filter_info_size; /* Size of filter information */ H5O_pline_t *pline; /* Pipeline information from the header on disk */ @@ -371,7 +365,7 @@ H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, hdr->heap_size = size + filter_info_size; /* Point at correct offset in header for the filter information */ - p = image + filter_info_off; + p = (const uint8_t *)image + filter_info_off; /* Decode the size of a filtered root direct block */ H5F_DECODE_LENGTH(udata->f, p, hdr->pline_root_direct_size); @@ -391,7 +385,7 @@ H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, /* Release the space allocated for the I/O pipeline filters */ H5O_msg_free(H5O_PLINE_ID, pline); } /* end if */ - else + else /* Set the heap header's size */ hdr->heap_size = size; @@ -412,9 +406,6 @@ H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, /* Finish initialization of heap header */ if(H5HF_hdr_finish_init(hdr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") -#ifdef QAK -HDfprintf(stderr, "%s: hdr->fspace = %p\n", FUNC, hdr->fspace); -#endif /* QAK */ /* Set return value */ ret_value = hdr; @@ -431,7 +422,7 @@ done: /*------------------------------------------------------------------------- * Function: H5HF_cache_hdr_image_len * - * Purpose: Tell the metadata cache about the actual size + * Purpose: Tell the metadata cache about the actual size * of the fractal heap header * * Return: Non-negative on success/Negative on failure @@ -445,20 +436,18 @@ done: static herr_t H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr) { - const H5HF_hdr_t *hdr = (const H5HF_hdr_t *)thing; /* Fractal heap header */ - + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_hdr_image_len) /* Check arguments */ HDassert(hdr); HDassert(image_len_ptr); - + /* Report the fractal heap header's prefix + I/O filter length */ *image_len_ptr = H5HF_HEADER_SIZE(hdr) + hdr->filter_len; FUNC_LEAVE_NOAPI(SUCCEED) - } /* end H5HF_cache_hdr_image_len() */ @@ -473,31 +462,21 @@ H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr) * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Feb 24 2006 - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * July 25, 2008 - * Converted from H5HF_cache_hdr_flush * *------------------------------------------------------------------------- */ static herr_t -H5HF_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, - haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, - unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, +H5HF_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { - herr_t ret_value = SUCCEED; /* Return value */ - uint8_t *p; /* Pointer into raw data buffer */ - size_t size; /* Header size on disk */ - uint8_t heap_flags; /* Status flags for heap */ - uint32_t metadata_chksum; /* Computed metadata checksum value */ H5HF_hdr_t *hdr = (H5HF_hdr_t *)_thing; /* fractal heap header */ + uint8_t *p; /* Pointer into raw data buffer */ + size_t size; /* Header size on disk */ + uint8_t heap_flags; /* Status flags for heap */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_serialize) @@ -638,15 +617,10 @@ H5HF_cache_hdr_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * koziol@ncsa.uiuc.edu * Feb 27 2006 * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * July 25, 2008 - * Converted from H5HF_cache_iblock_load - * *------------------------------------------------------------------------- */ static void * -H5HF_cache_iblock_deserialize(haddr_t UNUSED addr, size_t UNUSED len, +H5HF_cache_iblock_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, void *_udata, hbool_t UNUSED *dirty) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ @@ -660,9 +634,6 @@ H5HF_cache_iblock_deserialize(haddr_t UNUSED addr, size_t UNUSED len, H5HF_indirect_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_deserialize) -#ifdef QAK -HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(image); @@ -774,9 +745,6 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); iblock->nchildren++; iblock->max_child = u; } /* end if */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr); -#endif /* QAK */ } /* end for */ /* Sanity check */ @@ -814,6 +782,7 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add /* Sanity check */ HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + done: /* Release resources */ if(!ret_value && iblock) @@ -834,27 +803,14 @@ done: * koziol@ncsa.uiuc.edu * Mar 6 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * July 25, 2008 - * Converted from H5HF_cache_iblock_flush - * *------------------------------------------------------------------------- */ static herr_t - -H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, - haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, - unsigned UNUSED *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, +H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned UNUSED *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { - herr_t ret_value = SUCCEED; /* Return value */ H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_indirect_t *iblock = (H5HF_indirect_t *)_thing; uint8_t *p; /* Pointer into raw data buffer */ @@ -864,11 +820,9 @@ H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, #endif /* NDEBUG */ uint32_t metadata_chksum; /* Computed metadata checksum value */ size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_serialize) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_serialize) /* check arguments */ HDassert(f); @@ -877,12 +831,6 @@ HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC /* Get the pointer to the shared heap header */ hdr = iblock->hdr; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtable.cparam.width); -#endif /* QAK */ /* Set the shared heap header's file context for this operation */ hdr->f = f; @@ -905,9 +853,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab /* Encode indirect block-specific fields */ for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) { -#ifdef QAK -HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr); -#endif /* QAK */ /* Encode child block address */ H5F_addr_encode(f, &p, iblock->ents[u].addr); @@ -918,9 +863,6 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add /* Encode extra information for direct blocks */ if(u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) { -#ifdef QAK -HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->filt_ents[u].size, iblock->filt_ents[u].filter_mask); -#endif /* QAK */ /* Sanity check */ /* (either both the address & size are defined or both are * not defined) @@ -981,7 +923,7 @@ done: * Programmer: Mike McGreevy * mcgreevy@hdfgroup.org * July 25, 2008 - * + * *------------------------------------------------------------------------- */ static herr_t @@ -1003,10 +945,10 @@ H5HF_cache_iblock_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * Function: H5HF_cache_dblock_deserialize * * Purpose: Given a direct block disk image, construct and return the - * associated in core representation of the fractal heap + * associated in core representation of the fractal heap * direct block. * - * Note that this function is a heavily re-worked version + * Note that this function is a heavily re-worked version * of the old H5HF_cache_dblock_load() routine, which had * to be replaced convert the fractal heap to use the new * journaling version of the cache. @@ -1019,20 +961,13 @@ H5HF_cache_iblock_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * koziol@ncsa.uiuc.edu * Feb 27 2006 * - * Changes: JRM -- 8/10/08 - * Converted from H5HF_cache_dblock_load(). - * *------------------------------------------------------------------------- */ - static void * -H5HF_cache_dblock_deserialize(haddr_t addr, - size_t len, - const void *image, - void *udata, - hbool_t *dirty) +H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, const void *image, + void *_udata, hbool_t *dirty) { - H5HF_dblock_cache_ud_t * ud_ptr; /* pointer to user data */ + H5HF_dblock_cache_ud_t *udata = (H5HF_dblock_cache_ud_t *)_udata; /* pointer to user data */ H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_parent_t *par_info; /* Pointer to parent information */ H5HF_direct_t *dblock = NULL; /* Direct block info */ @@ -1043,93 +978,63 @@ H5HF_cache_dblock_deserialize(haddr_t addr, FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_deserialize) /* Check arguments */ - HDassert( H5F_addr_defined(addr) ); - HDassert( len > 0 ); - HDassert( image != NULL ); - HDassert( udata != NULL ); - - ud_ptr = (H5HF_dblock_cache_ud_t *)udata; - - par_info = (H5HF_parent_t *)(&(ud_ptr->par_info)); - - HDassert( ud_ptr->f != NULL ); - HDassert( ud_ptr->dblock_size > 0 ); - + HDassert(H5F_addr_defined(addr)); + HDassert(len > 0); + HDassert(image != NULL); + HDassert(udata != NULL); + HDassert(udata->f != NULL); + HDassert(udata->dblock_size > 0); /* Allocate space for the fractal heap direct block */ - if( NULL == (dblock = H5FL_MALLOC(H5HF_direct_t)) ) { - + if(NULL == (dblock = H5FL_MALLOC(H5HF_direct_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - } HDmemset(&dblock->cache_info, 0, sizeof(H5AC2_info_t)); + par_info = (H5HF_parent_t *)(&(udata->par_info)); + /* Get the pointer to the shared heap header */ hdr = par_info->hdr; - /* Set the shared heap header's file context for this operation */ - hdr->f = ud_ptr->f; - + hdr->f = udata->f; /* Share common heap information */ dblock->hdr = hdr; - - if( H5HF_hdr_incr(hdr) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, \ - "can't increment reference count on shared heap header") - } - + if(H5HF_hdr_incr(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ - dblock->size = ud_ptr->dblock_size; + dblock->size = udata->dblock_size; dblock->blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dblock->size); - /* Allocate block buffer */ /* XXX: Change to using free-list factories */ - if( (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) - == NULL ) { + if(NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \ - "memory allocation failed") - } - - - /* copy the disk image into the in core image, with filtering + /* copy the disk image into the in core image, with filtering * if appropriate. */ - - if ( hdr->filter_len > 0 ) { - + if(hdr->filter_len > 0) { H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */ - size_t nbytes; /* Number of bytes used in buffer, after - * applying reverse filters - */ + size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */ void *read_buf; /* Pointer to buffer to read in */ size_t read_size; /* Size of filtered direct block to read */ unsigned filter_mask; /* Excluded filters for direct block */ - /* Allocate buffer to perform I/O filtering on, and - * then copy the on disk image into it. + /* Allocate buffer to perform I/O filtering on, and + * then copy the on disk image into it. * * Note that one could argue that we should just do the * filtering in the buffer provided by the cache, and in - * theory there is no reason why we shouldn't. However, + * theory there is no reason why we shouldn't. However, * I can see some scenarios in which this would cause problems, * and in any case, we have declared it to be constant. Thus * we will make a copy instead. */ - if ( NULL == ( read_buf = H5MM_malloc(len)) ) { - - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, \ - "memory allocation failed for pipeline buffer") - } - -#ifdef QAK -HDfprintf(stderr, "%s: len = %Zu, read_buf = %p\n", FUNC, len, read_buf); -#endif /* QAK */ + if(NULL == (read_buf = H5MM_malloc(len))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer") /* Copy disk image into read_buf */ HDmemcpy(read_buf, image, len); @@ -1137,100 +1042,59 @@ HDfprintf(stderr, "%s: len = %Zu, read_buf = %p\n", FUNC, len, read_buf); /* Push direct block data through I/O filter pipeline */ nbytes = len; read_size = len; - filter_mask = ud_ptr->filter_mask; - - if ( H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, - H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, - &read_buf) < 0 ) { + filter_mask = udata->filter_mask; - HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, \ - "output pipeline failed") - } -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nbytes, read_size, read_buf); -#endif /* QAK */ + if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed") /* Sanity check */ - HDassert( nbytes == dblock->size ); + HDassert(nbytes == dblock->size); /* Copy un-filtered data into block's buffer */ HDmemcpy(dblock->blk, read_buf, dblock->size); /* Release the read buffer */ H5MM_xfree(read_buf); - - } else /* no filtering case */ { - - /* just copy the disk image into dblock->blk */ - + } /* end if */ + else { /* Sanity check */ - HDassert( len == dblock->size ); + HDassert(len == dblock->size); + /* just copy the disk image into dblock->blk */ HDmemcpy(dblock->blk, image, len); - } /* end no filtering case */ - /* Start decoding direct block */ - p = dblock->blk; - /* Magic number */ - if ( HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC) ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, \ - "wrong fractal heap direct block signature") - } - + if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block signature") p += H5HF_SIZEOF_MAGIC; - /* Version */ - - if ( *p++ != H5HF_DBLOCK_VERSION ) { - - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, \ - "wrong fractal heap direct block version") - } - + if(*p++ != H5HF_DBLOCK_VERSION) + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") /* Address of heap that owns this block (just for file integrity checks) */ - - H5F_addr_decode(ud_ptr->f, &p, &heap_addr); - - if ( H5F_addr_ne(heap_addr, hdr->heap_addr) ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, \ - "incorrect heap header address for direct block") - } - + H5F_addr_decode(udata->f, &p, &heap_addr); + if(H5F_addr_ne(heap_addr, hdr->heap_addr)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") /* Address of parent block */ - dblock->parent = par_info->iblock; dblock->par_entry = par_info->entry; - - if ( dblock->parent ) { - + if(dblock->parent) { /* Share parent block */ - if ( H5HF_iblock_incr(dblock->parent) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, \ - "can't increment reference count on shared indirect block") - } + if(H5HF_iblock_incr(dblock->parent) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") } /* end if */ - /* Offset of heap within the heap's address space */ - UINT64DECODE_VAR(p, dblock->block_off, hdr->heap_off_size); - - /* Encode checksum on direct block, if requested */ - - if ( hdr->checksum_dblocks ) { - + /* Decode checksum on direct block, if requested */ + if(hdr->checksum_dblocks) { uint32_t stored_chksum; /* Metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -1239,30 +1103,24 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb /* Reset checksum field, for computing the checksum */ /* (Casting away const OK - QAK) */ - HDmemset((uint8_t *)p - H5HF_SIZEOF_CHKSUM, 0, - (size_t)H5HF_SIZEOF_CHKSUM); + HDmemset((uint8_t *)p - H5HF_SIZEOF_CHKSUM, 0, (size_t)H5HF_SIZEOF_CHKSUM); /* Compute checksum on entire direct block */ computed_chksum = H5_checksum_metadata(dblock->blk, dblock->size, 0); /* Verify checksum */ - if ( stored_chksum != computed_chksum ) { - - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, \ - "incorrect metadata checksum for fractal heap direct block") - } + if(stored_chksum != computed_chksum) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap direct block") } /* end if */ /* Sanity check */ - HDassert( (size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) ); + HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); /* Set return value */ ret_value = dblock; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5HF_cache_dblock_deserialize() */ @@ -1278,56 +1136,39 @@ done: * koziol@ncsa.uiuc.edu * Feb 27 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * JRM -- 8/11/08 - * Converted from H5HF_cache_dblock_flush(). - * *------------------------------------------------------------------------- */ - -static herr_t -H5HF_cache_dblock_serialize(const H5F_t * f, - hid_t dxpl_id, - haddr_t addr, - size_t len, - void * image, - void * _thing, - unsigned * flags, - haddr_t * new_addr, - size_t * new_len, - void ** new_image) +static herr_t +H5HF_cache_dblock_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image, void * _thing, unsigned *flags, haddr_t *new_addr, + size_t *new_len, void **new_image) { - herr_t ret_value = SUCCEED; /* Return value */ - H5HF_direct_t * dblock; - H5HF_hdr_t * hdr; /* Shared fractal heap information */ + H5HF_hdr_t *hdr; /* Shared fractal heap information */ + H5HF_direct_t *dblock; void * write_buf; /* Pointer to buffer to write out */ size_t write_size; /* Size of buffer to write out */ uint8_t * p; /* Pointer into raw data buffer */ #ifndef NDEBUG hbool_t entry_filtered = FALSE; #endif + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_serialize) /* check arguments */ - HDassert( f != NULL ); - HDassert( H5F_addr_defined(addr) ); - HDassert( len > 0 ); - HDassert( image != NULL ); - HDassert( _thing != NULL ); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(len > 0); + HDassert(image); + HDassert(_thing); dblock = (H5HF_direct_t *)_thing; - HDassert( dblock->cache_info.is_dirty ); - HDassert( flags != NULL ); - HDassert( new_addr != NULL ); - HDassert( new_len != NULL ); - HDassert( new_image != NULL ); + HDassert(dblock->cache_info.is_dirty); + HDassert(flags); + HDassert(new_addr); + HDassert(new_len); + HDassert(new_image); /* set *flags to 0 -- will overwrite if needed */ *flags = 0; @@ -1355,8 +1196,7 @@ H5HF_cache_dblock_serialize(const H5F_t * f, UINT64ENCODE_VAR(p, dblock->block_off, hdr->heap_off_size); /* Metadata checksum */ - if ( hdr->checksum_dblocks ) { - + if(hdr->checksum_dblocks) { uint32_t metadata_chksum; /* Computed metadata checksum value */ /* Clear the checksum field, to compute the checksum */ @@ -1370,103 +1210,68 @@ H5HF_cache_dblock_serialize(const H5F_t * f, } /* end if */ /* Sanity check */ - HDassert( (size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) ); + HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); /* Check for I/O filters on this heap */ if(hdr->filter_len > 0) { -#ifndef NDEBUG - entry_filtered = TRUE; -#endif /* NDEBUG */ - H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */ size_t nbytes; /* Number of bytes used */ unsigned filter_mask; /* Filter mask for block */ +#ifndef NDEBUG + entry_filtered = TRUE; +#endif /* NDEBUG */ + /* Allocate buffer to perform I/O filtering on */ write_size = dblock->size; - if ( NULL == (write_buf = H5MM_malloc(write_size)) ) { - - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, \ - "memory allocation failed for pipeline buffer") - } + if(NULL == (write_buf = H5MM_malloc(write_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") HDmemcpy(write_buf, dblock->blk, write_size); /* Push direct block data through I/O filter pipeline */ nbytes = write_size; - - if ( H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &write_size, &write_buf) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, \ - "output pipeline failed") - } -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu, dblock->blk = %p\n", FUNC, dblock->size, dblock->blk); -HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dblock->parent, dblock->par_entry); -#endif /* QAK */ + if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed") /* Use the compressed number of bytes as the size to write */ write_size = nbytes; /* Check for root direct block */ - if( dblock->parent == NULL ) { - - hbool_t hdr_changed = FALSE; /* Whether the header information - * changed - */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); -#endif /* QAK */ + if(dblock->parent == NULL) { + hbool_t hdr_changed = FALSE; /* Whether the header information changed */ /* Sanity check */ - HDassert( H5F_addr_eq(hdr->man_dtable.table_addr, addr) ); - HDassert( hdr->pline_root_direct_size > 0 ); + HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); + HDassert(hdr->pline_root_direct_size > 0); /* Check if the filter mask changed */ - if ( hdr->pline_root_direct_filter_mask != filter_mask ) { - + if(hdr->pline_root_direct_filter_mask != filter_mask) { hdr->pline_root_direct_filter_mask = filter_mask; hdr_changed = TRUE; } /* end if */ /* Check if we need to re-size the block on disk */ - if ( hdr->pline_root_direct_size != write_size ) { -#ifdef QAK -HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); -#endif /* QAK */ + if(hdr->pline_root_direct_size != write_size) { /* Release direct block's current disk space */ - if( H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, - (hsize_t)hdr->pline_root_direct_size) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, \ - "unable to free fractal heap direct block"); - } + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)hdr->pline_root_direct_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") /* Allocate space for the compressed direct block */ - if ( HADDR_UNDEF == - (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, - (hsize_t)write_size)) ) { - - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, \ - "file allocation failed for fractal heap direct block") - } + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") *flags |= H5C2__SERIALIZE_RESIZED_FLAG; *new_len = write_size; /* Let the metadata cache know, if the block moved */ - if ( ! H5F_addr_eq(hdr->man_dtable.table_addr, addr) ) { - + if(!H5F_addr_eq(hdr->man_dtable.table_addr, addr)) { *flags |= H5C2__SERIALIZE_RENAMED_FLAG; *new_addr = addr; - } + } /* end if */ - /* Update information about compressed direct block's - * location & size + /* Update information about compressed direct block's + * location & size */ hdr->man_dtable.table_addr = addr; hdr->pline_root_direct_size = write_size; @@ -1476,20 +1281,12 @@ HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); } /* end if */ /* Check if heap header was modified */ - if ( hdr_changed ) { - - if ( H5HF_hdr_dirty(hdr) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, \ - "can't mark heap header as dirty") - } - } + if(hdr_changed) + if(H5HF_hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { - - hbool_t par_changed = FALSE; /* Whether the parent's - * information changed - */ + hbool_t par_changed = FALSE; /* Whether the parent's information changed */ H5HF_indirect_t *par_iblock; /* Parent indirect block */ unsigned par_entry; /* Entry in parent indirect block */ @@ -1497,55 +1294,37 @@ HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); par_iblock = dblock->parent; par_entry = dblock->par_entry; -#ifdef QAK -HDfprintf(stderr, "%s: par_iblock->filt_ents[%u].size = %Zu, par_iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_entry, par_iblock->filt_ents[par_entry].size, par_entry, par_iblock->filt_ents[par_entry].filter_mask); -HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_entry, par_iblock->ents[par_entry].addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); HDassert(par_iblock->filt_ents[par_entry].size > 0); /* Check if the filter mask changed */ - if ( par_iblock->filt_ents[par_entry].filter_mask != filter_mask ) { - + if(par_iblock->filt_ents[par_entry].filter_mask != filter_mask) { par_iblock->filt_ents[par_entry].filter_mask = filter_mask; par_changed = TRUE; } /* end if */ /* Check if we need to re-size the block on disk */ - if ( par_iblock->filt_ents[par_entry].size != write_size ) { -#ifdef QAK -HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); -#endif /* QAK */ + if(par_iblock->filt_ents[par_entry].size != write_size) { /* Release direct block's current disk space */ - if ( H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, - (hsize_t)par_iblock->filt_ents[par_entry].size) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, \ - "unable to free fractal heap direct block") - } + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") /* Allocate space for the compressed direct block */ - if ( HADDR_UNDEF == - (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, - dxpl_id, (hsize_t)write_size)) ) { - - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, \ - "file allocation failed for fractal heap direct block") - } + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") *flags |= H5C2__SERIALIZE_RESIZED_FLAG; *new_len = write_size; /* Let the metadata cache know, if the block moved */ - if( ! H5F_addr_eq(par_iblock->ents[par_entry].addr, addr) ) { - + if(!H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)) { *flags |= H5C2__SERIALIZE_RENAMED_FLAG; *new_addr = addr; - } + } /* end if */ - /* Update information about compressed direct - * block's location & size + /* Update information about compressed direct + * block's location & size */ par_iblock->ents[par_entry].addr = addr; par_iblock->filt_ents[par_entry].size = write_size; @@ -1555,14 +1334,9 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); } /* end if */ /* Check if parent was modified */ - if ( par_changed ) { - - if ( H5HF_iblock_dirty(par_iblock) < 0 ) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, \ - "can't mark heap header as dirty") - } - } + if(par_changed) + if(H5HF_iblock_dirty(par_iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end else */ } /* end if */ else { @@ -1570,42 +1344,34 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); write_size = dblock->size; } /* end else */ - if ( write_size == len ) { - - HDassert( *flags == 0 ); - HDassert( write_buf != NULL ); - HDassert( ( entry_filtered ) || ( write_buf == dblock->blk ) ); + if(write_size == len) { + HDassert(*flags == 0); + HDassert(write_buf != NULL); + HDassert(entry_filtered || (write_buf == dblock->blk)); HDmemcpy(image, write_buf, write_size); - if ( write_buf != dblock->blk ) { - + if(write_buf != dblock->blk) H5MM_xfree(write_buf); - } - - } else { - + } /* end if */ + else { /* on disk image has been resized, and possibly renamed -- *flags, * *new_len, and *new_addr should all be setup by now. - * Thus all we need to do here is the old image, and allocate + * Thus all we need to do here is the old image, and allocate * space for the new image. */ - - HDassert( *flags != 0 ); - HDassert( write_buf != NULL ); - HDassert( *new_len = write_size ); - HDassert( write_buf != dblock->blk ); + HDassert(*flags != 0); + HDassert(write_buf != NULL); + HDassert(*new_len = write_size); + HDassert(write_buf != dblock->blk); H5MM_xfree(image); *new_image = write_buf; - - } + } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5HF_cache_dblock_serialize() */ @@ -1620,12 +1386,9 @@ done: * koziol@ncsa.uiuc.edu * Feb 27 2006 * - * Changes: John Mainzer -- 8/11/08 - * Converted from H5HF_cache_dblock_dest(). - * *------------------------------------------------------------------------- */ -herr_t +herr_t H5HF_cache_dblock_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_dblock_free_icr) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 33267ab..0c45e4f 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -188,8 +188,8 @@ herr_t H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ - herr_t ret_value = SUCCEED; /* Return value */ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_hdr_debug, FAIL) @@ -202,6 +202,7 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); + /* Set up user data for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; @@ -398,11 +399,11 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ H5HF_direct_t *dblock = NULL; /* Fractal heap direct block info */ + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ size_t blk_prefix_size; /* Size of prefix for block */ size_t amount_free; /* Amount of free space in block */ uint8_t *marker = NULL; /* Track free space for block */ herr_t ret_value = SUCCEED; /* Return value */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ FUNC_ENTER_NOAPI(H5HF_dblock_debug, FAIL) @@ -417,6 +418,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, HDassert(H5F_addr_defined(hdr_addr)); HDassert(block_size > 0); + /* Set up user data for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; @@ -505,7 +507,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, H5_buffer_dump(stream, indent, dblock->blk, marker, (size_t)0, dblock->size); done: - if(dblock && H5AC2_unprotect(f, dxpl_id, H5AC2_FHEAP_DBLOCK, addr, (size_t)0, dblock, H5AC__NO_FLAGS_SET) < 0) + if(dblock && H5AC2_unprotect(f, dxpl_id, H5AC2_FHEAP_DBLOCK, addr, (size_t)0, dblock, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block") if(hdr && H5AC2_unprotect(f, dxpl_id, H5AC2_FHEAP_HDR, hdr_addr, (size_t)0, hdr, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") @@ -534,11 +536,11 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ + H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ hbool_t did_protect; /* Whether we protected the indirect block or not */ char temp_str[64]; /* Temporary string, for formatting */ size_t u, v; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ FUNC_ENTER_NOAPI(H5HF_iblock_debug, FAIL) @@ -553,6 +555,7 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, HDassert(H5F_addr_defined(hdr_addr)); HDassert(nrows > 0); + /* Set up user data for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; @@ -727,8 +730,8 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ - herr_t ret_value = SUCCEED; /* Return value */ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_sects_debug, FAIL) @@ -741,6 +744,7 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, HDassert(indent >= 0); HDassert(fwidth >= 0); + /* Set up user data for protect call */ cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 7515013..f57c408 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -119,7 +119,6 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo /* Share common heap information */ dblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") @@ -132,13 +131,11 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo dblock->block_off += hdr->man_dtable.row_block_off[par_row]; dblock->block_off += hdr->man_dtable.row_block_size[par_row] * (par_entry % hdr->man_dtable.cparam.width); H5_ASSIGN_OVERFLOW(/* To: */ dblock->size, /* From: */ hdr->man_dtable.row_block_size[par_row], /* From: */ hsize_t, /* To: */ size_t); - } /* end if */ else { /* Must be the root direct block */ dblock->block_off = 0; dblock->size = hdr->man_dtable.cparam.start_block_size; - } /* end else */ dblock->blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dblock->size); free_space = dblock->size - H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); @@ -154,9 +151,6 @@ HDmemset(dblock->blk, 0, dblock->size); /* Allocate space for the direct block on disk */ if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); -#endif /* QAK */ /* Attach to parent indirect block, if there is one */ dblock->parent = par_iblock; @@ -226,11 +220,6 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_destroy) -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ /* * Check arguments. @@ -261,9 +250,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: root direct block\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr->man_dtable.table_addr == dblock_addr); HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size); @@ -279,25 +265,11 @@ HDfprintf(stderr, "%s: root direct block\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: root indirect block\n", FUNC); -#endif /* QAK */ - /* Adjust heap statistics */ hdr->man_alloc_size -= dblock->size; -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -HDfprintf(stderr, "%s: dblock->parent->nchildren = %u\n", FUNC, dblock->parent->nchildren); -HDfprintf(stderr, "%s: dblock->par_entry = %u\n", FUNC, dblock->par_entry); -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Check for this direct block being the highest in the heap */ if((dblock->block_off + dblock->size) == hdr->man_iter_off) { -#ifdef QAK -HDfprintf(stderr, "%s: Reversing iterator\n", FUNC); -#endif /* QAK */ /* Move 'next block' iterator backwards (may shrink heap) */ if(H5HF_hdr_reverse_iter(hdr, dxpl_id, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reverse 'next block' iterator") @@ -324,10 +296,6 @@ HDfprintf(stderr, "%s: Reversing iterator\n", FUNC); dblock->par_entry = 0; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: Before releasing direct block's space, dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ - /* Release direct block's disk space */ if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, dblock_addr, dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") @@ -365,9 +333,6 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_new) -#ifdef QAK -HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); -#endif /* QAK */ /* * Check arguments. @@ -384,15 +349,8 @@ HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1 - min_dblock_size = %Zu\n", FUNC, min_dblock_size); -HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD= %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); -#endif /* QAK */ if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) min_dblock_size *= 2; -#ifdef QAK -HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ /* Check if this is the first block in the heap */ if(!H5F_addr_defined(hdr->man_dtable.table_addr) && @@ -401,10 +359,6 @@ HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, &dblock_addr, ret_sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ - /* Point root at new direct block */ hdr->man_dtable.curr_root_rows = 0; hdr->man_dtable.table_addr = dblock_addr; @@ -424,16 +378,10 @@ HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr unsigned next_entry; /* Iterator's next block entry */ size_t next_size; /* Size of next direct block to create */ -#ifdef QAK -HDfprintf(stderr, "%s: before updating iterator, hdr->man_iter_off = %Hu, hdr->man_size = %Hu\n", FUNC, hdr->man_iter_off, hdr->man_size); -#endif /* QAK */ /* Update iterator to reflect any previous increments as well as allow for requested direct block size */ if(H5HF_hdr_update_iter(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator") -#ifdef QAK -HDfprintf(stderr, "%s: after updating iterator, hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Retrieve information about current iterator position */ if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") @@ -450,18 +398,9 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not su if(H5HF_hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator") -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ - /* Create new direct block at current location*/ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, next_entry, &dblock_addr, ret_sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ } /* end else */ done: @@ -484,14 +423,12 @@ done: *------------------------------------------------------------------------- */ H5HF_direct_t * -H5HF_man_dblock_protect(H5HF_hdr_t *hdr, - hid_t dxpl_id, - haddr_t dblock_addr, - size_t dblock_size, - H5HF_indirect_t *par_iblock, - unsigned par_entry, - H5AC2_protect_t rw) +H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, + size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry, + H5AC2_protect_t rw) { + H5HF_direct_t *dblock; /* Direct block from cache */ + H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */ size_t odi_size; /* On disk image size of the direct block. * Note that there is no necessary relation * between this value, and the actual @@ -499,16 +436,9 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, * reduce the size of the on disk image, * and check sums may increase it. */ - H5HF_dblock_cache_ud_t ud; /* parent and other infor for - * deserializing direct block - */ - H5HF_direct_t *dblock; /* Direct block from cache */ H5HF_direct_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect) -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -518,62 +448,45 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr HDassert(dblock_size > 0); /* Set up parent info */ - ud.par_info.hdr = hdr; - ud.par_info.iblock = par_iblock; - ud.par_info.entry = par_entry; + udata.par_info.hdr = hdr; + udata.par_info.iblock = par_iblock; + udata.par_info.entry = par_entry; /* set up the file pointer in the user data */ - ud.f = hdr->f; + udata.f = hdr->f; /* set up the direct block size */ - ud.dblock_size = dblock_size; + udata.dblock_size = dblock_size; /* compute the on disk image size -- observe that odi_size and * dblock_size will be identical if there is no filtering. */ - if ( hdr->filter_len > 0 ) { - - if ( par_iblock == NULL ) { - + if(hdr->filter_len > 0) { + if(par_iblock == NULL) { odi_size = hdr->pline_root_direct_size; - ud.filter_mask = hdr->pline_root_direct_filter_mask; - - } else { - + udata.filter_mask = hdr->pline_root_direct_filter_mask; + } /* end if */ + else { /* Sanity check */ - HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, - dblock_addr)); + HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); /* Set up parameters to read filtered direct block */ odi_size = par_iblock->filt_ents[par_entry].size; - ud.filter_mask = par_iblock->filt_ents[par_entry].filter_mask; - - } - } else { - + udata.filter_mask = par_iblock->filt_ents[par_entry].filter_mask; + } /* end else */ + } /* end if */ + else odi_size = dblock_size; - } - /* Protect the direct block */ - if(NULL == (dblock = H5AC2_protect(hdr->f, - dxpl_id, - H5AC2_FHEAP_DBLOCK, - dblock_addr, - odi_size, - (void *)&ud, - rw))) { - - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, \ - "unable to protect fractal heap direct block") - } + if(NULL == (dblock = H5AC2_protect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, odi_size, (void *)&udata, rw))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block") /* Set the return value */ ret_value = dblock; done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5HF_man_dblock_protect() */ @@ -603,9 +516,6 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_locate) -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off); -#endif /* QAK */ /* * Check arguments. @@ -618,15 +528,9 @@ HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off); /* Look up row & column for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -#endif /* QAK */ /* Set initial indirect block info */ iblock_addr = hdr->man_dtable.table_addr; -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); -#endif /* QAK */ /* Lock root indirect block */ if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, rw, &did_protect))) @@ -645,9 +549,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); /* Compute indirect block's entry */ entry = (row * hdr->man_dtable.cparam.width) + col; -#ifdef QAK -HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); -#endif /* QAK */ /* Locate child indirect block */ iblock_addr = iblock->ents[entry].addr; @@ -672,18 +573,11 @@ HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); /* Switch variables to use new indirect block */ iblock = new_iblock; did_protect = new_did_protect; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ /* Look up row & column in new indirect block for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") HDassert(row < iblock->nrows); /* child must be smaller than parent */ -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -#endif /* QAK */ } /* end while */ /* Set return parameters */ @@ -715,7 +609,6 @@ done: * *------------------------------------------------------------------------- */ - herr_t H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, hsize_t dblock_size) @@ -724,9 +617,6 @@ H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_delete) -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -735,10 +625,8 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr HDassert(H5F_addr_defined(dblock_addr)); /* Check the direct block's status in the metadata cache */ - if(H5AC2_get_entry_status(f, dblock_addr, &dblock_status) < 0) { - + if(H5AC2_get_entry_status(f, dblock_addr, &dblock_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block") - } /* If the direct block is in the cache, expunge it now */ if(dblock_status & H5AC2_ES__IN_CACHE) { @@ -746,15 +634,9 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr HDassert(!(dblock_status & H5AC2_ES__IS_PINNED)); HDassert(!(dblock_status & H5AC2_ES__IS_PROTECTED)); -#ifdef QAK -HDfprintf(stderr, "%s: Expunging direct block from cache\n", FUNC); -#endif /* QAK */ /* Evict the direct block from the metadata cache */ if(H5AC2_expunge_entry(f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache") -#ifdef QAK -HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC); -#endif /* QAK */ } /* end if */ /* Release direct block's disk space */ @@ -791,10 +673,6 @@ H5HF_man_dblock_dest(H5HF_direct_t *dblock) */ HDassert(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock); -#endif /* QAK */ - /* Decrement reference count on shared fractal heap info */ HDassert(dblock->hdr != NULL); if(H5HF_hdr_decr(dblock->hdr) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index ecdbca1..46e37cb 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -268,12 +268,6 @@ H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) else if(H5HF_hdr_compute_free_space(hdr, u) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize direct block free space for indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: row_block_size[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_size[u]); -HDfprintf(stderr, "%s: row_block_off[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_off[u]); -HDfprintf(stderr, "%s: row_tot_dblock_free[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_tot_dblock_free[u]); -HDfprintf(stderr, "%s: row_max_dblock_free[%Zu] = %Zu\n", FUNC, u, hdr->man_dtable.row_max_dblock_free[u]); -#endif /* QAK */ } /* end for */ /* Initialize the block iterator for searching for free space */ @@ -433,9 +427,6 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) /* Compute the I/O filters' encoded size */ if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size") -#ifdef QAK -HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len); -#endif /* QAK */ /* Compute size of header on disk */ hdr->heap_size = H5HF_HEADER_SIZE(hdr) /* Base header size */ @@ -481,9 +472,6 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len); hdr->id_len = cparam->id_len; break; } /* end switch */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->id_len = %Zu\n", FUNC, hdr->id_len); -#endif /* QAK */ /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ @@ -582,10 +570,8 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr) /* Mark header as evictable again when no child blocks depend on it */ if(hdr->rc == 0) { HDassert(hdr->file_rc == 0); - if(H5AC2_unpin_entry(hdr) < 0) { - + if(H5AC2_unpin_entry(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") - } } /* end if */ done: @@ -669,18 +655,15 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_dirty) -#ifdef QAK -HDfprintf(stderr, "%s: Marking heap header as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr); /* Resize pinned header in cache if I/O filter is present. */ - if (hdr->filter_len > 0) { + if(hdr->filter_len > 0) { if(H5AC2_resize_pinned_entry(hdr, (size_t)hdr->heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header") - } + } /* end if */ /* Mark header as dirty in cache */ if(H5AC2_mark_pinned_or_protected_entry_dirty(hdr) < 0) @@ -713,9 +696,6 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_adj_free) -#ifdef QAK -HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt); -#endif /* QAK */ /* * Check arguments. @@ -725,9 +705,6 @@ HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt); /* Update heap header */ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); hdr->total_man_free += amt; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -#endif /* QAK */ /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -762,12 +739,6 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) * Check arguments. */ HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s; new_size = %Hu, extra_free = %Hd\n", FUNC, new_size, extra_free); -HDfprintf(stderr, "%s; hdr->total_size = %Hu\n", FUNC, hdr->total_size); -HDfprintf(stderr, "%s; hdr->man_size = %Hu\n", FUNC, hdr->man_size); -HDfprintf(stderr, "%s; hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -#endif /* QAK */ /* Set the total managed space in heap */ hdr->man_size = new_size; @@ -810,9 +781,6 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) /* Update the "allocated" size within the heap */ hdr->man_alloc_size += alloc_size; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_alloc_size = %Hu\n", "H5HF_hdr_inc_alloc", hdr->man_alloc_size); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_hdr_inc_alloc() */ @@ -886,9 +854,6 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Set the offset of the iterator in the heap */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, curr_off = %Hu\n", FUNC, hdr->man_iter_off, curr_off); -#endif /* QAK */ hdr->man_iter_off = curr_off; done: @@ -918,9 +883,6 @@ H5HF_hdr_skip_blocks(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *iblock, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_skip_blocks) -#ifdef QAK -HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries); -#endif /* QAK */ /* * Check arguments. @@ -933,17 +895,11 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne row = start_entry / hdr->man_dtable.cparam.width; col = start_entry % hdr->man_dtable.cparam.width; sect_size = H5HF_dtable_span_size(&hdr->man_dtable, row, col, nentries); -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - hdr->man_iter_off = %Hu, sect_size = %Hu\n", FUNC, hdr->man_iter_off, sect_size); -#endif /* QAK */ HDassert(sect_size > 0); /* Advance the new block iterator */ if(H5HF_hdr_inc_iter(hdr, sect_size, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0 - hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Add 'indirect' section for blocks skipped in this row */ if(H5HF_sect_indirect_add(hdr, dxpl_id, iblock, start_entry, nentries) < 0) @@ -976,9 +932,6 @@ H5HF_hdr_update_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_size) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_update_iter) -#ifdef QAK -HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -988,9 +941,6 @@ HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); /* Check for creating first indirect block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Creating root direct block\n", FUNC); -#endif /* QAK */ if(H5HF_man_iblock_root_create(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to create root indirect block") } /* end if */ @@ -1001,21 +951,11 @@ HDfprintf(stderr, "%s: Creating root direct block\n", FUNC); unsigned next_entry; /* Iterator's next block entry */ unsigned min_dblock_row; /* Minimum row for direct block size request */ -#ifdef QAK -HDfprintf(stderr, "%s: searching root indirect block\n", FUNC); -#endif /* QAK */ /* Compute min. row for direct block requested */ min_dblock_row = H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); -#ifdef QAK -HDfprintf(stderr, "%s: min_dblock_size = %Zu, min_dblock_row = %u\n", FUNC, min_dblock_size, min_dblock_row); -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Initialize block iterator, if necessary */ if(!H5HF_man_iter_ready(&hdr->next_block)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Start iterator with previous offset of iterator */ if(H5HF_man_iter_start_offset(hdr, dxpl_id, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") @@ -1025,14 +965,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ /* Check for skipping over blocks in the current block */ if(min_dblock_row > next_row && next_row < iblock->nrows) { unsigned min_entry; /* Min entry for direct block requested */ @@ -1044,9 +976,6 @@ HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); skip_entries = (iblock->nrows * hdr->man_dtable.cparam.width) - next_entry; else skip_entries = min_entry - next_entry; -#ifdef QAK -HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, skip_entries); -#endif /* QAK */ /* Add skipped direct blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, skip_entries) < 0) @@ -1061,33 +990,15 @@ HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, sk /* Reset conditions for leaving loop */ walked_up = walked_down = FALSE; -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ - /* Check for walking off end of indirect block */ /* (walk up iterator) */ while(next_row >= iblock->nrows) { -#ifdef QAK -HDfprintf(stderr, "%s: Off the end of a block, next_row = %u, iblock->nrows = %u\n", FUNC, next_row, iblock->nrows); -#endif /* QAK */ /* Check for needing to expand root indirect block */ if(iblock->parent == NULL) { -#ifdef QAK -HDfprintf(stderr, "%s: Doubling root block\n", FUNC); -#endif /* QAK */ if(H5HF_man_iblock_root_double(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to double root indirect block") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Walking up a level\n", FUNC); -#endif /* QAK */ /* Move iterator up one level */ if(H5HF_man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") @@ -1104,36 +1015,16 @@ HDfprintf(stderr, "%s: Walking up a level\n", FUNC); /* Indicate that we walked up */ walked_up = TRUE; } /* end while */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ /* Check for walking into child indirect block */ /* (walk down iterator) */ if(next_row >= hdr->man_dtable.max_direct_rows) { unsigned child_nrows; /* Number of rows in new indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: Walking down into child indirect block\n", FUNC); -#endif /* QAK */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.1\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ HDassert(!H5F_addr_defined(iblock->ents[next_entry].addr)); /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]); -#ifdef QAK -HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); -#endif /* QAK */ /* Check for skipping over indirect blocks */ /* (that don't have direct blocks large enough to hold direct block size requested) */ @@ -1141,19 +1032,12 @@ HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); unsigned child_rows_needed; /* Number of rows needed to hold direct block */ unsigned child_entry; /* Entry of child indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: Skipping indirect block row that is too small\n", FUNC); -#endif /* QAK */ /* Compute # of rows needed in child indirect block */ child_rows_needed = (H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; HDassert(child_rows_needed > child_nrows); child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width; if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width)) child_entry = iblock->nrows * hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: child_rows_needed = %u\n", FUNC, child_rows_needed); -HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); -#endif /* QAK */ /* Add skipped indirect blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, (child_entry - next_entry)) < 0) @@ -1164,9 +1048,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); hbool_t did_protect; /* Whether we protected the indirect block or not */ haddr_t new_iblock_addr; /* New indirect block's address */ -#ifdef QAK -HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC); -#endif /* QAK */ /* Allocate new indirect block */ if(H5HF_man_iblock_create(hdr, dxpl_id, iblock, next_entry, child_nrows, child_nrows, &new_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") @@ -1185,9 +1066,6 @@ HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC); /* Compute entry for direct block size requested */ new_entry = hdr->man_dtable.cparam.width * min_dblock_row; -#ifdef QAK -HDfprintf(stderr, "%s: Skipping rows in new child indirect block - new_entry = %u\n", FUNC, new_entry); -#endif /* QAK */ /* Add skipped blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, new_iblock, 0, new_entry) < 0) @@ -1239,9 +1117,6 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) */ HDassert(hdr); HDassert(nentries); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, adv_size = %Hu\n", FUNC, hdr->man_iter_off, adv_size); -#endif /* QAK */ /* Advance the iterator for the current location within the indirect block */ if(hdr->next_block.curr) @@ -1297,11 +1172,6 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) /* Get information about current iterator location */ if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Move current iterator position backwards once */ curr_entry--; @@ -1317,23 +1187,14 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); /* Walk backwards through entries, until we find one that has a child */ /* (Skip direct block that will be deleted, if we find it) */ tmp_entry = curr_entry; -#ifdef QAK -HDfprintf(stderr, "%s: tmp_entry = %d\n", FUNC, tmp_entry); -#endif /* QAK */ while(tmp_entry >= 0 && (H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || !H5F_addr_defined(iblock->ents[tmp_entry].addr))) tmp_entry--; -#ifdef QAK -HDfprintf(stderr, "%s: check 2.0 - tmp_entry = %d\n", FUNC, tmp_entry); -#endif /* QAK */ /* Check for no earlier blocks in this indirect block */ if(tmp_entry < 0) { /* Check for parent of current indirect block */ if(iblock->parent) { -#ifdef QAK -HDfprintf(stderr, "%s: Walking up a block\n", FUNC); -#endif /* QAK */ /* Move iterator to parent of current block */ if(H5HF_man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to move current block iterator location up") @@ -1341,11 +1202,6 @@ HDfprintf(stderr, "%s: Walking up a block\n", FUNC); /* Get information about current iterator location */ if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Move current iterator position backwards once */ curr_entry--; @@ -1354,9 +1210,6 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); walked_up = TRUE; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Heap empty\n", FUNC); -#endif /* QAK */ /* Reset iterator offset */ hdr->man_iter_off = 0; @@ -1372,14 +1225,7 @@ HDfprintf(stderr, "%s: Heap empty\n", FUNC); /* Check if entry is for a direct block */ row = curr_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -HDfprintf(stderr, "%s: row = %u\n", FUNC, row); -#endif /* QAK */ if(row < hdr->man_dtable.max_direct_rows) { -#ifdef QAK -HDfprintf(stderr, "%s: Found direct block\n", FUNC); -#endif /* QAK */ /* Increment entry to empty location */ curr_entry++; @@ -1391,19 +1237,12 @@ HDfprintf(stderr, "%s: Found direct block\n", FUNC); hdr->man_iter_off = iblock->block_off; hdr->man_iter_off += hdr->man_dtable.row_block_off[curr_entry / hdr->man_dtable.cparam.width]; hdr->man_iter_off += hdr->man_dtable.row_block_size[curr_entry / hdr->man_dtable.cparam.width] * (curr_entry % hdr->man_dtable.cparam.width); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ } /* end if */ else { H5HF_indirect_t *child_iblock; /* Pointer to child indirect block */ hbool_t did_protect; /* Whether we protected the indirect block or not */ unsigned child_nrows; /* # of rows in child block */ -#ifdef QAK -HDfprintf(stderr, "%s: Walking down into child block\n", FUNC); -#endif /* QAK */ /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]); @@ -1422,11 +1261,6 @@ HDfprintf(stderr, "%s: Walking down into child block\n", FUNC); /* Update iterator location */ iblock = child_iblock; curr_entry = (child_iblock->nrows * hdr->man_dtable.cparam.width) - 1; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Unprotect child indirect block */ if(H5HF_man_iblock_unprotect(child_iblock, dxpl_id, H5AC2__NO_FLAGS_SET, did_protect) < 0) @@ -1462,18 +1296,12 @@ H5HF_hdr_empty(H5HF_hdr_t *hdr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_empty) -#ifdef QAK -HDfprintf(stderr, "%s: Resetting heap header to empty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr); /* Reset block iterator, if necessary */ if(H5HF_man_iter_ready(&hdr->next_block)) { -#ifdef QAK -HDfprintf(stderr, "%s: 'next block' iterator is ready\n", FUNC); -#endif /* QAK */ if(H5HF_man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") } /* end if */ @@ -1510,7 +1338,6 @@ done: * *------------------------------------------------------------------------- */ - herr_t H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) { @@ -1543,9 +1370,6 @@ H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) * will get unpinned) */ if(H5F_addr_defined(hdr->fs_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr); -#endif /* QAK */ /* Delete free space manager for heap */ if(H5HF_space_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager") @@ -1553,18 +1377,12 @@ HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr); /* Check for root direct/indirect block */ if(H5F_addr_defined(hdr->man_dtable.table_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a\n", FUNC, hdr->man_dtable.table_addr); -#endif /* QAK */ if(hdr->man_dtable.curr_root_rows == 0) { hsize_t dblock_size; /* Size of direct block */ /* Check for I/O filters on this heap */ if(hdr->filter_len > 0) { dblock_size = (hsize_t)hdr->pline_root_direct_size; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_root_direct_size); -#endif /* QAK */ /* Reset the header's pipeline information */ hdr->pline_root_direct_size = 0; @@ -1586,9 +1404,6 @@ HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_ro /* Check for 'huge' objects in heap */ if(H5F_addr_defined(hdr->huge_bt2_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->huge_bt2_addr = %a\n", FUNC, hdr->huge_bt2_addr); -#endif /* QAK */ /* Delete huge objects in heap and their tracker */ if(H5HF_huge_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap 'huge' objects and tracker") diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index a43dd42..391ff3c 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -197,6 +197,7 @@ H5HF_iblock_unpin(H5HF_indirect_t *iblock) iblock->hdr->root_iblock = NULL; } /* end if */ } /* end if */ + /* Mark block as evictable again */ if(H5AC2_unpin_entry(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") @@ -237,10 +238,6 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock) /* Increment reference count on shared indirect block */ iblock->rc++; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -272,23 +269,13 @@ H5HF_iblock_decr(H5HF_indirect_t *iblock) /* Decrement reference count on shared indirect block */ iblock->rc--; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ /* Mark block as evictable again when no child blocks depend on it */ if(iblock->rc == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: indirect block ref. count at zero, iblock->addr = %a\n", FUNC, iblock->addr); -#endif /* QAK */ if(H5HF_iblock_unpin(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") if(iblock->nchildren == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Removing indirect block from cache, iblock->addr = %a\n", FUNC, iblock->addr); -#endif /* QAK */ /* Check for deleting root indirect block (and no root direct block) */ if(iblock->block_off == 0 && iblock->hdr->man_dtable.curr_root_rows > 0) { /* Reset root pointer information */ @@ -343,9 +330,6 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_iblock_dirty) -#ifdef QAK -HDfprintf(stderr, "%s: Marking indirect block as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(iblock); @@ -386,10 +370,6 @@ H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_create) -#ifdef QAK -HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC); -#endif /* QAK */ - /* Check for allocating entire root indirect block initially */ if(hdr->man_dtable.cparam.start_root_rows == 0) nrows = hdr->man_dtable.max_root_rows; @@ -406,27 +386,19 @@ HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC); if(nrows < rows_needed) nrows = rows_needed; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: nrows = %u\n", FUNC, nrows); -#endif /* QAK */ /* Allocate root indirect block */ if(H5HF_man_iblock_create(hdr, dxpl_id, NULL, 0, nrows, hdr->man_dtable.max_root_rows, &iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); -#endif /* QAK */ /* Move current direct block (used as root) into new indirect block */ + /* Lock new indirect block */ if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, nrows, NULL, 0, FALSE, H5AC2_WRITE, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Check if there's already a direct block as root) */ have_direct_block = H5F_addr_defined(hdr->man_dtable.table_addr); -#ifdef QAK -HDfprintf(stderr, "%s: have_direct_block = %u\n", FUNC, (unsigned)have_direct_block); -#endif /* QAK */ if(have_direct_block) { H5HF_direct_t *dblock; /* Pointer to direct block to query */ @@ -520,6 +492,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si haddr_t new_addr; /* New address of indirect block */ hsize_t acc_dblock_free; /* Accumulated free space in direct blocks */ hsize_t next_size; /* The previous value of the "next size" for the new block iterator */ + hsize_t old_iblock_size; /* Old size of indirect block */ unsigned next_row; /* The next row to allocate block in */ unsigned next_entry; /* The previous value of the "next entry" for the new block iterator */ unsigned new_next_entry = 0;/* The new value of the "next entry" for the new block iterator */ @@ -529,14 +502,9 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si hbool_t skip_direct_rows = FALSE; /* Whether we are skipping direct rows */ size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - hsize_t old_iblock_size; /* Old size of indirect block */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_double) -#ifdef QAK -HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ - /* Get "new block" iterator information */ if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") @@ -544,19 +512,10 @@ HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", /* Make certain the iterator is at the root indirect block */ HDassert(iblock->parent == NULL); -#ifdef QAK -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ HDassert(iblock->block_off == 0); /* Keep this for later */ old_nrows = iblock->nrows; -#ifdef QAK -HDfprintf(stderr, "%s: old_nrows = %u\n", FUNC, old_nrows); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size); -#endif /* QAK */ /* Check for skipping over direct block rows */ if(iblock->nrows < hdr->man_dtable.max_direct_rows && min_dblock_size > next_size) { @@ -575,11 +534,6 @@ HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size); /* Compute new # of rows in indirect block */ new_nrows = MAX(min_nrows, MIN(2 * iblock->nrows, iblock->max_rows)); -#ifdef QAK -HDfprintf(stderr, "%s: min_nrows = %u, new_nrows = %u\n", FUNC, min_nrows, new_nrows); -HDfprintf(stderr, "%s: iblock->nrows = %u, iblock->max_rows = %u\n", FUNC, iblock->nrows, iblock->max_rows); -HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); -#endif /* QAK */ /* Currently, the old block data is "thrown away" after the space is reallocated, * to avoid data copy in H5MF_realloc() call by just free'ing the space and @@ -602,15 +556,12 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); /* Allocate space for the new indirect block on disk */ if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr); -#endif /* QAK */ /* Resize pinned indirect block in the cache, if its changed size */ if(old_iblock_size != iblock->size) { if(H5AC2_resize_pinned_entry(iblock, (size_t)iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block") - } + } /* end if */ /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { @@ -690,11 +641,6 @@ HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, ib hdr->man_dtable.table_addr = new_addr; /* Extend heap to cover new root indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]); -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]); -HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free); -#endif /* QAK */ if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") @@ -722,12 +668,12 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) H5HF_hdr_t *hdr = iblock->hdr; /* Pointer to heap header */ haddr_t new_addr; /* New address of indirect block */ hsize_t acc_dblock_free; /* Accumulated free space in direct blocks */ + hsize_t old_size; /* Old size of indirect block */ unsigned max_child_row; /* Row for max. child entry */ unsigned old_nrows; /* Old # of rows */ unsigned new_nrows; /* New # of rows */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - hsize_t old_size; /* Old size of indirect block */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_halve) @@ -736,19 +682,11 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) HDassert(iblock->parent == NULL); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: Reducing root indirect block\n", FUNC); -#endif /* QAK */ - /* Compute maximum row used by child of indirect block */ max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ new_nrows = 1 << (1 + H5V_log2_gen((uint64_t)max_child_row)); -#ifdef QAK -HDfprintf(stderr, "%s: new_nrows = %u\n", FUNC, new_nrows); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -#endif /* QAK */ /* Currently, the old block data is "thrown away" after the space is reallocated, * to avoid data copy in H5MF_realloc() call by just free'ing the space and @@ -777,15 +715,12 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); /* Allocate space for the new indirect block on disk */ if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); -#endif /* QAK */ /* Resize pinned indirect block in the cache, if it has changed size */ if(old_size != iblock->size) { if(H5AC2_resize_pinned_entry(iblock, (size_t)iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block") - } + } /* end if */ /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { @@ -831,11 +766,6 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); hdr->man_dtable.table_addr = new_addr; /* Shrink heap to only cover new root indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]); -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]); -HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free); -#endif /* QAK */ if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block") @@ -876,10 +806,6 @@ H5HF_man_iblock_root_revert(H5HF_indirect_t *root_iblock, hid_t dxpl_id) */ HDassert(root_iblock); -#ifdef QAK -HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC); -#endif /* QAK */ - /* Set up local convenience variables */ hdr = root_iblock->hdr; dblock_addr = root_iblock->ents[0].addr; @@ -917,7 +843,7 @@ HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") done: - if(dblock && H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, H5AC__NO_FLAGS_SET) < 0) + if(dblock && H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -969,13 +895,6 @@ H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t ** if(NULL == (iblock = H5HF_sect_row_get_iblock(old_sec_node))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc); -#endif /* QAK */ - /* Hold indirect block in memory, until direct block can point to it */ if(H5HF_iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") @@ -986,9 +905,6 @@ HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc); HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce row section node") /* Create direct block & single section */ -#ifdef QAK -HDfprintf(stderr, "%s: Allocating direct block, dblock_entry = %u\n", FUNC, dblock_entry); -#endif /* QAK */ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, NULL, sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") @@ -1046,9 +962,6 @@ H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *par_iblo if(H5HF_hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") -#ifdef QAK -HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows); -#endif /* QAK */ /* Set info for direct block */ iblock->rc = 0; iblock->nrows = nrows; @@ -1071,9 +984,6 @@ HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows); /* Compute the number of direct rows for this indirect block */ dir_rows = MIN(iblock->nrows, hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); -#endif /* QAK */ /* Allocate & initialize indirect block filtered entry array */ if(NULL == (iblock->filt_ents = H5FL_SEQ_CALLOC(H5HF_indirect_filt_ent_t, (size_t)(dir_rows * hdr->man_dtable.cparam.width)))) @@ -1121,6 +1031,7 @@ HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); /* Update indirect block's statistics */ iblock->nchildren = 0; iblock->max_child = 0; + /* Cache the new indirect block */ if(H5AC2_set(hdr->f, dxpl_id, H5AC2_FHEAP_IBLOCK, *addr_p, (size_t)iblock->size, iblock, H5AC2__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap indirect block to cache") @@ -1156,12 +1067,8 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, H5HF_indirect_t *iblock = NULL; /* Indirect block from cache */ hbool_t should_protect = FALSE; /* Whether we should protect the indirect block or not */ H5HF_indirect_t *ret_value; /* Return value */ - H5HF_iblock_cache_ud_t cache_udata; /* User-data for callback */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_protect) -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows); -#endif /* QAK */ /* * Check arguments. @@ -1208,11 +1115,14 @@ HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr /* Check for protecting indirect block */ if(must_protect || should_protect) { + H5HF_iblock_cache_ud_t cache_udata; /* User-data for callback */ + /* Set up parent info */ par_info.hdr = hdr; par_info.iblock = par_iblock; par_info.entry = par_entry; + /* Set up user data for protect call */ cache_udata.f = hdr->f; cache_udata.par_info = &par_info; cache_udata.nrows = &iblock_nrows; @@ -1221,7 +1131,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr if(NULL == (iblock = H5AC2_protect(hdr->f, dxpl_id, H5AC2_FHEAP_IBLOCK, iblock_addr, H5HF_IBLOCK_SIZE(hdr, iblock_nrows), &cache_udata, rw))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block") *did_protect = TRUE; - } /* end if */ else *did_protect = FALSE; @@ -1292,10 +1201,6 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_attach) -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, entry = %u, child_addr = %a\n", FUNC, iblock, entry, child_addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ /* * Check arguments. @@ -1361,10 +1266,6 @@ H5HF_man_iblock_detach(H5HF_indirect_t *iblock, hid_t dxpl_id, unsigned entry) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_detach) -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, entry = %u\n", FUNC, iblock, entry); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ /* * Check arguments. @@ -1445,10 +1346,6 @@ HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") done: -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_man_iblock_detach() */ @@ -1512,9 +1409,6 @@ H5HF_man_iblock_delete(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_delete) -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows); -#endif /* QAK */ /* * Check arguments. @@ -1690,9 +1584,6 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock) */ HDassert(iblock); HDassert(iblock->rc == 0); -#ifdef QAK -HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC); -#endif /* QAK */ /* Decrement reference count on shared info */ HDassert(iblock->hdr); diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 4ac10b5..d69e314 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -139,9 +139,6 @@ H5HF_man_iter_start_offset(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_start_offset) -#ifdef QAK -HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); -#endif /* QAK */ /* * Check arguments. @@ -184,19 +181,11 @@ HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); /* Compute column */ col = curr_offset / hdr->man_dtable.row_block_size[row]; -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); -HDfprintf(stderr, "%s: curr_offset = %Hu\n", FUNC, curr_offset); -#endif /* QAK */ /* Set the current level's context */ biter->curr->row = row; biter->curr->col = col; biter->curr->entry = (row * hdr->man_dtable.cparam.width) + col; -#ifdef QAK -HDfprintf(stderr, "%s: biter->curr->entry = %u\n", FUNC, biter->curr->entry); -#endif /* QAK */ /* Get the context indirect block's information */ if(root_block) { @@ -456,11 +445,6 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width; biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width; /* HDassert(biter->curr->row <= biter->curr->context->nrows); */ -#ifdef QAK -HDfprintf(stderr, "%s: biter->curr->entry = %u\n", "H5HF_man_iter_next", biter->curr->entry); -HDfprintf(stderr, "%s: biter->curr->row = %u\n", "H5HF_man_iter_next", biter->curr->row); -HDfprintf(stderr, "%s: biter->curr->col = %u\n", "H5HF_man_iter_next", biter->curr->col); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_man_iter_next() */ diff --git a/src/H5HFman.c b/src/H5HFman.c index 1d7fa71..29d3d4a 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -104,9 +104,6 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert) -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ /* * Check arguments. @@ -119,9 +116,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); /* Look for free space */ if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)obj_size, &sec_node)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") -#ifdef QAK -HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found); -#endif /* QAK */ /* If we didn't find a node, go create a direct block big enough to hold the requested block */ if(!node_found) @@ -132,15 +126,6 @@ HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_f /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->sect_info.type = %s\n", FUNC, (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "H5HF_FSPACE_SECT_FIRST_ROW" : "H5HF_FSPACE_SECT_NORMAL_ROW")); -HDfprintf(stderr, "%s: sec_node->u.row.under = %p\n", FUNC, sec_node->u.row.under); -HDfprintf(stderr, "%s: sec_node->u.row.row = %u\n", FUNC, sec_node->u.row.row); -HDfprintf(stderr, "%s: sec_node->u.row.col = %u\n", FUNC, sec_node->u.row.col); -HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.row.num_entries); -#endif /* QAK */ /* Allocate 'single' selection out of 'row' selection */ if(H5HF_man_iblock_alloc_row(hdr, dxpl_id, &sec_node) < 0) @@ -158,14 +143,6 @@ HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.ro /* Retrieve direct block address from section */ if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sec_node, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent); -if(sec_node->u.single.parent) - HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr); -HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry); -#endif /* QAK */ /* Lock direct block */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC2_WRITE))) @@ -175,16 +152,8 @@ HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.s /* Get the offset of the object within the block */ blk_off = sec_node->sect_info.addr - dblock->block_off; -#ifdef QAK -HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ /* Sanity checks */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ HDassert(sec_node->sect_info.size >= obj_size); /* Reduce (& possibly re-add) single section */ @@ -207,13 +176,7 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); } /* end block */ /* Set the heap ID for the new object (heap offset & obj length) */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ H5HF_MAN_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off + blk_off), obj_size); -#endif /* QAK */ /* Update statistics about heap */ hdr->man_nobjs++; @@ -261,6 +224,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_op_real) + /* * Check arguments. */ @@ -282,16 +246,8 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, id++; /* Decode the object offset within the heap & its length */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); -#endif /* QAK */ UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size); -#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); @@ -321,9 +277,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd /* Look up indirect block containing direct block */ if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &entry, &did_protect, H5AC2_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") -#ifdef QAK -HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); -#endif /* QAK */ /* Set direct block info */ dblock_addr = iblock->ents[entry].addr; @@ -352,9 +305,6 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") iblock = NULL; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* Compute offset of object within block */ HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size); @@ -534,16 +484,8 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) id++; /* Decode the object offset within the heap & it's length */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); -#endif /* QAK */ UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size); -#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); @@ -557,24 +499,15 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: direct root block\n", FUNC); -#endif /* QAK */ /* Set direct block info */ dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_block_off = 0; dblock_entry = 0; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: indirect root block\n", FUNC); -#endif /* QAK */ /* Look up indirect block containing direct block */ if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &dblock_entry, &did_protect, H5AC2_WRITE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") -#ifdef QAK -HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].addr); -#endif /* QAK */ /* Check for offset of invalid direct block */ if(!H5F_addr_defined(iblock->ents[dblock_entry].addr)) @@ -589,16 +522,10 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].a dblock_block_off += hdr->man_dtable.row_block_off[dblock_entry / hdr->man_dtable.cparam.width]; dblock_block_off += hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width] * (dblock_entry % hdr->man_dtable.cparam.width); } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %Zu\n", FUNC, dblock_size); -#endif /* QAK */ /* Compute offset of object within block */ HDassert((obj_off - dblock_block_off) < (hsize_t)dblock_size); blk_off = (size_t)(obj_off - dblock_block_off); -#ifdef QAK -HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); -#endif /* QAK */ /* Check for object's offset in the direct block prefix information */ if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) @@ -611,14 +538,6 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); /* Create free space section node */ if(NULL == (sec_node = H5HF_sect_single_new(obj_off, obj_len, iblock, dblock_entry))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space") -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent); -if(sec_node->u.single.parent) - HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr); -HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry); -#endif /* QAK */ /* Unlock indirect block */ if(iblock) { diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index d5cedb1..55c601e 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -575,7 +575,6 @@ H5_DLLVAR const H5AC2_class_t H5AC2_FHEAP_HDR[1]; H5_DLLVAR const H5AC2_class_t H5AC2_FHEAP_IBLOCK[1]; /* H5HF direct block inherits cache-like properties from H5AC */ -H5_DLLVAR const H5AC_class_t H5AC_FHEAP_DBLOCK[1]; H5_DLLVAR const H5AC2_class_t H5AC2_FHEAP_DBLOCK[1]; /* The v2 B-tree class for tracking indirectly accessed 'huge' objects */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index fd7e945..9587fe0 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -810,10 +810,6 @@ H5HF_sect_single_full_dblock(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect->sect_info.state == H5FS_SECT_LIVE); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Retrieve direct block address from section */ if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sect, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") @@ -821,18 +817,10 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ /* Check for section occupying entire direct block */ /* (and not the root direct block) */ dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %u\n", FUNC, dblock_size); -HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", FUNC, dblock_overhead); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows); -#endif /* QAK */ if((dblock_size - dblock_overhead) == sect->sect_info.size && hdr->man_dtable.curr_root_rows > 0) { H5HF_direct_t *dblock; /* Pointer to direct block for section */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); @@ -841,11 +829,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); if(H5HF_sect_row_from_single(hdr, sect, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section") -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ - /* Destroy direct block */ if(H5HF_man_dblock_destroy(hdr, dxpl_id, dblock, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block") @@ -891,10 +874,6 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata) HDassert(sect); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_add", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if single section covers entire direct block it's in */ /* (converts to row section possibly) */ if(H5HF_sect_single_full_dblock(hdr, dxpl_id, sect) < 0) @@ -984,11 +963,6 @@ H5HF_sect_single_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if second section adjoins first section */ /* (This can only occur within a direct block, due to the direct block * overhead at the beginning of a block, so no need to check if sections @@ -1038,11 +1012,6 @@ H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE); HDassert(H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Add second section's size to first section */ sect1->sect_info.size += sect2->sect_info.size; @@ -1096,11 +1065,6 @@ H5HF_sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Check arguments. */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single_can_shrink", hdr->man_dtable.curr_root_rows); -#endif /* QAK */ - /* Check for section occupying entire root direct block */ /* (We shouldn't ever have a single section that occupies an entire * direct block, unless it's in the root direct block (because it @@ -1113,10 +1077,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %Zu\n", "H5HF_sect_single_can_shrink", dblock_size); -HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", "H5HF_sect_single_can_shrink", dblock_overhead); -#endif /* QAK */ if((dblock_size - dblock_overhead) == sect->sect_info.size) HGOTO_DONE(TRUE) } /* end if */ @@ -1166,10 +1126,6 @@ H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void UNUSED *_udata) HDassert(*sect); HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); -#ifdef QAK -HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type); -#endif /* QAK */ - /* Check to see if we should revive section */ if((*sect)->sect_info.state != H5FS_SECT_LIVE) if(H5HF_sect_single_revive(hdr, dxpl_id, (*sect)) < 0) @@ -1182,9 +1138,6 @@ HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect /* Protect the direct block for the section */ /* (should be a root direct block) */ HDassert(dblock_addr == hdr->man_dtable.table_addr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") @@ -1272,9 +1225,6 @@ H5HF_sect_single_valid(const H5FS_section_class_t UNUSED *cls, const H5FS_sectio /* Check arguments. */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ if(sect->sect_info.state == H5FS_SECT_LIVE) { /* Check if this section is not in a direct block that is the root direct block */ /* (not enough information to check on a single section in a root direct block) */ @@ -1286,9 +1236,6 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single unsigned dblock_status = 0; /* Direct block's status in the metadata cache */ herr_t status; /* Generic status value */ -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_valid", sect->u.single.parent, sect->u.single.par_entry); -#endif /* QAK */ /* Sanity check settings for section's direct block's parent */ iblock = sect->u.single.parent; HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); @@ -1415,11 +1362,6 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, HDassert(hdr); HDassert(sect); HDassert(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: sect.sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: dblock->parent = %p\n", FUNC, dblock->parent); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows); -#endif /* QAK */ /* Convert 'single' section information to 'row' section info */ sect->sect_info.addr = dblock->block_off; @@ -1513,10 +1455,6 @@ H5HF_sect_row_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect, sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); HDassert(sect->sect_info.state == H5FS_SECT_LIVE); HDassert(entry_p); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ /* Mark the row as checked out from the free space manager */ HDassert(sect->u.row.checked_out == FALSE); @@ -1534,9 +1472,6 @@ HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row. /* Check for eliminating the section */ if(sect->u.row.num_entries == 1) { -#ifdef QAK -HDfprintf(stderr, "%s: Freeing row section\n", FUNC); -#endif /* QAK */ /* Free row section */ if(H5HF_sect_row_free((H5FS_section_info_t *)sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section node") @@ -1840,16 +1775,6 @@ H5HF_sect_row_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out); -HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out); -#endif /* QAK */ - /* Get the top indirect section underlying each row */ top_indir_sect1 = H5HF_sect_indirect_top(sect1->u.row.under); HDassert(top_indir_sect1); @@ -1862,11 +1787,6 @@ HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_ca */ if(top_indir_sect1 != top_indir_sect2) { if(H5HF_sect_indirect_iblock_off(top_indir_sect1) == H5HF_sect_indirect_iblock_off(top_indir_sect2)) { -#ifdef QAK -HDfprintf(stderr, "%s: top_indir_sect1->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect1->sect_info.addr); -HDfprintf(stderr, "%s: top_indir_sect1->u.indirect.span_size = %Hu\n", "H5HF_sect_row_can_merge", top_indir_sect1->u.indirect.span_size); -HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect2->sect_info.addr); -#endif /* QAK */ /* Check if second section adjoins first section */ if(H5F_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), top_indir_sect2->sect_info.addr)) HGOTO_DONE(TRUE) @@ -1874,9 +1794,6 @@ HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_c } /* end if */ done: -#ifdef QAK -HDfprintf(stderr, "%s: ret_value = %t\n", "H5HF_sect_row_can_merge", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* H5HF_sect_row_can_merge() */ @@ -1916,15 +1833,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, HDassert(sect2); HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if second section is past end of "next block" iterator */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off); -#endif /* QAK */ if(sect2->sect_info.addr >= hdr->man_iter_off) { H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ @@ -1945,10 +1854,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", h if(sect2->sect_info.state != H5FS_SECT_LIVE) if(H5HF_sect_row_revive(hdr, dxpl_id, sect2) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out); -HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out); -#endif /* QAK */ /* Merge rows' underlying indirect sections together */ if(H5HF_sect_indirect_merge_row(hdr, dxpl_id, sect1, sect2) < 0) @@ -1992,15 +1897,7 @@ H5HF_sect_row_can_shrink(const H5FS_section_info_t *_sect, void UNUSED *_udata) HDassert(sect); HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_shrink", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ - /* Check if section is past end of "next block" iterator */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off); -#endif /* QAK */ if(sect->sect_info.addr >= hdr->man_iter_off) HGOTO_DONE(TRUE) @@ -2040,11 +1937,6 @@ H5HF_sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert(*sect); HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: (*sect)->sect_info = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type, ((*sect)->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: (*sect)->u.row = {%p, %u, %u, %u}\n", FUNC, (*sect)->u.row.under, (*sect)->u.row.row, (*sect)->u.row.col, (*sect)->u.row.num_entries); -#endif /* QAK */ - /* Get the top indirect section underlying each row */ top_indir_sect = H5HF_sect_indirect_top((*sect)->u.row.under); @@ -2162,19 +2054,12 @@ H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t * cls_prvt = cls->cls_private; hdr = cls_prvt->hdr; -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_valid", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ /* Sanity checking on the row */ HDassert(sect->u.row.under); HDassert(sect->u.row.num_entries); HDassert(sect->u.row.checked_out == FALSE); indir_sect = sect->u.row.under; indir_idx = sect->u.row.row - indir_sect->u.indirect.row; -#ifdef QAK -HDfprintf(stderr, "%s: indir_idx = %u\n", "H5HF_sect_row_valid", indir_idx); -#endif /* QAK */ HDassert(indir_sect->u.indirect.dir_rows[indir_idx] == sect); /* Check if the section is actually within the heap */ @@ -2273,9 +2158,6 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) ret_value = sect->sect_info.state == H5FS_SECT_LIVE ? sect->u.indirect.u.iblock->block_off : sect->u.indirect.u.iblock_off; -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %Hu\n", "H5HF_sect_indirect_iblock_off", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_iblock_off() */ @@ -2305,17 +2187,11 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.parent = %p\n", "H5HF_sect_indirect_top", sect->u.indirect.parent); -#endif /* QAK */ if(sect->u.indirect.parent) ret_value = H5HF_sect_indirect_top(sect->u.indirect.parent); else ret_value = sect; -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %p\n", "H5HF_sect_indirect_top", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_top() */ @@ -2500,9 +2376,6 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, HDassert(iblock); HDassert(row_sect); HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: Entering\n", FUNC); -#endif /* QAK */ /* Create free space section node */ if(NULL == (sect = H5HF_sect_indirect_new(hdr, row_sect->sect_info.addr, @@ -2533,9 +2406,6 @@ done: if(H5HF_sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node") -#ifdef QAK -HDfprintf(stderr, "%s: Leaving\n", FUNC); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_for_row() */ @@ -2572,12 +2442,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_init_rows) -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: first_child = %t\n", FUNC, first_child); -HDfprintf(stderr, "%s: start_row = %u, start_col = %u\n", FUNC, start_row, start_col); -HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); -#endif /* QAK */ /* * Check arguments. @@ -2668,9 +2532,6 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); if(u < hdr->man_dtable.max_direct_rows) { H5HF_free_section_t *row_sect = NULL; /* 'Row' free space section to add */ -#ifdef QAK -HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", FUNC, row_col, row_entries); -#endif /* QAK */ /* Create 'row' free space section node */ if(NULL == (row_sect = H5HF_sect_row_create(curr_off, (hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col, @@ -2712,11 +2573,6 @@ HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", F /* Compute info about row's indirect blocks for child section */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[u]); child_nentries = child_nrows * hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); -HDfprintf(stderr, "%s: child_nentries = %u\n", FUNC, child_nentries); -HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries); -#endif /* QAK */ /* Add an indirect section for each indirect block in the row */ for(v = 0; v < row_entries; v++) { @@ -2729,9 +2585,6 @@ HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries); /* Get the address of the child indirect block */ if(H5HF_man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve child indirect block's address") -#ifdef QAK -HDfprintf(stderr, "%s: child_iblock_addr = %a\n", FUNC, child_iblock_addr); -#endif /* QAK */ /* If the child indirect block's address is defined, protect it */ if(H5F_addr_defined(child_iblock_addr)) { @@ -2832,9 +2685,6 @@ H5HF_sect_indirect_add(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_add) -#ifdef QAK -HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries); -#endif /* QAK */ /* * Check arguments. @@ -2857,9 +2707,6 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne for(u = 0; u < start_row; u++) sect_off += hdr->man_dtable.row_block_size[u] * hdr->man_dtable.cparam.width; sect_off += hdr->man_dtable.row_block_size[start_row] * start_col; -#ifdef QAK -HDfprintf(stderr, "%s: sect_off = %Hu\n", FUNC, sect_off); -#endif /* QAK */ /* Create free space section node */ if(NULL == (sect = H5HF_sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, @@ -2912,9 +2759,6 @@ H5HF_sect_indirect_decr(H5HF_free_section_t *sect) */ HDassert(sect); HDassert(sect->u.indirect.rc); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc); -#endif /* QAK */ /* Decrement ref. count for indirect section */ sect->u.indirect.rc--; @@ -2972,10 +2816,6 @@ H5HF_sect_indirect_revive_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); /* Look up indirect block containing indirect blocks for section */ -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC2_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") @@ -3042,10 +2882,6 @@ H5HF_sect_indirect_revive(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); HDassert(sect_iblock); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ /* Increment reference count on indirect block that free section is in */ if(H5HF_iblock_incr(sect_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") @@ -3116,11 +2952,6 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ /* Compute starting & ending information for row section */ row_start_entry = (row_sect->u.row.row * hdr->man_dtable.cparam.width) + row_sect->u.row.col; row_end_entry = (row_start_entry + row_sect->u.row.num_entries) - 1; -#ifdef QAK -HDfprintf(stderr, "%s: row_sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, row_sect->sect_info.addr, row_sect->sect_info.size, row_sect->sect_info.type, (row_sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: row_sect->u.row.row = %u, row_sect->u.row.col = %u, row_sect->u.row.num_entries = %u\n", FUNC, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries); -HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_start_entry, row_end_entry); -#endif /* QAK */ /* Compute starting & ending information for indirect section */ sect = row_sect->u.row.under; @@ -3137,31 +2968,16 @@ HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_st HDassert(sect->u.indirect.dir_nrows > 0); HDassert(sect->u.indirect.dir_rows); HDassert(sect->u.indirect.dir_rows[(row_sect->u.row.row - start_row)] == row_sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry); -HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col); -HDfprintf(stderr, "%s: end_entry = %u, end_row = %u, end_col = %u\n", FUNC, end_entry, end_row, end_col); -#endif /* QAK */ /* Check if we should allocate from end of indirect section */ if(row_end_entry == end_entry && start_row != end_row) { *alloc_from_start = FALSE; row_entry = row_end_entry; -#ifdef QAK -HDfprintf(stderr, "%s: Row is at end of indirect section\n", FUNC); -#endif /* QAK */ } /* end if */ else { *alloc_from_start = TRUE; row_entry = row_start_entry; -#ifdef QAK -HDfprintf(stderr, "%s: Row is NOT at end of indirect section\n", FUNC); -#endif /* QAK */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry); -#endif /* QAK */ /* Check if we have a parent section to be detached from */ if(sect->u.indirect.parent) { @@ -3188,9 +3004,6 @@ HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry); /* Check how to adjust section for allocated entry */ if(sect->u.indirect.num_entries > 1) { if(row_entry == start_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC); -#endif /* QAK */ /* Adjust section start */ sect->sect_info.addr += hdr->man_dtable.row_block_size[sect->u.indirect.row]; @@ -3205,9 +3018,6 @@ HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC); /* Adjust direct row information */ sect->u.indirect.dir_nrows--; -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirect.dir_nrows); -#endif /* QAK */ /* Adjust direct row sections for indirect section */ if(sect->u.indirect.dir_nrows > 0) { @@ -3243,9 +3053,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirec else if(row_entry == end_entry) { unsigned new_end_row; /* New end row for entries */ -#ifdef QAK -HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents == 0); HDassert(sect->u.indirect.indir_ents == NULL); @@ -3270,9 +3077,6 @@ HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC); unsigned new_start_row; /* New starting row for current indirect section */ unsigned u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity checks */ HDassert(row_sect->u.row.col == 0); HDassert(row_sect->u.row.row > 0); @@ -3284,10 +3088,6 @@ HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC); new_start_row = row_sect->u.row.row; peer_nentries = row_entry - start_entry; peer_dir_nrows = new_start_row - start_row; -#ifdef QAK -HDfprintf(stderr, "%s: peer_nentries = %u, peer_dir_nrows = %u\n", FUNC, peer_nentries, peer_dir_nrows); -HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row); -#endif /* QAK */ /* Get indirect block information for peer */ if(sect->sect_info.state == H5FS_SECT_LIVE) { @@ -3298,9 +3098,6 @@ HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row); iblock = NULL; iblock_off = sect->u.indirect.u.iblock_off; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off); -#endif /* QAK */ /* Create peer indirect section */ if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, @@ -3409,9 +3206,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s HDassert(sect); HDassert(sect->u.indirect.span_size > 0); HDassert(sect->u.indirect.iblock_entries > 0); -#ifdef QAK -HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); -#endif /* QAK */ /* Compute starting & ending information for indirect section */ start_row = sect->u.indirect.row; @@ -3420,12 +3214,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); end_entry = (start_entry + sect->u.indirect.num_entries) - 1; end_row = end_entry / hdr->man_dtable.cparam.width; end_col = end_entry % hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry); -HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col); -HDfprintf(stderr, "%s: end_entry = %u, end_row = %u, end_col = %u\n", FUNC, end_entry, end_row, end_col); -#endif /* QAK */ /* Check how to adjust section for allocated entry */ if(sect->u.indirect.num_entries > 1) { @@ -3450,9 +3238,6 @@ HDfprintf(stderr, "%s: end_entry = %u, end_row = %u, end_col = %u\n", FUNC, end_ /* Check if we can allocate from start of indirect section */ if(child_entry == start_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.dir_nrows == 0); HDassert(sect->u.indirect.dir_rows == NULL); @@ -3483,9 +3268,6 @@ HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for child indirect section") } /* end if */ else if(child_entry == end_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents > 0); HDassert(sect->u.indirect.indir_ents); @@ -3511,9 +3293,6 @@ HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); unsigned new_nentries; /* New number of entries for current indirect section */ unsigned u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents > 0); HDassert(sect->u.indirect.indir_ents); @@ -3524,10 +3303,6 @@ HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC); peer_start_col = (child_entry + 1) % hdr->man_dtable.cparam.width; child_row = child_entry / hdr->man_dtable.cparam.width; new_nentries = sect->u.indirect.num_entries - (peer_nentries + 1); -#ifdef QAK -HDfprintf(stderr, "%s: peer_nentries = %u, peer_start_row = %u, peer_start_col = %u\n", FUNC, peer_nentries, peer_start_row, peer_start_col); -HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries); -#endif /* QAK */ HDassert(child_row >= hdr->man_dtable.max_direct_rows); /* Get indirect block information for peer */ @@ -3539,27 +3314,18 @@ HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries); iblock = NULL; iblock_off = sect->u.indirect.u.iblock_off; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off); -#endif /* QAK */ /* Update the number of entries in current section & calculate it's span size */ /* (Will use this to compute the section address for the peer section */ sect->u.indirect.num_entries = new_nentries; sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, sect->u.indirect.row, sect->u.indirect.col, new_nentries); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size); -#endif /* QAK */ HDassert(sect->u.indirect.span_size > 0); /* Compute address of peer indirect section */ peer_sect_addr = sect->sect_info.addr; peer_sect_addr += sect->u.indirect.span_size; peer_sect_addr += hdr->man_dtable.row_block_size[child_row]; -#ifdef QAK -HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); -#endif /* QAK */ /* Create peer indirect section */ if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, peer_sect_addr, @@ -3583,9 +3349,6 @@ HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); /* Eliminate indirect entries for this section, if appropriate */ if(sect->u.indirect.indir_nents == 0) sect->u.indirect.indir_ents = H5MM_xfree(sect->u.indirect.indir_ents); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indirect.indir_nents); -#endif /* QAK */ /* Re-target transferred row sections to point to new underlying indirect section */ for(u = 0; u < peer_nentries; u++) @@ -3598,10 +3361,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indir /* Adjust reference counts for current & peer sections */ peer_sect->u.indirect.rc = peer_nentries; sect->u.indirect.rc -= peer_nentries; -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc); -HDfprintf(stderr, "%s: peer_sect->u.indirect.rc = %u\n", FUNC, peer_sect->u.indirect.rc); -#endif /* QAK */ /* Transfer cached information about indirect block */ peer_sect->u.indirect.iblock_entries = sect->u.indirect.iblock_entries; @@ -3802,10 +3561,6 @@ H5HF_sect_indirect_merge_row(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect1); sect2 = H5HF_sect_indirect_top(row_sect2->u.row.under); HDassert(sect2); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Sanity check some assumptions about the indirect sections */ HDassert(sect1->sect_info.state == H5FS_SECT_LIVE); @@ -3823,24 +3578,12 @@ HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sec end_entry1 = (start_entry1 + sect1->u.indirect.num_entries) - 1; end_row1 = end_entry1 / hdr->man_dtable.cparam.width; end_col1 = end_entry1 % hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.dir_nrows = %u\n", FUNC, sect1->u.indirect.dir_nrows); -HDfprintf(stderr, "%s: start_row1 = %u, start_col1 = %u, start_entry1 = %u\n", FUNC, start_row1, start_col1, start_entry1); -HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries); -HDfprintf(stderr, "%s: end_row1 = %u, end_col1 = %u, end_entry1 = %u\n", FUNC, end_row1, end_col1, end_entry1); -#endif /* QAK */ start_row2 = sect2->u.indirect.row; start_col2 = sect2->u.indirect.col; start_entry2 = (start_row2 * hdr->man_dtable.cparam.width) + start_col2; end_entry2 = (start_entry2 + sect2->u.indirect.num_entries) - 1; end_row2 = end_entry2 / hdr->man_dtable.cparam.width; end_col2 = end_entry2 % hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect2->u.indirect.dir_nrows = %u\n", FUNC, sect2->u.indirect.dir_nrows); -HDfprintf(stderr, "%s: start_row2 = %u, start_col2 = %u, start_entry2 = %u\n", FUNC, start_row2, start_col2, start_entry2); -HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.indirect.num_entries); -HDfprintf(stderr, "%s: end_row2 = %u, end_col2 = %u, end_entry2 = %u\n", FUNC, end_row2, end_col2, end_entry2); -#endif /* QAK */ /* Check for direct sections in second section */ /* (second indirect section can be parent of indirect section for second @@ -3864,9 +3607,6 @@ HDfprintf(stderr, "%s: end_row2 = %u, end_col2 = %u, end_entry2 = %u\n", FUNC, e if(row_sect1->u.row.under->u.indirect.u.iblock->block_off == row_sect2->u.row.under->u.indirect.u.iblock->block_off && end_row1 == start_row2) { H5HF_free_section_t *last_row_sect1; /* Last row in first indirect section */ -#ifdef QAK -HDfprintf(stderr, "%s: Sections share a row\n", FUNC); -#endif /* QAK */ /* Locate the last row section in first indirect section, if we don't already have it */ if(row_sect1->u.row.row != end_row1) @@ -3889,9 +3629,6 @@ HDfprintf(stderr, "%s: Sections share a row\n", FUNC); merged_rows = TRUE; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC); -#endif /* QAK */ /* Set up parameters for transfer of rows */ src_row2 = 0; @@ -3901,11 +3638,6 @@ HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC); /* Indicate that the rows were _not_ merged */ merged_rows = FALSE; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: new_dir_nrows1 = %u\n", FUNC, new_dir_nrows1); -HDfprintf(stderr, "%s: src_row2 = %u\n", FUNC, src_row2); -HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); -#endif /* QAK */ /* Check if we need to move additional rows */ if(nrows_moved2 > 0) { @@ -3991,9 +3723,6 @@ HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); /* Wrap up, freeing or re-inserting second row section */ /* (want this to be after the first indirection section is consistent again) */ if(merged_rows) { -#ifdef QAK -HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC); -#endif /* QAK */ /* Release second row section */ /* (indirectly releases second indirect section, since all of it's * other dependents are gone) @@ -4003,9 +3732,6 @@ HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC); -#endif /* QAK */ /* Decrement ref. count on second indirect section's parent */ HDassert(sect2->u.indirect.rc == 0); if(sect2->u.indirect.parent) @@ -4020,27 +3746,14 @@ HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC); /* (it's already been added to first indirect section, but it's been removed * from the free space manager and needs to be re-added) */ -#ifdef QAK -HDfprintf(stderr, "%s: Re-inserting second row section\n", FUNC); -#endif /* QAK */ row_sect2->sect_info.type = H5HF_FSPACE_SECT_NORMAL_ROW; if(H5HF_space_add(hdr, dxpl_id, row_sect2, H5FS_ADD_SKIP_VALID) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add second row section to free space") -#ifdef QAK -HDfprintf(stderr, "%s: Done re-inserting second row section\n", FUNC); -#endif /* QAK */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.iblock_entries = %u\n", FUNC, sect1->u.indirect.iblock_entries); -HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries); -#endif /* QAK */ /* Check if we can create parent indirect section for first section */ /* (i.e. merged indirect sections cover an entire indirect block) */ if(sect1->u.indirect.iblock_entries == sect1->u.indirect.num_entries) { -#ifdef QAK -HDfprintf(stderr, "%s: creating parent indirect section\n", FUNC); -#endif /* QAK */ /* Build parent section for fully populated indirect section */ HDassert(sect1->u.indirect.parent == NULL); if(H5HF_sect_indirect_build_parent(hdr, sect1) < 0) @@ -4075,9 +3788,6 @@ H5HF_sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_build_parent) -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Sanity check parameters */ HDassert(hdr); @@ -4087,18 +3797,12 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ HDassert(sect->u.indirect.iblock_entries == sect->u.indirect.num_entries); HDassert(sect->u.indirect.u.iblock); HDassert(sect->u.indirect.parent == NULL); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -#endif /* QAK */ /* Get information for creating parent indirect section */ par_entry = sect->u.indirect.u.iblock->par_entry; par_row = par_entry / hdr->man_dtable.cparam.width; par_col = par_entry % hdr->man_dtable.cparam.width; HDassert(par_row >= hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: par_entry = %u, par_row = %u, par_col = %u\n", FUNC, par_entry, par_row, par_col); -#endif /* QAK */ par_iblock = sect->u.indirect.u.iblock->parent; HDassert(par_iblock); @@ -4155,12 +3859,6 @@ H5HF_sect_indirect_shrink(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s /* Sanity check some assumptions about the indirect section */ HDassert(sect->u.indirect.dir_nrows > 0 || sect->u.indirect.indir_nents > 0); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p\n", FUNC, sect->u.indirect.parent); -#endif /* QAK */ /* Walk through direct rows, freeing them */ for(u = 0; u < sect->u.indirect.dir_nrows; u++) { @@ -4216,9 +3914,6 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, HDassert(hdr); HDassert(sect); HDassert(buf); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Check if this indirect section has a parent & forward if this section is first */ if(sect->u.indirect.parent) { @@ -4231,35 +3926,18 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ if(sect->sect_info.state == H5FS_SECT_LIVE) { HDassert(sect->u.indirect.u.iblock); UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock->block_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock->block_off = %Hu\n", FUNC, sect->u.indirect.u.iblock->block_off); -#endif /* QAK */ } /* end if */ else -{ UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ -} /* Indirect range's row */ UINT16ENCODE(buf, sect->u.indirect.row); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.row = %u\n", FUNC, sect->u.indirect.row); -#endif /* QAK */ /* Indirect range's column */ UINT16ENCODE(buf, sect->u.indirect.col); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.col = %u\n", FUNC, sect->u.indirect.col); -#endif /* QAK */ /* Indirect range's # of entries */ UINT16ENCODE(buf, sect->u.indirect.num_entries); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.num_entries = %u\n", FUNC, sect->u.indirect.num_entries); -#endif /* QAK */ } /* end else */ done: @@ -4304,33 +3982,18 @@ H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(buf); HDassert(H5F_addr_defined(sect_addr)); HDassert(sect_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_addr = %a, sect_size = %Hu\n", FUNC, sect_addr, sect_size); -#endif /* QAK */ /* Indirect range's indirect block's block offset */ UINT64DECODE_VAR(buf, iblock_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: iblock_off = %Hu\n", FUNC, iblock_off); -#endif /* QAK */ /* Indirect section's row */ UINT16DECODE(buf, start_row); -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u\n", FUNC, start_row); -#endif /* QAK */ /* Indirect section's column */ UINT16DECODE(buf, start_col); -#ifdef QAK -HDfprintf(stderr, "%s: start_col = %u\n", FUNC, start_col); -#endif /* QAK */ /* Indirect section's # of entries */ UINT16DECODE(buf, nentries); -#ifdef QAK -HDfprintf(stderr, "%s: nentries = %u\n", FUNC, nentries); -#endif /* QAK */ /* Create free space section node */ if(NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size, @@ -4438,15 +4101,6 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(hdr); HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_indirect_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -if(sect->sect_info.state == H5FS_SECT_LIVE) - HDfprintf(stderr, "%s: sect->u.indirect = {%p, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock); -else - HDfprintf(stderr, "%s: sect->u.indirect = {%Hu, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock_off); -HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -#endif /* QAK */ - /* Compute starting entry, column & row */ start_row = sect->u.indirect.row; start_col = sect->u.indirect.col; @@ -4456,10 +4110,6 @@ HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, s end_entry = (start_entry + sect->u.indirect.num_entries) - 1; end_row = end_entry / hdr->man_dtable.cparam.width; end_col = end_entry % hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", "H5HF_sect_indirect_valid", start_row, start_col, start_entry); -HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect_indirect_valid", end_row, end_col, end_entry); -#endif /* QAK */ /* Sanity check any direct rows */ if(sect->u.indirect.dir_nrows > 0) { diff --git a/src/H5HG.c b/src/H5HG.c index c741b91..9d7b9fa 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -86,35 +86,16 @@ H5FL_BLK_DEFINE(heap_chunk); * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * - * John Mainzer 5/26/04 - * Modified function to return the disk address of the new - * global heap collection, or HADDR_UNDEF on failure. This - * is necessary, as in some cases (i.e. flexible parallel) - * H5AC2_set() will imediately flush and destroy the in memory - * version of the new collection. For the same reason, I - * moved the code which places the new collection on the cwfs - * list to just before the call to H5AC2_set(). - * - * John Mainzer 6/8/05 - * Removed code setting the is_dirty field of the cache info. - * This is no longer pemitted, as the cache code is now - * manageing this field. Since this function uses a call to - * H5AC2_set() (which marks the entry dirty automaticly), no - * other change is required. - * *------------------------------------------------------------------------- */ static haddr_t H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) { H5HG_heap_t *heap = NULL; - haddr_t ret_value = HADDR_UNDEF; uint8_t *p = NULL; haddr_t addr; size_t n; - int i; + haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HG_create) @@ -200,91 +181,21 @@ HDmemset(heap->chunk, 0, size); } /* Add the heap to the cache */ - if (H5AC2_set (f, dxpl_id, H5AC2_GHEAP, addr, (size_t)size, heap, H5AC2__NO_FLAGS_SET)<0) - HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, \ - "unable to cache global heap collection"); + if(H5AC2_set(f, dxpl_id, H5AC2_GHEAP, addr, (size_t)size, heap, H5AC2__NO_FLAGS_SET)<0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") ret_value = addr; done: - if ( ! ( H5F_addr_defined(addr) ) && heap) { - if ( H5HG_dest(heap) < 0 ) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, \ - "unable to destroy global heap collection"); - } + if(!(H5F_addr_defined(addr)) && heap) + if(H5HG_dest(heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value); } /* H5HG_create() */ /*------------------------------------------------------------------------- - * Function: H5HG_clear - * - * Purpose: Mark a global heap in memory as non-dirty. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, March 20, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT(H5HG_clear); - - /* Check arguments */ - assert (heap); - - /* Mark heap as clean */ - heap->cache_info.is_dirty = FALSE; - - if (destroy) - if (H5HG_dest(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection"); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* H5HG_clear() */ - - -/*------------------------------------------------------------------------- - * Function: H5HG_compute_size - * - * Purpose: Compute the size in bytes of the specified instance of - * H5HG_heap_t on disk, and return it in *len_ptr. On failure, - * the value of *len_ptr is undefined. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 5/13/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5HG_compute_size(const H5F_t UNUSED *f, const H5HG_heap_t *heap, size_t *size_ptr) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_compute_size); - - /* Check arguments */ - HDassert(heap); - HDassert(size_ptr); - - *size_ptr = heap->size; - - FUNC_LEAVE_NOAPI(SUCCEED); -} /* H5HG_compute_size() */ - - -/*------------------------------------------------------------------------- * Function: H5HG_alloc * * Purpose: Given a heap with enough free space, this function will split @@ -300,16 +211,6 @@ H5HG_compute_size(const H5F_t UNUSED *f, const H5HG_heap_t *heap, size_t *size_p * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * - * John Mainzer, 6/8/05 - * Modified the function to use the new dirtied parameter of - * of H5AC2_unprotect() instead of modifying the is_dirty - * field of the cache info. - * - * In this case, that required adding the new heap_dirtied_ptr - * parameter to the function's argument list. - * *------------------------------------------------------------------------- */ static size_t @@ -531,30 +432,6 @@ done: * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * - * John Mainzer -- 5/24/04 - * The function used to modify the heap without protecting - * the relevant collection first. I did a half assed job - * of fixing the problem, which should hold until we try to - * support multi-threading. At that point it will have to - * be done right. - * - * See in line comment of this date for more details. - * - * John Mainzer - 5/26/04 - * Modified H5HG_create() to return the disk address of the - * new collection, instead of the address of its - * representation in core. This was necessary as in FP - * mode, the cache will immediately flush and destroy any - * entry inserted in it via H5AC2_set(). I then modified - * this function to account for the change in H5HG_create(). - * - * John Mainzer - 6/8/05 - * Modified function to use the dirtied parameter of - * H5AC2_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t @@ -662,11 +539,10 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* --cwfsno; } /* end if */ } /* end else */ - HDassert(H5F_addr_defined(addr)); - if ( NULL == (heap = H5AC2_protect(f, dxpl_id, H5AC2_GHEAP, addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC2_WRITE)) ) - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); - + + if(NULL == (heap = H5AC2_protect(f, dxpl_id, H5AC2_GHEAP, addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC2_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") HDassert(heap->obj[0].size); /* Split the free space to make room for the new object */ @@ -688,8 +564,8 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* hobj->idx = idx; done: - if ( heap && H5AC2_unprotect(f, dxpl_id, H5AC2_GHEAP, heap->addr, (size_t)0, heap, heap_flags) < 0 ) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to unprotect heap."); + if(heap && H5AC2_unprotect(f, dxpl_id, H5AC2_GHEAP, heap->addr, (size_t)0, heap, heap_flags) < 0) + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to unprotect heap.") FUNC_LEAVE_NOAPI(ret_value); } /* H5HG_insert() */ @@ -820,7 +696,6 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); if(adjust!=0) { - /* Load the heap */ if (NULL == (heap = H5AC2_protect(f, dxpl_id, H5AC2_GHEAP, hobj->addr, (size_t)H5HG_SPEC_READ_SIZE, f, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); @@ -839,7 +714,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) ret_value=heap->obj[hobj->idx].nrefs; done: - if (heap && H5AC2_unprotect(f, dxpl_id, H5AC2_GHEAP, hobj->addr, (size_t)0, heap, heap_flags)<0) + if(heap && H5AC2_unprotect(f, dxpl_id, H5AC2_GHEAP, hobj->addr, (size_t)0, heap, heap_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -906,10 +781,8 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) } else { heap->obj[0].size += need; } - HDmemmove (obj_start, obj_start+need, heap->size-((obj_start+need)-heap->chunk)); - if (heap->obj[0].size>=H5HG_SIZEOF_OBJHDR (f)) { p = heap->obj[0].begin; UINT16ENCODE(p, 0); /*id*/ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 4b45c1b..97e5772 100755 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -27,14 +27,13 @@ /****************/ /* Module Setup */ /****************/ - #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #define H5HG_PACKAGE /*suppress error about including H5HGpkg */ + /***********/ /* Headers */ /***********/ - #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ @@ -42,18 +41,22 @@ #include "H5HGpkg.h" /* Global heaps */ #include "H5MMprivate.h" /* Memory management */ + /****************/ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Package Typedefs */ /********************/ + /********************/ /* Local Prototypes */ /********************/ @@ -67,6 +70,7 @@ static herr_t H5HG_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size_t *new_len, void **new_image); static herr_t H5HG_free_icr(haddr_t addr, size_t len, void *thing); + /*********************/ /* Package Variables */ /*********************/ @@ -85,14 +89,17 @@ const H5AC2_class_t H5AC2_GHEAP[1] = {{ NULL, }}; + /*****************************/ /* Library Private Variables */ /*****************************/ + /*******************/ /* Local Variables */ /*******************/ + /*------------------------------------------------------------------------- * Function: H5HG_deserialize @@ -105,42 +112,27 @@ const H5AC2_class_t H5AC2_GHEAP[1] = {{ * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * July 28, 2008 - * Converted from H5HG_load - * *------------------------------------------------------------------------- */ static void * H5HG_deserialize(haddr_t addr, size_t UNUSED len, const void *image, void *_udata, hbool_t UNUSED *dirty) { - H5HG_heap_t *heap = NULL; H5F_t *f = (H5F_t *)_udata; uint8_t *p; size_t nalloc, need; - size_t max_idx=0; /* The maximum index seen */ - int i; + size_t max_idx = 0; /* The maximum index seen */ H5HG_heap_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_deserialize, NULL); + FUNC_ENTER_NOAPI(H5HG_deserialize, NULL) /* check arguments */ HDassert(image); /* Allocate space for heap */ - if(NULL == (heap = H5FL_CALLOC (H5HG_heap_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") heap->addr = addr; heap->shared = f->shared; @@ -148,26 +140,25 @@ H5HG_deserialize(haddr_t addr, size_t UNUSED len, const void *image, /* Magic number */ if(HDmemcmp(p, H5HG_MAGIC, (size_t)H5HG_SIZEOF_MAGIC)) - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "bad global heap collection signature"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad global heap collection signature") p += H5HG_SIZEOF_MAGIC; /* Version */ - if (H5HG_VERSION!=*p++) - HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap"); + if(H5HG_VERSION != *p++) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap") /* Reserved */ p += 3; /* Size */ - H5F_DECODE_LENGTH (f, p, heap->size); - assert (heap->size>=H5HG_MINSIZE); + H5F_DECODE_LENGTH(f, p, heap->size); + HDassert(heap->size>=H5HG_MINSIZE); /* if heap->size is more than the allocated image size, then we need to do nothing and wait for correctly sized image to come in */ - if (heap->size <= len) { - + if(heap->size <= len) { /* Allocate space for the heap->chunk */ if(NULL == (heap->chunk = H5FL_BLK_MALLOC(heap_chunk, (size_t)heap->size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Copy image into chunk */ HDmemcpy(heap->chunk, image, heap->size); @@ -175,47 +166,48 @@ H5HG_deserialize(haddr_t addr, size_t UNUSED len, const void *image, /* Decode each object */ p = heap->chunk + H5HG_SIZEOF_HDR(f); nalloc = H5HG_NOBJS (f, heap->size); - if (NULL==(heap->obj = H5FL_SEQ_MALLOC (H5HG_obj_t,nalloc))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - heap->obj[0].size=heap->obj[0].nrefs=0; - heap->obj[0].begin=NULL; + if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t,nalloc))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + heap->obj[0].size = heap->obj[0].nrefs = 0; + heap->obj[0].begin = NULL; heap->nalloc = nalloc; - while (pchunk+heap->size) { - if (p+H5HG_SIZEOF_OBJHDR(f)>heap->chunk+heap->size) { + while(p < (heap->chunk + heap->size)) { + if((p + H5HG_SIZEOF_OBJHDR(f)) > (heap->chunk + heap->size)) { /* * The last bit of space is too tiny for an object header, so we * assume that it's free space. */ - assert (NULL==heap->obj[0].begin); - heap->obj[0].size = ((const uint8_t *)heap->chunk+heap->size) - p; + HDassert(NULL == heap->obj[0].begin); + heap->obj[0].size = ((const uint8_t *)heap->chunk + heap->size) - p; heap->obj[0].begin = p; p += heap->obj[0].size; - } else { + } /* end if */ + else { unsigned idx; uint8_t *begin = p; UINT16DECODE (p, idx); /* Check if we need more room to store heap objects */ - if(idx>=heap->nalloc) { + if(idx >= heap->nalloc) { size_t new_alloc; /* New allocation number */ H5HG_obj_t *new_obj; /* New array of object descriptions */ /* Determine the new number of objects to index */ - new_alloc=MAX(heap->nalloc*2,(idx+1)); + new_alloc = MAX(heap->nalloc * 2, (idx + 1)); /* Reallocate array of objects */ - if (NULL==(new_obj = H5FL_SEQ_REALLOC (H5HG_obj_t, heap->obj, new_alloc))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(NULL == (new_obj = H5FL_SEQ_REALLOC(H5HG_obj_t, heap->obj, new_alloc))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Update heap information */ - heap->nalloc=new_alloc; - heap->obj=new_obj; + heap->nalloc = new_alloc; + heap->obj = new_obj; } /* end if */ - UINT16DECODE (p, heap->obj[idx].nrefs); + UINT16DECODE(p, heap->obj[idx].nrefs); p += 4; /*reserved*/ - H5F_DECODE_LENGTH (f, p, heap->obj[idx].size); + H5F_DECODE_LENGTH(f, p, heap->obj[idx].size); heap->obj[idx].begin = begin; /* * The total storage size includes the size of the object header @@ -223,68 +215,68 @@ H5HG_deserialize(haddr_t addr, size_t UNUSED len, const void *image, * aligned. The last bit of space is the free space object whose * size is never padded and already includes the object header. */ - if (idx>0) { + if(idx > 0) { need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(heap->obj[idx].size); /* Check for "gap" in index numbers (caused by deletions) and fill in heap object values */ - if(idx>(max_idx+1)) - HDmemset(&heap->obj[max_idx+1],0,sizeof(H5HG_obj_t)*(idx-(max_idx+1))); - max_idx=idx; - } else { + if(idx > (max_idx + 1)) + HDmemset(&heap->obj[max_idx + 1], 0, sizeof(H5HG_obj_t) * (idx - (max_idx + 1))); + max_idx = idx; + } /* end if */ + else need = heap->obj[idx].size; - } p = begin + need; - } - } - assert(p==heap->chunk+heap->size); - assert(H5HG_ISALIGNED(heap->obj[0].size)); - + } /* end else */ + } /* end while */ + HDassert(p == heap->chunk + heap->size); + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); /* Set the next index value to use */ - if(max_idx>0) - heap->nused=max_idx+1; + if(max_idx > 0) + heap->nused = max_idx + 1; else - heap->nused=1; + heap->nused = 1; /* * Add the new heap to the CWFS list, removing some other entry if * necessary to make room. We remove the right-most entry that has less * free space than this heap. */ - if (!f->shared->cwfs) { - f->shared->cwfs = H5MM_malloc (H5HG_NCWFS*sizeof(H5HG_heap_t*)); - if (NULL==f->shared->cwfs) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(!f->shared->cwfs) { + if(NULL == (f->shared->cwfs = H5MM_malloc(H5HG_NCWFS * sizeof(H5HG_heap_t*)))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") f->shared->ncwfs = 1; f->shared->cwfs[0] = heap; - } else if (H5HG_NCWFS==f->shared->ncwfs) { - for (i=H5HG_NCWFS-1; i>=0; --i) { - if (f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, i * sizeof(H5HG_heap_t*)); + } else if(H5HG_NCWFS == f->shared->ncwfs) { + int i; /* Local index variable */ + + for(i = H5HG_NCWFS - 1; i >= 0; --i) { + if(f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { + HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, i * sizeof(H5HG_heap_t *)); f->shared->cwfs[0] = heap; break; - } - } + } /* end if */ + } /* end for */ } else { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, f->shared->ncwfs*sizeof(H5HG_heap_t*)); + HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *)); f->shared->ncwfs += 1; f->shared->cwfs[0] = heap; - } + } /* end else */ /* Sanity check */ HDassert((size_t)((const uint8_t *)p - (const uint8_t *)heap->chunk) <= len); - } /* end if heap->size <= len */ ret_value = heap; done: - if (!ret_value && heap) { - if(H5HG_dest(heap)<0) + if(!ret_value && heap) { + if(H5HG_dest(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection"); - } - FUNC_LEAVE_NOAPI(ret_value); -} + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HG_deserialize() */ /*------------------------------------------------------------------------- @@ -298,53 +290,32 @@ done: * Programmer: Robb Matzke * Friday, March 27, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - * - * JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * Mike McGreevy - * mcgreevy@hdfgroup.org - * July 28, 2008 - * Converted from H5HG_flush - * *------------------------------------------------------------------------- */ static herr_t -H5HG_serialize (const H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5HG_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { - herr_t ret_value=SUCCEED; /* Return value */ H5HG_heap_t *heap = (H5HG_heap_t *)_thing; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_serialize, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5HG_serialize) /* Check arguments */ - assert (f); - assert (H5F_addr_defined (addr)); - assert (H5F_addr_eq (addr, heap->addr)); - assert (heap); - + HDassert(f); + HDassert(H5F_addr_defined (addr)); + HDassert(H5F_addr_eq (addr, heap->addr)); + HDassert(heap); /* Need to increase image size if we need to copy a bigger thing into it */ - if (heap->size > len) { + if(heap->size > len) { /* free old image buffer */ H5MM_free(image); /* allocate new image buffer */ - *new_image = H5MM_malloc(heap->size); - if (*new_image == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "new image null after H5MM_realloc()\n"); + if(NULL == (*new_image = H5MM_malloc(heap->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new image null after H5MM_realloc()\n") /* copy the heap->chunk into the new image buffer */ HDmemcpy(*new_image, heap->chunk, heap->size); @@ -354,20 +325,18 @@ H5HG_serialize (const H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, size_t UNUSE /* specify in flags that image has been resized */ *flags = H5C2__SERIALIZE_RESIZED_FLAG; - - } else { - + } /* end if */ + else { /* copy the heap->chunk into the image buffer */ HDmemcpy(image, heap->chunk, heap->size); /* Reset the cache flags for this operation */ *flags = 0; - - } + } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HG_serialize() */ /*------------------------------------------------------------------------- @@ -387,7 +356,6 @@ done: static herr_t H5HG_image_len(const void *thing, size_t *image_len_ptr) { - const H5HG_heap_t *heap = (const H5HG_heap_t *)thing; /* Global heap */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_image_len) @@ -400,7 +368,6 @@ H5HG_image_len(const void *thing, size_t *image_len_ptr) *image_len_ptr = heap->size; FUNC_LEAVE_NOAPI(SUCCEED) - } /* end H5HG_image_len() */ @@ -432,6 +399,3 @@ H5HG_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HG_free_icr() */ - - - diff --git a/src/H5HL.c b/src/H5HL.c index 5c7c247..69f79ec 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -48,6 +48,7 @@ #include "H5HLpkg.h" /* Local Heaps */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ @@ -62,7 +63,6 @@ #define H5HL_SPEC_READ_SIZE 512 - /******************/ /* Local Typedefs */ /******************/ diff --git a/src/H5I.c b/src/H5I.c index b8bc04c..d64b4a2 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -42,13 +42,12 @@ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ -#include "H5AC2private.h" /* Metadata cache */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ @@ -1253,8 +1252,6 @@ done: * Programmer: Quincey Koziol * Dec 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -1262,19 +1259,19 @@ H5Idec_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Idec_ref, id, H5AC_dxpl_id, FAIL); + FUNC_ENTER_API_META(H5Idec_ref, id, H5AC2_dxpl_id, FAIL) H5TRACE1("Is", "i", id); /* Check arguments */ - if (id<0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID"); + if(id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual decrement operation */ - if((ret_value = H5I_dec_ref(id))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count"); + if((ret_value = H5I_dec_ref(id)) < 0) + HGOTO_ERROR (H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") done: - FUNC_LEAVE_API_META(ret_value); + FUNC_LEAVE_API_META(ret_value) } /* end H5Idec_ref() */ @@ -1387,19 +1384,19 @@ H5Iinc_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Iinc_ref, id, H5AC_dxpl_id, FAIL); + FUNC_ENTER_API_META(H5Iinc_ref, id, H5AC2_dxpl_id, FAIL) H5TRACE1("Is", "i", id); /* Check arguments */ - if (id<0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID"); + if(id < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") /* Do actual increment operation */ - if((ret_value = H5I_inc_ref(id))<0) + if((ret_value = H5I_inc_ref(id)) < 0) HGOTO_ERROR (H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count"); done: - FUNC_LEAVE_API_META(ret_value); + FUNC_LEAVE_API_META(ret_value) } /* end H5Iinc_ref() */ @@ -1999,13 +1996,13 @@ H5I_find_id(hid_t id) ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { - ssize_t ret_value; + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Iget_name, FAIL) H5TRACE3("Zs", "ixz", id, name, size); /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(id, name, size, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_get_name(id, name, size, H5P_DEFAULT, H5AC2_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: diff --git a/src/H5L.c b/src/H5L.c index e911c99..608d76d 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -28,6 +28,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gpkg.h" /* Groups */ @@ -37,7 +38,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ -#include "H5AC2private.h" /* Metadata cache */ /****************/ /* Local Macros */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 9186bf4..d5b8b96 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -20,6 +20,7 @@ #define H5_INTERFACE_INIT_FUNC H5L_init_extern_interface #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ @@ -27,7 +28,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ -#include "H5AC2private.h" /* Metadata cache */ static hid_t H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, const void *udata, size_t UNUSED udata_size, hid_t lapl_id); diff --git a/src/H5MF.c b/src/H5MF.c index 953726a..27b00cc 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -60,7 +60,6 @@ /********************/ /* Local Prototypes */ /********************/ -static hbool_t H5MF_alloc_overflow(const H5F_t *f, hsize_t size); /*********************/ @@ -98,8 +97,7 @@ static hbool_t H5MF_alloc_overflow(const H5F_t *f, hsize_t size); haddr_t H5MF_alloc(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { - haddr_t ret_value, new_eoa; - herr_t result; + haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5MF_alloc, HADDR_UNDEF) @@ -114,19 +112,18 @@ H5MF_alloc(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* Allocate space from the virtual file layer */ if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, type, dxpl_id, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed") - + /* Check for journaling in progress */ - if (f->shared->cache2->mdj_enabled == 1) { - + if(f->shared->cache2->mdj_enabled) { + haddr_t new_eoa; + /* get updated EOA value */ - if (HADDR_UNDEF ==(new_eoa = H5FDget_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, \ - "file get eoa request failed") + if(HADDR_UNDEF == (new_eoa = H5FDget_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed") /* journal the updated EOA value */ - if(SUCCEED != H5C2_jb__eoa(&(f->shared->cache2->mdj_jbrb), new_eoa)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ - "H5C2_jb__eoa() failed.") + if(H5C2_jb__eoa(&(f->shared->cache2->mdj_jbrb), new_eoa) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTJOURNAL, HADDR_UNDEF, "H5C2_jb__eoa() failed.") } /* end if */ /* Convert absolute file address to relative file address */ @@ -238,51 +235,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_alloc_overflow - * - * Purpose: Checks if an allocation of file space would cause an overflow. - * F is the file whose space is being allocated, SIZE is the amount - * of space needed. - * - * Return: FALSE if no overflow would result - * TRUE if overflow would result (the allocation should not be allowed) - * - * Programmer: James Laird - * Nat Furrer - * Tuesday, June 1, 2004 - * - *------------------------------------------------------------------------- - */ -static hbool_t -H5MF_alloc_overflow(const H5F_t *f, hsize_t size) -{ - haddr_t eoa; /* End-of-allocation in the file */ - haddr_t space_avail; /* Unallocated space still available in file */ - hbool_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5MF_alloc_overflow) - - /* Start with the current end of the file's address. */ - eoa = H5F_get_eoa(f); - HDassert(H5F_addr_defined(eoa)); - - /* Subtract EOA from the file's maximum address to get the actual amount of - * addressable space left in the file. - */ - HDassert(f->shared->maxaddr >= eoa); - space_avail = (hsize_t)(f->shared->maxaddr - eoa); - - /* Ensure that there's enough room left in the file for something of this size */ - if(size > space_avail) - ret_value = TRUE; - else - ret_value = FALSE; - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_alloc_overflow() */ - - -/*------------------------------------------------------------------------- * Function: H5MF_can_extend * * Purpose: Check if a block in the file can be extended. diff --git a/src/H5O.c b/src/H5O.c index f16ed1c..1200aa6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -98,7 +98,6 @@ static herr_t H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Header message ID to class mapping */ - /* Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new * message. */ @@ -135,8 +134,6 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_UNKNOWN, /*0x0018 Placeholder for unknown message */ }; -/* HDassert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); */ - /* Header object ID to class mapping */ /* * Initialize the object class info table. Begin with the most general types diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 3c29c24..38cce08 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -559,10 +559,8 @@ H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, for(idx = 0; idx < oh->nmesgs; idx++) if(type == oh->mesg[idx].type) break; - if(idx == oh->nmesgs) { - + if(idx == oh->nmesgs) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "message type not found") - } /* * Decode the message if necessary. If the message is shared then retrieve @@ -579,7 +577,6 @@ H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space") done: - FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_read_real() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 74c5ae1..49c59bf 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2120,13 +2120,13 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Convert the fill value */ if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { if(bkg_buf) - H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end if */ /* Release the background buffer */ if(bkg_buf) - H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ else diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index ced4df8..c4f0331 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -221,7 +221,6 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) if(H5P_register(pclass, H5F_ACS_JNL_INIT_CONFIG_NAME, H5F_ACS_JNL_INIT_CONFIG_SIZE, &initJnlCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the size of raw data chunk cache (elements) */ if(H5P_register(pclass, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -1335,27 +1334,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pset_mdc_config(hid_t plist_id, - H5AC_cache_config_t *config_ptr) +H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pset_mdc_config, FAIL); + FUNC_ENTER_API(H5Pset_mdc_config, FAIL) H5TRACE2("e", "i*x", plist_id, config_ptr); /* Get the plist structure */ - if( NULL == ( plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS) ) ) { - - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - } + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* validate the new configuration */ - if ( H5AC_validate_config(config_ptr) < 0 ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "invalid metadata cache configuration"); - } + if(H5AC_validate_config(config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache configuration") /* set the modified config */ @@ -1363,16 +1356,11 @@ H5Pset_mdc_config(hid_t plist_id, * will have to test the version and do translation here. */ - if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr)<0) { - - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, \ - "can't set metadata cache initial config"); - } + if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache initial config") done: - FUNC_LEAVE_API(ret_value); - } /* H5Pset_mdc_config() */ @@ -1397,33 +1385,25 @@ done: * *------------------------------------------------------------------------- */ - herr_t -H5Pget_mdc_config(hid_t plist_id, - H5AC_cache_config_t *config_ptr) +H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pget_mdc_config, FAIL); + FUNC_ENTER_API(H5Pget_mdc_config, FAIL) H5TRACE2("e", "i*x", plist_id, config_ptr); /* Get the plist structure */ - if ( NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)) ) { - - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - } + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* validate the config_ptr */ - if ( config_ptr == NULL ) { - + if(config_ptr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - } - - if ( ! H5AC2_validate_cache_config_ver(config_ptr->version) ) { + if(!H5AC2_validate_cache_config_ver(config_ptr->version)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") - } /* If we ever support multiple versions of H5AC_cache_config_t, we * will have to get the cannonical version here, and then translate @@ -1431,16 +1411,11 @@ H5Pget_mdc_config(hid_t plist_id, */ /* Get the current initial metadata cache resize configuration */ - if ( H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0 ) { - - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, \ - "can't get metadata cache initial resize config"); - } + if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get metadata cache initial resize config") done: - - FUNC_LEAVE_API(ret_value); - + FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_config() */ diff --git a/src/H5R.c b/src/H5R.c index b42e663..510328d 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -21,6 +21,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ @@ -29,7 +30,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Rpkg.h" /* References */ #include "H5Sprivate.h" /* Dataspaces */ -#include "H5AC2private.h" /* Metadata cache */ /* Local macro definitions */ diff --git a/src/H5SM.c b/src/H5SM.c index c6f53e2..d77918f 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -208,6 +208,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t) (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f)); if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") + /* Cache the new table */ if(H5AC2_set(f, dxpl_id, H5AC2_SOHM_TABLE, table_addr, (size_t)table_size, table, H5AC2__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add SOHM table to cache") @@ -342,10 +343,10 @@ htri_t H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id) { H5SM_master_table_t *table = NULL; /* Shared object master table */ + hsize_t table_size; /* Size of SOHM master table in file */ unsigned type_flag; /* Flag corresponding to message type */ size_t u; /* Local index variable */ htri_t ret_value = FALSE; /* Return value */ - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI_NOINIT(H5SM_type_shared) @@ -356,19 +357,15 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id) /* Determine size of table in file */ table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f)); - /* Look up the master SOHM table */ if(H5F_addr_defined(f->shared->sohm_addr)) { if(NULL == (table = (H5SM_master_table_t *)H5AC2_protect(f, dxpl_id, H5AC2_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC2_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") - } /* end if */ else /* No shared messages of any type */ HGOTO_DONE(FALSE) - - /* Search the indexes until we find one that matches this flag or we've * searched them all. */ @@ -402,9 +399,9 @@ herr_t H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_addr) { H5SM_master_table_t *table = NULL; /* Shared object master table */ + hsize_t table_size; /* Size of SOHM master table in file */ ssize_t index_num; /* Which index */ herr_t ret_value = SUCCEED; /* Return value */ - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI(H5SM_get_fheap_addr, FAIL) @@ -780,9 +777,9 @@ static herr_t H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_id) { H5SM_list_t *list = NULL; + H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ haddr_t btree_addr; herr_t ret_value = SUCCEED; - H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ FUNC_ENTER_NOAPI_NOINIT(H5SM_convert_btree_to_list) @@ -802,6 +799,7 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i cache_udata.f = f; cache_udata.header = header; + /* Protect the SOHM list */ if(NULL == (list = (H5SM_list_t *)H5AC2_protect(f, dxpl_id, H5AC2_SOHM_LIST, header->index_addr, H5SM_LIST_SIZE(f, header->list_max), &cache_udata, H5AC2_WRITE))) HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM list index") @@ -888,10 +886,10 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table, { size_t mesg_size; H5SM_master_table_t *my_table = NULL; + hsize_t table_size; /* Size of SOHM master table in file */ ssize_t index_num; htri_t tri_ret; htri_t ret_value = TRUE; - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI(H5SM_can_share, FAIL) @@ -999,11 +997,11 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, void *mesg, unsigned *mesg_flags) { H5SM_master_table_t *table = NULL; + hsize_t table_size; /* Size of SOHM master table in file */ unsigned cache_flags = H5AC2__NO_FLAGS_SET; ssize_t index_num; htri_t tri_ret; htri_t ret_value = TRUE; - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI(H5SM_try_share, FAIL) @@ -1154,6 +1152,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, { H5SM_list_t *list = NULL; /* List index */ H5SM_mesg_key_t key; /* Key used to search the index */ + H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ H5O_shared_t shared; /* Shared H5O message */ hbool_t found = FALSE; /* Was the message in the index? */ H5HF_t *fheap = NULL; /* Fractal heap handle */ @@ -1161,7 +1160,6 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void * encoding_buf = NULL; /* Buffer for encoded message */ size_t empty_pos = UFAIL; /* Empty entry in list */ herr_t ret_value = SUCCEED; - H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ FUNC_ENTER_NOAPI_NOINIT(H5SM_write_mesg) @@ -1381,13 +1379,13 @@ herr_t H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg) { H5SM_master_table_t *table = NULL; + hsize_t table_size; /* Size of SOHM master table in file */ unsigned cache_flags = H5AC2__NO_FLAGS_SET; ssize_t index_num; void *mesg_buf = NULL; void *native_mesg = NULL; unsigned type_id; /* Message type ID to operate on */ herr_t ret_value = SUCCEED; - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI(H5SM_delete, FAIL) @@ -1611,12 +1609,12 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5SM_mesg_key_t key; H5SM_sohm_t message; /* Deleted message returned from index */ H5SM_sohm_t *message_ptr; /* Pointer to deleted message returned from index */ + H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ H5HF_t *fheap = NULL; /* Fractal heap that contains the message */ size_t buf_size; /* Size of the encoded message (out) */ void *encoding_buf = NULL; /* The encoded message (out) */ unsigned type_id; /* Message type to operate on */ herr_t ret_value = SUCCEED; - H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ FUNC_ENTER_NOAPI_NOINIT(H5SM_delete_from_index) @@ -1788,8 +1786,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) H5F_file_t *shared = f->shared; /* Shared file info (convenience variable) */ H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */ H5SM_master_table_t *table = NULL; /* SOHM master table */ - herr_t ret_value = SUCCEED; /* Return value */ hsize_t table_size; /* Size of SOHM master table in file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5SM_get_info, FAIL) @@ -2047,12 +2045,12 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id, H5SM_index_header_t *header=NULL; /* Index header for message type */ H5SM_mesg_key_t key; /* Key for looking up message */ H5SM_sohm_t message; /* Shared message returned from callback */ + H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + hsize_t table_size; /* Size of SOHM master table in file */ ssize_t index_num; /* Table index for message type */ size_t buf_size; /* Size of the encoded message */ void * encoding_buf = NULL; /* Buffer for encoded message */ herr_t ret_value = SUCCEED; /* Return value */ - H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI_NOINIT(H5SM_get_refcount) @@ -2418,9 +2416,9 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr, unsigned table_vers, unsigned num_indexes) { H5SM_master_table_t *table = NULL; /* SOHM master table */ + hsize_t table_size; /* Size of SOHM master table in file */ unsigned x; /* Counter variable */ herr_t ret_value = SUCCEED; /* Return value */ - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI(H5SM_table_debug, FAIL) @@ -2509,9 +2507,9 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr, H5SM_list_t *list = NULL; /* SOHM index list for message type (if in list form) */ H5SM_index_header_t header; /* A "false" header used to read the list */ + H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ unsigned x; /* Counter variable */ herr_t ret_value = SUCCEED; /* Return value */ - H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */ FUNC_ENTER_NOAPI(H5SM_list_debug, FAIL) @@ -2598,9 +2596,9 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo) { H5SM_master_table_t *table = NULL; /* SOHM master table */ H5HF_t *fheap = NULL; /* Fractal heap handle */ + hsize_t table_size; /* Size of SOHM master table in file */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - hsize_t table_size; /* Size of SOHM master table in file */ FUNC_ENTER_NOAPI(H5SM_ih_size, FAIL) diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 3d2c63c..35b13ba 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -54,13 +54,15 @@ /* Metadata cache (H5AC) callbacks */ -static void *H5SM_table_deserialize(haddr_t addr, size_t len, const void *image, const void *udata, hbool_t *dirty); +static void *H5SM_table_deserialize(haddr_t addr, size_t len, const void *image, + void *udata, hbool_t *dirty); static herr_t H5SM_table_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5SM_table_free_icr(haddr_t addr, size_t len, void *thing); -static void *H5SM_list_deserialize(haddr_t addr, size_t len, const void *image, const void *udata, hbool_t *dirty); +static void *H5SM_list_deserialize(haddr_t addr, size_t len, const void *image, + void *udata, hbool_t *dirty); static herr_t H5SM_list_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); @@ -116,19 +118,14 @@ const H5AC2_class_t H5AC2_SOHM_LIST[1] = {{ * Programmer: James Laird * November 6, 2006 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * June 26, 2008 - * Converted from H5SM_table_load() - * *------------------------------------------------------------------------- */ static void * H5SM_table_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, const void *_udata, hbool_t UNUSED *dirty) + const void *image, void *_udata, hbool_t UNUSED *dirty) { H5SM_master_table_t *table = NULL; - const H5F_t *f = (const H5F_t *)_udata; /* File pointer */ + H5F_t *f = (H5F_t *)_udata; /* File pointer */ const uint8_t *p; /* Pointer into input buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -241,11 +238,6 @@ done: * Programmer: James Laird * November 6, 2006 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * June 27, 2008 - * Converted from H5SM_table_flush() - * *------------------------------------------------------------------------- */ static herr_t @@ -254,12 +246,11 @@ H5SM_table_serialize(const H5F_t * f, hid_t UNUSED dxlp_id, haddr_t UNUSED addr, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ uint8_t *p; /* Pointer into raw data buffer */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t x; /* Counter variable */ - FUNC_ENTER_NOAPI_NOINIT(H5SM_table_serialize) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_table_serialize) /* check arguments */ HDassert(f); @@ -310,9 +301,9 @@ H5SM_table_serialize(const H5F_t * f, hid_t UNUSED dxlp_id, haddr_t UNUSED addr, H5F_addr_encode(f, &p, table->indexes[x].heap_addr); } /* end for */ - /* Compute checksum on buffer */ - computed_chksum = H5_checksum_metadata(image, (len - H5SM_SIZEOF_CHECKSUM), 0); - UINT32ENCODE(p, computed_chksum); + /* Compute checksum on buffer */ + computed_chksum = H5_checksum_metadata(image, (len - H5SM_SIZEOF_CHECKSUM), 0); + UINT32ENCODE(p, computed_chksum); /* Reset the cache flags for this operation (metadata not resize or renamed) */ *flags = 0; @@ -320,8 +311,7 @@ H5SM_table_serialize(const H5F_t * f, hid_t UNUSED dxlp_id, haddr_t UNUSED addr, /* Sanity check */ HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM_table_serialize() */ @@ -366,21 +356,16 @@ H5SM_table_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * Programmer: James Laird * November 6, 2006 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * June 27, 2008 - * Converted from H5SM_list_load() - * *------------------------------------------------------------------------- */ static void * H5SM_list_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, - const void *_udata, hbool_t UNUSED *dirty) + void *_udata, hbool_t UNUSED *dirty) { H5SM_list_t *list; /* The SOHM list being read in */ - const H5SM_list_cache_ud_t *udata = (const H5SM_list_cache_ud_t *)_udata; /* User data for callback */ + H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ size_t size; /* Size of SOHM list on disk */ - uint8_t *p; /* Pointer into input buffer */ + const uint8_t *p; /* Pointer into input buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t x; /* Counter variable for messages in list */ @@ -424,6 +409,9 @@ H5SM_list_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, UINT32DECODE(p, stored_chksum); /* Sanity check */ + HDassert((size_t)(p - (const uint8_t *)image) <= len); + + /* Sanity check */ HDassert((size_t)(p - (const uint8_t *)image) == size); /* Compute checksum on entire header */ @@ -440,15 +428,12 @@ H5SM_list_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, /* Set return value */ ret_value = list; - /* Sanity check */ - HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); - done: /* Release resources */ if(!ret_value && list) { if(list->messages) - H5FL_ARR_FREE(H5SM_sohm_t, list->messages); - H5FL_FREE(H5SM_list_t, list); + list->messages = H5FL_ARR_FREE(H5SM_sohm_t, list->messages); + list = H5FL_FREE(H5SM_list_t, list); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -466,11 +451,6 @@ done: * Programmer: James Laird * November 6, 2006 * - * Changes: Mike McGreevy - * mcgreevy@hdfgroup.org - * June 27, 2008 - * Converted from H5SM_list_flush() - * *------------------------------------------------------------------------- */ static herr_t @@ -479,12 +459,12 @@ H5SM_list_serialize(const H5F_t * f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5SM_list_t *list = (H5SM_list_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ uint8_t *p; /* Pointer into raw data buffer */ size_t size; /* Header size on disk */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t mesgs_written; /* Number of messages written to list */ size_t x; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5SM_list_serialize) diff --git a/src/H5SMtest.c b/src/H5SMtest.c index dc19287..b72aabb 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -80,8 +80,8 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id, size_t *mesg_count) { H5SM_master_table_t *table = NULL; /* SOHM master table */ - herr_t ret_value = SUCCEED; /* Return value */ hsize_t table_size; /* Size of SOHM master table in file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5SM_get_mesg_count_test) diff --git a/src/H5T.c b/src/H5T.c index 9b6ff94..98597cc 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -28,6 +28,7 @@ #include "H5private.h" /*generic functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Dprivate.h" /*datasets (for H5Tcopy) */ #include "H5Eprivate.h" /*error handling */ #include "H5Fprivate.h" /* Files */ @@ -38,7 +39,6 @@ #include "H5MMprivate.h" /*memory management */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Tpkg.h" /*data-type functions */ -#include "H5AC2private.h" /* Metadata cache */ /* Check for header needed for SGI floating-point code */ #ifdef H5_HAVE_SYS_FPU_H diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 96d756e..404b9ef 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -26,13 +26,13 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FOprivate.h" /* File objects */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5AC2private.h" /* Metadata cache */ /* Static local functions */ static H5T_t *H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id); diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index b0398d4..528eade 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -42,11 +42,11 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FOprivate.h" /* File objects */ #include "H5Iprivate.h" /* IDs */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5AC2private.h" /* Metadata cache */ #ifndef H5_NO_DEPRECATED_SYMBOLS diff --git a/src/H5err.txt b/src/H5err.txt index abc2eac..7b9fcb4 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -173,7 +173,6 @@ MINOR, CACHE, H5E_CANTEXPUNGE, Unable to expunge a metadata cache entry MINOR, CACHE, H5E_CANTRESIZE, Unable to resize a metadata cache entry MINOR, CACHE, H5E_CANTJOURNAL, Unable to write to journal file - # B-tree related errors MINOR, BTREE, H5E_NOTFOUND, Object not found MINOR, BTREE, H5E_EXISTS, Object already exists diff --git a/test/cache2_journal.c b/test/cache2_journal.c index bd1f862..dfa51bf 100644 --- a/test/cache2_journal.c +++ b/test/cache2_journal.c @@ -176,7 +176,7 @@ static void check_superblock_extensions(void); static void check_mdjsc_callbacks(void); -static herr_t test_mdjsc_callback(H5C2_mdj_config_t * config_ptr, +static herr_t test_mdjsc_callback(const H5C2_mdj_config_t * config_ptr, hid_t dxpl_id, void * data_ptr); @@ -1972,7 +1972,7 @@ open_existing_file_for_journaling(const char * hdf_file_name, "Bad param(s) on entry to open_existing_file_for_journaling().\n"; pass2 = FALSE; } - else if ( strlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + else if ( HDstrlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { failure_mssg2 = "journal file name too long.\n"; pass2 = FALSE; @@ -2030,7 +2030,7 @@ open_existing_file_for_journaling(const char * hdf_file_name, /* set journaling config fields to taste */ jnl_config.enable_journaling = TRUE; - strcpy(jnl_config.journal_file_path, journal_file_name); + HDstrcpy(jnl_config.journal_file_path, journal_file_name); jnl_config.journal_recovered = FALSE; jnl_config.jbrb_buf_size = (8 * 1024); @@ -2397,14 +2397,14 @@ setup_cache_for_journaling(const char * hdf_file_name, "Bad param(s) on entry to setup_cache_for_journaling().\n"; pass2 = FALSE; } - else if ( strlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) + else if ( HDstrlen(journal_file_name) > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { failure_mssg2 = "journal file name too long.\n"; pass2 = FALSE; } else { - strcpy(jnl_config.journal_file_path, journal_file_name); + HDstrcpy(jnl_config.journal_file_path, journal_file_name); if ( verbose ) { @@ -3263,7 +3263,7 @@ mdj_smoke_check_00(hbool_t human_readable) "testfiles/cache2_journal_bsc00_018.jnl", NULL }; - char * ((* testfiles)[]); + const char **testfiles; char filename[512]; char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; hbool_t testfile_missing = FALSE; @@ -3279,14 +3279,14 @@ mdj_smoke_check_00(hbool_t human_readable) if ( human_readable ) { - testfiles = &human_readable_testfiles; + testfiles = human_readable_testfiles; /* set update_architypes to TRUE to generate new architype files */ update_architypes = FALSE; TESTING("human readable mdj smoke check 00 -- general coverage"); } else { - testfiles = &binary_testfiles; + testfiles = binary_testfiles; /* set update_architypes to TRUE to generate new architype files */ update_architypes = TRUE; TESTING("binary mdj smoke check 00 -- general coverage"); @@ -3325,7 +3325,7 @@ mdj_smoke_check_00(hbool_t human_readable) pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; @@ -3373,13 +3373,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[0]); + copy_file(journal_filename, testfiles[0]); } - if ( file_exists((*testfiles)[0]) ) { + if ( file_exists(testfiles[0]) ) { - verify_journal_contents(journal_filename, (*testfiles)[0], - human_readable); + verify_journal_contents(journal_filename, testfiles[0], human_readable); } else { @@ -3454,13 +3453,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[1]); + copy_file(journal_filename, testfiles[1]); } - if ( file_exists((*testfiles)[1]) ) { + if ( file_exists(testfiles[1]) ) { - verify_journal_contents(journal_filename, (*testfiles)[1], - human_readable); + verify_journal_contents(journal_filename, testfiles[1], human_readable); } else { @@ -3503,13 +3501,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[2]); + copy_file(journal_filename, testfiles[2]); } - if ( file_exists((*testfiles)[2]) ) { + if ( file_exists(testfiles[2]) ) { - verify_journal_contents(journal_filename, (*testfiles)[2], - human_readable); + verify_journal_contents(journal_filename, testfiles[2], human_readable); } else { @@ -3542,13 +3539,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[3]); + copy_file(journal_filename, testfiles[3]); } - if ( file_exists((*testfiles)[3]) ) { + if ( file_exists(testfiles[3]) ) { - verify_journal_contents(journal_filename, (*testfiles)[3], - human_readable); + verify_journal_contents(journal_filename, testfiles[3], human_readable); } else { @@ -3591,13 +3587,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[4]); + copy_file(journal_filename, testfiles[4]); } - if ( file_exists((*testfiles)[4]) ) { + if ( file_exists(testfiles[4]) ) { - verify_journal_contents(journal_filename, (*testfiles)[4], - human_readable); + verify_journal_contents(journal_filename, testfiles[4], human_readable); } else { @@ -3645,13 +3640,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[5]); + copy_file(journal_filename, testfiles[5]); } - if ( file_exists((*testfiles)[5]) ) { + if ( file_exists(testfiles[5]) ) { - verify_journal_contents(journal_filename, (*testfiles)[5], - human_readable); + verify_journal_contents(journal_filename, testfiles[5], human_readable); } else { @@ -3685,13 +3679,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[6]); + copy_file(journal_filename, testfiles[6]); } - if ( file_exists((*testfiles)[6]) ) { + if ( file_exists(testfiles[6]) ) { - verify_journal_contents(journal_filename, (*testfiles)[6], - human_readable); + verify_journal_contents(journal_filename, testfiles[6], human_readable); } else { @@ -3737,13 +3730,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[7]); + copy_file(journal_filename, testfiles[7]); } - if ( file_exists((*testfiles)[7]) ) { + if ( file_exists(testfiles[7]) ) { - verify_journal_contents(journal_filename, (*testfiles)[7], - human_readable); + verify_journal_contents(journal_filename, testfiles[7], human_readable); } else { @@ -3801,13 +3793,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[8]); + copy_file(journal_filename, testfiles[8]); } - if ( file_exists((*testfiles)[8]) ) { + if ( file_exists(testfiles[8]) ) { - verify_journal_contents(journal_filename, (*testfiles)[8], - human_readable); + verify_journal_contents(journal_filename, testfiles[8], human_readable); } else { @@ -3868,13 +3859,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[9]); + copy_file(journal_filename, testfiles[9]); } - if ( file_exists((*testfiles)[9]) ) { + if ( file_exists(testfiles[9]) ) { - verify_journal_contents(journal_filename, (*testfiles)[9], - human_readable); + verify_journal_contents(journal_filename, testfiles[9], human_readable); } else { @@ -3939,13 +3929,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[10]); + copy_file(journal_filename, testfiles[10]); } - if ( file_exists((*testfiles)[10]) ) { + if ( file_exists(testfiles[10]) ) { - verify_journal_contents(journal_filename, (*testfiles)[10], - human_readable); + verify_journal_contents(journal_filename, testfiles[10], human_readable); } else { @@ -3995,13 +3984,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[11]); + copy_file(journal_filename, testfiles[11]); } - if ( file_exists((*testfiles)[11]) ) { + if ( file_exists(testfiles[11]) ) { - verify_journal_contents(journal_filename, (*testfiles)[11], - human_readable); + verify_journal_contents(journal_filename, testfiles[11], human_readable); } else { @@ -4097,13 +4085,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[12]); + copy_file(journal_filename, testfiles[12]); } - if ( file_exists((*testfiles)[12]) ) { + if ( file_exists(testfiles[12]) ) { - verify_journal_contents(journal_filename, (*testfiles)[12], - human_readable); + verify_journal_contents(journal_filename, testfiles[12], human_readable); } else { @@ -4127,13 +4114,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[13]); + copy_file(journal_filename, testfiles[13]); } - if ( file_exists((*testfiles)[13]) ) { + if ( file_exists(testfiles[13]) ) { - verify_journal_contents(journal_filename, (*testfiles)[13], - human_readable); + verify_journal_contents(journal_filename, testfiles[13], human_readable); } else { @@ -4159,13 +4145,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[14]); + copy_file(journal_filename, testfiles[14]); } - if ( file_exists((*testfiles)[14]) ) { + if ( file_exists(testfiles[14]) ) { - verify_journal_contents(journal_filename, (*testfiles)[14], - human_readable); + verify_journal_contents(journal_filename, testfiles[14], human_readable); } else { @@ -4214,13 +4199,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[15]); + copy_file(journal_filename, testfiles[15]); } - if ( file_exists((*testfiles)[15]) ) { + if ( file_exists(testfiles[15]) ) { - verify_journal_contents(journal_filename, (*testfiles)[15], - human_readable); + verify_journal_contents(journal_filename, testfiles[15], human_readable); } else { @@ -4246,13 +4230,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[16]); + copy_file(journal_filename, testfiles[16]); } - if ( file_exists((*testfiles)[16]) ) { + if ( file_exists(testfiles[16]) ) { - verify_journal_contents(journal_filename, (*testfiles)[16], - human_readable); + verify_journal_contents(journal_filename, testfiles[16], human_readable); } else { @@ -4318,13 +4301,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[17]); + copy_file(journal_filename, testfiles[17]); } - if ( file_exists((*testfiles)[17]) ) { + if ( file_exists(testfiles[17]) ) { - verify_journal_contents(journal_filename, (*testfiles)[17], - human_readable); + verify_journal_contents(journal_filename, testfiles[17], human_readable); } else { @@ -4440,7 +4422,7 @@ mdj_smoke_check_00(hbool_t human_readable) /* set journaling config fields to taste */ jnl_config.enable_journaling = TRUE; - strcpy(jnl_config.journal_file_path, journal_filename); + HDstrcpy(jnl_config.journal_file_path, journal_filename); jnl_config.journal_recovered = FALSE; jnl_config.jbrb_buf_size = (8 * 1024); @@ -4480,13 +4462,12 @@ mdj_smoke_check_00(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[18]); + copy_file(journal_filename, testfiles[18]); } - if ( file_exists((*testfiles)[18]) ) { + if ( file_exists(testfiles[18]) ) { - verify_journal_contents(journal_filename, (*testfiles)[18], - human_readable); + verify_journal_contents(journal_filename, testfiles[18], human_readable); } else { @@ -4615,7 +4596,7 @@ mdj_smoke_check_01(hbool_t human_readable) "testfiles/cache2_journal_bsc01_004.jnl", NULL }; - char * ((* testfiles)[]); + const char **testfiles; char filename[512]; char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; hbool_t testfile_missing = FALSE; @@ -4636,14 +4617,14 @@ mdj_smoke_check_01(hbool_t human_readable) if ( human_readable ) { - testfiles = &human_readable_testfiles; + testfiles = human_readable_testfiles; /* set update_architypes to TRUE to generate new architype files */ update_architypes = FALSE; TESTING("hr mdj smoke check 01 -- jnl clean ins, prot, unprot, del, ren"); } else { - testfiles = &binary_testfiles; + testfiles = binary_testfiles; /* set update_architypes to TRUE to generate new architype files */ update_architypes = FALSE; TESTING("b mdj smoke check 01 -- jnl clean ins, prot, unprot, del, ren"); @@ -4682,7 +4663,7 @@ mdj_smoke_check_01(hbool_t human_readable) pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; @@ -4749,13 +4730,12 @@ mdj_smoke_check_01(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[0]); + copy_file(journal_filename, testfiles[0]); } - if ( file_exists((*testfiles)[0]) ) { + if ( file_exists(testfiles[0]) ) { - verify_journal_contents(journal_filename, (*testfiles)[0], - human_readable); + verify_journal_contents(journal_filename, testfiles[0], human_readable); } else { @@ -4795,13 +4775,12 @@ mdj_smoke_check_01(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[1]); + copy_file(journal_filename, testfiles[1]); } - if ( file_exists((*testfiles)[1]) ) { + if ( file_exists(testfiles[1]) ) { - verify_journal_contents(journal_filename, (*testfiles)[1], - human_readable); + verify_journal_contents(journal_filename, testfiles[1], human_readable); } else { @@ -4841,13 +4820,12 @@ mdj_smoke_check_01(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[2]); + copy_file(journal_filename, testfiles[2]); } - if ( file_exists((*testfiles)[2]) ) { + if ( file_exists(testfiles[2]) ) { - verify_journal_contents(journal_filename, (*testfiles)[2], - human_readable); + verify_journal_contents(journal_filename, testfiles[2], human_readable); } else { @@ -4882,13 +4860,12 @@ mdj_smoke_check_01(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[3]); + copy_file(journal_filename, testfiles[3]); } - if ( file_exists((*testfiles)[3]) ) { + if ( file_exists(testfiles[3]) ) { - verify_journal_contents(journal_filename, (*testfiles)[3], - human_readable); + verify_journal_contents(journal_filename, testfiles[3], human_readable); } else { @@ -4923,13 +4900,12 @@ mdj_smoke_check_01(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[4]); + copy_file(journal_filename, testfiles[4]); } - if ( file_exists((*testfiles)[4]) ) { + if ( file_exists(testfiles[4]) ) { - verify_journal_contents(journal_filename, (*testfiles)[4], - human_readable); + verify_journal_contents(journal_filename, testfiles[4], human_readable); } else { @@ -5023,7 +4999,7 @@ mdj_smoke_check_02(hbool_t human_readable) "testfiles/cache2_journal_bsc02_004.jnl", NULL }; - char * ((* testfiles)[]); + const char **testfiles; char filename[512]; char journal_filename[H5AC2__MAX_JOURNAL_FILE_NAME_LEN + 1]; hbool_t testfile_missing = FALSE; @@ -5044,14 +5020,14 @@ mdj_smoke_check_02(hbool_t human_readable) if ( human_readable ) { - testfiles = &human_readable_testfiles; + testfiles = human_readable_testfiles; /* set update_architypes to TRUE to generate new architype files */ update_architypes = FALSE; TESTING("hr mdj smoke check 02 -- jnl dirty ins, prot, unprot, del, ren"); } else { - testfiles = &binary_testfiles; + testfiles = binary_testfiles; /* set update_architypes to TRUE to generate new architype files */ update_architypes = FALSE; TESTING("b mdj smoke check 02 -- jnl dirty ins, prot, unprot, del, ren"); @@ -5066,8 +5042,7 @@ mdj_smoke_check_02(hbool_t human_readable) /* setup the file name */ if ( pass2 ) { - if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, sizeof(filename)) - == NULL ) { + if ( h5_fixname(FILENAMES[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (1).\n"; @@ -5084,14 +5059,12 @@ mdj_smoke_check_02(hbool_t human_readable) /* setup the journal file name */ if ( pass2 ) { - if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, - sizeof(journal_filename)) == NULL ) { + if ( h5_fixname(FILENAMES[3], H5P_DEFAULT, journal_filename, sizeof(journal_filename)) == NULL ) { pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= - H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; failure_mssg2 = "journal file name too long.\n"; @@ -5157,13 +5130,12 @@ mdj_smoke_check_02(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[0]); + copy_file(journal_filename, testfiles[0]); } - if ( file_exists((*testfiles)[0]) ) { + if ( file_exists(testfiles[0]) ) { - verify_journal_contents(journal_filename, (*testfiles)[0], - human_readable); + verify_journal_contents(journal_filename, testfiles[0], human_readable); } else { @@ -5203,13 +5175,12 @@ mdj_smoke_check_02(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[1]); + copy_file(journal_filename, testfiles[1]); } - if ( file_exists((*testfiles)[1]) ) { + if ( file_exists(testfiles[1]) ) { - verify_journal_contents(journal_filename, (*testfiles)[1], - human_readable); + verify_journal_contents(journal_filename, testfiles[1], human_readable); } else { @@ -5249,13 +5220,12 @@ mdj_smoke_check_02(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[2]); + copy_file(journal_filename, testfiles[2]); } - if ( file_exists((*testfiles)[2]) ) { + if ( file_exists(testfiles[2]) ) { - verify_journal_contents(journal_filename, (*testfiles)[2], - human_readable); + verify_journal_contents(journal_filename, testfiles[2], human_readable); } else { @@ -5290,13 +5260,12 @@ mdj_smoke_check_02(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[3]); + copy_file(journal_filename, testfiles[3]); } - if ( file_exists((*testfiles)[3]) ) { + if ( file_exists(testfiles[3]) ) { - verify_journal_contents(journal_filename, (*testfiles)[3], - human_readable); + verify_journal_contents(journal_filename, testfiles[3], human_readable); } else { @@ -5331,13 +5300,12 @@ mdj_smoke_check_02(hbool_t human_readable) if ( update_architypes ) { - copy_file(journal_filename, (*testfiles)[4]); + copy_file(journal_filename, testfiles[4]); } - if ( file_exists((*testfiles)[4]) ) { + if ( file_exists(testfiles[4]) ) { - verify_journal_contents(journal_filename, (*testfiles)[4], - human_readable); + verify_journal_contents(journal_filename, testfiles[4], human_readable); } else { @@ -5582,7 +5550,7 @@ mdj_api_example_test(hbool_t human_readable) pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; @@ -5681,7 +5649,7 @@ mdj_api_example_test(hbool_t human_readable) jnl_config_0.enable_journaling = TRUE; - strcpy(jnl_config_0.journal_file_path, journal_filename); + HDstrcpy(jnl_config_0.journal_file_path, journal_filename); /* jnl_config_0.journal_recovered should always be FALSE unless * you are writing a new journal recovery tool, and need to @@ -5966,8 +5934,8 @@ mdj_api_example_test(hbool_t human_readable) } /* select on disk hyperslab */ - offset[0] = i; /*offset of hyperslab in file*/ - offset[1] = j; + offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ + offset[1] = (hsize_t)j; a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ a_size[1] = CHUNK_SIZE; status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, @@ -6053,8 +6021,8 @@ mdj_api_example_test(hbool_t human_readable) j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; /* select on disk hyperslab */ - offset[0] = i; /*offset of hyperslab in file*/ - offset[1] = j; + offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ + offset[1] = (hsize_t)j; a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ a_size[1] = CHUNK_SIZE; status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, @@ -6183,8 +6151,8 @@ mdj_api_example_test(hbool_t human_readable) j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; /* select on disk hyperslab */ - offset[0] = i; /*offset of hyperslab in file*/ - offset[1] = j; + offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ + offset[1] = (hsize_t)j; a_size[0] = CHUNK_SIZE; /*size of hyperslab*/ a_size[1] = CHUNK_SIZE; status = H5Sselect_hyperslab(filespace_ids[m], H5S_SELECT_SET, @@ -6621,7 +6589,7 @@ check_superblock_extensions(void) file_ptr->shared->mdc_jnl_enabled = TRUE; file_ptr->shared->mdc_jnl_magic = 123; - file_ptr->shared->mdc_jnl_file_name_len = strlen("abc"); + file_ptr->shared->mdc_jnl_file_name_len = HDstrlen("abc"); HDstrncpy(file_ptr->shared->mdc_jnl_file_name, "abc", file_ptr->shared->mdc_jnl_file_name_len + 1); @@ -6709,12 +6677,12 @@ check_superblock_extensions(void) failure_mssg2 = "unexpected mdc_jnl_magic(1).\n"; } else if ( file_ptr->shared->mdc_jnl_file_name_len != - (size_t)strlen("abc") ) { + (size_t)HDstrlen("abc") ) { pass2 = FALSE; failure_mssg2 = "unexpected mdc_jnl_file_name_len (1).\n"; - } else if ( strcmp(file_ptr->shared->mdc_jnl_file_name, "abc") != 0 ) { + } else if ( HDstrcmp(file_ptr->shared->mdc_jnl_file_name, "abc") != 0 ) { pass2 = FALSE; failure_mssg2 = "unexpected mdc_jnl_file_name (1).\n"; @@ -6806,7 +6774,7 @@ check_superblock_extensions(void) file_ptr->shared->mdc_jnl_enabled = TRUE; file_ptr->shared->mdc_jnl_magic = 456; - file_ptr->shared->mdc_jnl_file_name_len = strlen("qrst"); + file_ptr->shared->mdc_jnl_file_name_len = HDstrlen("qrst"); HDstrncpy(file_ptr->shared->mdc_jnl_file_name, "qrst", file_ptr->shared->mdc_jnl_file_name_len + 1); @@ -6824,7 +6792,7 @@ check_superblock_extensions(void) file_ptr->shared->mdc_jnl_enabled = TRUE; file_ptr->shared->mdc_jnl_magic = 789; - file_ptr->shared->mdc_jnl_file_name_len = strlen("z"); + file_ptr->shared->mdc_jnl_file_name_len = HDstrlen("z"); HDstrncpy(file_ptr->shared->mdc_jnl_file_name, "z", file_ptr->shared->mdc_jnl_file_name_len + 1); @@ -6900,12 +6868,12 @@ check_superblock_extensions(void) failure_mssg2 = "unexpected mdc_jnl_magic(2).\n"; } else if ( file_ptr->shared->mdc_jnl_file_name_len != - (size_t)strlen("z") ) { + (size_t)HDstrlen("z") ) { pass2 = FALSE; failure_mssg2 = "unexpected mdc_jnl_file_name_len (2).\n"; - } else if ( strcmp(file_ptr->shared->mdc_jnl_file_name, "z") != 0 ) { + } else if ( HDstrcmp(file_ptr->shared->mdc_jnl_file_name, "z") != 0 ) { pass2 = FALSE; failure_mssg2 = "unexpected mdc_jnl_file_name (2).\n"; @@ -7091,8 +7059,8 @@ static hbool_t callback_test_cache_is_dirty = FALSE; static int callback_test_null_data_ptr_count = 0; static herr_t -test_mdjsc_callback(H5C2_mdj_config_t * config_ptr, - hid_t dxpl_id, +test_mdjsc_callback(const H5C2_mdj_config_t * config_ptr, + hid_t UNUSED dxpl_id, void * data_ptr) { if ( config_ptr == NULL ) @@ -7688,7 +7656,7 @@ verify_mdjsc_callback_error_rejection(void) pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; @@ -8082,7 +8050,7 @@ verify_mdjsc_callback_execution(void) pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; @@ -8237,7 +8205,7 @@ verify_mdjsc_callback_execution(void) /* set journaling config fields to taste */ jnl_config.enable_journaling = TRUE; - strcpy(jnl_config.journal_file_path, journal_filename); + HDstrcpy(jnl_config.journal_file_path, journal_filename); jnl_config.journal_recovered = FALSE; jnl_config.jbrb_buf_size = (8 * 1024); @@ -8533,7 +8501,7 @@ verify_mdjsc_callback_execution(void) /* set journaling config fields to taste */ jnl_config.enable_journaling = TRUE; - strcpy(jnl_config.journal_file_path, journal_filename); + HDstrcpy(jnl_config.journal_file_path, journal_filename); jnl_config.journal_recovered = FALSE; jnl_config.jbrb_buf_size = (8 * 1024); @@ -8684,7 +8652,7 @@ verify_mdjsc_callback_execution(void) /* set journaling config fields to taste */ jnl_config.enable_journaling = TRUE; - strcpy(jnl_config.journal_file_path, journal_filename); + HDstrcpy(jnl_config.journal_file_path, journal_filename); jnl_config.journal_recovered = FALSE; jnl_config.jbrb_buf_size = (8 * 1024); @@ -9053,7 +9021,7 @@ verify_mdjsc_callback_execution(void) /* set journaling config fields to taste */ jnl_config.enable_journaling = TRUE; - strcpy(jnl_config.journal_file_path, journal_filename); + HDstrcpy(jnl_config.journal_file_path, journal_filename); jnl_config.journal_recovered = FALSE; jnl_config.jbrb_buf_size = (8 * 1024); @@ -9400,7 +9368,7 @@ verify_mdjsc_callback_registration_deregistration(void) pass2 = FALSE; failure_mssg2 = "h5_fixname() failed (2).\n"; } - else if ( strlen(journal_filename) >= + else if ( HDstrlen(journal_filename) >= H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { pass2 = FALSE; @@ -11471,15 +11439,12 @@ check_binary_message_format(void) const char * fcn_name = "check_binary_message_format()"; char filename[512]; char time_buf[32]; - char verify[9][500]; - char from_journal[9][500]; char * p; hbool_t show_progress = FALSE; int32_t checkpoint = 1; int i; int fd; herr_t result; - FILE * readback; H5C2_jbrb_t jbrb_struct; time_t current_date; @@ -11910,10 +11875,10 @@ check_binary_message_format(void) verify_journal_msg( /* fd */ fd, - /* expected_msg */ expected_header, + /* expected_msg */ (uint8_t *)expected_header, /* expected msg len */ expected_header_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual headers differ.", + /* mismatch failure msg */ "expected and actual headers differ.", /* read failure msg */ "error reading header.", /* eof failure msg */ "encountered eof in header msg.", /* not last msg failure */ NULL); @@ -11923,7 +11888,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_1, /* expected msg len */ expected_msg_1_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 1 differ.", + /* mismatch failure msg */ "expected and actual msg 1 differ.", /* read failure msg */ "error reading msg 1.", /* eof failure msg */ "encountered eof in msg 1.", /* not last msg failure */ NULL); @@ -11933,7 +11898,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_2, /* expected msg len */ expected_msg_2_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 2 differ.", + /* mismatch failure msg */ "expected and actual msg 2 differ.", /* read failure msg */ "error reading msg 2.", /* eof failure msg */ "encountered eof in msg 2", /* not last msg failure */ NULL); @@ -11943,7 +11908,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_3, /* expected msg len */ expected_msg_3_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 3 differ.", + /* mismatch failure msg */ "expected and actual msg 3 differ.", /* read failure msg */ "error reading msg 3.", /* eof failure msg */ "encountered eof in msg 3", /* not last msg failure */ NULL); @@ -11953,7 +11918,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_4, /* expected msg len */ expected_msg_4_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 4 differ.", + /* mismatch failure msg */ "expected and actual msg 4 differ.", /* read failure msg */ "error reading msg 4.", /* eof failure msg */ "encountered eof in msg 4", /* not last msg failure */ NULL); @@ -11963,7 +11928,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_5, /* expected msg len */ expected_msg_5_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 5 differ.", + /* mismatch failure msg */ "expected and actual msg 5 differ.", /* read failure msg */ "error reading msg 5.", /* eof failure msg */ "encountered eof in msg 5", /* not last msg failure */ NULL); @@ -11973,7 +11938,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_6, /* expected msg len */ expected_msg_6_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 6 differ.", + /* mismatch failure msg */ "expected and actual msg 6 differ.", /* read failure msg */ "error reading msg 6.", /* eof failure msg */ "encountered eof in msg 6", /* not last msg failure */ NULL); @@ -11983,7 +11948,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_7, /* expected msg len */ expected_msg_7_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg7 differ.", + /* mismatch failure msg */ "expected and actual msg7 differ.", /* read failure msg */ "error reading msg 7.", /* eof failure msg */ "encountered eof in msg 7", /* not last msg failure */ NULL); @@ -11993,7 +11958,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_8, /* expected msg len */ expected_msg_8_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 8 differ.", + /* mismatch failure msg */ "expected and actual msg 8 differ.", /* read failure msg */ "error reading msg 8.", /* eof failure msg */ "encountered eof in msg 8", /* not last msg failure */ NULL); @@ -12003,7 +11968,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_9, /* expected msg len */ expected_msg_9_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 9 differ.", + /* mismatch failure msg */ "expected and actual msg 9 differ.", /* read failure msg */ "error reading msg 9.", /* eof failure msg */ "encountered eof in msg 9", /* not last msg failure */ NULL); @@ -12013,7 +11978,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_10, /* expected msg len */ expected_msg_10_len, /* last_msg */ TRUE, - /* mismatch failuer msg */ "expected and actual msg 10 differ.", + /* mismatch failure msg */ "expected and actual msg 10 differ.", /* read failure msg */ "error reading msg 10.", /* eof failure msg */ "encountered eof in msg 10", /* not last msg failure */ "msg 10 does not end file"); @@ -12270,10 +12235,10 @@ check_binary_message_format(void) verify_journal_msg( /* fd */ fd, - /* expected_msg */ expected_header, + /* expected_msg */ (uint8_t *)expected_header, /* expected msg len */ expected_header_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual headers differ.", + /* mismatch failure msg */ "expected and actual headers differ.", /* read failure msg */ "error reading header.", /* eof failure msg */ "encountered eof in header msg.", /* not last msg failure */ NULL); @@ -12283,7 +12248,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_11, /* expected msg len */ expected_msg_11_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 11 differ.", + /* mismatch failure msg */ "expected and actual msg 11 differ.", /* read failure msg */ "error reading msg 11.", /* eof failure msg */ "encountered eof in msg 11.", /* not last msg failure */ NULL); @@ -12293,7 +12258,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_12, /* expected msg len */ expected_msg_12_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 12 differ.", + /* mismatch failure msg */ "expected and actual msg 12 differ.", /* read failure msg */ "error reading msg 12.", /* eof failure msg */ "encountered eof in msg 12", /* not last msg failure */ NULL); @@ -12303,7 +12268,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_13, /* expected msg len */ expected_msg_13_len, /* last_msg */ FALSE, - /* mismatch failuer msg */ "expected and actual msg 13 differ.", + /* mismatch failure msg */ "expected and actual msg 13 differ.", /* read failure msg */ "error reading msg 13.", /* eof failure msg */ "encountered eof in msg 13", /* not last msg failure */ NULL); @@ -12313,7 +12278,7 @@ check_binary_message_format(void) /* expected_msg */ expected_msg_14, /* expected msg len */ expected_msg_14_len, /* last_msg */ TRUE, - /* mismatch failuer msg */ "expected and actual msg 14 differ.", + /* mismatch failure msg */ "expected and actual msg 14 differ.", /* read failure msg */ "error reading msg 14.", /* eof failure msg */ "encountered eof in msg 14", /* not last msg failure */ "msg 14 does not end file"); diff --git a/test/testhdf5.c b/test/testhdf5.c index 668498a..95ec90c 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -44,7 +44,6 @@ main(int argc, char *argv[]) TestInit(argv[0], NULL, NULL); /* Tests are generally arranged from least to most complexity... */ - AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL); AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL); AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL); diff --git a/tools/h5recover/h5recover.c b/tools/h5recover/h5recover.c index 79449c1..711380f 100644 --- a/tools/h5recover/h5recover.c +++ b/tools/h5recover/h5recover.c @@ -3055,7 +3055,7 @@ get_jnl_header_info(char * file_path_ptr, indent1, file_path_ptr); } - // In the following call, the mode should be ignored. + /* In the following call, the mode should be ignored. */ file_ptr = HDfopen(file_path_ptr, "r"); if ( file_ptr == NULL ) { -- cgit v0.12