summaryrefslogtreecommitdiffstats
path: root/src/H5SMcache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-10-07 13:32:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-10-07 13:32:32 (GMT)
commitbdbdbb9f89db8d3a76fc71705cdbbd89124f4687 (patch)
tree53d16d2097c591d2c7094da6b8e2b23ef5663a0f /src/H5SMcache.c
parentb256db872d5ce4f81c6486b60c4e29e8122b67c2 (diff)
downloadhdf5-bdbdbb9f89db8d3a76fc71705cdbbd89124f4687.zip
hdf5-bdbdbb9f89db8d3a76fc71705cdbbd89124f4687.tar.gz
hdf5-bdbdbb9f89db8d3a76fc71705cdbbd89124f4687.tar.bz2
[svn-r15801] Description:
Bring r15800 back from trunk: - File free space branch changes through r15794 Tested on: Mac OS X/32 10.5.5 (amazon) in debug mode Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode 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
Diffstat (limited to 'src/H5SMcache.c')
-rw-r--r--src/H5SMcache.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 021b43f..91478c5 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -27,6 +27,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
#include "H5SMpkg.h" /* Shared object header messages */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -652,18 +653,34 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5SM_list_dest(H5F_t UNUSED *f, H5SM_list_t* list)
+H5SM_list_dest(H5F_t *f, H5SM_list_t* list)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_list_dest)
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_list_dest)
+ /* Sanity check */
HDassert(list);
+ HDassert(list->header);
HDassert(list->messages);
- H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
+ /* If we're going to free the space on disk, the address must be valid */
+ HDassert(!list->cache_info.free_file_space_on_destroy || H5F_addr_defined(list->cache_info.addr));
+
+ /* Check for freeing file space for shared message index list */
+ if(list->cache_info.free_file_space_on_destroy) {
+ /* Release the space on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, H5AC_dxpl_id, list->cache_info.addr, (hsize_t)H5SM_LIST_SIZE(f, list->header->list_max)) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "unable to free shared message list")
+ } /* end if */
+ /* Release resources */
+ H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
(void)H5FL_FREE(H5SM_list_t, list);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_list_dest() */