summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-07-17 21:04:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-07-17 21:04:44 (GMT)
commit814ad1cb42a824fc5a0b0b4d675aa7b4c6caec4c (patch)
treec02814849855790343ad1c2b421c73b3eaaf270d /src/H5O.c
parent4be636f4f00271f85802fbb6ef079146f2dbf7fb (diff)
downloadhdf5-814ad1cb42a824fc5a0b0b4d675aa7b4c6caec4c.zip
hdf5-814ad1cb42a824fc5a0b0b4d675aa7b4c6caec4c.tar.gz
hdf5-814ad1cb42a824fc5a0b0b4d675aa7b4c6caec4c.tar.bz2
[svn-r13986] Description:
Add flag to bypass (expensive) B-tree & heap size retrieval for internal calls to H5O_get_info(). Teted on: Mac OS X/32 10.4.10 (amazon) FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 1b5add7..c8c9d69 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -486,7 +486,7 @@ H5Oget_info(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
/* Retrieve the object's information */
- if(H5G_loc_info(&loc, name, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0)
+ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
done:
FUNC_LEAVE_API(ret_value)
@@ -550,7 +550,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_found = TRUE;
/* Retrieve the object's information */
- if(H5O_get_info(obj_loc.oloc, oinfo, H5AC_ind_dxpl_id) < 0)
+ if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, oinfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info")
done:
@@ -1827,7 +1827,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
+H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *oinfo)
{
H5O_t *oh = NULL; /* Object header */
H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
@@ -1859,14 +1859,16 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
if(H5O_obj_type_real(oh, &oinfo->type) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
- /* Retrieve btree and heap storage info */
- if(oinfo->type == H5O_TYPE_GROUP) {
- if(H5O_group_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve group btree & heap info")
- } else if(oinfo->type == H5O_TYPE_DATASET) {
- if(H5O_dset_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve chunked dataset btree info")
- }
+ /* Retrieve btree and heap storage info, if requested */
+ if(want_ih_info) {
+ if(oinfo->type == H5O_TYPE_GROUP) {
+ if(H5O_group_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve group btree & heap info")
+ } else if(oinfo->type == H5O_TYPE_DATASET) {
+ if(H5O_dset_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve chunked dataset btree info")
+ }
+ } /* end if */
/* Set the object's reference count */
oinfo->rc = oh->nlink;
@@ -1938,8 +1940,12 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
/* Retrieve # of attributes */
oinfo->num_attrs = H5O_attr_count_real(oloc->file, dxpl_id, oh);
- if((oinfo->num_attrs > 0) && (H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
+
+ /* Get B-tree & heap metadata storage size, if requested */
+ if(want_ih_info) {
+ if((oinfo->num_attrs > 0) && (H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
+ } /* end if */
/* Iterate over all the chunks, adding any gaps to the free space */
oinfo->hdr.space.total = 0;