summaryrefslogtreecommitdiffstats
path: root/src/H5B2int.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2007-07-13 21:12:25 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2007-07-13 21:12:25 (GMT)
commitd44b27ddcc66a8ed55f5069eabbf4c287ce1d99a (patch)
treeab22bfaa95add178894e6c649dc4b8aea0d196f4 /src/H5B2int.c
parent31a2af29ca7aa91fcd47eb018a02ff2e425c5b55 (diff)
downloadhdf5-d44b27ddcc66a8ed55f5069eabbf4c287ce1d99a.zip
hdf5-d44b27ddcc66a8ed55f5069eabbf4c287ce1d99a.tar.gz
hdf5-d44b27ddcc66a8ed55f5069eabbf4c287ce1d99a.tar.bz2
[svn-r13978] purpose:
New feature. Description: Added routines to report on the amount of storage for: 1) 1.6 btree and heap storage info for groups 2) 1.8 btree, fractal heap storage info for groups, attributes and SOHM table 3) btree storage for chunked datasets 4) 1.8 superblock extension size. Platform tested: h5committested.
Diffstat (limited to 'src/H5B2int.c')
-rw-r--r--src/H5B2int.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 5d71d43..20e4300 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -3304,4 +3304,63 @@ H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_shared_t *shared, H5B2_inter
return(0);
} /* end H5B2_assert_internal2() */
#endif /* H5B2_DEBUG */
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_info_iterate_node
+ *
+ * Purpose: Iterate over all the records from a B-tree node, collecting
+ * btree storage info.
+ *
+ * Return: non-negative on success, negative on error
+ *
+ * Programmer: Vailin Choi
+ * July 12 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_info_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
+const H5B2_node_ptr_t *curr_node, hsize_t *btree_size)
+{
+ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ herr_t ret_value = SUCCEED; /* Iterator return value */
+ H5B2_internal_t *internal = NULL; /* Pointer to internal node */
+ unsigned u; /* Local index */
+
+ FUNC_ENTER_NOAPI(H5B2_info_iterate_node, FAIL)
+
+ /* Check arguments. */
+ HDassert(f);
+ HDassert(bt2_shared);
+ HDassert(curr_node);
+ HDassert(btree_size);
+
+ /* Get the pointer to the shared B-tree info */
+ shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
+ HDassert(shared);
+
+
+ if(depth > 0) {
+ /* Lock the current B-tree node */
+ if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
+
+ if(depth>1) {
+ /* Descend into children */
+ for(u=0; u<internal->nrec+1; u++)
+ if(H5B2_info_iterate_node(f, dxpl_id, bt2_shared, (depth-1), &(internal->node_ptrs[u]), btree_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
+ } /* end if */
+ else /* depth is 1: count all the leaf nodes from this node */
+ *btree_size += (internal->nrec + 1) * shared->node_size;
+ } /* end if */
+
+ /* Count this node */
+ *btree_size += shared->node_size;
+done:
+ if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5B2_info_iterate_node() */