summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-14 16:04:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-14 16:04:42 (GMT)
commit665366d499eb7831d90655c704507c4920313361 (patch)
treebb324f8f1f7bb10b01da9d8007a59d006349a47e /src
parent7de10b48334d0113b1733f145c7d2bb4e9d4f9f1 (diff)
downloadhdf5-665366d499eb7831d90655c704507c4920313361.zip
hdf5-665366d499eb7831d90655c704507c4920313361.tar.gz
hdf5-665366d499eb7831d90655c704507c4920313361.tar.bz2
[svn-r14085] Description:
Refactor H5HF_size() size statistics code for fractal heap to conform to how the rest of the fractal heap routines work. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'src')
-rw-r--r--src/H5Goh.c20
-rw-r--r--src/H5HFprivate.h3
-rw-r--r--src/H5HFstat.c20
-rw-r--r--src/H5Oattribute.c22
-rwxr-xr-xsrc/H5SM.c20
5 files changed, 62 insertions, 23 deletions
diff --git a/src/H5Goh.c b/src/H5Goh.c
index 4f7dbc6..3ccdf16 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -260,6 +260,7 @@ herr_t
H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
H5O_linfo_t linfo; /* Link info message */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_group_bh_info, FAIL)
@@ -296,12 +297,27 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
/* Get fractal heap size, if available */
- if(H5F_addr_defined(linfo.fheap_addr))
- if(H5HF_size(f, dxpl_id, linfo.fheap_addr, &bh_info->heap_size) < 0)
+ if(H5F_addr_defined(linfo.fheap_addr)) {
+ /* Open the fractal heap for links */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, linfo.fheap_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Get heap storage size */
+ if(H5HF_size(fheap, dxpl_id, &bh_info->heap_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
+
+ /* Release the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ fheap = NULL;
+ } /* end if */
} /* end else */
done:
+ /* Release resources */
+ if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_group_bh_info() */
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 208ab57..790f5ea 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -128,8 +128,7 @@ H5_DLL herr_t H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr);
/* Statistics routines */
H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats);
-H5_DLL herr_t H5HF_size(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr,
- hsize_t *heap_size/*out*/);
+H5_DLL herr_t H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size/*out*/);
/* Debugging routines */
#ifdef H5HF_DEBUGGING
diff --git a/src/H5HFstat.c b/src/H5HFstat.c
index b2f45df..2e3e189 100644
--- a/src/H5HFstat.c
+++ b/src/H5HFstat.c
@@ -124,9 +124,9 @@ H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats)
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_size(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, hsize_t *heap_size)
+H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size)
{
- H5HF_hdr_t *hdr = NULL; /* Fractal heap header */
+ H5HF_hdr_t *hdr; /* Fractal heap header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_size, FAIL)
@@ -134,13 +134,11 @@ H5HF_size(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, hsize_t *heap_size)
/*
* Check arguments.
*/
- HDassert(f);
- HDassert(H5F_addr_defined(fh_addr));
+ HDassert(fh);
HDassert(heap_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")
+ /* Get "convenience" pointer to fractal heap header */
+ hdr = fh->hdr;
/* Add in values already known */
*heap_size += hdr->heap_size; /* Heap header */
@@ -149,7 +147,7 @@ H5HF_size(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, hsize_t *heap_size)
/* Check for indirect blocks for managed objects */
if(H5F_addr_defined(hdr->man_dtable.table_addr) && hdr->man_dtable.curr_root_rows != 0)
- if(H5HF_man_iblock_size(f, dxpl_id, hdr, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, heap_size) < 0)
+ if(H5HF_man_iblock_size(hdr->f, dxpl_id, hdr, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, heap_size) < 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 */
@@ -169,7 +167,7 @@ H5HF_size(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, hsize_t *heap_size)
huge_bt2_class = H5HF_BT2_INDIR;
/* Get the B-tree storage for the appropriate class */
- if(H5B2_iterate_size(f, dxpl_id, huge_bt2_class, hdr->huge_bt2_addr, heap_size) < 0)
+ if(H5B2_iterate_size(hdr->f, dxpl_id, huge_bt2_class, hdr->huge_bt2_addr, heap_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
@@ -179,10 +177,6 @@ H5HF_size(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, hsize_t *heap_size)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
done:
- /* Release resources */
- 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_size() */
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index aacf3a0..5050e5c 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1711,7 +1711,8 @@ done:
herr_t
H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_attr_bh_info, FAIL)
@@ -1739,13 +1740,28 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
/* Get storage size of fractal heap, if it's used */
- if(H5F_addr_defined(ainfo.fheap_addr))
- if(H5HF_size(f, dxpl_id, ainfo.fheap_addr, &(bh_info->heap_size)) < 0)
+ if(H5F_addr_defined(ainfo.fheap_addr)) {
+ /* Open the fractal heap for attributes */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo.fheap_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Get heap storage size */
+ if(H5HF_size(fheap, dxpl_id, &(bh_info->heap_size)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+
+ /* Release the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ fheap = NULL;
+ } /* end if */
} /* end else */
} /* end if */
done:
+ /* Release resources */
+ if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_attr_bh_info() */
diff --git a/src/H5SM.c b/src/H5SM.c
index bf0a5d8..179a526 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -2496,6 +2496,7 @@ herr_t
H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
{
H5SM_master_table_t *table = NULL; /* SOHM master table */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2525,14 +2526,27 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
else if(table->indexes[u].index_type == H5SM_LIST)
finfo->sohm.msgs_info.index_size += H5SM_LIST_SIZE(f, table->indexes[u].list_max);
- /* Get heap storage size */
- if(H5F_addr_defined(table->indexes[u].heap_addr))
- if(H5HF_size(f, dxpl_id, table->indexes[u].heap_addr, &(finfo->sohm.msgs_info.heap_size)) < 0)
+ /* Check for heap for this index */
+ if(H5F_addr_defined(table->indexes[u].heap_addr)) {
+ /* Open the fractal heap for this index */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, table->indexes[u].heap_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Get heap storage size */
+ if(H5HF_size(fheap, dxpl_id, &(finfo->sohm.msgs_info.heap_size)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info")
+
+ /* Release the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ fheap = NULL;
+ } /* end if */
} /* end for */
done:
/* Release resources */
+ if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "unable to close SOHM master table")