summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5Fsuper.c2
-rw-r--r--src/H5Gdeprec.c3
-rw-r--r--src/H5Glink.c2
-rw-r--r--src/H5Gloc.c6
-rw-r--r--src/H5Gname.c2
-rw-r--r--src/H5Gnode.c2
-rw-r--r--src/H5Gprivate.h5
-rw-r--r--src/H5O.c32
-rw-r--r--src/H5Oprivate.h3
9 files changed, 34 insertions, 23 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 7d1a8ad..cbc5f72 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -996,7 +996,7 @@ H5F_super_ext_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_ext_size)
ext_loc.addr = f->shared->extension_addr;
/* Get object header info for superblock extension */
- if(H5O_get_info(&ext_loc, &oinfo, dxpl_id) < 0)
+ if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
/* Set the superblock extension size */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 2f6d4e5..69779ff 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -1052,7 +1052,8 @@ H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char UNUSED *name, const H5O_
H5O_info_t oinfo; /* Object information */
/* Go retrieve the object information */
- if(H5O_get_info(obj_loc->oloc, &oinfo, udata->dxpl_id) < 0)
+ /* (don't need index & heap info) */
+ if(H5O_get_info(obj_loc->oloc, udata->dxpl_id, FALSE, &oinfo) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
/* Get mapped object type */
diff --git a/src/H5Glink.c b/src/H5Glink.c
index da3e60d..fef0514 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -484,7 +484,7 @@ H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
/* Check if the object pointed by the soft link exists in the source file */
- if(H5G_loc_info(&grp_loc, tmp_src_lnk.u.soft.name, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) {
+ if(H5G_loc_info(&grp_loc, tmp_src_lnk.u.soft.name, FALSE, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) {
/* Convert soft link to hard link */
tmp_src_lnk.u.soft.name = H5MM_xfree(tmp_src_lnk.u.soft.name);
tmp_src_lnk.type = H5L_TYPE_HARD;
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 9740d02..20c8a08 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -73,6 +73,7 @@ typedef struct {
typedef struct {
/* downward */
hid_t dxpl_id; /* DXPL to use for operation */
+ hbool_t want_ih_info; /* Whether to retrieve the index & heap info */
/* upward */
H5O_info_t *oinfo; /* Object information to retrieve */
@@ -629,7 +630,7 @@ H5G_loc_info_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, const
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist")
/* Query object information */
- if(H5O_get_info(obj_loc->oloc, udata->oinfo, udata->dxpl_id) < 0)
+ if(H5O_get_info(obj_loc->oloc, udata->dxpl_id, udata->want_ih_info, udata->oinfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info")
done:
@@ -655,7 +656,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_loc_info(H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/,
+H5G_loc_info(H5G_loc_t *loc, const char *name, hbool_t want_ih_info, H5O_info_t *oinfo/*out*/,
hid_t lapl_id, hid_t dxpl_id)
{
H5G_loc_info_t udata; /* User data for traversal callback */
@@ -670,6 +671,7 @@ H5G_loc_info(H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/,
/* Set up user data for locating object */
udata.dxpl_id = dxpl_id;
+ udata.want_ih_info = want_ih_info;
udata.oinfo = oinfo;
/* Traverse group hierarchy to locate object */
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 7619644..a4635bc 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -1094,7 +1094,7 @@ H5G_refname_iterator(hid_t group, const char *name, const H5L_info_t *link_info,
/* Go retrieve the object information */
tmp_oloc.file = loc.oloc->file;
tmp_oloc.addr = link_info->u.address;
- if(H5O_get_info(&tmp_oloc, &oinfo, udata->dxpl_id) < 0)
+ if(H5O_get_info(&tmp_oloc, udata->dxpl_id, FALSE, &oinfo) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info")
/* If its ref count is > 1, we add it to the list of visited objects */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 5aa64c5..a1884ac 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -1785,7 +1785,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
link_name = (char *)H5HL_offset_into(f, heap, tmp_src_ent.cache.slink.lval_offset);
/* Check if the object pointed by the soft link exists in the source file */
- if(H5G_loc_info(&grp_loc, link_name, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) {
+ if(H5G_loc_info(&grp_loc, link_name, FALSE, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) {
tmp_src_ent.header = oinfo.addr;
src_ent = &tmp_src_ent;
} /* end if */
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 40d2df8..82b667b 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -197,8 +197,9 @@ H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name,
H5_DLL herr_t H5G_loc_find_by_idx(H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5G_loc_t *obj_loc/*out*/, hid_t lapl_id, hid_t dxpl_id);
-H5_DLL herr_t H5G_loc_info(H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/,
- hid_t lapl_id, hid_t dxpl_id);
+H5_DLL herr_t H5G_loc_info(H5G_loc_t *loc, const char *name,
+ hbool_t want_ih_info, H5O_info_t *oinfo/*out*/, hid_t lapl_id,
+ hid_t dxpl_id);
H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc);
H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc);
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;
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 2376113..120568e 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -531,7 +531,8 @@ H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh,
H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned mesg_flags);
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
-H5_DLL herr_t H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id);
+H5_DLL herr_t H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
+ H5O_info_t *oinfo);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
H5_DLL hid_t H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id);