summaryrefslogtreecommitdiffstats
path: root/src/H5HFspace.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-01-03 19:01:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-01-03 19:01:17 (GMT)
commit136cefdf9116b910b6a46f1f649ee8b9cdc7fc68 (patch)
tree18b67bde577f74eab2a5519014daf99205c88902 /src/H5HFspace.c
parent04d73e7a0c69839922cf78adcb04e2617fc0f5b9 (diff)
downloadhdf5-136cefdf9116b910b6a46f1f649ee8b9cdc7fc68.zip
hdf5-136cefdf9116b910b6a46f1f649ee8b9cdc7fc68.tar.gz
hdf5-136cefdf9116b910b6a46f1f649ee8b9cdc7fc68.tar.bz2
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing queries. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5HFspace.c')
-rw-r--r--src/H5HFspace.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/H5HFspace.c b/src/H5HFspace.c
index 16eae51..77d8b1b 100644
--- a/src/H5HFspace.c
+++ b/src/H5HFspace.c
@@ -94,7 +94,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id)
+H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id, hbool_t may_create)
{
const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for fractal heap */
H5HF_FSPACE_SECT_CLS_SINGLE,
@@ -118,19 +118,22 @@ H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
} /* end if */
else {
- H5FS_create_t fs_create; /* Free space creation parameters */
-
- /* Set the free space creation parameters */
- fs_create.client = H5FS_CLIENT_FHEAP_ID;
- fs_create.shrink_percent = H5HF_FSPACE_SHRINK;
- fs_create.expand_percent = H5HF_FSPACE_EXPAND;
- fs_create.max_sect_size = hdr->man_dtable.cparam.max_direct_size;
- fs_create.max_sect_addr = hdr->man_dtable.cparam.max_index;
-
- /* Create the free space structure for the heap */
- if(NULL == (hdr->fspace = H5FS_create(hdr->f, dxpl_id, &hdr->fs_addr,
- &fs_create, NELMTS(classes), classes, hdr)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
+ /* Check if we are allowed to create the free space manager */
+ if(may_create) {
+ H5FS_create_t fs_create; /* Free space creation parameters */
+
+ /* Set the free space creation parameters */
+ fs_create.client = H5FS_CLIENT_FHEAP_ID;
+ fs_create.shrink_percent = H5HF_FSPACE_SHRINK;
+ fs_create.expand_percent = H5HF_FSPACE_EXPAND;
+ fs_create.max_sect_size = hdr->man_dtable.cparam.max_direct_size;
+ fs_create.max_sect_addr = hdr->man_dtable.cparam.max_index;
+
+ /* Create the free space structure for the heap */
+ if(NULL == (hdr->fspace = H5FS_create(hdr->f, dxpl_id, &hdr->fs_addr,
+ &fs_create, NELMTS(classes), classes, hdr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
+ } /* end if */
} /* end else */
done:
@@ -170,7 +173,7 @@ H5HF_space_add(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *node,
/* Check if the free space for the heap has been initialized */
if(!hdr->fspace)
- if(H5HF_space_start(hdr, dxpl_id) < 0)
+ if(H5HF_space_start(hdr, dxpl_id, TRUE) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
/* Construct user data */
@@ -204,7 +207,7 @@ done:
htri_t
H5HF_space_find(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t request, H5HF_free_section_t **node)
{
- htri_t node_found; /* Whether an existing free list node was found */
+ htri_t node_found = FALSE; /* Whether an existing free list node was found */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_space_find)
@@ -218,12 +221,13 @@ H5HF_space_find(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t request, H5HF_free_secti
/* Check if the free space for the heap has been initialized */
if(!hdr->fspace)
- if(H5HF_space_start(hdr, dxpl_id) < 0)
+ if(H5HF_space_start(hdr, dxpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
/* Search for free space in the heap */
- if((node_found = H5FS_sect_find(hdr->f, dxpl_id, hdr->fspace, request, (H5FS_section_info_t **)node)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap")
+ if(hdr->fspace)
+ if((node_found = H5FS_sect_find(hdr->f, dxpl_id, hdr->fspace, request, (H5FS_section_info_t **)node)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap")
/* Set return value */
ret_value = node_found;
@@ -262,12 +266,16 @@ H5HF_space_size(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t *fs_size)
/* Check if the free space for the heap has been initialized */
if(!hdr->fspace)
- if(H5HF_space_start(hdr, dxpl_id) < 0)
+ if(H5HF_space_start(hdr, dxpl_id, FALSE) < 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")
+ if(hdr->fspace) {
+ if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
+ } /* end if */
+ else
+ *fs_size = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)