summaryrefslogtreecommitdiffstats
path: root/src/H5FS.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-08-07 16:49:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-08-07 16:49:18 (GMT)
commit9a03ce6406817238a4c9b7fc77cc9fbeac8636e1 (patch)
tree97665ac7131af744c0e5dbc6ed4ead35ff6b2690 /src/H5FS.c
parenta44487281dcb259187efbd70817cc8ce9f36e72d (diff)
downloadhdf5-9a03ce6406817238a4c9b7fc77cc9fbeac8636e1.zip
hdf5-9a03ce6406817238a4c9b7fc77cc9fbeac8636e1.tar.gz
hdf5-9a03ce6406817238a4c9b7fc77cc9fbeac8636e1.tar.bz2
[svn-r12549] Description:
Add support for entire heap deletion. Platforms tested: FreeBSD 4.11 (sleipnir) Linux/32 2.4 (chicago) Linux/64 2.4 (mir) Mac OS X (amazon)
Diffstat (limited to 'src/H5FS.c')
-rw-r--r--src/H5FS.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/H5FS.c b/src/H5FS.c
index 7d77351..e6bb45d 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -283,12 +283,38 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC);
/* Delete serialized section storage, if there are any */
#ifdef QAK
-HDfprintf(stderr, "%s: fs_hdr->sect_addr = %a\n", FUNC, fs_hdr->sect_addr);
+HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
#endif /* QAK */
if(fspace->serial_sect_count > 0) {
+ unsigned sinfo_status = 0; /* Free space section info's status in the metadata cache */
+
+ /* Sanity check */
HDassert(H5F_addr_defined(fspace->sect_addr));
HDassert(fspace->sect_size > 0);
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size)<0)
+
+ /* Check the free space section info's status in the metadata cache */
+ if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space section info")
+
+ /* If the free space section info is in the cache, expunge it now */
+ if(sinfo_status & H5AC_ES__IN_CACHE) {
+ /* Sanity checks on direct block */
+ HDassert(!(sinfo_status & H5AC_ES__IS_PINNED));
+ HDassert(!(sinfo_status & H5AC_ES__IS_PROTECTED));
+
+#ifdef QAK
+HDfprintf(stderr, "%s: Expunging free space section info from cache\n", FUNC);
+#endif /* QAK */
+ /* Evict the free space section info from the metadata cache */
+ if(H5AC_expunge_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove free space section info from cache")
+#ifdef QAK
+HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUNC);
+#endif /* QAK */
+ } /* end if */
+
+ /* Release the space in the file */
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
} /* end if */