summaryrefslogtreecommitdiffstats
path: root/src/H5EAcache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-10-07 04:17:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-10-07 04:17:35 (GMT)
commit9f60f016ab71cf8ce39c859fd9eb61c6fca35d63 (patch)
tree0ddbcb2f8707b578af22c62748420b9e3c19177b /src/H5EAcache.c
parent504c67846e6a4cc5706403bf21a9ae4f07aae7b4 (diff)
downloadhdf5-9f60f016ab71cf8ce39c859fd9eb61c6fca35d63.zip
hdf5-9f60f016ab71cf8ce39c859fd9eb61c6fca35d63.tar.gz
hdf5-9f60f016ab71cf8ce39c859fd9eb61c6fca35d63.tar.bz2
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which includes a fair bit of code cleanup & rearrangement along with a couple of bug fixes also. 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/H5EAcache.c')
-rw-r--r--src/H5EAcache.c76
1 files changed, 74 insertions, 2 deletions
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 35a6916..fe64d05 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -458,11 +458,29 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_size() */
/* ARGSUSED */
BEGIN_FUNC(STATIC, ERR,
herr_t, SUCCEED, FAIL,
-H5EA__cache_hdr_dest(H5F_t UNUSED *f, H5EA_hdr_t *hdr))
+H5EA__cache_hdr_dest(H5F_t *f, H5EA_hdr_t *hdr))
/* Check arguments */
+ HDassert(f);
HDassert(hdr);
+ /* Verify that header is clean */
+ HDassert(hdr->cache_info.is_dirty == FALSE);
+
+ /* If we're going to free the space on disk, the address must be valid */
+ HDassert(!hdr->cache_info.free_file_space_on_destroy || H5F_addr_defined(hdr->cache_info.addr));
+
+ /* Check for freeing file space for extensible array header */
+ if(hdr->cache_info.free_file_space_on_destroy) {
+ /* Sanity check address */
+ HDassert(H5F_addr_eq(hdr->addr, hdr->cache_info.addr));
+
+ /* Release the space on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)hdr->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array header")
+ } /* end if */
+
/* Release the extensible array header */
if(H5EA__hdr_dest(hdr) < 0)
H5E_THROW(H5E_CANTFREE, "can't free extensible array header")
@@ -803,8 +821,26 @@ herr_t, SUCCEED, FAIL,
H5EA__cache_iblock_dest(H5F_t *f, H5EA_iblock_t *iblock))
/* Sanity check */
+ HDassert(f);
HDassert(iblock);
+ /* Verify that index block is clean */
+ HDassert(iblock->cache_info.is_dirty == FALSE);
+
+ /* If we're going to free the space on disk, the address must be valid */
+ HDassert(!iblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(iblock->cache_info.addr));
+
+ /* Check for freeing file space for extensible array index block */
+ if(iblock->cache_info.free_file_space_on_destroy) {
+ /* Sanity check address */
+ HDassert(H5F_addr_eq(iblock->addr, iblock->cache_info.addr));
+
+ /* Release the space on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_EARRAY_IBLOCK, H5AC_dxpl_id, iblock->cache_info.addr, (hsize_t)iblock->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array index block")
+ } /* end if */
+
/* Release the index block */
if(H5EA__iblock_dest(f, iblock) < 0)
H5E_THROW(H5E_CANTFREE, "can't free extensible array index block")
@@ -1112,8 +1148,26 @@ herr_t, SUCCEED, FAIL,
H5EA__cache_sblock_dest(H5F_t *f, H5EA_sblock_t *sblock))
/* Sanity check */
+ HDassert(f);
HDassert(sblock);
+ /* Verify that super block is clean */
+ HDassert(sblock->cache_info.is_dirty == FALSE);
+
+ /* If we're going to free the space on disk, the address must be valid */
+ HDassert(!sblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(sblock->cache_info.addr));
+
+ /* Check for freeing file space for extensible array super block */
+ if(sblock->cache_info.free_file_space_on_destroy) {
+ /* Sanity check address */
+ HDassert(H5F_addr_eq(sblock->addr, sblock->cache_info.addr));
+
+ /* Release the space on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_EARRAY_SBLOCK, H5AC_dxpl_id, sblock->cache_info.addr, (hsize_t)sblock->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array super block")
+ } /* end if */
+
/* Release the super block */
if(H5EA__sblock_dest(f, sblock) < 0)
H5E_THROW(H5E_CANTFREE, "can't free extensible array super block")
@@ -1314,7 +1368,7 @@ H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
- /* Write the index block */
+ /* Write the data block */
HDassert((size_t)(p - buf) == size);
if(H5F_block_write(f, H5FD_MEM_EARRAY_DBLOCK, addr, size, dxpl_id, buf) < 0)
H5E_THROW(H5E_WRITEERROR, "unable to save extensible array data block to disk")
@@ -1418,8 +1472,26 @@ herr_t, SUCCEED, FAIL,
H5EA__cache_dblock_dest(H5F_t *f, H5EA_dblock_t *dblock))
/* Sanity check */
+ HDassert(f);
HDassert(dblock);
+ /* Verify that data block is clean */
+ HDassert(dblock->cache_info.is_dirty == FALSE);
+
+ /* If we're going to free the space on disk, the address must be valid */
+ HDassert(!dblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(dblock->cache_info.addr));
+
+ /* Check for freeing file space for extensible array data block */
+ if(dblock->cache_info.free_file_space_on_destroy) {
+ /* Sanity check address */
+ HDassert(H5F_addr_eq(dblock->addr, dblock->cache_info.addr));
+
+ /* Release the space on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_EARRAY_DBLOCK, H5AC_dxpl_id, dblock->cache_info.addr, (hsize_t)dblock->size) < 0)
+ H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block")
+ } /* end if */
+
/* Release the data block */
if(H5EA__dblock_dest(f, dblock) < 0)
H5E_THROW(H5E_CANTFREE, "can't free extensible array data block")