summaryrefslogtreecommitdiffstats
path: root/src/H5HFspace.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-14 13:33:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-14 13:33:14 (GMT)
commit4dc989f28232245dbc2f52c1330346868099234e (patch)
treed063e00bd62d863f93e3ceed6f810c03c8b410a9 /src/H5HFspace.c
parentabd36a6f6ed8a19c2253209dd2f2632c1df34a29 (diff)
downloadhdf5-4dc989f28232245dbc2f52c1330346868099234e.zip
hdf5-4dc989f28232245dbc2f52c1330346868099234e.tar.gz
hdf5-4dc989f28232245dbc2f52c1330346868099234e.tar.bz2
[svn-r14083] Description:
Correct problem with fractal heap's free space size usage gathering routine, which was "poisoning the cache" by loading an incorrectly initialized piece of metadata from the file. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 6.2 (amazon)
Diffstat (limited to 'src/H5HFspace.c')
-rw-r--r--src/H5HFspace.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/H5HFspace.c b/src/H5HFspace.c
index 83551ba..16eae51 100644
--- a/src/H5HFspace.c
+++ b/src/H5HFspace.c
@@ -234,6 +234,47 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_space_size
+ *
+ * Purpose: Query the size of the heap's free space info on disk
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * August 14 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_space_size(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t *fs_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HF_space_size)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(fs_size);
+
+ /* Check if the free space for the heap has been initialized */
+ if(!hdr->fspace)
+ if(H5HF_space_start(hdr, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
+
+ /* Get free space metadata size */
+ if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_space_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_space_remove
*
* Purpose: Remove a section from the free space for the heap