summaryrefslogtreecommitdiffstats
path: root/src/H5HF.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-03-13 19:47:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-03-13 19:47:16 (GMT)
commitee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9 (patch)
tree7cbd8c5fc545197f4efed76b9c317c817ebf791f /src/H5HF.c
parentc619cf0f518bfea91a34136a1424951eb17b99a4 (diff)
downloadhdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.zip
hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.tar.gz
hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.tar.bz2
[svn-r12084] Purpose:
Code checkpoint Description: The fractal heap code is reasonably stable and is passing all its current tests, so checkpoint everything with CVS. Also, add "statistics" module for v2 B-trees code, which is only a stub right now. Platforms tested: FreeBSD 4.11 (sleipnir) Mac OSX (amazon) Linux 2.4 (chicago)
Diffstat (limited to 'src/H5HF.c')
-rw-r--r--src/H5HF.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/H5HF.c b/src/H5HF.c
index 2577628..f183748 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -38,8 +38,8 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5HFpkg.h" /* Fractal heaps */
#include "H5Eprivate.h" /* Error handling */
+#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
/****************/
@@ -160,7 +160,9 @@ H5HF_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size,
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5HF_insert, FAIL)
+#ifdef QAK
HDfprintf(stderr, "%s: size = %Zu\n", FUNC, size);
+#endif /* QAK */
/*
* Check arguments.
@@ -190,16 +192,23 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported ye
if(shared->write_once) {
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'write once' managed blocks not supported yet")
} /* end if */
- else if(size <= shared->total_man_free) {
-HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "allocating internal managed blocks not supported yet")
- } /* end if */
else {
- /* Allocate space at end of heap */
- if(H5HF_man_alloc_end(fh->shared, dxpl_id, &hdr_flags, size, obj, id) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space at end of managed blocks")
+ H5HF_section_free_node_t *sec_node;
+
+ /* Find free space in heap */
+ if(H5HF_man_find(fh->shared, dxpl_id, size, &sec_node) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space in fractal heap")
+
+ /* Use free space for allocating object */
+ if(H5HF_man_insert(fh->shared, dxpl_id, sec_node, size, obj, id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space for object in fractal heap")
} /* end else */
} /* end else */
+ /* Check for making header dirty */
+ if(shared->dirty)
+ hdr_flags |= H5AC__DIRTIED_FLAG;
+
done:
if(fh && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, addr, fh, hdr_flags) < 0)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header")