summaryrefslogtreecommitdiffstats
path: root/src/H5HFiblock.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/H5HFiblock.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/H5HFiblock.c')
-rw-r--r--src/H5HFiblock.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 7afa7c4..15c998c 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -1575,4 +1575,65 @@ HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iblock_delete() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5HF_indirect_info
+ *
+ * Purpose: Gather storage used for the indirect block in fractal heap
+ *
+ * Return: non-negative on success, negative on error
+ *
+ * Programmer: Vailin Choi
+ * July 12 2007
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_indirect_info(H5F_t *f, hid_t dxpl_id, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned nrows, hsize_t *heap_size)
+{
+ hbool_t did_protect;
+ H5HF_indirect_t *iblock; /* Pointer to indirect block */
+ size_t u, v;
+ int reterr;
+ int ret_value=SUCCEED;
+ FUNC_ENTER_NOAPI(H5HF_indirect_info, FAIL)
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(hdr);
+ HDassert(H5F_addr_defined(iblock_addr));
+ HDassert(heap_size);
+
+ if (NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, nrows, NULL, 0, FALSE, H5AC_READ, &did_protect)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block")
+
+ *heap_size += iblock->size;
+
+ /* Indirect entries in this indirect block */
+ if(iblock->nrows > hdr->man_dtable.max_direct_rows) {
+ unsigned first_row_bits; /* Number of bits used bit addresses in first row */
+ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */
+
+ first_row_bits = H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) +
+ H5V_log2_of2(hdr->man_dtable.cparam.width);
+ for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) {
+ num_indirect_rows = (H5V_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1;
+ for(v = 0; v < hdr->man_dtable.cparam.width; v++) {
+ size_t off = (u * hdr->man_dtable.cparam.width) + v;
+
+ if (H5F_addr_defined(iblock->ents[off].addr)) {
+ reterr = H5HF_indirect_info(f, dxpl_id, hdr, iblock->ents[off].addr, num_indirect_rows, heap_size);
+ if (reterr < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block")
+ } /* end if */
+ } /* end for v */
+ } /* end for u */
+ } /* end if */
+
+done:
+ if(H5HF_man_iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
+ FUNC_LEAVE_NOAPI(ret_value)
+}