summaryrefslogtreecommitdiffstats
path: root/src/H5HFiblock.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-05 13:39:56 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-05 13:39:56 (GMT)
commit74c8b68acab0fc2408740e7a38a2ab2bcdf58f57 (patch)
treed0d2da7ac1ea824f0ef78e757ace31a85bc4b6aa /src/H5HFiblock.c
parent4c0421ba76a7615cc02f43b8f3778f5d6a1f4d68 (diff)
downloadhdf5-74c8b68acab0fc2408740e7a38a2ab2bcdf58f57.zip
hdf5-74c8b68acab0fc2408740e7a38a2ab2bcdf58f57.tar.gz
hdf5-74c8b68acab0fc2408740e7a38a2ab2bcdf58f57.tar.bz2
[svn-r18702] Description:
Bring r18672 from metadata journaling "merging" branch to trunk: Mostly changes to move to only using one 'user data' parameter for calls to H5AC_protect(), along with some minor reformatting code cleanups. 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 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) 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-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5HFiblock.c')
-rw-r--r--src/H5HFiblock.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 74fbe63..d50dee2 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -489,6 +489,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
haddr_t new_addr; /* New address of indirect block */
hsize_t acc_dblock_free; /* Accumulated free space in direct blocks */
hsize_t next_size; /* The previous value of the "next size" for the new block iterator */
+ hsize_t old_iblock_size; /* Old size of indirect block */
unsigned next_row; /* The next row to allocate block in */
unsigned next_entry; /* The previous value of the "next entry" for the new block iterator */
unsigned new_next_entry = 0;/* The new value of the "next entry" for the new block iterator */
@@ -544,6 +545,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
* QAK - 3/14/2006
*/
/* Free previous indirect block disk space */
+ old_iblock_size = iblock->size;
if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space")
} /* end if */
@@ -562,6 +564,12 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
} /* end else */
+ /* Resize pinned indirect block in the cache, if its changed size */
+ if(old_iblock_size != iblock->size) {
+ if(H5AC_resize_pinned_entry(iblock, (size_t)iblock->size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block")
+ } /* end if */
+
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
@@ -667,6 +675,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
H5HF_hdr_t *hdr = iblock->hdr; /* Pointer to heap header */
haddr_t new_addr; /* New address of indirect block */
hsize_t acc_dblock_free; /* Accumulated free space in direct blocks */
+ hsize_t old_size; /* Old size of indirect block */
unsigned max_child_row; /* Row for max. child entry */
unsigned old_nrows; /* Old # of rows */
unsigned new_nrows; /* New # of rows */
@@ -699,6 +708,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
* QAK - 6/12/2006
*/
/* Free previous indirect block disk space */
+ old_size = iblock->size;
if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space")
} /* end if */
@@ -723,6 +733,12 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
} /* end else */
+ /* Resize pinned indirect block in the cache, if it has changed size */
+ if(old_size != iblock->size) {
+ if(H5AC_resize_pinned_entry(iblock, (size_t)iblock->size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block")
+ } /* end if */
+
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
@@ -1123,13 +1139,20 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr,
/* Check for protecting indirect block */
if(must_protect || should_protect) {
+ H5HF_iblock_cache_ud_t cache_udata; /* User-data for callback */
+
/* Set up parent info */
par_info.hdr = hdr;
par_info.iblock = par_iblock;
par_info.entry = par_entry;
+ /* Set up user data for protect call */
+ cache_udata.f = hdr->f;
+ cache_udata.par_info = &par_info;
+ cache_udata.nrows = &iblock_nrows;
+
/* Protect the indirect block */
- if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &iblock_nrows, &par_info, rw)))
+ if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &cache_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block")
*did_protect = TRUE;
} /* end if */
@@ -1595,11 +1618,11 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock)
/* Release entry tables */
if(iblock->ents)
- H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents);
+ iblock->ents = H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents);
if(iblock->filt_ents)
- H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents);
+ iblock->filt_ents = H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents);
if(iblock->child_iblocks)
- H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks);
+ iblock->child_iblocks = H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks);
/* Free fractal heap indirect block info */
iblock = H5FL_FREE(H5HF_indirect_t, iblock);