diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-01-03 19:01:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-01-03 19:01:17 (GMT) |
commit | 136cefdf9116b910b6a46f1f649ee8b9cdc7fc68 (patch) | |
tree | 18b67bde577f74eab2a5519014daf99205c88902 /src/H5HFdbg.c | |
parent | 04d73e7a0c69839922cf78adcb04e2617fc0f5b9 (diff) | |
download | hdf5-136cefdf9116b910b6a46f1f649ee8b9cdc7fc68.zip hdf5-136cefdf9116b910b6a46f1f649ee8b9cdc7fc68.tar.gz hdf5-136cefdf9116b910b6a46f1f649ee8b9cdc7fc68.tar.bz2 |
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5HFdbg.c')
-rw-r--r-- | src/H5HFdbg.c | 94 |
1 files changed, 52 insertions, 42 deletions
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 3a7288f..bbbe26f 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -394,7 +394,6 @@ 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_debug_iter_ud1_t udata; /* User data for callbacks */ 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 */ @@ -450,36 +449,43 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize the free space information for the heap */ - if(H5HF_space_start(hdr, dxpl_id) < 0) + if(H5HF_space_start(hdr, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") - /* Prepare user data for section iteration callback */ - udata.stream = stream; - udata.indent = indent; - udata.fwidth = fwidth; - udata.dblock_addr = dblock->block_off; - udata.dblock_size = block_size; - udata.marker = marker; - udata.sect_count = 0; - udata.amount_free = 0; - - /* Print header */ - HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); - - /* Iterate over the free space sections, to detect overlaps with this block */ - if(H5FS_sect_iterate(f, dxpl_id, hdr->fspace, H5HF_dblock_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") - - /* Close the free space information */ - if(H5HF_space_close(hdr, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") - - /* Keep the amount of space free */ - amount_free = udata.amount_free; - - /* Check for no free space */ - if(amount_free == 0) - HDfprintf(stream, "%*s<none>\n", indent + 3, ""); + /* If there is a free space manager for the heap, check for sections that overlap this block */ + if(hdr->fspace) { + H5HF_debug_iter_ud1_t udata; /* User data for callbacks */ + + /* Prepare user data for section iteration callback */ + udata.stream = stream; + udata.indent = indent; + udata.fwidth = fwidth; + udata.dblock_addr = dblock->block_off; + udata.dblock_size = block_size; + udata.marker = marker; + udata.sect_count = 0; + udata.amount_free = 0; + + /* Print header */ + HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); + + /* Iterate over the free space sections, to detect overlaps with this block */ + if(H5FS_sect_iterate(f, dxpl_id, hdr->fspace, H5HF_dblock_debug_cb, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + + /* Close the free space information */ + if(H5HF_space_close(hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + + /* Keep the amount of space free */ + amount_free = udata.amount_free; + + /* Check for no free space */ + if(amount_free == 0) + HDfprintf(stream, "%*s<none>\n", indent + 3, ""); + } /* end if */ + else + amount_free = 0; HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:", @@ -709,7 +715,6 @@ 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 */ - H5HF_debug_iter_ud2_t udata; /* User data for callbacks */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_sects_debug, FAIL) @@ -730,22 +735,27 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") /* Initialize the free space information for the heap */ - if(H5HF_space_start(hdr, dxpl_id) < 0) + if(H5HF_space_start(hdr, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") - /* Prepare user data for section iteration callback */ - udata.fspace = hdr->fspace; - udata.stream = stream; - udata.indent = indent; - udata.fwidth = fwidth; + /* If there is a free space manager for the heap, iterate over them */ + if(hdr->fspace) { + H5HF_debug_iter_ud2_t udata; /* User data for callbacks */ - /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, dxpl_id, hdr->fspace, H5HF_sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + /* Prepare user data for section iteration callback */ + udata.fspace = hdr->fspace; + udata.stream = stream; + udata.indent = indent; + udata.fwidth = fwidth; - /* Close the free space information */ - if(H5HF_space_close(hdr, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + /* Iterate over all the free space sections */ + if(H5FS_sect_iterate(f, dxpl_id, hdr->fspace, H5HF_sects_debug_cb, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + + /* Close the free space information */ + if(H5HF_space_close(hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + } /* end if */ done: if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0) |