summaryrefslogtreecommitdiffstats
path: root/src/H5HF.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/H5HF.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/H5HF.c')
-rw-r--r--src/H5HF.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/H5HF.c b/src/H5HF.c
index 768b7e7..8d65604 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -926,3 +926,88 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_delete() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5HF_fheap_info
+ *
+ * Purpose: Retrieve storage info for:
+ * 1. fractal heap
+ * 2. btree storage used by huge objects in fractal heap
+ * 3. free space storage info
+ *
+ * Return: non-negative on success, negative on error
+ *
+ * Programmer: Vailin Choi
+ * July 12 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_fheap_info(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, hsize_t *heap_size, hsize_t *huge_bt_size)
+{
+ H5HF_hdr_t *hdr = NULL;
+ herr_t ret_value = SUCCEED;
+ hsize_t meta_size = 0;
+ int reterr;
+
+ FUNC_ENTER_NOAPI(H5HF_fheap_info, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(H5F_addr_defined(fh_addr));
+ HDassert(heap_size);
+ HDassert(huge_bt_size);
+
+
+ /* Lock the heap header into memory */
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
+
+ *heap_size += hdr->heap_size;
+ *heap_size += hdr->man_alloc_size;
+ *heap_size += hdr->huge_size;
+
+ if(H5F_addr_defined(hdr->man_dtable.table_addr)) {
+ if (hdr->man_dtable.curr_root_rows != 0) {
+ reterr = H5HF_indirect_info(f, dxpl_id, hdr, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, heap_size);
+ if (reterr < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to get fractal heap storage info for indirect block")
+ }
+ }
+
+ /* get B-tree storage for huge objects in fractal heap */
+ if (H5F_addr_defined(hdr->huge_bt2_addr)) {
+ if (hdr->huge_ids_direct) {
+ if (hdr->filter_len > 0) {
+ if (H5B2_info_iterate(f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr, huge_bt_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ } else {
+ if (H5B2_info_iterate(f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr, huge_bt_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ }
+ } else {
+ if (hdr->filter_len > 0) {
+ if (H5B2_info_iterate(f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr, huge_bt_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ } else {
+ if (H5B2_info_iterate(f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, huge_bt_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+ }
+ }
+ }
+ if (H5F_addr_defined(hdr->fs_addr)) {
+ meta_size = 0;
+ if (H5FS_meta_info(f, dxpl_id, hdr->fs_addr, &meta_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
+ *heap_size += meta_size;
+ }
+
+done:
+ /* Unprotect the header, if an error occurred */
+ if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_fheap_info() */