summaryrefslogtreecommitdiffstats
path: root/src/H5MFaggr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-11 12:47:43 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-11 12:47:43 (GMT)
commitbcb872eaaa7da3a726ff6f71921d3ba82577d597 (patch)
tree4d3a566d701c3a6e42d99447eb6de506e68d8fa8 /src/H5MFaggr.c
parentda73cc2d02248c73cfa545a765d2d017cb0b1bff (diff)
downloadhdf5-bcb872eaaa7da3a726ff6f71921d3ba82577d597.zip
hdf5-bcb872eaaa7da3a726ff6f71921d3ba82577d597.tar.gz
hdf5-bcb872eaaa7da3a726ff6f71921d3ba82577d597.tar.bz2
[svn-r17319] Description:
Bring more superblock manipulation & aggregator changes from file free space branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (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/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.8 (amazon) in debug mode Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5MFaggr.c')
-rw-r--r--src/H5MFaggr.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index fa5014bc..0526ef2 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -75,6 +75,66 @@
/*-------------------------------------------------------------------------
+ * Function: H5MF_aggr_vfd_alloc
+ *
+ * Purpose: Allocate SIZE bytes of file memory via H5MF_aggr_alloc()
+ * and return the relative address where that contiguous chunk
+ * of file memory exists.
+ * The TYPE argument describes the purpose for which the storage
+ * is being requested.
+ *
+ * Return: Success: The file address of new chunk.
+ * Failure: HADDR_UNDEF
+ *
+ * Programmer: Vailin Choi; July 1st, 2009
+ * (The coding is from H5MF_alloc().)
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size)
+{
+ haddr_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5MF_aggr_vfd_alloc, HADDR_UNDEF)
+#ifdef H5MF_ALLOC_DEBUG
+HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
+#endif /* H5MF_ALLOC_DEBUG */
+
+ /* check arguments */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->lf);
+ HDassert(size > 0);
+
+ /* Couldn't find anything from the free space manager, go allocate some */
+ if(alloc_type != H5FD_MEM_DRAW) {
+ /* Handle metadata differently from "raw" data */
+ if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata")
+ } /* end if */
+ else {
+ /* Allocate "raw" data */
+ if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), alloc_type, size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data")
+ } /* end else */
+
+ /* Sanity check for overlapping into file's temporary allocation space */
+ HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr));
+
+done:
+#ifdef H5MF_ALLOC_DEBUG
+HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
+#endif /* H5MF_ALLOC_DEBUG */
+#ifdef H5MF_ALLOC_DEBUG_DUMP
+H5MF_sects_dump(f, dxpl_id, stderr);
+#endif /* H5MF_ALLOC_DEBUG_DUMP */
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5MF_aggr_vfd_alloc() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5MF_aggr_alloc
*
* Purpose: Try to allocate SIZE bytes of memory from an aggregator