summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5AC.c6
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5B.c193
-rw-r--r--src/H5B2.c103
-rw-r--r--src/H5B2cache.c43
-rw-r--r--src/H5B2dbg.c21
-rw-r--r--src/H5B2int.c200
-rw-r--r--src/H5B2pkg.h28
-rw-r--r--src/H5B2stat.c5
-rw-r--r--src/H5B2test.c20
-rw-r--r--src/H5Bcache.c28
-rw-r--r--src/H5Bpkg.h12
-rw-r--r--src/H5C.c30
-rw-r--r--src/H5Cprivate.h41
-rw-r--r--src/H5Distore.c1
-rw-r--r--src/H5F.c4
-rw-r--r--src/H5FDmpio.c1
-rw-r--r--src/H5FS.c13
-rw-r--r--src/H5FScache.c95
-rw-r--r--src/H5FSdbg.c10
-rw-r--r--src/H5FSpkg.h13
-rw-r--r--src/H5FSsection.c29
-rw-r--r--src/H5Fmount.c1
-rw-r--r--src/H5Fpkg.h6
-rw-r--r--src/H5G.c1
-rw-r--r--src/H5Gdeprec.c1
-rw-r--r--src/H5Gnode.c35
-rw-r--r--src/H5HF.c30
-rw-r--r--src/H5HFcache.c86
-rw-r--r--src/H5HFdbg.c28
-rw-r--r--src/H5HFdblock.c34
-rw-r--r--src/H5HFhdr.c8
-rw-r--r--src/H5HFiblock.c25
-rw-r--r--src/H5HFpkg.h30
-rw-r--r--src/H5HG.c8
-rw-r--r--src/H5HGcache.c11
-rw-r--r--src/H5HGdbg.c2
-rw-r--r--src/H5HL.c12
-rw-r--r--src/H5HLcache.c33
-rw-r--r--src/H5L.c1
-rw-r--r--src/H5Lexternal.c1
-rw-r--r--src/H5O.c4
-rw-r--r--src/H5Ocache.c19
-rw-r--r--src/H5Ochunk.c6
-rwxr-xr-xsrc/H5SM.c54
-rw-r--r--src/H5SMcache.c30
-rwxr-xr-xsrc/H5SMpkg.h7
-rw-r--r--src/H5SMtest.c2
-rw-r--r--test/cache.c138
-rw-r--r--test/cache_api.c15
-rw-r--r--test/cache_common.c301
-rw-r--r--test/cache_common.h33
-rw-r--r--testpar/t_cache.c25
53 files changed, 1085 insertions, 800 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index a293cfe..ca8bddd 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -1752,8 +1752,7 @@ H5AC_protect(H5F_t *f,
hid_t dxpl_id,
const H5AC_class_t *type,
haddr_t addr,
- const void *udata1,
- void *udata2,
+ void *udata,
H5AC_protect_t rw)
{
/* char * fcn_name = "H5AC_protect"; */
@@ -1825,8 +1824,7 @@ H5AC_protect(H5F_t *f,
H5AC_noblock_dxpl_id,
type,
addr,
- udata1,
- udata2,
+ udata,
protect_flags);
if ( thing == NULL ) {
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 5fe590a..aa0f6e9 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -269,7 +269,7 @@ H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
haddr_t addr, void *thing, unsigned int flags);
H5_DLL herr_t H5AC_pin_protected_entry(void *thing);
H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
- haddr_t addr, const void *udata1, void *udata2,
+ haddr_t addr, void *udata,
H5AC_protect_t rw);
H5_DLL herr_t H5AC_resize_pinned_entry(void *thing, size_t new_size);
H5_DLL herr_t H5AC_unpin_entry(void *thing);
diff --git a/src/H5B.c b/src/H5B.c
index ff1c0e1..5b9f733 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -261,6 +261,7 @@ done:
(void)H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, *addr_p, (hsize_t)shared->sizeof_rnode);
} /* end if */
if(bt)
+ /* Destroy B-tree node */
if(H5B_node_dest(bt) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
} /* end if */
@@ -296,7 +297,9 @@ herr_t
H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata)
{
H5B_t *bt = NULL;
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned idx=0, lt = 0, rt; /* Final, left & right key indices */
int cmp = 1; /* Key comparison value */
int ret_value = SUCCEED; /* Return value */
@@ -313,14 +316,21 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
HDassert(type->found);
HDassert(H5F_addr_defined(addr));
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/*
* Perform a binary search to locate the child which contains
* the thing for which we're searching.
*/
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
rt = bt->nchildren;
while(lt < rt && cmp) {
@@ -407,6 +417,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
{
H5P_genplist_t *dx_plist; /* Data transfer property list */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned new_bt_flags = H5AC__NO_FLAGS_SET;
H5B_t *new_bt = NULL;
unsigned nleft, nright; /* Number of keys in left & right halves */
@@ -486,7 +497,10 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
*/
if(H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree")
- if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = shared->type;
+ cache_udata.rc_shared = old_bt->rc_shared;
+ if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree")
new_bt->level = old_bt->level;
@@ -525,8 +539,12 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
if(H5F_addr_defined(old_bt->right)) {
H5B_t *tmp_bt;
+ H5B_cache_ud_t cache_udata2; /* User-data for metadata cache callback */
- if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE)))
+ cache_udata2.f = f;
+ cache_udata2.type = shared->type;
+ cache_udata2.rc_shared = old_bt->rc_shared;
+ if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, &cache_udata2, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling")
tmp_bt->left = *new_addr_p;
@@ -576,7 +594,9 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
unsigned level;
H5B_t *bt;
H5B_t *new_bt; /* Copy of B-tree info */
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
H5B_ins_t my_ins = H5B_INS_ERROR;
herr_t ret_value = SUCCEED;
@@ -595,11 +615,18 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
HGOTO_DONE(SUCCEED)
HDassert(H5B_INS_RIGHT == my_ins);
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/* the current root */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
level = bt->level;
@@ -611,7 +638,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
bt = NULL;
/* the new node */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new node")
if(!rt_key_changed)
@@ -631,7 +658,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root")
/* update the new child's left pointer */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child")
bt->left = old_root;
@@ -645,7 +672,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
* at the new location -QAK
*/
/* Bring the old root into the cache if it's not already */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child")
/* Make certain the old root info is marked as dirty before moving it, */
@@ -810,7 +837,9 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
{
unsigned bt_flags = H5AC__NO_FLAGS_SET, twin_flags = H5AC__NO_FLAGS_SET;
H5B_t *bt = NULL, *twin = NULL;
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned lt = 0, idx = 0, rt; /* Left, final & right index values */
int cmp = -1; /* Key comparison value */
haddr_t child_addr = HADDR_UNDEF;
@@ -837,15 +866,22 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*lt_key_changed = FALSE;
*rt_key_changed = FALSE;
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/*
* Use a binary search to find the child that will receive the new
* data. When the search completes IDX points to the child that
* should get the new data.
*/
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
rt = bt->nchildren;
while(lt < rt && cmp) {
@@ -1007,7 +1043,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
if(bt->nchildren == shared->two_k) {
if(H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node")
- if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE)))
+ if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
if(idx < bt->nchildren) {
tmp_bt = bt;
@@ -1079,6 +1115,9 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
H5B_operator_t op, void *udata)
{
H5B_t *bt = NULL; /* Pointer to current B-tree node */
+ H5RC_t *rc_shared; /* Ref-counted shared info */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
uint8_t *native = NULL; /* Array of keys in native format */
haddr_t *child = NULL; /* Array of child pointers */
herr_t ret_value; /* Return value */
@@ -1094,8 +1133,17 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
HDassert(op);
HDassert(udata);
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/* Protect the initial/current node */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node")
if(bt->level > 0) {
@@ -1111,14 +1159,9 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, H5_ITER_ERROR, "unable to list B-tree node")
} /* end if */
else {
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
unsigned nchildren; /* Number of child pointers */
haddr_t next_addr; /* Address of next node to the right */
- /* Get the shared B-tree information */
- shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
-
/* Allocate space for a copy of the native records & child pointers */
if(NULL == (native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, H5_ITER_ERROR, "memory allocation failed for shared B-tree native records")
@@ -1164,7 +1207,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
if(H5F_addr_defined(next_addr)) {
/* Protect the next node to the right */
addr = next_addr;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "B-tree node")
/* Cache information from this node */
@@ -1270,7 +1313,9 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
{
H5B_t *bt = NULL, *sibling = NULL;
unsigned bt_flags = H5AC__NO_FLAGS_SET;
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned idx = 0, lt = 0, rt; /* Final, left & right indices */
int cmp = 1; /* Key comparison value */
H5B_ins_t ret_value = H5B_INS_ERROR;
@@ -1286,14 +1331,21 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
HDassert(udata);
HDassert(rt_key && rt_key_changed);
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/*
* Perform a binary search to locate the child which contains the thing
* for which we're searching.
*/
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
rt = bt->nchildren;
while(lt < rt && cmp) {
@@ -1371,7 +1423,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
if(ret_value != H5B_INS_REMOVE && level > 0) {
if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
/* Make certain the native key for the right sibling is set up */
@@ -1399,7 +1451,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
bt->nchildren = 0;
if(level > 0) {
if(H5F_addr_defined(bt->left)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node from tree")
sibling->right = bt->right;
@@ -1409,7 +1461,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
sibling = NULL; /* Make certain future references will be caught */
} /* end if */
if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
/* Copy left-most key from deleted node to left-most key in it's right neighbor */
@@ -1425,7 +1477,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
bt->right = HADDR_UNDEF;
H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t);
if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)shared->sizeof_rnode) < 0
- || H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags | H5C__DELETED_FLAG) < 0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG) < 0) {
bt = NULL;
bt_flags = H5AC__NO_FLAGS_SET;
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to free B-tree node")
@@ -1471,7 +1523,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
if(level > 0) {
if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
@@ -1539,6 +1591,9 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
hbool_t rt_key_changed = FALSE; /*right key changed?*/
unsigned bt_flags = H5AC__NO_FLAGS_SET;
H5B_t *bt = NULL; /*btree node */
+ H5RC_t *rc_shared; /* Ref-counted shared info */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B_remove, FAIL)
@@ -1554,11 +1609,20 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
udata, rt_key, &rt_key_changed) == H5B_INS_ERROR)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree")
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/*
* If the B-tree is now empty then make sure we mark the root node as
* being at level zero
*/
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree root node")
if(0 == bt->nchildren && 0 != bt->level) {
@@ -1595,7 +1659,9 @@ herr_t
H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata)
{
H5B_t *bt = NULL; /* B-tree node being operated on */
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1606,11 +1672,18 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
HDassert(type);
HDassert(H5F_addr_defined(addr));
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/* Lock this B-tree node into memory for now */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
/* Iterate over all children in tree, deleting them */
if(bt->level > 0) {
@@ -1832,7 +1905,9 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
const H5B_info_ud_t *info_udata)
{
H5B_t *bt = NULL; /* Pointer to current B-tree node */
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned level; /* Node level */
size_t sizeof_rnode; /* Size of raw (disk) node */
haddr_t next_addr; /* Address of next node to the right */
@@ -1851,17 +1926,22 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
HDassert(info_udata->bt_info);
HDassert(info_udata->udata);
- /* Protect the initial/current node */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, info_udata->udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
-
- /* Get the shared B-tree information */
- shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, info_udata->udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
HDassert(shared);
/* Get the raw node size for iteration */
sizeof_rnode = shared->sizeof_rnode;
+ /* Protect the initial/current node */
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
+
/* Cache information from this node */
left_child = bt->child[0];
next_addr = bt->right;
@@ -1883,7 +1963,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
while(H5F_addr_defined(next_addr)) {
/* Protect the next node to the right */
addr = next_addr;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, info_udata->udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node")
/* Cache information from this node */
@@ -2016,7 +2096,9 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
const H5B_class_t *type, void *udata)
{
H5B_t *bt = NULL;
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned u; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
@@ -2032,13 +2114,20 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
HDassert(fwidth >= 0);
HDassert(type);
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/*
* Load the tree node.
*/
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
- shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
- HDassert(shared);
/*
* Print the values.
@@ -2125,7 +2214,9 @@ static herr_t
H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata)
{
H5B_t *bt = NULL;
+ H5RC_t *rc_shared; /* Ref-counted shared info */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
int i, ncell, cmp;
static int ncalls = 0;
herr_t status;
@@ -2144,8 +2235,18 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
if(H5DEBUG(B))
fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
} /* end if */
+
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
+ HDassert(shared);
+
/* Initialize the queue */
- bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ);
+ cache_udata.f = f;
+ cache_udata.type = type;
+ cache_udata.rc_shared = rc_shared;
+ bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ);
HDassert(bt);
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
@@ -2166,7 +2267,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
* test.
*/
for(ncell = 0; cur; ncell++) {
- bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, type, udata, H5AC_READ);
+ bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, &cache_udata, H5AC_READ);
HDassert(bt);
/* Check node header */
diff --git a/src/H5B2.c b/src/H5B2.c
index c583f32..9c329fe 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -171,6 +171,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
unsigned bt2_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_insert, FAIL)
@@ -181,7 +182,9 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Look up the b-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -253,6 +256,7 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
H5B2_node_ptr_t root_ptr; /* Node pointer info for root node */
unsigned depth; /* Current depth of the tree */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_iterate, FAIL)
@@ -264,7 +268,9 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(op);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -338,6 +344,8 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
unsigned depth; /* Current depth of the tree */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_find, FAIL)
@@ -348,7 +356,9 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -405,7 +415,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for current record */
if(op && (op)(H5B2_INT_NREC(internal, shared, idx), op_data) < 0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -426,7 +436,10 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
@@ -500,6 +513,8 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
unsigned depth; /* Current depth of the tree */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_index, FAIL)
@@ -511,7 +526,9 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(op);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -625,7 +642,10 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Sanity check index */
@@ -674,6 +694,7 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
unsigned bt2_flags = H5AC__NO_FLAGS_SET;
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_remove, FAIL)
@@ -684,7 +705,9 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Look up the b-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -729,7 +752,7 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -757,6 +780,7 @@ H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
unsigned bt2_flags = H5AC__NO_FLAGS_SET;
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_remove_by_idx, FAIL)
@@ -767,7 +791,9 @@ H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
HDassert(H5F_addr_defined(addr));
/* Look up the b-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -820,7 +846,7 @@ H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -844,8 +870,9 @@ herr_t
H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hsize_t *nrec)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED;
+ H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_get_nrec, FAIL)
@@ -856,7 +883,9 @@ H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(nrec);
/* Look up the B-tree header */
- if (NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get B-tree number of records */
@@ -864,7 +893,7 @@ H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
done:
/* Release B-tree header node */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -902,6 +931,7 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
{
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_neighbor, FAIL)
@@ -913,7 +943,9 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(op);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -936,7 +968,7 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -971,6 +1003,7 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
{
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_delete, FAIL)
@@ -981,7 +1014,9 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -1038,6 +1073,8 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
unsigned depth; /* Current depth of the tree */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_modify, FAIL)
@@ -1049,7 +1086,9 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HDassert(op);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -1098,7 +1137,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[idx];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -1108,12 +1147,12 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t changed; /* Whether the 'modify' callback changed the record */
/* Make callback for current record */
- if ( (op)(H5B2_INT_NREC(internal,shared,idx), op_data, &changed) <0) {
+ if((op)(H5B2_INT_NREC(internal,shared,idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed==FALSE);
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
@@ -1123,7 +1162,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
internal_flags |= changed ? H5AC__DIRTIED_FLAG : 0;
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -1139,7 +1178,10 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t changed = FALSE;/* Whether the 'modify' callback changed the record */
/* Lock B-tree leaf node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
@@ -1147,7 +1189,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
if(cmp != 0) {
/* Unlock leaf node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Note: don't push error on stack, leave that to next higher level,
@@ -1162,12 +1204,12 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end if */
else {
/* Make callback for current record */
- if ((op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data, &changed) <0) {
+ if((op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data, &changed) < 0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed==FALSE);
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
@@ -1178,7 +1220,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
leaf_flags |= (changed ? H5AC__DIRTIED_FLAG : 0);
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
}
@@ -1213,6 +1255,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add
hbool_t incr_rc = FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
H5B2_node_ptr_t root_ptr; /* Node pointer info for root node */
unsigned depth; /* Current depth of the tree */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_iterate_size, FAIL)
@@ -1224,7 +1267,9 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add
HDassert(btree_size);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 5b168ba..387c153 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -67,17 +67,17 @@
/********************/
/* Metadata cache callbacks */
-static H5B2_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
+static H5B2_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_t *b, unsigned UNUSED * flags_ptr);
static herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *bt2);
static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *b, hbool_t destroy);
static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t *bt, size_t *size_ptr);
-static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_shared);
+static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_internal_t *i, unsigned UNUSED * flags_ptr);
static herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal);
static herr_t H5B2_cache_internal_clear(H5F_t *f, H5B2_internal_t *i, hbool_t destroy);
static herr_t H5B2_cache_internal_size(const H5F_t *f, const H5B2_internal_t *i, size_t *size_ptr);
-static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_shared);
+static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_leaf_t *l, unsigned UNUSED * flags_ptr);
static herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf);
static herr_t H5B2_cache_leaf_clear(H5F_t *f, H5B2_leaf_t *l, hbool_t destroy);
@@ -144,9 +144,9 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{
*-------------------------------------------------------------------------
*/
static H5B2_t *
-H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void UNUSED *udata)
+H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- const H5B2_class_t *type = (const H5B2_class_t *) _type; /* Type of B-tree */
+ H5B2_hdr_cache_ud_t *udata = (H5B2_hdr_cache_ud_t *)_udata;
unsigned depth; /* Depth of B-tree */
size_t node_size, rrec_size; /* Size info for B-tree */
uint8_t split_percent, merge_percent; /* Split & merge %s for B-tree */
@@ -165,7 +165,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(type);
+ HDassert(udata);
/* Allocate space for the B-tree data structure */
if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
@@ -177,7 +177,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(f);
+ size = H5B2_HEADER_SIZE(udata->f);
/* Get a pointer to a buffer that's large enough for header */
if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size)))
@@ -200,7 +200,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version")
/* B-tree type */
- if(*p++ != (uint8_t)type->id)
+ if(*p++ != (uint8_t)udata->type->id)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree type")
/* Node size (in bytes) */
@@ -217,9 +217,9 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
merge_percent = *p++;
/* Root node pointer */
- H5F_addr_decode(f, (const uint8_t **)&p, &(bt2->root.addr));
+ H5F_addr_decode(udata->f, (const uint8_t **)&p, &(bt2->root.addr));
UINT16DECODE(p, bt2->root.node_nrec);
- H5F_DECODE_LENGTH(f, p, bt2->root.all_nrec);
+ H5F_DECODE_LENGTH(udata->f, p, bt2->root.all_nrec);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
@@ -235,7 +235,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 B-tree header")
/* Initialize shared B-tree info */
- if(H5B2_shared_init(f, bt2, type, depth, node_size, rrec_size, split_percent, merge_percent) < 0)
+ if(H5B2_shared_init(udata->f, bt2, udata->type, depth, node_size, rrec_size, split_percent, merge_percent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't create shared B-tree info")
/* Set return value */
@@ -479,9 +479,9 @@ H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
*-------------------------------------------------------------------------
*/
static H5B2_internal_t *
-H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata, void UNUSED *udata2)
+H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- const H5B2_int_load_ud1_t *udata = (const H5B2_int_load_ud1_t *)_udata; /* Pointer to user data */
+ H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
H5B2_shared_t *shared; /* Shared B-tree information */
H5B2_internal_t *internal = NULL; /* Internal node read */
const uint8_t *p; /* Pointer into raw data buffer */
@@ -547,7 +547,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
native = internal->int_native;
for(u = 0; u < internal->nrec; u++) {
/* Decode record */
- if((shared->type->decode)(f, p, native) < 0)
+ if((shared->type->decode)(udata->f, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record")
/* Move to next record */
@@ -559,7 +559,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
int_node_ptr = internal->node_ptrs;
for(u = 0; u < internal->nrec + 1; u++) {
/* Decode node pointer */
- H5F_addr_decode(f, (const uint8_t **)&p, &(int_node_ptr->addr));
+ H5F_addr_decode(udata->f, (const uint8_t **)&p, &(int_node_ptr->addr));
UINT64DECODE_VAR(p, int_node_ptr->node_nrec, shared->max_nrec_size);
if(udata->depth > 1)
UINT64DECODE_VAR(p, int_node_ptr->all_nrec, shared->node_info[udata->depth - 1].cum_max_nrec_size)
@@ -816,10 +816,9 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal,
*-------------------------------------------------------------------------
*/
static H5B2_leaf_t *
-H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bt2_shared)
+H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- const unsigned *nrec = (const unsigned *)_nrec;
- H5RC_t *bt2_shared = (H5RC_t *)_bt2_shared; /* Shared B-tree information */
+ H5B2_leaf_cache_ud_t *udata = (H5B2_leaf_cache_ud_t *)_udata;
H5B2_shared_t *shared; /* Shared B-tree information */
H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */
const uint8_t *p; /* Pointer into raw data buffer */
@@ -834,14 +833,14 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(bt2_shared);
+ HDassert(udata);
if(NULL == (leaf = H5FL_MALLOC(H5B2_leaf_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&leaf->cache_info, 0, sizeof(H5AC_info_t));
/* Share common B-tree information */
- leaf->shared = bt2_shared;
+ leaf->shared = udata->bt2_shared;
H5RC_INC(leaf->shared);
/* Get the pointer to the shared B-tree info */
@@ -872,13 +871,13 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys")
/* Set the number of records in the leaf */
- leaf->nrec = *nrec;
+ leaf->nrec = *udata->nrec;
/* Deserialize records for leaf node */
native = leaf->leaf_native;
for(u = 0; u < leaf->nrec; u++) {
/* Decode record */
- if((shared->type->decode)(f, p, native) < 0)
+ if((shared->type->decode)(udata->f, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 836486e..56e3c4d 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -94,6 +94,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
H5B2_shared_t *shared; /* Shared B-tree information */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_hdr_debug, FAIL)
@@ -111,7 +112,9 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree header.
*/
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -204,6 +207,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
H5B2_shared_t *shared; /* Shared B-tree information */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_int_debug, FAIL)
@@ -223,7 +227,9 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree header.
*/
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -333,6 +339,8 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
H5B2_shared_t *shared; /* Shared B-tree information */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_leaf_debug, FAIL)
@@ -352,7 +360,9 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree header.
*/
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -362,7 +372,10 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Load the B-tree leaf node
*/
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &nrec, bt2->shared, H5AC_READ)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &nrec;
+ cache_leaf_udata.bt2_shared = bt2->shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
/* Release the B-tree header */
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 71e522e..ecf9bae 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -377,6 +377,7 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
H5B2_shared_t *shared; /* B-tree's shared info */
unsigned mid_record; /* Index of "middle" record in current node */
unsigned old_node_nrec; /* Number of records in internal node split */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_split1)
@@ -440,9 +441,14 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_addr = internal->node_ptrs[idx + 1].addr;
/* Protect both leafs */
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
+ cache_leaf_udata.bt2_shared = internal->shared;
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx + 1].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx + 1].node_nrec);
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -646,6 +652,7 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
H5B2_shared_t *shared; /* B-tree's shared info */
hssize_t left_moved_nrec=0, right_moved_nrec=0; /* Number of records moved, for internal redistrib */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_redistribute2)
@@ -654,7 +661,7 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HDassert(internal);
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
/* Check for the kind of B-tree node to redistribute */
@@ -668,9 +675,9 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock left & right B-tree child nodes */
- if (NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -693,9 +700,14 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock left & right B-tree child nodes */
- if (NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
+ cache_leaf_udata.bt2_shared = internal->shared;
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx + 1].node_nrec);
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -832,9 +844,9 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
#endif /* H5B2_DEBUG */
/* Release child nodes (marked as dirty) */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -875,6 +887,7 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *middle_node_ptrs=NULL;/* Pointers to childs' node pointer info */
hssize_t left_moved_nrec=0, right_moved_nrec=0; /* Number of records moved, for internal split */
hssize_t middle_moved_nrec=0; /* Number of records moved, for internal split */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_redistribute3)
@@ -884,7 +897,7 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
/* Check for the kind of B-tree node to redistribute */
@@ -900,11 +913,11 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx-1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx-1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (middle_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (middle_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
@@ -933,11 +946,18 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx-1].node_nrec), internal->shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx-1].node_nrec);
+ cache_leaf_udata.bt2_shared = internal->shared;
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
+ if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx+1].node_nrec);
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -1204,11 +1224,11 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
#endif /* H5B2_DEBUG */
/* Unlock child nodes (marked as dirty) */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1243,6 +1263,7 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
H5B2_node_ptr_t *left_node_ptrs=NULL, *right_node_ptrs=NULL;/* Pointers to childs' node pointer info */
H5B2_shared_t *shared; /* B-tree's shared info */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge2)
@@ -1254,7 +1275,7 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
/* Check for the kind of B-tree node to split */
@@ -1293,9 +1314,14 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock left & right B-tree child nodes */
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
+ cache_leaf_udata.bt2_shared = internal->shared;
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx+1].node_nrec);
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1403,6 +1429,7 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *middle_node_ptrs=NULL;/* Pointer to child's node pointer info */
H5B2_shared_t *shared; /* B-tree's shared info */
hsize_t middle_moved_nrec; /* Number of records moved, for internal split */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge3)
@@ -1414,7 +1441,7 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
/* Check for the kind of B-tree node to split */
@@ -1430,11 +1457,11 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx-1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (left_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, left_addr, internal->node_ptrs[idx-1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (middle_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (middle_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
- if (NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
+ if(NULL == (right_internal = H5B2_protect_internal(f, dxpl_id, internal->shared, right_addr, internal->node_ptrs[idx+1].node_nrec, (depth - 1), H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
@@ -1463,11 +1490,18 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
right_addr = internal->node_ptrs[idx+1].addr;
/* Lock B-tree child nodes */
- if (NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &(internal->node_ptrs[idx-1].node_nrec), internal->shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx-1].node_nrec);
+ cache_leaf_udata.bt2_shared = internal->shared;
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
+ if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
- if (NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &(internal->node_ptrs[idx+1].node_nrec), internal->shared, H5AC_WRITE)))
+
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx+1].node_nrec);
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1578,15 +1612,15 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
#endif /* H5B2_DEBUG */
/* Unlock left & middle nodes (marked as dirty) */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache (marked as dirty) */
- if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, right_addr, (hsize_t)shared->node_size) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, right_addr, (hsize_t)shared->node_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree leaf node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG|H5AC__DELETED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DIRTIED_FLAG|H5AC__DELETED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1619,6 +1653,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
void *child; /* Pointer to child node */
uint8_t *child_native; /* Pointer to child's native records */
H5B2_shared_t *shared; /* B-tree's shared info */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_swap_leaf)
@@ -1629,7 +1664,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDassert(idx <= internal->nrec);
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
/* Check for the kind of B-tree node to swap */
@@ -1656,7 +1691,10 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
child_addr = internal->node_ptrs[idx].addr;
/* Lock B-tree child node */
- if (NULL == (child_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, child_addr, &(internal->node_ptrs[idx].node_nrec), internal->shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
+ cache_leaf_udata.bt2_shared = internal->shared;
+ if(NULL == (child_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, child_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1681,7 +1719,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
#endif /* H5B2_DEBUG */
/* Unlock child node */
- if (H5AC_unprotect(f, dxpl_id, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC_unprotect(f, dxpl_id, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1710,6 +1748,7 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_insert_leaf)
@@ -1720,14 +1759,17 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
- /* Lock current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
-
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
+ /* Lock current B-tree node */
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &cache_leaf_udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
+
/* Must have a leaf node with enough space to insert a record now */
HDassert(curr_node_ptr->node_nrec < shared->node_info[0].max_nrec);
@@ -1809,7 +1851,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
/* Split or redistribute child node pointers, if necessary */
@@ -1903,7 +1945,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
+ if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2081,7 +2123,7 @@ H5B2_internal_t *
H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr,
unsigned nrec, unsigned depth, H5AC_protect_t rw)
{
- H5B2_int_load_ud1_t udata; /* User data to pass through to cache 'load' callback */
+ H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */
H5B2_internal_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_protect_internal)
@@ -2096,9 +2138,10 @@ H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr,
udata.bt2_shared = bt2_shared;
udata.nrec = nrec;
udata.depth = depth;
+ udata.f = f;
/* Protect the internal node */
- if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_INT, addr, &udata, NULL, rw)))
+ if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_INT, addr, &udata, rw)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree internal node")
done:
@@ -2134,6 +2177,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
uint8_t *native = NULL; /* Pointers to copy of node's native records */
H5B2_node_ptr_t *node_ptrs = NULL; /* Pointers to node's node pointers */
unsigned u; /* Local index */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = H5_ITER_CONT; /* Iterator return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_iterate_node)
@@ -2172,7 +2216,10 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
H5B2_leaf_t *leaf; /* Pointer to leaf node */
/* Lock the current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &(curr_node->node_nrec), bt2_shared, H5AC_READ)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node->node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Set up information about current node */
@@ -2248,6 +2295,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_leaf)
@@ -2258,15 +2306,18 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
- /* Lock current B-tree node */
- leaf_addr = curr_node_ptr->addr;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
-
/* Get the pointer to the shared B-tree info */
shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
+ /* Lock current B-tree node */
+ leaf_addr = curr_node_ptr->addr;
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &cache_leaf_udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
+
/* Sanity check number of records */
HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec);
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
@@ -2551,6 +2602,7 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */
unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_remove_leaf_by_idx)
@@ -2561,15 +2613,18 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
- /* Lock B-tree leaf node */
- leaf_addr = curr_node_ptr->addr;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
-
/* Get the pointer to the shared B-tree info */
shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
+ /* Lock B-tree leaf node */
+ leaf_addr = curr_node_ptr->addr;
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &cache_leaf_udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
+
/* Sanity check number of records */
HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec);
HDassert(leaf->nrec == curr_node_ptr->node_nrec);
@@ -2919,6 +2974,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
int cmp=0; /* Comparison value of records */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_neighbor_leaf)
@@ -2930,14 +2986,16 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(H5F_addr_defined(curr_node_ptr->addr));
HDassert(op);
- /* Lock current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
-
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
+ /* Lock current B-tree node */
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &cache_leaf_udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Locate node pointer for child */
cmp = H5B2_locate_record(shared->type, leaf->nrec, shared->nat_off, leaf->leaf_native, udata, &idx);
@@ -2962,7 +3020,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Make callback if neighbor record has been found */
if(neighbor_loc) {
/* Make callback for current record */
- if ((op)(neighbor_loc, op_data) < 0)
+ if((op)(neighbor_loc, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree neighbor operation")
} /* end if */
else
@@ -2970,7 +3028,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3061,7 +3119,7 @@ H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3090,6 +3148,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
void *node=NULL; /* Pointers to current node */
uint8_t *native; /* Pointers to node's native records */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_delete_node)
@@ -3100,7 +3159,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
HDassert(curr_node);
/* Get the pointer to the shared B-tree info */
- shared=(H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
if(depth>0) {
@@ -3108,7 +3167,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
unsigned u; /* Local index */
/* Lock the current B-tree node */
- if (NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node->addr, curr_node->node_nrec, depth, H5AC_WRITE)))
+ if(NULL == (internal = H5B2_protect_internal(f, dxpl_id, bt2_shared, curr_node->addr, curr_node->node_nrec, depth, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Set up information about current node */
@@ -3117,15 +3176,18 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
native = internal->int_native;
/* Descend into children */
- for(u=0; u<internal->nrec+1; u++)
- if(H5B2_delete_node(f, dxpl_id, bt2_shared, depth-1, &(internal->node_ptrs[u]), op, op_data) < 0)
+ for(u = 0; u < internal->nrec + 1; u++)
+ if(H5B2_delete_node(f, dxpl_id, bt2_shared, (depth - 1), &(internal->node_ptrs[u]), op, op_data) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed")
} /* end if */
else {
H5B2_leaf_t *leaf; /* Pointer to leaf node */
/* Lock the current B-tree node */
- if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &(curr_node->node_nrec), bt2_shared, H5AC_WRITE)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node->node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Set up information about current node */
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 270cdfd..21b6eee 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -126,6 +126,27 @@ typedef struct {
hsize_t all_nrec; /* Number of records in node pointed to and all it's children */
} H5B2_node_ptr_t;
+/* Callback info for loading a free space header into the cache */
+typedef struct H5B2_hdr_cache_ud_t {
+ H5F_t *f; /* File that v2 b-tree header is within */
+ const H5B2_class_t *type; /* User-data for protecting */
+} H5B2_hdr_cache_ud_t;
+
+/* Callback info for loading a free space internal node into the cache */
+typedef struct H5B2_internal_cache_ud_t {
+ H5F_t *f; /* File that v2 b-tree header is within */
+ H5RC_t *bt2_shared; /* Ref counter for shared B-tree info */
+ unsigned nrec; /* Number of records in node to load */
+ unsigned depth; /* Depth of node to load */
+} H5B2_internal_cache_ud_t;
+
+/* Callback info for loading a free space leaf node into the cache */
+typedef struct H5B2_leaf_cache_ud_t {
+ H5F_t *f; /* File that v2 b-tree header is within */
+ const unsigned *nrec; /* Number of records in node to load */
+ H5RC_t *bt2_shared; /* Ref counter for shared B-tree info */
+} H5B2_leaf_cache_ud_t;
+
/* Information about a node at a given depth */
typedef struct {
unsigned max_nrec; /* Max. number of records in node */
@@ -194,13 +215,6 @@ typedef struct H5B2_internal_t {
unsigned depth; /* Depth of this node in the B-tree */
} H5B2_internal_t;
-/* User data for metadata cache 'load' callback */
-typedef struct {
- H5RC_t *bt2_shared; /* Ref counter for shared B-tree info */
- unsigned nrec; /* Number of records in node to load */
- unsigned depth; /* Depth of node to load */
-} H5B2_int_load_ud1_t;
-
#ifdef H5B2_TESTING
/* Node information for testing */
typedef struct {
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index 899bb8a..8aaa248 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -88,6 +88,7 @@ H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
{
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_stat_info)
@@ -99,7 +100,9 @@ H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
HDassert(info);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get pointer to reference counted shared B-tree info */
diff --git a/src/H5B2test.c b/src/H5B2test.c
index f2cf79d..deb1748 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -258,6 +258,7 @@ H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
haddr_t addr, haddr_t *root_addr)
{
H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for cache callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr_test)
@@ -269,7 +270,9 @@ H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
HDassert(root_addr);
/* Look up the B-tree header */
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get B-tree root addr */
@@ -309,6 +312,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
unsigned depth; /* Current depth of the tree */
int cmp; /* Comparison value of records */
unsigned idx; /* Location of record which matches key */
+ H5B2_hdr_cache_ud_t cache_udata; /* User-data for cache callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_get_node_info_test, FAIL)
@@ -319,13 +323,15 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
HDassert(H5F_addr_defined(addr));
/* Look up the B-tree header */
- if (NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ cache_udata.f = f;
+ cache_udata.type = type;
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
- bt2_shared=bt2->shared;
+ bt2_shared = bt2->shared;
H5RC_INC(bt2_shared);
- incr_rc=TRUE;
+ incr_rc = TRUE;
/* Get the pointer to the shared B-tree info */
shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
@@ -391,9 +397,13 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
{
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
+ H5B2_leaf_cache_ud_t cache_leaf_udata; /* User-data for callback */
/* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
+ cache_leaf_udata.f = f;
+ cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
+ cache_leaf_udata.bt2_shared = bt2_shared;
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index 110f6e2..0537502 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -54,7 +54,7 @@
/********************/
/* Metadata cache callbacks */
-static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
+static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b, unsigned UNUSED * flags_ptr);
static herr_t H5B_dest(H5F_t *f, H5B_t *bt);
static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy);
@@ -96,10 +96,10 @@ const H5AC_class_t H5AC_BT[1] = {{
*-------------------------------------------------------------------------
*/
static H5B_t *
-H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
+H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- const H5B_class_t *type = (const H5B_class_t *) _type;
- H5B_t *bt = NULL;
+ H5B_t *bt = NULL; /* Pointer to the deserialized B-tree node */
+ H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */
H5B_shared_t *shared; /* Pointer to shared B-tree info */
const uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native keys */
@@ -111,8 +111,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(type);
- HDassert(type->get_shared);
+ HDassert(udata);
/* Allocate the B-tree node in memory */
if(NULL == (bt = H5FL_MALLOC(H5B_t)))
@@ -120,8 +119,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t));
/* Set & increment the ref-counted "shared" B-tree information for the node */
- if(NULL == (bt->rc_shared=(type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer")
+ bt->rc_shared = udata->rc_shared;
H5RC_INC(bt->rc_shared);
/* Get a pointer to the shared info, for convenience */
@@ -146,7 +144,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
p += 4;
/* node type and level */
- if(*p++ != (uint8_t)type->id)
+ if(*p++ != (uint8_t)udata->type->id)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
bt->level = *p++;
@@ -154,26 +152,26 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
UINT16DECODE(p, bt->nchildren);
/* sibling pointers */
- H5F_addr_decode(f, (const uint8_t **)&p, &(bt->left));
- H5F_addr_decode(f, (const uint8_t **)&p, &(bt->right));
+ H5F_addr_decode(udata->f, (const uint8_t **)&p, &(bt->left));
+ H5F_addr_decode(udata->f, (const uint8_t **)&p, &(bt->right));
/* the child/key pairs */
native = bt->native;
for(u = 0; u < bt->nchildren; u++) {
/* Decode native key value */
- if((type->decode)(shared, p, native) < 0)
+ if((udata->type->decode)(shared, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
p += shared->sizeof_rkey;
- native += type->sizeof_nkey;
+ native += udata->type->sizeof_nkey;
/* Decode address value */
- H5F_addr_decode(f, (const uint8_t **)&p, bt->child + u);
+ H5F_addr_decode(udata->f, (const uint8_t **)&p, bt->child + u);
} /* end for */
/* Decode final key */
if(bt->nchildren > 0) {
/* Decode native key value */
- if((type->decode)(shared, p, native) < 0)
+ if((udata->type->decode)(shared, p, native) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
} /* end if */
diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h
index 05f9f30..e48ec23 100644
--- a/src/H5Bpkg.h
+++ b/src/H5Bpkg.h
@@ -33,8 +33,7 @@
/* Other private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5RCprivate.h" /* Reference counted objects */
+#include "H5FLprivate.h" /* Free Lists */
/**************************/
@@ -59,6 +58,13 @@ typedef struct H5B_t {
haddr_t *child; /*2k child pointers */
} H5B_t;
+/* Callback info for loading a B-tree node into the cache */
+typedef struct H5B_cache_ud_t {
+ H5F_t *f; /* File that B-tree node is within */
+ const struct H5B_class_t *type; /* Type of tree */
+ H5RC_t *rc_shared; /* Ref-counted shared info */
+} H5B_cache_ud_t;
+
/*****************************/
/* Package Private Variables */
/*****************************/
@@ -79,7 +85,7 @@ H5FL_EXTERN(H5B_t);
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5B_node_dest(H5B_t *b);
+H5_DLL herr_t H5B_node_dest(H5B_t *bt);
#endif /*_H5Bpkg_H*/
diff --git a/src/H5C.c b/src/H5C.c
index 850194c..a2386e2 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -175,8 +175,7 @@ static void * H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- const void * udata1,
- void * udata2,
+ void * udata,
hbool_t skip_file_checks);
static herr_t H5C_make_space_in_cache(H5F_t * f,
@@ -210,7 +209,7 @@ static herr_t H5C_verify_not_in_index(H5C_t * cache_ptr,
#define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS
static void *H5C_epoch_marker_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
+ void *udata);
static herr_t H5C_epoch_marker_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
haddr_t addr, void *thing,
unsigned *flags_ptr);
@@ -241,8 +240,7 @@ static void *
H5C_epoch_marker_load(H5F_t UNUSED * f,
hid_t UNUSED dxpl_id,
haddr_t UNUSED addr,
- const void UNUSED * udata1,
- void UNUSED * udata2)
+ void UNUSED * udata)
{
void * ret_value = NULL; /* Return value */
@@ -321,6 +319,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
+
/*-------------------------------------------------------------------------
* Function: H5C_create
@@ -2175,7 +2174,7 @@ H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr,
*-------------------------------------------------------------------------
*/
herr_t
-H5C_insert_entry(H5F_t * f,
+H5C_insert_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
const H5C_class_t * type,
@@ -2475,7 +2474,7 @@ done:
*/
#ifdef H5_HAVE_PARALLEL
herr_t
-H5C_mark_entries_as_clean(H5F_t * f,
+H5C_mark_entries_as_clean(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
int32_t ce_array_len,
@@ -3332,13 +3331,12 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5C_protect(H5F_t * f,
+H5C_protect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- const void * udata1,
- void * udata2,
+ void * udata,
unsigned flags)
{
H5C_t * cache_ptr;
@@ -3396,8 +3394,7 @@ H5C_protect(H5F_t * f,
hit = FALSE;
- thing = H5C_load_entry(f, primary_dxpl_id, type, addr, udata1, udata2,
- cache_ptr->skip_file_checks);
+ thing = H5C_load_entry(f, primary_dxpl_id, type, addr, udata, cache_ptr->skip_file_checks);
if ( thing == NULL ) {
@@ -7472,7 +7469,7 @@ H5C_flush_single_entry(const H5F_t * f,
hid_t secondary_dxpl_id,
const H5C_class_t * type_ptr,
haddr_t addr,
- unsigned flags,
+ unsigned flags,
hbool_t * first_flush_ptr,
hbool_t del_entry_from_slist_on_destroy)
{
@@ -7879,7 +7876,7 @@ H5C_flush_single_entry(const H5F_t * f,
if ( cache_ptr->aux_ptr != NULL ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Flush operation occured in the parallel case.")
+ "resize/rename in serialize occured in parallel case.")
}
}
@@ -8030,8 +8027,7 @@ H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- const void * udata1,
- void * udata2,
+ void * udata,
#ifndef NDEBUG
hbool_t skip_file_checks)
#else /* NDEBUG */
@@ -8053,7 +8049,7 @@ H5C_load_entry(H5F_t * f,
HDassert( type->size );
HDassert( H5F_addr_defined(addr) );
- if ( NULL == (thing = (type->load)(f, dxpl_id, addr, udata1, udata2)) ) {
+ if ( NULL == (thing = (type->load)(f, dxpl_id, addr, udata)) ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "unable to load entry")
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 2c2de6d..da22c8a 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -124,8 +124,7 @@ typedef struct H5C_t H5C_t;
typedef void *(*H5C_load_func_t)(H5F_t *f,
hid_t dxpl_id,
haddr_t addr,
- const void *udata1,
- void *udata2);
+ void *udata);
typedef herr_t (*H5C_flush_func_t)(H5F_t *f,
hid_t dxpl_id,
hbool_t dest,
@@ -443,6 +442,37 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr,
* there is no previous item, it should be NULL.
*
*
+ * Fields supporting metadata journaling:
+ *
+ * last_trans: unit64_t containing the ID of the last transaction in
+ * which this entry was dirtied. If journaling is disabled,
+ * or if the entry has never been dirtied in a transaction,
+ * this field should be set to zero. Once we notice that
+ * the specified transaction has made it to disk, we will
+ * reset this field to zero as well.
+ *
+ * We must maintain this field, as to avoid messages from
+ * the future, we must not flush a dirty entry to disk
+ * until the last transaction in which it was dirtied
+ * has made it to disk in the journal file.
+ *
+ * trans_next: Next pointer in the entries modified in the current
+ * transaction list. This field should always be null
+ * unless journaling is enabled, the entry is dirty,
+ * and last_trans field contains the current transaction
+ * number. Even if all these conditions are fulfilled,
+ * the field will still be NULL if this is the last
+ * entry on the list.
+ *
+ * trans_prev: Previous pointer in the entries modified in the current
+ * transaction list. This field should always be null
+ * unless journaling is enabled, the entry is dirty,
+ * and last_trans field contains the current transaction
+ * number. Even if all these conditions are fulfilled,
+ * the field will still be NULL if this is the first
+ * entry on the list.
+ *
+ *
* Cache entry stats collection fields:
*
* These fields should only be compiled in when both H5C_COLLECT_CACHE_STATS
@@ -1022,11 +1052,10 @@ H5_DLL herr_t H5C_pin_protected_entry(void *thing);
H5_DLL void * H5C_protect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- const H5C_class_t * type,
+ const H5C_class_t * type,
haddr_t addr,
- const void * udata1,
- void * udata2,
- unsigned flags);
+ void * udata,
+ unsigned flags);
H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr);
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 4da3db8..e824c26 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -52,7 +52,6 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5Bprivate.h" /* B-link trees */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
diff --git a/src/H5F.c b/src/H5F.c
index c27194e..b7825bd 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -22,7 +22,7 @@
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
#include "H5Aprivate.h" /* Attributes */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
@@ -1956,7 +1956,7 @@ H5F_try_close(H5F_t *f)
*/
if(f->intent&H5F_ACC_RDWR) {
/* Flush and destroy all caches */
- if(H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL, H5C__NO_FLAGS_SET) < 0)
+ if(H5F_flush(f, H5AC_dxpl_id, H5F_SCOPE_LOCAL, H5F_FLUSH_NONE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 5853d05..be7d921 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -26,7 +26,6 @@
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5Dprivate.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
diff --git a/src/H5FS.c b/src/H5FS.c
index b2e127d..cb390f0 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -33,6 +33,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5FSpkg.h" /* File free space */
#include "H5MFprivate.h" /* File memory management */
@@ -55,6 +56,8 @@
/********************/
/* Local Prototypes */
/********************/
+
+/* Section info routines */
static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data);
static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data);
@@ -169,6 +172,7 @@ H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses,
H5FS_t *fspace = NULL; /* New free space structure */
H5FS_prot_t fs_prot; /* Information for protecting free space manager */
unsigned fspace_status = 0; /* Free space header's status in the metadata cache */
+ H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */
H5FS_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5FS_open, NULL)
@@ -185,9 +189,11 @@ HDfprintf(stderr, "%s: Opening free space manager, nclasses = %Zu\n", FUNC, ncla
fs_prot.nclasses = nclasses;
fs_prot.classes = classes;
fs_prot.cls_init_udata = cls_init_udata;
+ cache_udata.fs_prot = &fs_prot;
+ cache_udata.f = f;
/* Protect the free space header */
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header")
#ifdef QAK
HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
@@ -239,6 +245,7 @@ H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr)
{
H5FS_t *fspace = NULL; /* Free space header loaded from file */
H5FS_prot_t fs_prot; /* Temporary information for protecting free space header */
+ H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FS_delete, FAIL)
@@ -255,9 +262,11 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC);
fs_prot.nclasses = 0;
fs_prot.classes = NULL;
fs_prot.cls_init_udata = NULL;
+ cache_udata.fs_prot = &fs_prot;
+ cache_udata.f = f;
/* Protect the free space header */
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_WRITE)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
/* Delete serialized section storage, if there are any */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 9032050..5d9f5c6 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -34,6 +34,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5FSpkg.h" /* File free space */
#include "H5Vprivate.h" /* Vectors and arrays */
@@ -77,12 +78,12 @@ static herr_t H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *
static herr_t H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata);
/* Metadata cache callbacks */
-static H5FS_t *H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2);
+static H5FS_t *H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_t *fspace, unsigned UNUSED * flags_ptr);
static herr_t H5FS_cache_hdr_dest(H5F_t *f, H5FS_t *fspace);
static herr_t H5FS_cache_hdr_clear(H5F_t *f, H5FS_t *fspace, hbool_t destroy);
static herr_t H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t *fspace, size_t *size_ptr);
-static H5FS_sinfo_t *H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2);
+static H5FS_sinfo_t *H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_sinfo_t *sinfo, unsigned UNUSED * flags_ptr);
static herr_t H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo);
static herr_t H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy);
@@ -143,10 +144,10 @@ H5FL_BLK_DEFINE_STATIC(sect_block);
*-------------------------------------------------------------------------
*/
static H5FS_t *
-H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot, void UNUSED *udata2)
+H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5FS_t *fspace = NULL; /* Free space header info */
- const H5FS_prot_t *fs_prot = (const H5FS_prot_t *)_fs_prot; /* User data for protecting */
+ H5FS_hdr_cache_ud_t *udata = (H5FS_hdr_cache_ud_t *)_udata; /* user data for callback */
size_t size; /* Header size */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
uint8_t hdr_buf[H5FS_HDR_BUF_SIZE]; /* Buffer for header */
@@ -162,10 +163,10 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot,
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(fs_prot);
+ HDassert(udata);
/* Allocate a new free space manager */
- if(NULL == (fspace = H5FS_new(fs_prot->nclasses, fs_prot->classes, fs_prot->cls_init_udata)))
+ if(NULL == (fspace = H5FS_new(udata->fs_prot->nclasses, udata->fs_prot->classes, udata->fs_prot->cls_init_udata)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set free space manager's internal information */
@@ -176,7 +177,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot,
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute the size of the free space header on disk */
- size = H5FS_HEADER_SIZE(f);
+ size = H5FS_HEADER_SIZE(udata->f);
/* Get a pointer to a buffer that's large enough for header */
if(NULL == (hdr = H5WB_actual(wb, size)))
@@ -203,16 +204,16 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot,
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header")
/* Total space tracked */
- H5F_DECODE_LENGTH(f, p, fspace->tot_space);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->tot_space);
/* Total # of free space sections tracked */
- H5F_DECODE_LENGTH(f, p, fspace->tot_sect_count);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->tot_sect_count);
/* # of serializable free space sections tracked */
- H5F_DECODE_LENGTH(f, p, fspace->serial_sect_count);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->serial_sect_count);
/* # of ghost free space sections tracked */
- H5F_DECODE_LENGTH(f, p, fspace->ghost_sect_count);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->ghost_sect_count);
/* # of section classes */
/* (only check if we actually have some classes) */
@@ -230,16 +231,16 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot,
UINT16DECODE(p, fspace->max_sect_addr);
/* Max. size of section to track */
- H5F_DECODE_LENGTH(f, p, fspace->max_sect_size);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->max_sect_size);
/* Address of serialized free space sections */
- H5F_addr_decode(f, &p, &fspace->sect_addr);
+ H5F_addr_decode(udata->f, &p, &fspace->sect_addr);
/* Size of serialized free space sections */
- H5F_DECODE_LENGTH(f, p, fspace->sect_size);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->sect_size);
/* Allocated size of serialized free space sections */
- H5F_DECODE_LENGTH(f, p, fspace->alloc_sect_size);
+ H5F_DECODE_LENGTH(udata->f, p, fspace->alloc_sect_size);
/* Compute checksum on indirect block */
computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - (const uint8_t *)hdr), 0);
@@ -506,10 +507,10 @@ H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_pt
*-------------------------------------------------------------------------
*/
static H5FS_sinfo_t *
-H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void *_fspace)
+H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5FS_sinfo_t *sinfo = NULL; /* Free space section info */
- H5FS_t *fspace = (H5FS_t *)_fspace; /* User data for protecting */
+ H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* user data for callback */
haddr_t fs_addr; /* Free space header address */
size_t old_sect_size; /* Old section size */
uint8_t *buf = NULL; /* Temporary buffer */
@@ -523,28 +524,28 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(fspace);
+ HDassert(udata);
/* Allocate a new free space section info */
- if(NULL == (sinfo = H5FS_sinfo_new(f, fspace)))
+ if(NULL == (sinfo = H5FS_sinfo_new(udata->f, udata->fspace)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Link free space manager to section info */
/* (for deserializing sections) */
- HDassert(fspace->sinfo == NULL);
- fspace->sinfo = sinfo;
+ HDassert(udata->fspace->sinfo == NULL);
+ udata->fspace->sinfo = sinfo;
/* Sanity check address */
- if(H5F_addr_ne(addr, fspace->sect_addr))
+ if(H5F_addr_ne(addr, udata->fspace->sect_addr))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect address for free space sections")
/* Allocate space for the buffer to serialize the sections into */
- H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t);
- if(NULL == (buf = H5FL_BLK_MALLOC(sect_block, (size_t)fspace->sect_size)))
+ H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ udata->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t);
+ if(NULL == (buf = H5FL_BLK_MALLOC(sect_block, (size_t)udata->fspace->sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read buffer from disk */
- if(H5F_block_read(f, H5FD_MEM_FSPACE_SINFO, fspace->sect_addr, (size_t)fspace->sect_size, dxpl_id, buf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_FSPACE_SINFO, udata->fspace->sect_addr, (size_t)udata->fspace->sect_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space sections")
/* Deserialize free sections from buffer available */
@@ -560,12 +561,12 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections version")
/* Address of free space header for these sections */
- H5F_addr_decode(f, &p, &fs_addr);
- if(H5F_addr_ne(fs_addr, fspace->addr))
+ H5F_addr_decode(udata->f, &p, &fs_addr);
+ if(H5F_addr_ne(fs_addr, udata->fspace->addr))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections")
/* Check for any serialized sections */
- if(fspace->serial_sect_count > 0) {
+ if(udata->fspace->serial_sect_count > 0) {
hsize_t old_tot_sect_count; /* Total section count from header */
hsize_t old_serial_sect_count; /* Total serializable section count from header */
hsize_t old_ghost_sect_count; /* Total ghost section count from header */
@@ -573,17 +574,17 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *
unsigned sect_cnt_size; /* The size of the section size counts */
/* Compute the size of the section counts */
- sect_cnt_size = H5V_limit_enc_size((uint64_t)fspace->serial_sect_count);
+ sect_cnt_size = H5V_limit_enc_size((uint64_t)udata->fspace->serial_sect_count);
/* Reset the section count, the "add" routine will update it */
- old_tot_sect_count = fspace->tot_sect_count;
- old_serial_sect_count = fspace->serial_sect_count;
- old_ghost_sect_count = fspace->ghost_sect_count;
- old_tot_space = fspace->tot_space;
- fspace->tot_sect_count = 0;
- fspace->serial_sect_count = 0;
- fspace->ghost_sect_count = 0;
- fspace->tot_space = 0;
+ old_tot_sect_count = udata->fspace->tot_sect_count;
+ old_serial_sect_count = udata->fspace->serial_sect_count;
+ old_ghost_sect_count = udata->fspace->ghost_sect_count;
+ old_tot_space = udata->fspace->tot_space;
+ udata->fspace->tot_sect_count = 0;
+ udata->fspace->serial_sect_count = 0;
+ udata->fspace->ghost_sect_count = 0;
+ udata->fspace->tot_space = 0;
/* Walk through the buffer, deserializing sections */
do {
@@ -614,27 +615,27 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *
/* Call 'deserialize' callback for this section */
des_flags = 0;
- HDassert(fspace->sect_cls[sect_type].deserialize);
- if(NULL == (new_sect = (*fspace->sect_cls[sect_type].deserialize)(&fspace->sect_cls[sect_type], dxpl_id, p, sect_addr, sect_size, &des_flags)))
+ HDassert(udata->fspace->sect_cls[sect_type].deserialize);
+ if(NULL == (new_sect = (*udata->fspace->sect_cls[sect_type].deserialize)(&udata->fspace->sect_cls[sect_type], udata->dxpl_id, p, sect_addr, sect_size, &des_flags)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTDECODE, NULL, "can't deserialize section")
/* Update offset in serialization buffer */
- p += fspace->sect_cls[sect_type].serial_size;
+ p += udata->fspace->sect_cls[sect_type].serial_size;
/* Insert section in free space manager, unless requested not to */
if(!(des_flags & H5FS_DESERIALIZE_NO_ADD))
- if(H5FS_sect_add(f, dxpl_id, fspace, new_sect, H5FS_ADD_DESERIALIZING, NULL) < 0)
+ if(H5FS_sect_add(udata->f, udata->dxpl_id, udata->fspace, new_sect, H5FS_ADD_DESERIALIZING, NULL) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, NULL, "can't add section to free space manager")
} /* end for */
} while(p < ((buf + old_sect_size) - H5FS_SIZEOF_CHKSUM));
/* Sanity check */
HDassert((size_t)(p - buf) == (old_sect_size - H5FS_SIZEOF_CHKSUM));
- HDassert(old_sect_size == fspace->sect_size);
- HDassert(old_tot_sect_count == fspace->tot_sect_count);
- HDassert(old_serial_sect_count == fspace->serial_sect_count);
- HDassert(old_ghost_sect_count == fspace->ghost_sect_count);
- HDassert(old_tot_space == fspace->tot_space);
+ HDassert(old_sect_size == udata->fspace->sect_size);
+ HDassert(old_tot_sect_count == udata->fspace->tot_sect_count);
+ HDassert(old_serial_sect_count == udata->fspace->serial_sect_count);
+ HDassert(old_ghost_sect_count == udata->fspace->ghost_sect_count);
+ HDassert(old_tot_space == udata->fspace->tot_space);
} /* end if */
/* Compute checksum on indirect block */
@@ -658,7 +659,7 @@ done:
buf = H5FL_BLK_FREE(sect_block, buf);
if(!ret_value && sinfo)
if(H5FS_sinfo_dest(sinfo) < 0)
- HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space section info")
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FS_cache_sinfo_load() */ /*lint !e818 Can't make udata a pointer to const */
diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c
index 0ac7b3b..1afa016 100644
--- a/src/H5FSdbg.c
+++ b/src/H5FSdbg.c
@@ -92,6 +92,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int
{
H5FS_t *fspace = NULL; /* Free space header info */
H5FS_prot_t fs_prot; /* Information for protecting free space manager */
+ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FS_debug, FAIL)
@@ -109,11 +110,13 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int
fs_prot.nclasses = 0;
fs_prot.classes = NULL;
fs_prot.cls_init_udata = NULL;
+ cache_udata.fs_prot = &fs_prot;
+ cache_udata.f = f;
/*
* Load the free space header.
*/
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &fs_prot, NULL, H5AC_READ)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header")
/* Print opening message */
@@ -229,6 +232,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int
H5FS_t *fspace = NULL; /* Free space header info */
H5FS_prot_t fs_prot; /* Information for protecting free space manager */
H5FS_client_t client; /* The client of the free space */
+ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FS_sects_debug, FAIL)
@@ -248,11 +252,13 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int
fs_prot.nclasses = 0;
fs_prot.classes = NULL;
fs_prot.cls_init_udata = NULL;
+ cache_udata.fs_prot = &fs_prot;
+ cache_udata.f = f;
/*
* Load the free space header.
*/
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &fs_prot, NULL, H5AC_READ)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header")
/* Retrieve the client id */
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index d900b59..4cf20de 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -101,6 +101,19 @@ typedef struct H5FS_prot_t {
void *cls_init_udata; /* Pointer to class init user data */
} H5FS_prot_t;
+/* Callback info for loading a free space header into the cache */
+typedef struct H5FS_hdr_cache_ud_t {
+ H5F_t *f; /* File that free space header is within */
+ H5FS_prot_t * fs_prot; /* user data for protecting */
+} H5FS_hdr_cache_ud_t;
+
+/* Callback info for loading free space section info into the cache */
+typedef struct H5FS_sinfo_cache_ud_t {
+ H5F_t *f; /* File that free space section info is within */
+ H5FS_t *fspace; /* free space manager */
+ hid_t dxpl_id;
+} H5FS_sinfo_cache_ud_t;
+
/* Free space section bin info */
typedef struct H5FS_bin_t {
size_t tot_sect_count; /* Total # of sections in this bin */
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 7713bf4..c918714 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -186,6 +186,7 @@ static H5FS_sinfo_t *
H5FS_sinfo_pin(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace)
{
H5FS_sinfo_t *sinfo; /* Section information struct created */
+ H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */
H5FS_sinfo_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5FS_sinfo_pin)
@@ -232,8 +233,12 @@ HDfprintf(stderr, "%s: New section info, addr = %a, size = %Hu\n", FUNC, fspace-
#ifdef QAK
HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
#endif /* QAK */
+
/* Protect the free space sections */
- if(NULL == (sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, NULL, fspace, H5AC_WRITE)))
+ cache_udata.fspace = fspace;
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+ if(NULL == (sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space sections")
/* Pin them in the cache */
@@ -304,7 +309,7 @@ H5FS_sect_increase(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
/* Increment amount of space required to serialize all sections */
#ifdef QAK
-HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, sinfo->serial_size);
+HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size);
HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size);
#endif /* QAK */
fspace->sinfo->serial_size += cls->serial_size;
@@ -370,7 +375,7 @@ H5FS_sect_decrease(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, const H5FS_section_c
/* Decrement amount of space required to serialize all sections */
#ifdef QAK
-HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->serial_size);
+HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size);
HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size);
#endif /* QAK */
fspace->sinfo->serial_size -= cls->serial_size;
@@ -1092,7 +1097,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC);
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")
#ifdef QAK
-HDfprintf(stderr, "%s: fspace->hdr->tot_space = %Hu\n", FUNC, fspace->hdr->tot_space);
+HDfprintf(stderr, "%s: fspace->hdr->tot_space = %Hu\n", FUNC, fspace->tot_space);
#endif /* QAK */
/* Mark free space sections as changed */
/* (if adding sections while deserializing sections, don't set the flag) */
@@ -1330,6 +1335,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sec
if(fspace->sect_size > fspace->alloc_sect_size) {
size_t new_size; /* New size of space for serialized sections */
haddr_t old_addr; /* Old address of serialized sections */
+ hsize_t old_alloc_sect_size; /* Old size of section info */
/* Currently, the old block data is "thrown away" after the space is reallocated,
* so avoid data copy in H5MF_realloc() call by just free'ing the space and
@@ -1342,6 +1348,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sec
*/
/* Free previous serialized sections disk space */
old_addr = fspace->sect_addr;
+ old_alloc_sect_size = fspace->alloc_sect_size;
if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_addr, fspace->alloc_sect_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
@@ -1362,6 +1369,12 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size);
HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr, fspace->sect_addr);
#endif /* QAK */
+ /* Resize pinned section info in the cache, if its changed size */
+ if(old_alloc_sect_size != fspace->alloc_sect_size) {
+ if(H5AC_resize_pinned_entry(fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRESIZE, FAIL, "unable to resize free space section info")
+ } /* end if */
+
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(fspace->sect_addr, old_addr)) {
if(H5AC_rename(f, H5AC_FSPACE_SINFO, old_addr, fspace->sect_addr) < 0)
@@ -1380,6 +1393,7 @@ HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr,
else {
size_t decrease_threshold; /* Size threshold for decreasing serialized section size */
haddr_t old_addr; /* Old address of serialized sections */
+ hsize_t old_alloc_sect_size; /* Old size of section info */
/* Compute the threshold for decreasing the sections' serialized size */
decrease_threshold = (size_t)(((size_t)fspace->alloc_sect_size * (double)fspace->shrink_percent) / 100.0);
@@ -1399,6 +1413,7 @@ HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr,
*/
/* Free previous serialized sections disk space */
old_addr = fspace->sect_addr;
+ old_alloc_sect_size = fspace->alloc_sect_size;
if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_addr, fspace->alloc_sect_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
@@ -1419,6 +1434,12 @@ HDfprintf(stderr, "%s: Allocating space for smaller serialized sections, new_siz
if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, (hsize_t)fspace->alloc_sect_size)))
HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ /* Resize pinned section info in the cache, if its changed size */
+ if(old_alloc_sect_size != fspace->alloc_sect_size) {
+ if(H5AC_resize_pinned_entry(fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRESIZE, FAIL, "unable to resize free space section info")
+ } /* end if */
+
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(fspace->sect_addr, old_addr)) {
if(H5AC_rename(f, H5AC_FSPACE_SINFO, old_addr, fspace->sect_addr) < 0)
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 9066af7..1d2684e 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -21,6 +21,7 @@
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5Gprivate.h" /* Groups */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 142d378..070d361 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -36,7 +36,7 @@
/* Other private headers needed by this file */
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Gprivate.h" /* Groups */
@@ -100,14 +100,14 @@ typedef struct H5F_file_t {
size_t sizeof_size; /* Size of offsets in file */
haddr_t super_addr; /* Absolute address of super block */
haddr_t base_addr; /* Absolute base address for rel.addrs. */
- haddr_t extension_addr; /* Relative address of superblock extension */
+ haddr_t extension_addr; /* Relative address of superblock extension */
haddr_t sohm_addr; /* Relative address of shared object header message table */
unsigned sohm_vers; /* Version of shared message table on disk */
unsigned sohm_nindexes; /* Number of shared messages indexes in the table */
haddr_t driver_addr; /* File driver information block address*/
haddr_t maxaddr; /* Maximum address for file */
- H5AC_t *cache; /* The object cache */
+ H5AC_t *cache; /* The object cache */
H5AC_cache_config_t
mdc_initCacheCfg; /* initial configuration for the */
/* metadata cache. This structure is */
diff --git a/src/H5G.c b/src/H5G.c
index 408a6a2..ede2209 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -83,6 +83,7 @@
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5Gpkg.h" /* Groups */
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 16531a7..9bf6f7c 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -41,6 +41,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index e904b4e..bb411a2 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -78,8 +78,7 @@ static size_t H5G_node_size_real(const H5F_t *f);
static herr_t H5G_node_free(H5G_node_t *sym);
/* Metadata cache callbacks */
-static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
- void *_udata2);
+static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata);
static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
H5G_node_t *sym, unsigned UNUSED * flags_ptr);
static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym);
@@ -347,8 +346,7 @@ H5G_node_free(H5G_node_t *sym)
*-------------------------------------------------------------------------
*/
static H5G_node_t *
-H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1,
- void UNUSED * _udata2)
+H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
H5G_node_t *sym = NULL;
size_t size;
@@ -356,7 +354,7 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
uint8_t node_buf[H5G_NODE_BUF_SIZE]; /* Buffer for node */
uint8_t *node; /* Pointer to node buffer */
const uint8_t *p;
- H5G_node_t *ret_value; /*for error handling */
+ H5G_node_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_node_load)
@@ -365,8 +363,7 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
*/
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(!_udata1);
- HDassert(NULL == _udata2);
+ HDassert(udata);
/*
* Initialize variables.
@@ -874,7 +871,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
/*
* Load the symbol table node for exclusive access.
*/
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node")
/* Get base address of heap */
@@ -980,7 +977,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
/*
* Load the symbol node.
*/
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node")
/* Get base address of heap */
@@ -1023,7 +1020,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(H5G_node_create(f, dxpl_id, H5B_INS_FIRST, NULL, NULL, NULL, new_node_p/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node")
- if(NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node")
HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
@@ -1137,7 +1134,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
HDassert(udata && udata->common.heap);
/* Load the symbol table */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node")
/* "Normal" removal of a single entry from the symbol table node */
@@ -1226,7 +1223,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
*rt_key_changed = TRUE;
sn->nsyms = 0;
if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size_real(f)) < 0
- || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG) < 0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node")
} /* end if */
@@ -1298,7 +1295,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
*rt_key_changed = TRUE;
sn->nsyms = 0;
if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size_real(f)) < 0
- || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG) < 0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node")
} /* end if */
@@ -1347,7 +1344,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad
HDassert(udata && udata->heap);
/* Protect the symbol table node & local heap while we iterate over entries */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
/*
@@ -1424,7 +1421,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr
HDassert(num_objs);
/* Find the object node and add the number of symbol entries. */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
*num_objs += sn->nsyms;
@@ -1469,7 +1466,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add
HDassert(udata);
/* Get a pointer to the symbol table node */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node");
/* Find the node, locate the object symbol table entry and retrieve the name */
@@ -1607,7 +1604,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
HDassert(udata);
/* load the symbol table into memory from the source file */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
/* get the base address of the heap */
@@ -1742,7 +1739,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_
* Save information about the symbol table node since we can't lock it
* because we're about to call an application function.
*/
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
/* Check if the link table needs to be extended */
@@ -1856,7 +1853,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
* If we couldn't load the symbol table node, then try loading the
* B-tree node.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) {
+ if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ))) {
H5G_bt_common_t udata; /*data to pass through B-tree */
H5E_clear_stack(NULL); /* discard that error */
diff --git a/src/H5HF.c b/src/H5HF.c
index 66a24e8..093bd3b 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -152,6 +152,7 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
{
H5HF_t *fh = NULL; /* Pointer to new fractal heap */
H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
haddr_t fh_addr; /* Heap header address */
H5HF_t *ret_value; /* Return value */
@@ -174,8 +175,12 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
if(NULL == (fh = H5FL_MALLOC(H5HF_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap info")
+ /* Set up userdata for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/* Lock the heap header into memory */
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load fractal heap header")
/* Point fractal heap wrapper at header and bump it's ref count */
@@ -224,6 +229,7 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr)
{
H5HF_t *fh = NULL; /* Pointer to new fractal heap */
H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
H5HF_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5HF_open, NULL)
@@ -234,11 +240,15 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr)
HDassert(f);
HDassert(H5F_addr_defined(fh_addr));
+ /* Set up userdata for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/* Load the heap header into memory */
#ifdef QAK
HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr);
#endif /* QAK */
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load fractal heap header")
#ifdef QAK
HDfprintf(stderr, "%s: hdr->rc = %u, hdr->fspace = %p\n", FUNC, hdr->rc, hdr->fspace);
@@ -785,6 +795,7 @@ done:
herr_t
H5HF_close(H5HF_t *fh, hid_t dxpl_id)
{
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
hbool_t pending_delete = FALSE; /* Whether the heap is pending deletion */
haddr_t heap_addr = HADDR_UNDEF; /* Address of heap (for deletion) */
herr_t ret_value = SUCCEED; /* Return value */
@@ -854,8 +865,12 @@ HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr-
if(pending_delete) {
H5HF_hdr_t *hdr; /* Another pointer to fractal heap header */
+ /* Set up userdata for protect call */
+ cache_udata.f = fh->f;
+ cache_udata.dxpl_id = dxpl_id;
+
/* Lock the heap header into memory */
- if(NULL == (hdr = H5AC_protect(fh->f, dxpl_id, H5AC_FHEAP_HDR, heap_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = H5AC_protect(fh->f, dxpl_id, H5AC_FHEAP_HDR, heap_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
/* Set the shared heap header's file context for this operation */
@@ -891,7 +906,8 @@ herr_t
H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr)
{
H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */
- herr_t ret_value = SUCCEED;
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_delete, FAIL)
@@ -901,11 +917,15 @@ H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr)
HDassert(f);
HDassert(H5F_addr_defined(fh_addr));
+ /* Set up userdata for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/* Lock the heap header into memory */
#ifdef QAK
HDfprintf(stderr, "%s: fh_addr = %a\n", FUNC, fh_addr);
#endif /* QAK */
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
/* Check for files using shared heap header */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 306139b..92c7ff3 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -34,6 +34,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5MFprivate.h" /* File memory management */
@@ -76,17 +77,17 @@ static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dt
static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable);
/* Metadata cache (H5AC) callbacks */
-static H5HF_hdr_t *H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2);
+static H5HF_hdr_t *H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_hdr_t *hdr, unsigned UNUSED * flags_ptr);
static herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr);
static herr_t H5HF_cache_hdr_clear(H5F_t *f, H5HF_hdr_t *hdr, hbool_t destroy);
static herr_t H5HF_cache_hdr_size(const H5F_t *f, const H5HF_hdr_t *hdr, size_t *size_ptr);
-static H5HF_indirect_t *H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2);
+static H5HF_indirect_t *H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_indirect_t *iblock, unsigned UNUSED * flags_ptr);
static herr_t H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock);
static herr_t H5HF_cache_iblock_clear(H5F_t *f, H5HF_indirect_t *iblock, hbool_t destroy);
static herr_t H5HF_cache_iblock_size(const H5F_t *f, const H5HF_indirect_t *iblock, size_t *size_ptr);
-static H5HF_direct_t *H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2);
+static H5HF_direct_t *H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_direct_t *dblock, unsigned UNUSED * flags_ptr);
static herr_t H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock);
static herr_t H5HF_cache_dblock_clear(H5F_t *f, H5HF_direct_t *dblock, hbool_t destroy);
@@ -256,9 +257,10 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable)
*-------------------------------------------------------------------------
*/
static H5HF_hdr_t *
-H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
+H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5HF_hdr_t *hdr = NULL; /* Fractal heap info */
+ H5HF_hdr_cache_ud_t *udata = (H5HF_hdr_cache_ud_t *)_udata;
size_t size; /* Header size */
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
uint8_t hdr_buf[H5HF_HDR_BUF_SIZE]; /* Buffer for header */
@@ -274,9 +276,10 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
+ HDassert(udata);
/* Allocate space for the fractal heap data structure */
- if(NULL == (hdr = H5HF_hdr_alloc(f)))
+ if(NULL == (hdr = H5HF_hdr_alloc(udata->f)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the heap header's address */
@@ -322,22 +325,22 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
/* "Huge" object information */
UINT32DECODE(p, hdr->max_man_size); /* Max. size of "managed" objects */
- H5F_DECODE_LENGTH(f, p, hdr->huge_next_id); /* Next ID to use for "huge" object */
- H5F_addr_decode(f, &p, &hdr->huge_bt2_addr); /* Address of "huge" object tracker B-tree */
+ H5F_DECODE_LENGTH(udata->f, p, hdr->huge_next_id); /* Next ID to use for "huge" object */
+ H5F_addr_decode(udata->f, &p, &hdr->huge_bt2_addr); /* Address of "huge" object tracker B-tree */
/* "Managed" object free space information */
- H5F_DECODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */
- H5F_addr_decode(f, &p, &hdr->fs_addr); /* Address of free section header */
+ H5F_DECODE_LENGTH(udata->f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */
+ H5F_addr_decode(udata->f, &p, &hdr->fs_addr); /* Address of free section header */
/* Heap statistics */
- H5F_DECODE_LENGTH(f, p, hdr->man_size);
- H5F_DECODE_LENGTH(f, p, hdr->man_alloc_size);
- H5F_DECODE_LENGTH(f, p, hdr->man_iter_off);
- H5F_DECODE_LENGTH(f, p, hdr->man_nobjs);
- H5F_DECODE_LENGTH(f, p, hdr->huge_size);
- H5F_DECODE_LENGTH(f, p, hdr->huge_nobjs);
- H5F_DECODE_LENGTH(f, p, hdr->tiny_size);
- H5F_DECODE_LENGTH(f, p, hdr->tiny_nobjs);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->man_size);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->man_alloc_size);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->man_iter_off);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->man_nobjs);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->huge_size);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->huge_nobjs);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->tiny_size);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->tiny_nobjs);
/* Managed objects' doubling-table info */
if(H5HF_dtable_decode(hdr->f, &p, &(hdr->man_dtable)) < 0)
@@ -377,13 +380,13 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
p = buf + filter_info_off;
/* Decode the size of a filtered root direct block */
- H5F_DECODE_LENGTH(f, p, hdr->pline_root_direct_size);
+ H5F_DECODE_LENGTH(udata->f, p, hdr->pline_root_direct_size);
/* Decode the filter mask for a filtered root direct block */
UINT32DECODE(p, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
- if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, dxpl_id, H5O_PLINE_ID, p)))
+ if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, H5O_PLINE_ID, p)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
p += hdr->filter_len;
@@ -425,7 +428,7 @@ done:
HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
if(!ret_value && hdr)
if(H5HF_hdr_dest(hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap header")
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -690,11 +693,10 @@ H5HF_cache_hdr_size(const H5F_t UNUSED *f, const H5HF_hdr_t *hdr, size_t *size_p
*-------------------------------------------------------------------------
*/
static H5HF_indirect_t *
-H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows, void *_par_info)
+H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5HF_hdr_t *hdr; /* Shared fractal heap information */
- const unsigned *nrows = (const unsigned *)_nrows; /* # of rows in indirect block */
- H5HF_parent_t *par_info = (H5HF_parent_t *)_par_info; /* Shared parent information */
+ H5HF_iblock_cache_ud_t *udata = (H5HF_iblock_cache_ud_t *)_udata; /* user data for callback */
H5HF_indirect_t *iblock = NULL; /* Indirect block info */
H5WB_t *wb = NULL; /* Wrapped buffer for indirect block data */
uint8_t iblock_buf[H5HF_IBLOCK_BUF_SIZE]; /* Buffer for indirect block */
@@ -711,7 +713,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(par_info);
+ HDassert(udata);
/* Allocate space for the fractal heap indirect block */
if(NULL == (iblock = H5FL_CALLOC(H5HF_indirect_t)))
@@ -719,10 +721,10 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
HDmemset(&iblock->cache_info, 0, sizeof(H5AC_info_t));
/* Get the pointer to the shared heap header */
- hdr = par_info->hdr;
+ hdr = udata->par_info->hdr;
/* Set the shared heap header's file context for this operation */
- hdr->f = f;
+ hdr->f = udata->f;
/* Share common heap information */
iblock->hdr = hdr;
@@ -731,7 +733,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
/* Set block's internal information */
iblock->rc = 0;
- iblock->nrows = *nrows;
+ iblock->nrows = *udata->nrows;
iblock->addr = addr;
iblock->nchildren = 0;
@@ -763,13 +765,13 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version")
/* Address of heap that owns this block */
- H5F_addr_decode(f, &p, &heap_addr);
+ H5F_addr_decode(udata->f, &p, &heap_addr);
if(H5F_addr_ne(heap_addr, hdr->heap_addr))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block")
/* Address of parent block */
- iblock->parent = par_info->iblock;
- iblock->par_entry = par_info->entry;
+ iblock->parent = udata->par_info->iblock;
+ iblock->par_entry = udata->par_info->entry;
if(iblock->parent) {
/* Share parent block */
if(H5HF_iblock_incr(iblock->parent) < 0)
@@ -804,7 +806,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
iblock->filt_ents = NULL;
for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) {
/* Decode child block address */
- H5F_addr_decode(f, &p, &(iblock->ents[u].addr));
+ H5F_addr_decode(udata->f, &p, &(iblock->ents[u].addr));
/* Check for heap with I/O filters */
if(hdr->filter_len > 0) {
@@ -814,7 +816,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
/* Decode extra information for direct blocks */
if(u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) {
/* Size of filtered direct block */
- H5F_DECODE_LENGTH(f, p, iblock->filt_ents[u].size);
+ H5F_DECODE_LENGTH(udata->f, p, iblock->filt_ents[u].size);
/* Sanity check */
/* (either both the address & size are defined or both are
@@ -1142,11 +1144,11 @@ H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, siz
*-------------------------------------------------------------------------
*/
static H5HF_direct_t *
-H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, void *_par_info)
+H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- const size_t *size = (const size_t *)_size; /* Size of block */
+ H5HF_dblock_cache_ud_t *udata = (H5HF_dblock_cache_ud_t *)_udata; /* pointer to user data */
H5HF_hdr_t *hdr; /* Shared fractal heap information */
- H5HF_parent_t *par_info = (H5HF_parent_t *)_par_info; /* Pointer to parent information */
+ H5HF_parent_t *par_info; /* Pointer to parent information */
H5HF_direct_t *dblock = NULL; /* Direct block info */
const uint8_t *p; /* Pointer into raw data buffer */
haddr_t heap_addr; /* Address of heap header in the file */
@@ -1157,7 +1159,9 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(par_info);
+ HDassert(udata != NULL);
+ HDassert(udata->f != NULL);
+ HDassert(udata->dblock_size > 0);
/* Allocate space for the fractal heap direct block */
if(NULL == (dblock = H5FL_MALLOC(H5HF_direct_t)))
@@ -1165,10 +1169,11 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t));
/* Get the pointer to the shared heap header */
+ par_info = (H5HF_parent_t *)(&(udata->par_info));
hdr = par_info->hdr;
/* Set the shared heap header's file context for this operation */
- hdr->f = f;
+ hdr->f = udata->f;
/* Share common heap information */
dblock->hdr = hdr;
@@ -1176,7 +1181,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header")
/* Set block's internal information */
- dblock->size = *size;
+ dblock->size = udata->dblock_size;
dblock->blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dblock->size);
/* Allocate block buffer */
@@ -1199,7 +1204,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Set up parameters to read filtered direct block */
read_size = hdr->pline_root_direct_size;
- filter_mask = hdr->pline_root_direct_filter_mask;
} /* end if */
else {
/* Sanity check */
@@ -1207,7 +1211,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Set up parameters to read filtered direct block */
read_size = par_info->iblock->filt_ents[par_info->entry].size;
- filter_mask = par_info->iblock->filt_ents[par_info->entry].filter_mask;
} /* end else */
/* Allocate buffer to perform I/O filtering on */
@@ -1220,6 +1223,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Push direct block data through I/O filter pipeline */
nbytes = read_size;
+ filter_mask = udata->filter_mask;
if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed")
@@ -1251,7 +1255,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version")
/* Address of heap that owns this block (just for file integrity checks) */
- H5F_addr_decode(f, &p, &heap_addr);
+ H5F_addr_decode(udata->f, &p, &heap_addr);
if(H5F_addr_ne(heap_addr, hdr->heap_addr))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block")
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index bbbe26f..9740e20 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -188,6 +188,7 @@ herr_t
H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth)
{
H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_hdr_debug, FAIL)
@@ -201,10 +202,14 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
+ /* Set up user data for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/*
* Load the fractal heap header.
*/
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
/* Print opening message */
@@ -394,6 +399,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
{
H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */
H5HF_direct_t *dblock = NULL; /* Fractal heap direct block info */
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
size_t blk_prefix_size; /* Size of prefix for block */
size_t amount_free; /* Amount of free space in block */
uint8_t *marker = NULL; /* Track free space for block */
@@ -412,10 +418,14 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
HDassert(H5F_addr_defined(hdr_addr));
HDassert(block_size > 0);
+ /* Set up user data for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/*
* Load the fractal heap header.
*/
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
/*
@@ -526,6 +536,7 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
{
H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */
H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
hbool_t did_protect; /* Whether we protected the indirect block or not */
char temp_str[64]; /* Temporary string, for formatting */
size_t u, v; /* Local index variable */
@@ -544,10 +555,14 @@ H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
HDassert(H5F_addr_defined(hdr_addr));
HDassert(nrows > 0);
+ /* Set up user data for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/*
* Load the fractal heap header.
*/
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
/*
@@ -715,6 +730,7 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr,
FILE *stream, int indent, int fwidth)
{
H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */
+ H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_sects_debug, FAIL)
@@ -728,10 +744,14 @@ H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
+ /* Set up user data for protect call */
+ cache_udata.f = f;
+ cache_udata.dxpl_id = dxpl_id;
+
/*
* Load the fractal heap header.
*/
- if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (hdr = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
/* Initialize the free space information for the heap */
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index e98302e..39c0738 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -428,8 +428,8 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr,
size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry,
H5AC_protect_t rw)
{
- H5HF_parent_t par_info; /* Parent info for loading block */
H5HF_direct_t *dblock; /* Direct block from cache */
+ H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */
H5HF_direct_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect)
@@ -442,12 +442,36 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr,
HDassert(dblock_size > 0);
/* Set up parent info */
- par_info.hdr = hdr;
- par_info.iblock = par_iblock;
- par_info.entry = par_entry;
+ udata.par_info.hdr = hdr;
+ udata.par_info.iblock = par_iblock;
+ udata.par_info.entry = par_entry;
+
+ /* set up the file pointer in the user data */
+ udata.f = hdr->f;
+
+ /* set up the direct block size */
+ udata.dblock_size = dblock_size;
+
+ /* compute the on disk image size -- observe that odi_size and
+ * dblock_size will be identical if there is no filtering.
+ */
+ if(hdr->filter_len > 0) {
+ if(par_iblock == NULL) {
+ udata.filter_mask = hdr->pline_root_direct_filter_mask;
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr));
+
+ /* Set up parameters to read filtered direct block */
+ udata.filter_mask = par_iblock->filt_ents[par_entry].filter_mask;
+ } /* end else */
+ } /* end if */
+ else
+ udata.filter_mask = 0;
/* Protect the direct block */
- if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &dblock_size, &par_info, rw)))
+ if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block")
/* Set the return value */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 85efb2f..ffc0104 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -132,7 +132,7 @@ done:
if(!ret_value)
if(hdr)
if(H5HF_hdr_dest(hdr) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap header")
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_hdr_alloc() */
@@ -661,6 +661,12 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr)
/* Sanity check */
HDassert(hdr);
+ /* Resize pinned header in cache if I/O filter is present. */
+ if(hdr->filter_len > 0) {
+ if(H5AC_resize_pinned_entry(hdr, (size_t)hdr->heap_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header")
+ } /* end if */
+
/* Mark header as dirty in cache */
if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty")
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index c6b434b..d027ec5 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -492,6 +492,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")
@@ -555,6 +557,12 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
+ /* 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)
@@ -660,6 +668,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 */
@@ -689,6 +698,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")
@@ -706,6 +716,12 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
+ /* 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)
@@ -1100,13 +1116,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 = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &iblock_nrows, &par_info, rw)))
+ if(NULL == (iblock = 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 */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 8b3eddd..af7f792 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -474,6 +474,36 @@ typedef struct {
hsize_t obj_len; /* Length of object removed (out) */
} H5HF_huge_remove_ud1_t;
+/* User data for fractal heap header cache client callback */
+typedef struct H5HF_hdr_cache_ud_t {
+ H5F_t *f; /* File pointer */
+ hid_t dxpl_id; /* DXPL ID for operation (in) */
+} H5HF_hdr_cache_ud_t;
+
+/* User data for fractal heap indirect block cache client callbacks */
+typedef struct H5HF_iblock_cache_ud_t {
+ H5HF_parent_t * par_info; /* Parent info */
+ H5F_t * f; /* File pointer */
+ const unsigned *nrows; /* Number of rows */
+} H5HF_iblock_cache_ud_t;
+
+/* User data for fractal heap direct block cache client callbacks */
+typedef struct H5HF_dblock_cache_ud_t {
+ H5HF_parent_t par_info; /* Parent info */
+ H5F_t * f; /* File pointer */
+ size_t dblock_size; /* size of the direct block, which bears
+ * no necessary relation to the block
+ * odi_size -- the size of the on disk
+ * image of the block. Note that the
+ * metadata cache is only interested
+ * in the odi_size, and thus it is this
+ * value that is passed to the cache in
+ * calls to it.
+ */
+ unsigned filter_mask; /* Excluded filters for direct block */
+} H5HF_dblock_cache_ud_t;
+
+
/*****************************/
/* Package Private Variables */
/*****************************/
diff --git a/src/H5HG.c b/src/H5HG.c
index e276ece..914c618 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -590,7 +590,7 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/
} /* end if */
} /* end else */
HDassert(H5F_addr_defined(addr));
- if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
/* Split the free space to make room for the new object */
@@ -652,7 +652,7 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/,
HDassert(hobj);
/* Load the heap */
- if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap")
HDassert(hobj->idx < heap->nused);
@@ -738,7 +738,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust)
if(adjust!=0) {
/* Load the heap */
- if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
+ if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
assert (hobj->idx<heap->nused);
@@ -800,7 +800,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Load the heap */
- if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
HDassert(hobj->idx < heap->nused);
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index de6f104..10031f8 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -62,8 +62,7 @@
/********************/
/* Metadata cache callbacks */
-static H5HG_heap_t *H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
- void *udata2);
+static H5HG_heap_t *H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5HG_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
H5HG_heap_t *heap, unsigned UNUSED * flags_ptr);
static herr_t H5HG_dest(H5F_t *f, H5HG_heap_t *heap);
@@ -76,7 +75,7 @@ static herr_t H5HG_size(const H5F_t *f, const H5HG_heap_t *heap, size_t *size_pt
/*********************/
/*
- * H5HG inherits cache-like properties from H5AC2
+ * H5HG inherits cache-like properties from H5AC
*/
const H5AC_class_t H5AC_GHEAP[1] = {{
H5AC_GHEAP_ID,
@@ -114,8 +113,7 @@ const H5AC_class_t H5AC_GHEAP[1] = {{
*-------------------------------------------------------------------------
*/
static H5HG_heap_t *
-H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
- void UNUSED * udata2)
+H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
H5HG_heap_t *heap = NULL;
uint8_t *p;
@@ -128,8 +126,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(!udata1);
- HDassert(!udata2);
+ HDassert(udata);
/* Allocate space for heap */
if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t)))
diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c
index 07de139..1fc0133 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -73,7 +73,7 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- if(NULL == (h = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (h = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load global heap collection");
fprintf(stream, "%*sGlobal Heap Collection...\n", indent, "");
diff --git a/src/H5HL.c b/src/H5HL.c
index 328fcda..daaa92b 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -455,7 +455,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, rw)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix")
/* Get the pointer to the heap */
@@ -479,7 +479,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
dblk_udata.loaded = FALSE;
/* Protect the local heap data block */
- if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, NULL, &dblk_udata, rw)))
+ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, &dblk_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block")
/* Pin the prefix, if the data block was loaded from file */
@@ -1075,7 +1075,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_WRITE)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
/* Get the pointer to the heap */
@@ -1092,7 +1092,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
dblk_udata.loaded = FALSE;
/* Protect the local heap data block */
- if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, NULL, &dblk_udata, H5AC_WRITE)))
+ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, &dblk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block")
/* Pin the prefix, if the data block was loaded from file */
@@ -1173,7 +1173,7 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_READ)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
/* Get the pointer to the heap */
@@ -1226,7 +1226,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_READ)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
/* Get the pointer to the heap */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index a5b0728..866a06d 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -72,15 +72,13 @@
/********************/
/* Metadata cache callbacks */
-static void *H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
+static void *H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
void *thing, unsigned *flags_ptr);
static herr_t H5HL_prefix_dest(H5F_t *f, void *thing);
static herr_t H5HL_prefix_clear(H5F_t *f, void *thing, hbool_t destroy);
static herr_t H5HL_prefix_size(const H5F_t *f, const void *thing, size_t *size_ptr);
-static void *H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
+static void *H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
void *thing, unsigned *flags_ptr);
static herr_t H5HL_datablock_dest(H5F_t *f, void *thing);
@@ -179,7 +177,7 @@ H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block)
/* Decode length of this free block */
H5F_DECODE_LENGTH_LEN(p, fl->size, heap->sizeof_size);
- if(fl->offset + fl->size > heap->dblk_size)
+ if((fl->offset + fl->size) > heap->dblk_size)
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list")
} /* end while */
@@ -246,25 +244,23 @@ H5HL_fl_serialize(const H5HL_t *heap)
*-------------------------------------------------------------------------
*/
static void *
-H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
- void *_udata)
+H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- H5HL_t *heap = NULL; /* Local heap */
- H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */
- H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for protecting local heap prefix */
+ H5HL_t *heap = NULL; /* Local heap */
+ H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */
+ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */
uint8_t buf[H5HL_SPEC_READ_SIZE]; /* Buffer for decoding */
size_t spec_read_size; /* Size of buffer to speculatively read in */
const uint8_t *p; /* Pointer into decoding buffer */
haddr_t abs_eoa; /* Absolute end of file address */
haddr_t rel_eoa; /* Relative end of file address */
- void *ret_value; /* Return value */
+ H5HL_prfx_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_load)
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(!udata1);
HDassert(udata);
HDassert(udata->sizeof_size > 0);
HDassert(udata->sizeof_addr > 0);
@@ -294,7 +290,7 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
/* Version */
if(H5HL_VERSION != *p++)
- HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong version number in global heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong version number in local heap")
/* Reserved */
p += 3;
@@ -592,22 +588,21 @@ H5HL_prefix_size(const H5F_t UNUSED *f, const void *thing, size_t *size_ptr)
*-------------------------------------------------------------------------
*/
static void *
-H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
- void *_udata)
+H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
- H5HL_dblk_t *dblk = NULL; /* Heap data block deserialized */
- H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for protecting local heap data block */
- void *ret_value; /* Return value */
+ H5HL_dblk_t *dblk = NULL; /* Local heap data block deserialized */
+ H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for callback */
+ H5HL_dblk_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_load)
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(!udata1);
HDassert(udata);
HDassert(udata->heap);
HDassert(!udata->heap->single_cache_obj);
+ HDassert(NULL == udata->heap->dblk);
/* Allocate space in memory for the heap data block */
if(NULL == (dblk = H5HL_dblk_new(udata->heap)))
diff --git a/src/H5L.c b/src/H5L.c
index 7c92dcc..b70f475 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -28,6 +28,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index ebb599f..70d010e 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -20,6 +20,7 @@
#define H5_INTERFACE_INIT_FUNC H5L_init_extern_interface
#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
diff --git a/src/H5O.c b/src/H5O.c
index deb55a3..f6df6df 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1575,7 +1575,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
udata.common.cont_msg_info = &cont_msg_info;
/* Lock the object header into the cache */
- if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, &udata, prot)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, &udata, prot)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check if there are any continuation messages to process */
@@ -1610,7 +1610,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
/* Bring the chunk into the cache */
/* (which adds to the object header */
chk_udata.chunk_size = cont_msg_info.msgs[curr_msg].size;
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, NULL, &chk_udata, prot)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, &chk_udata, prot)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
/* Sanity check */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 4c1f3a6..b426be8 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -67,15 +67,13 @@
/********************/
/* Metadata cache callbacks */
-static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
- void *_udata2);
+static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh, unsigned UNUSED * flags_ptr);
static herr_t H5O_dest(H5F_t *f, H5O_t *oh);
static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy);
static herr_t H5O_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr);
-static H5O_chunk_proxy_t *H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
- void *_udata2);
+static H5O_chunk_proxy_t *H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5O_cache_chk_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_chunk_proxy_t *chk_proxy, unsigned UNUSED * flags_ptr);
static herr_t H5O_cache_chk_dest(H5F_t *f, H5O_chunk_proxy_t *chk_proxy);
static herr_t H5O_cache_chk_clear(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t destroy);
@@ -155,11 +153,10 @@ H5FL_SEQ_DEFINE(H5O_cont_t);
*-------------------------------------------------------------------------
*/
static H5O_t *
-H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
- void *_udata2)
+H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5O_t *oh = NULL; /* Object header read in */
- H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata2; /* User data for callback */
+ H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */
H5WB_t *wb = NULL; /* Wrapped buffer for prefix data */
uint8_t read_buf[H5O_SPEC_READ_SIZE]; /* Buffer for speculative read */
const uint8_t *p; /* Pointer into buffer to decode */
@@ -176,7 +173,6 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(!_udata1);
HDassert(udata);
HDassert(udata->common.f);
HDassert(udata->common.cont_msg_info);
@@ -355,7 +351,7 @@ done:
/* Release the [possibly partially initialized] object header on errors */
if(!ret_value && oh)
if(H5O_free(oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to destroy object header data")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_load() */
@@ -628,11 +624,10 @@ H5O_size(const H5F_t UNUSED *f, const H5O_t *oh, size_t *size_ptr)
*-------------------------------------------------------------------------
*/
static H5O_chunk_proxy_t *
-H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
- void *_udata2)
+H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */
- H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata2; /* User data for callback */
+ H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */
H5WB_t *wb = NULL; /* Wrapped buffer for prefix data */
uint8_t chunk_buf[H5O_SPEC_READ_SIZE]; /* Buffer for speculative read */
uint8_t *buf; /* Buffer to decode */
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 6b21aed..e42c940 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -176,7 +176,7 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
chk_udata.chunk_size = oh->chunk[idx].size;
/* Get the chunk proxy */
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, NULL, &chk_udata, H5AC_WRITE)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
/* Sanity check */
@@ -290,7 +290,7 @@ H5O_chunk_update_idx(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
chk_udata.chunk_size = oh->chunk[idx].size;
/* Get the chunk proxy */
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, NULL, &chk_udata, H5AC_WRITE)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Update index for chunk proxy in cache */
@@ -342,7 +342,7 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
chk_udata.chunk_size = oh->chunk[idx].size;
/* Get the chunk proxy */
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, NULL, &chk_udata, H5AC_WRITE)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Sanity check */
diff --git a/src/H5SM.c b/src/H5SM.c
index aa2edf2..6a80cc4 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -355,7 +355,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
/* Look up the master SOHM table */
if(H5F_addr_defined(f->shared->sohm_addr)) {
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
else
@@ -405,7 +405,7 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
HDassert(fheap_addr);
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Look up index for message type */
@@ -769,6 +769,7 @@ static herr_t
H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_id)
{
H5SM_list_t *list = NULL;
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
haddr_t btree_addr;
herr_t ret_value = SUCCEED;
@@ -786,7 +787,12 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i
if(HADDR_UNDEF == (header->index_addr = H5SM_create_list(f, header, dxpl_id)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create shared message list")
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
+ /* Set up user data for metadata cache callback */
+ cache_udata.f = f;
+ cache_udata.header = header;
+
+ /* Protect the SOHM list */
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM list index")
/* Delete the B-tree and have messages copy themselves to the
@@ -889,7 +895,7 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
if(table)
my_table = table;
else {
- if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
@@ -995,7 +1001,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
HGOTO_DONE(FALSE)
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* "complex" sharing checks */
@@ -1130,6 +1136,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
{
H5SM_list_t *list = NULL; /* List index */
H5SM_mesg_key_t key; /* Key used to search the index */
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
H5O_shared_t shared; /* Shared H5O message */
hbool_t found = FALSE; /* Was the message in the index? */
H5HF_t *fheap = NULL; /* Fractal heap handle */
@@ -1173,8 +1180,12 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
if(header->index_type == H5SM_LIST) {
size_t list_pos; /* Position in a list index */
+ /* Set up user data for metadata cache callback */
+ cache_udata.f = f;
+ cache_udata.header = header;
+
/* The index is a list; get it from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* See if the message is already in the index and get its location.
@@ -1369,7 +1380,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
type_id = sh_mesg->msg_type_id;
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and try to delete from it */
@@ -1629,10 +1640,15 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Try to find the message in the index */
if(header->index_type == H5SM_LIST) {
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
size_t list_pos; /* Position of the message in the list */
+ /* Set up user data for metadata cache callback */
+ cache_udata.f = f;
+ cache_udata.header = header;
+
/* If the index is stored as a list, get it from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
@@ -1792,7 +1808,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
HDassert(shared->sohm_nindexes > 0 && shared->sohm_nindexes <= H5O_SHMESG_MAX_NINDEXES);
/* Read the rest of the SOHM table information from the cache */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get index conversion limits */
@@ -2018,7 +2034,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
HDassert(ref_count);
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and find the message in it */
@@ -2049,10 +2065,15 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Try to find the message in the index */
if(header->index_type == H5SM_LIST) {
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
size_t list_pos; /* Position of the message in the list */
+ /* Set up user data for metadata cache callback */
+ cache_udata.f = f;
+ cache_udata.header = header;
+
/* If the index is stored as a list, get it from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_READ)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
@@ -2397,7 +2418,7 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
HDfprintf(stream, "%*sShared Message Master Table...\n", indent, "");
@@ -2454,6 +2475,7 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
H5SM_list_t *list = NULL; /* SOHM index list for message type (if in list form) */
H5SM_index_header_t header; /* A "false" header used to read the list */
+ H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
unsigned x; /* Counter variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2477,8 +2499,12 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
header.index_type = H5SM_LIST;
header.index_addr = list_addr;
+ /* Set up user data for metadata cache callback */
+ cache_udata.f = f;
+ cache_udata.header = &header;
+
/* Get the list from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, NULL, &header, H5AC_READ)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
HDfprintf(stream, "%*sShared Message List Index...\n", indent, "");
@@ -2549,7 +2575,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
HDassert(finfo);
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 04618a6..a575e0e 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -53,12 +53,12 @@
/********************/
/* Metadata cache (H5AC) callbacks */
-static H5SM_master_table_t *H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *table);
+static H5SM_master_table_t *H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_master_table_t *table);
static herr_t H5SM_table_dest(H5F_t *f, H5SM_master_table_t* table);
static herr_t H5SM_table_clear(H5F_t *f, H5SM_master_table_t *table, hbool_t destroy);
static herr_t H5SM_table_size(const H5F_t *f, const H5SM_master_table_t *table, size_t *size_ptr);
-static H5SM_list_t *H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2);
+static H5SM_list_t *H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_list_t *list);
static herr_t H5SM_list_dest(H5F_t *f, H5SM_list_t* list);
static herr_t H5SM_list_clear(H5F_t *f, H5SM_list_t *list, hbool_t destroy);
@@ -113,7 +113,7 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{
*-------------------------------------------------------------------------
*/
static H5SM_master_table_t *
-H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
+H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
H5SM_master_table_t *table = NULL;
size_t size; /* Size of SOHM master table on disk */
@@ -458,10 +458,10 @@ H5SM_table_size(const H5F_t *f, const H5SM_master_table_t *table, size_t *size_p
*-------------------------------------------------------------------------
*/
static H5SM_list_t *
-H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void *udata2)
+H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
{
H5SM_list_t *list; /* The SOHM list being read in */
- H5SM_index_header_t *header = (H5SM_index_header_t *) udata2; /* Index header for this list */
+ H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */
size_t size; /* Size of SOHM list on disk */
H5WB_t *wb = NULL; /* Wrapped buffer for list index data */
uint8_t lst_buf[H5SM_LST_BUF_SIZE]; /* Buffer for list index */
@@ -475,7 +475,7 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
FUNC_ENTER_NOAPI_NOINIT(H5SM_list_load)
/* Sanity check */
- HDassert(header);
+ HDassert(udata->header);
/* Allocate space for the SOHM list data structure */
if(NULL == (list = H5FL_MALLOC(H5SM_list_t)))
@@ -483,17 +483,17 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
HDmemset(&list->cache_info, 0, sizeof(H5AC_info_t));
/* Allocate list in memory as an array*/
- if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, header->list_max)) == NULL)
+ if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, udata->header->list_max)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for SOHM list")
- list->header = header;
+ list->header = udata->header;
/* Wrap the local buffer for serialized list index info */
if(NULL == (wb = H5WB_wrap(lst_buf, sizeof(lst_buf))))
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute the size of the SOHM list on disk */
- size = H5SM_LIST_SIZE(f, header->num_messages);
+ size = H5SM_LIST_SIZE(udata->f, udata->header->num_messages);
/* Get a pointer to a buffer that's large enough for serialized list index */
if(NULL == (buf = H5WB_actual(wb, size)))
@@ -512,10 +512,10 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
p += H5SM_SIZEOF_MAGIC;
/* Read messages into the list array */
- for(x = 0; x < header->num_messages; x++) {
- if(H5SM_message_decode(f, p, &(list->messages[x])) < 0)
+ for(x = 0; x < udata->header->num_messages; x++) {
+ if(H5SM_message_decode(udata->f, p, &(list->messages[x])) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message")
- p += H5SM_SOHM_ENTRY_SIZE(f);
+ p += H5SM_SOHM_ENTRY_SIZE(udata->f);
} /* end for */
/* Read in checksum */
@@ -532,7 +532,7 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, NULL, "incorrect metadata checksum for shared message list")
/* Initialize the rest of the array */
- for(x = header->num_messages; x < header->list_max; x++)
+ for(x = udata->header->num_messages; x < udata->header->list_max; x++)
list->messages[x].location = H5SM_NO_LOC;
/* Set return value */
@@ -544,8 +544,8 @@ done:
HDONE_ERROR(H5E_SOHM, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
if(!ret_value && list) {
if(list->messages)
- H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
- H5FL_FREE(H5SM_list_t, list);
+ list->messages = H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
+ list = H5FL_FREE(H5SM_list_t, list);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index d1a6d13..fadf416 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -32,6 +32,7 @@
#include "H5SMprivate.h" /* Shared Object Header Messages */
/* Other private headers needed by this file */
+#include "H5ACprivate.h" /* Metadata Cache */
#include "H5B2private.h" /* B-trees */
#include "H5HFprivate.h" /* Fractal heaps */
@@ -220,6 +221,12 @@ typedef struct {
hid_t dxpl_id;
} H5SM_incr_ref_opdata;
+/* Callback info for loading a shared message index into the cache */
+typedef struct H5SM_list_cache_ud_t {
+ H5F_t *f; /* File that shared message index stored as a list is in */
+ H5SM_index_header_t *header; /* Index header for this list */
+} H5SM_list_cache_ud_t;
+
/****************************/
/* Package Variables */
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 8412a89..3b4f363 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -94,7 +94,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
ssize_t index_num; /* Table index for message type */
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index for this message type */
diff --git a/test/cache.c b/test/cache.c
index 3eb9795..da9ba46 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -252,7 +252,7 @@ smoke_check_1(void)
/* flush and destroy all entries in the cache: */
- flush_cache(/* file_ptr */ file_ptr,
+ flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ TRUE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
@@ -277,7 +277,7 @@ smoke_check_1(void)
/* flush all entries in the cache: */
- flush_cache(/* file_ptr */ file_ptr,
+ flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
@@ -471,7 +471,7 @@ smoke_check_2(void)
/* flush all entries in the cache: */
- flush_cache(/* file_ptr */ file_ptr,
+ flush_cache(/* file_ptr */ file_ptr,
/* destroy_entries */ FALSE,
/* dump_stats */ FALSE,
/* dump_detailed_stats */ FALSE);
@@ -968,8 +968,8 @@ smoke_check_5(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -1210,8 +1210,8 @@ smoke_check_6(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -1452,8 +1452,8 @@ smoke_check_7(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */
@@ -1695,8 +1695,8 @@ smoke_check_8(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */
@@ -4958,7 +4958,7 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
struct flush_cache_test_spec spec[])
{
/* const char * fcn_name = "check_flush_cache__multi_entry_test"; */
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
herr_t result;
int i;
@@ -6038,8 +6038,8 @@ check_flush_cache__flush_ops(H5F_t * file_ptr)
* which the call back function both resizes and renames the entry
* for which it has been called.
*
- * Again, we run this entry twice, as the first run moves the entry to its
- * alternate address, and the second moves it back.
+ * Again, we run this entry twice, as the first run moves the entry
+ * to its alternate address, and the second moves it back.
*/
int test_num = 9; /* and 10 */
unsigned int flush_flags = H5C__NO_FLAGS_SET;
@@ -9231,7 +9231,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
struct fo_flush_entry_check check[])
{
/* const char * fcn_name = "check_flush_cache__flush_op_test"; */
- H5C_t *cache_ptr = file_ptr->shared->cache;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
herr_t result;
int i;
@@ -12678,7 +12678,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
hbool_t expected_destroyed)
{
/* const char *fcn_name = "check_flush_cache__pinned_single_entry_test"; */
- H5C_t *cache_ptr = file_ptr->shared->cache;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
hbool_t expected_loaded = TRUE;
herr_t result;
@@ -12912,7 +12912,7 @@ check_get_entry_status(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 1.");
+ "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -12936,7 +12936,7 @@ check_get_entry_status(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 2.");
+ "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
} else if ( !in_cache || is_dirty || is_protected || is_pinned ) {
@@ -12958,7 +12958,7 @@ check_get_entry_status(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 3.");
+ "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
} else if ( !in_cache || is_dirty || !is_protected || is_pinned ) {
@@ -12980,7 +12980,7 @@ check_get_entry_status(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 4.");
+ "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
} else if ( !in_cache || is_dirty || is_protected || !is_pinned ) {
@@ -13002,7 +13002,7 @@ check_get_entry_status(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 5.");
+ "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || !is_pinned ) {
@@ -13024,7 +13024,7 @@ check_get_entry_status(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 6.");
+ "H5C_get_entry_status() reports failure 6.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || is_pinned ) {
@@ -13114,7 +13114,7 @@ check_expunge_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 1.");
+ "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -13152,7 +13152,7 @@ check_expunge_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 2.");
+ "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
} else if ( !in_cache || is_dirty || is_protected || is_pinned ) {
@@ -13192,7 +13192,7 @@ check_expunge_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 3.");
+ "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -13234,7 +13234,7 @@ check_expunge_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 4.");
+ "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -13273,7 +13273,7 @@ check_expunge_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 5.");
+ "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || is_pinned ) {
@@ -13307,14 +13307,14 @@ check_expunge_entry(void)
*/
result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size,
- &in_cache, &is_dirty, &is_protected,
- &is_pinned);
+ &in_cache, &is_dirty, &is_protected,
+ &is_pinned);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 6.");
+ "H5C_get_entry_status() reports failure 6.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -13912,7 +13912,7 @@ check_rename_entry__run_test(H5F_t * file_ptr,
struct rename_entry_test_spec * spec_ptr)
{
/* const char * fcn_name = "check_rename_entry__run_test"; */
- H5C_t *cache_ptr = file_ptr->shared->cache;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
unsigned int flags = H5C__NO_FLAGS_SET;
test_entry_t * base_addr;
@@ -14252,7 +14252,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 1.");
+ "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
} else if ( !in_cache || is_dirty || !is_protected || is_pinned ) {
@@ -14320,7 +14320,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 2.");
+ "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || is_pinned ||
@@ -14391,7 +14391,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 3.");
+ "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || is_pinned ||
@@ -14455,7 +14455,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 4.");
+ "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || ! is_pinned ||
@@ -14515,7 +14515,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 5.");
+ "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || ! is_pinned ||
@@ -14552,7 +14552,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 6.");
+ "H5C_get_entry_status() reports failure 6.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -14658,7 +14658,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 7.");
+ "H5C_get_entry_status() reports failure 7.");
failure_mssg = msg;
} else if ( !in_cache || is_dirty || !is_protected || is_pinned ) {
@@ -14728,7 +14728,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 8.");
+ "H5C_get_entry_status() reports failure 8.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || is_pinned ||
@@ -14799,7 +14799,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 9.");
+ "H5C_get_entry_status() reports failure 9.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || is_pinned ||
@@ -14865,7 +14865,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 10.");
+ "H5C_get_entry_status() reports failure 10.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || ! is_pinned ||
@@ -14925,7 +14925,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 11.");
+ "H5C_get_entry_status() reports failure 11.");
failure_mssg = msg;
} else if ( !in_cache || !is_dirty || is_protected || ! is_pinned ||
@@ -14962,7 +14962,7 @@ check_resize_entry(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 12.");
+ "H5C_get_entry_status() reports failure 12.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -15134,7 +15134,7 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* verivy that it is empty */
+ /* verify that it is empty */
if ( pass ) {
if ( ( cache_ptr->index_len != 0 ) ||
@@ -15213,7 +15213,7 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* verify that the an entry has been evicted */
+ /* verify that an entry has been evicted */
if ( pass ) {
if ( ( cache_ptr->index_len != 16 ) ||
@@ -15244,7 +15244,7 @@ check_evictions_enabled(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 1.");
+ "H5C_get_entry_status() reports failure 1.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -15307,7 +15307,7 @@ check_evictions_enabled(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 2.");
+ "H5C_get_entry_status() reports failure 2.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -15514,7 +15514,7 @@ check_evictions_enabled(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 3.");
+ "H5C_get_entry_status() reports failure 3.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -15550,7 +15550,7 @@ check_evictions_enabled(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 4.");
+ "H5C_get_entry_status() reports failure 4.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -15679,7 +15679,7 @@ check_evictions_enabled(void)
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "H5AC_get_entry_status() reports failure 5.");
+ "H5C_get_entry_status() reports failure 5.");
failure_mssg = msg;
} else if ( in_cache ) {
@@ -16520,7 +16520,7 @@ check_double_protect_err(void)
if ( pass ) {
cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[0]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET);
+ &(types[0]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET);
if ( cache_entry_ptr != NULL ) {
@@ -17177,7 +17177,7 @@ check_protect_ro_rw_err(void)
if ( pass ) {
thing_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[0]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET);
+ &(types[0]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET);
if ( thing_ptr != NULL ) {
@@ -17423,8 +17423,8 @@ check_auto_cache_resize(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -17821,7 +17821,6 @@ check_auto_cache_resize(void)
auto_size_ctl.flash_multiple = 2.0;
auto_size_ctl.flash_threshold = 0.5;
-
auto_size_ctl.decr_mode = H5C_decr__threshold;
auto_size_ctl.upper_hr_threshold = 0.995;
@@ -18175,7 +18174,6 @@ check_auto_cache_resize(void)
auto_size_ctl.flash_multiple = 2.0;
auto_size_ctl.flash_threshold = 0.5;
-
auto_size_ctl.decr_mode = H5C_decr__threshold;
auto_size_ctl.upper_hr_threshold = 0.995;
@@ -18639,7 +18637,7 @@ check_auto_cache_resize(void)
}
}
- if ( show_progress ) HDfprintf(stderr, "*check point %d\n", checkpoint++);
+ if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
/* now just bang on one entry -- after three epochs, this should
* get all entries other than the one evicted, and the cache size
@@ -20726,7 +20724,7 @@ check_auto_cache_resize(void)
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
- /* Load a second moster entry. Since the monster entry is larger
+ /* Load a second monster entry. Since the monster entry is larger
* than half the size of the cache yet again, and there is not
* sufficient space for the monster entry in the cache, we again
* add space to the cache to make space for the entry.
@@ -22006,7 +22004,6 @@ check_auto_cache_resize_disable(void)
auto_size_ctl.decr_mode = H5C_decr__threshold;
auto_size_ctl.upper_hr_threshold = 0.995;
-
auto_size_ctl.decrement = 0.5;
auto_size_ctl.apply_max_decrement = FALSE;
@@ -24252,6 +24249,7 @@ check_auto_cache_resize_disable(void)
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
+
/* Now test the flash cache size increment code to verify that it
* is disabled when it should be.
*
@@ -24279,7 +24277,6 @@ check_auto_cache_resize_disable(void)
* code enabled.
*/
-
if ( pass ) {
auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER;
@@ -24495,8 +24492,8 @@ check_auto_cache_resize_epoch_markers(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -25165,9 +25162,9 @@ check_auto_cache_resize_epoch_markers(void)
* Modifications:
*
* Added code to verify that errors in the flash cache size
- * increment related fields are caught as well.
+ * increment related fields are caught as well.
*
- * JRM -- 1/17/08
+ * JRM -- 1/17/08
*
*-------------------------------------------------------------------------
*/
@@ -25193,9 +25190,6 @@ check_auto_cache_resize_epoch_markers(void)
( (a).flash_threshold == (b).flash_threshold ) && \
( (a).decr_mode == (b).decr_mode ) && \
( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \
- ( (a).flash_incr_mode == (b).flash_incr_mode ) && \
- ( (a).flash_multiple == (b).flash_multiple ) && \
- ( (a).flash_threshold == (b).flash_threshold ) && \
( (a).decrement == (b).decrement ) && \
( (a).apply_max_decrement == (b).apply_max_decrement ) && \
( (a).max_decrement == (b).max_decrement ) && \
@@ -25237,8 +25231,8 @@ check_auto_cache_resize_input_errs(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold,
@@ -26571,7 +26565,6 @@ check_auto_cache_resize_input_errs(void)
}
}
-
/* test for bad flash_incr_mode rejection */
if ( pass ) {
@@ -26943,6 +26936,7 @@ check_auto_cache_resize_input_errs(void)
}
}
+
/* test for bad decr_mode rejection */
if ( pass ) {
@@ -27654,8 +27648,8 @@ check_auto_cache_resize_aux_fcns(void)
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
- /* double flash_multiple = */ 2.0,
- /* double flash_threshold = */ 0.5,
+ /* double flash_multiple = */ 2.0,
+ /* double flash_threshold = */ 0.5,
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off,
diff --git a/test/cache_api.c b/test/cache_api.c
index adf4aa8..5c3a3d9 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -25,6 +25,7 @@
#include "H5ACprivate.h"
#include "cache_common.h"
+
/* global variable declarations: */
extern const char *FILENAME[];
@@ -199,8 +200,7 @@ check_fapl_mdc_api_calls(void)
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
H5AC_cache_config_t mod_config =
{
- /* int version = */
- H5AC__CURR_CACHE_CONFIG_VERSION,
+ /* int version = */ H5AC__CURR_CACHE_CONFIG_VERSION,
/* hbool_t rpt_fcn_enabled = */ FALSE,
/* hbool_t open_trace_file = */ FALSE,
/* hbool_t close_trace_file = */ FALSE,
@@ -351,16 +351,16 @@ check_fapl_mdc_api_calls(void)
/* get a pointer to the files internal data structure */
if ( pass ) {
- file_ptr = H5I_object_verify(file_id, H5I_FILE);
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
if ( file_ptr == NULL ) {
pass = FALSE;
failure_mssg = "Can't get file_ptr.\n";
- } else {
+ } else {
- cache_ptr = file_ptr->shared->cache;
+ cache_ptr = file_ptr->shared->cache;
}
}
@@ -500,7 +500,7 @@ check_fapl_mdc_api_calls(void)
/* get a pointer to the files internal data structure */
if ( pass ) {
- file_ptr = H5I_object_verify(file_id, H5I_FILE);
+ file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
if ( file_ptr == NULL ) {
@@ -2138,6 +2138,7 @@ mdc_api_call_smoke_check(int express_test)
} /* mdc_api_call_smoke_check() */
+
/* The following array of invalid external MDC cache configurations is
* used to test error rejection in the MDC related API calls.
*/
@@ -2197,11 +2198,11 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] =
/* double lower_hr_threshold = */ 0.9,
/* double increment = */ 2.0,
/* hbool_t apply_max_increment = */ TRUE,
+ /* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_flash_incr_mode */
/* flash_incr_mode = */ H5C_flash_incr__off,
/* double flash_multiple = */ 2.0,
/* double flash_threshold = */ 0.5,
- /* size_t max_increment = */ (4 * 1024 * 1024),
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,
/* double upper_hr_threshold = */ 0.999,
/* double decrement = */ 0.9,
diff --git a/test/cache_common.c b/test/cache_common.c
index 146a4d8..5036b27 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -25,7 +25,7 @@
#include "H5MFprivate.h"
#include "cache_common.h"
-
+
/* global variable declarations: */
const char *FILENAME[] = {
@@ -249,8 +249,7 @@ static herr_t clear(H5F_t * f, void * thing, hbool_t dest);
static herr_t destroy(H5F_t * f, void * thing);
static herr_t flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
haddr_t addr, void *thing, unsigned UNUSED * flags_ptr);
-static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
+static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
static herr_t size(H5F_t * f, void * thing, size_t * size_ptr);
static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
struct flush_op *op_ptr, unsigned *flags_ptr);
@@ -271,8 +270,6 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -385,8 +382,6 @@ type_and_index_to_addr(int32_t type,
#endif
-/* Call back functions: */
-
/*-------------------------------------------------------------------------
*
* Function: check_if_write_permitted
@@ -404,8 +399,6 @@ type_and_index_to_addr(int32_t type,
*
* Programmer: John Mainzer, 5/15/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -920,8 +913,7 @@ void *
load(H5F_t UNUSED *f,
hid_t UNUSED dxpl_id,
haddr_t addr,
- const void UNUSED *udata1,
- void UNUSED *udata2)
+ void UNUSED *udata)
{
int32_t type;
int32_t idx;
@@ -966,73 +958,63 @@ load(H5F_t UNUSED *f,
} /* load() */
void *
-pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
void *
-variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2)
+variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
{
- return(load(f, dxpl_id, addr, udata1, udata2));
+ return(load(f, dxpl_id, addr, udata));
}
@@ -1165,7 +1147,7 @@ variable_size(H5F_t * f, void * thing, size_t * size_ptr)
/*-------------------------------------------------------------------------
* Function: add_flush_op
*
- * Purpose: Do noting if pass is FALSE on entry.
+ * Purpose: Do nothing if pass is FALSE on entry.
*
* Otherwise, add the specified flush operation to the
* target instance of test_entry_t.
@@ -1175,8 +1157,6 @@ variable_size(H5F_t * f, void * thing, size_t * size_ptr)
* Programmer: John Mainzer
* 9/1/06
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -1231,7 +1211,7 @@ add_flush_op(int target_type,
/*-------------------------------------------------------------------------
* Function: create_pinned_entry_dependency
*
- * Purpose: Do noting if pass is FALSE on entry.
+ * Purpose: Do nothing if pass is FALSE on entry.
*
* Otherwise, set up a pinned entry dependency so we can
* test the pinned entry modifications to the flush routine.
@@ -1247,8 +1227,6 @@ add_flush_op(int target_type,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -1328,10 +1306,6 @@ create_pinned_entry_dependency(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -1405,10 +1379,6 @@ dirty_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 9/1/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -1516,12 +1486,6 @@ execute_flush_op(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM - 10/12/04
- * Removed references to local_H5C_t, as we now get direct
- * access to the definition of H5C_t via H5Cpkg.h.
- *
*-------------------------------------------------------------------------
*/
@@ -1570,16 +1534,6 @@ entry_in_cache(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * JRM -- 3/31/06
- * Added initialization for new pinned entry test related
- * fields.
- *
- * JRM -- 4/1/07
- * Added initialization for the new is_read_only, and
- * ro_ref_count fields.
- *
*-------------------------------------------------------------------------
*/
@@ -1695,10 +1649,6 @@ reset_entries(void)
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -1762,23 +1712,19 @@ resize_entry(H5F_t * file_ptr,
/*-------------------------------------------------------------------------
- * Function: resize_pinned_entry
+ * Function: resize_pinned_entry
*
- * Purpose: Given a pointer to a cache, an entry type, an index, and
+ * Purpose: Given a pointer to a cache, an entry type, an index, and
* a new size, change the size of the target pinned entry
* to match the supplied new size.
*
- * Do nothing if pass is false on entry.
+ * Do nothing if pass is false on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 1/11/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -1786,7 +1732,7 @@ void
resize_pinned_entry(H5C_t * cache_ptr,
int32_t type,
int32_t idx,
- size_t new_size)
+ size_t new_size)
{
herr_t result;
test_entry_t * base_addr;
@@ -1802,7 +1748,7 @@ resize_pinned_entry(H5C_t * cache_ptr,
if ( ! entry_in_cache(cache_ptr, type, idx) ) {
- pass = FALSE;
+ pass = FALSE;
failure_mssg = "entry not in cache.";
} else {
@@ -1821,23 +1767,23 @@ resize_pinned_entry(H5C_t * cache_ptr,
} else {
- entry_ptr->size = new_size;
+ entry_ptr->size = new_size;
result = H5C_resize_pinned_entry((void *)entry_ptr,
new_size);
- if ( result != SUCCEED ) {
+ if ( result != SUCCEED ) {
- pass = FALSE;
- failure_mssg = "error(s) in H5C_resize_pinned_entry().";
+ pass = FALSE;
+ failure_mssg = "error(s) in H5C_resize_pinned_entry().";
- } else {
+ } else {
- HDassert( entry_ptr->size = (entry_ptr->header).size );
+ HDassert( entry_ptr->size = (entry_ptr->header).size );
}
- }
- }
+ }
+ }
}
return;
@@ -1858,8 +1804,6 @@ resize_pinned_entry(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -1918,8 +1862,6 @@ verify_clean(void)
* Programmer: John Mainzer
* 10/8/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -1947,7 +1889,7 @@ verify_entry_status(H5C_t * cache_ptr,
( expected[i].is_pinned ) ) ) {
pass = FALSE;
- sprintf(msg, "Contradictory data in expected[%d].\n", i);
+ sprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i);
failure_mssg = msg;
}
@@ -2159,8 +2101,6 @@ verify_entry_status(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 6/10/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -2233,10 +2173,10 @@ setup_cache(size_t max_cache_size,
hbool_t verbose = TRUE;
int mile_stone = 1;
hid_t fid = -1;
- haddr_t actual_base_addr;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
H5F_t * ret_val = NULL;
+ haddr_t actual_base_addr;
hid_t fapl_id = H5P_DEFAULT;
if ( show_progress ) /* 1 */
@@ -2578,17 +2518,12 @@ takedown_cache(H5F_t * file_ptr,
*
* Purpose: Expunge the entry indicated by the type and index.
*
- * Do nothing if pass is FALSE on entry.
*
* Return: void
*
* Programmer: John Mainzer
* 7/6/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -2651,8 +2586,6 @@ expunge_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/23/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -2718,24 +2651,6 @@ flush_cache(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/16/04
*
- * Modifications:
- *
- * JRM -- 1/13/05
- * Updated function for the flags parameter in
- * H5C_insert_entry(), and to allow access to this parameter.
- *
- * JRM -- 6/17/05
- * The interface no longer permits clean inserts.
- * Accordingly, the dirty parameter is no longer meaningfull.
- *
- * JRM -- 4/5/06
- * Added code to initialize the new cache_ptr field of the
- * test_entry_t structure.
- *
- * JRM -- 8/10/06
- * Updated to reflect the fact that entries can now be
- * inserted pinned.
- *
*-------------------------------------------------------------------------
*/
@@ -2836,10 +2751,6 @@ insert_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 3/28/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -2871,11 +2782,11 @@ mark_pinned_entry_dirty(int32_t type,
entry_ptr->is_dirty = TRUE;
- if ( size_changed ) {
+ if ( size_changed ) {
- /* update entry size now to keep the sanity checks happy */
- entry_ptr->size = new_size;
- }
+ /* update entry size now to keep the sanity checks happy */
+ entry_ptr->size = new_size;
+ }
result = H5C_mark_pinned_entry_dirty((void *)entry_ptr,
size_changed,
@@ -2889,20 +2800,20 @@ mark_pinned_entry_dirty(int32_t type,
( entry_ptr->addr != entry_ptr->header.addr ) ) {
#if 0 /* This is useful debugging code -- keep it around */
- HDfprintf(stdout, "result = %ld.\n", (long)result);
- HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n",
- (int)(entry_ptr->header.is_dirty));
- HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n",
- (int)(entry_ptr->header.is_pinned));
- HDfprintf(stdout,
- "(entry_ptr->header.type != &(types[type])) = %d.\n",
- (int)(entry_ptr->header.type != &(types[type])));
- HDfprintf(stdout,
- "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n",
- (long)(entry_ptr->size), (long)(entry_ptr->header.size));
- HDfprintf(stdout,
- "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n",
- (long)(entry_ptr->addr), (long)(entry_ptr->header.addr));
+ HDfprintf(stdout, "result = %ld.\n", (long)result);
+ HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n",
+ (int)(entry_ptr->header.is_dirty));
+ HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n",
+ (int)(entry_ptr->header.is_pinned));
+ HDfprintf(stdout,
+ "(entry_ptr->header.type != &(types[type])) = %d.\n",
+ (int)(entry_ptr->header.type != &(types[type])));
+ HDfprintf(stdout,
+ "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n",
+ (long)(entry_ptr->size), (long)(entry_ptr->header.size));
+ HDfprintf(stdout,
+ "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n",
+ (long)(entry_ptr->addr), (long)(entry_ptr->header.addr));
#endif
pass = FALSE;
failure_mssg = "error in H5C_mark_pinned_entry_dirty().";
@@ -2930,10 +2841,6 @@ mark_pinned_entry_dirty(int32_t type,
* Programmer: John Mainzer
* 5/17/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -3014,12 +2921,6 @@ mark_pinned_or_protected_entry_dirty(int32_t type,
* Programmer: John Mainzer
* 6/21/04
*
- * Modifications:
- *
- * JRM -- 6/17/05
- * Updated code to reflect the fact that renames automatically
- * dirty entries.
- *
*-------------------------------------------------------------------------
*/
@@ -3118,12 +3019,6 @@ rename_entry(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 6/11/04
*
- * Modifications:
- *
- * - Modified call to H5C_protect to pass H5C__NO_FLAGS_SET in the
- * new flags parameter.
- * JRM -- 3/28/07
- *
*-------------------------------------------------------------------------
*/
@@ -3155,7 +3050,7 @@ protect_entry(H5F_t * file_ptr,
HDassert( !(entry_ptr->is_protected) );
cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[type]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET);
+ &(types[type]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
@@ -3219,10 +3114,6 @@ protect_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 4/1/07
*
- * Modifications:
- *
- * - None.
- *
*-------------------------------------------------------------------------
*/
@@ -3256,7 +3147,7 @@ protect_entry_ro(H5F_t * file_ptr,
( entry_ptr->ro_ref_count > 0 ) ) );
cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[type]), entry_ptr->addr, NULL, NULL, H5C__READ_ONLY_FLAG);
+ &(types[type]), entry_ptr->addr, NULL, H5C__READ_ONLY_FLAG);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
@@ -3300,10 +3191,6 @@ protect_entry_ro(H5F_t * file_ptr,
* Programmer: John Mainzer
* 3/28/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -3367,26 +3254,6 @@ unpin_entry(int32_t type,
* Programmer: John Mainzer
* 6/12/04
*
- * Modifications:
- *
- * JRM -- 1/7/05
- * Updated for the replacement of the deleted parameter in
- * H5C_unprotect() with the new flags parameter.
- *
- * JRM - 6/17/05
- * Modified function to use the new dirtied parameter of
- * H5C_unprotect().
- *
- * JRM -- 9/8/05
- * Update for new entry size parameter in H5C_unprotect().
- * We don't use them here for now.
- *
- * JRM -- 3/31/06
- * Update for pinned entries.
- *
- * JRM -- 4/1/07
- * Updated for new multiple read protects.
- *
*-------------------------------------------------------------------------
*/
@@ -3540,10 +3407,6 @@ unprotect_entry(H5F_t * file_ptr,
* Programmer: John Mainzer
* 8/31/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -3555,7 +3418,6 @@ unprotect_entry_with_size_change(H5F_t * file_ptr,
size_t new_size)
{
/* const char * fcn_name = "unprotect_entry_with_size_change()"; */
- H5C_t *cache_ptr;
herr_t result;
hbool_t dirty_flag_set;
hbool_t pin_flag_set;
@@ -3565,10 +3427,13 @@ unprotect_entry_with_size_change(H5F_t * file_ptr,
test_entry_t * entry_ptr;
if ( pass ) {
+#ifndef NDEBUG
+ H5C_t * cache_ptr;
cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr );
+#endif /* NDEBUG */
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
HDassert( new_size <= entry_sizes[type] );
@@ -3661,12 +3526,6 @@ unprotect_entry_with_size_change(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/12/04
*
- * Modifications:
- *
- * JRM -- 4/4/07
- * Added code supporting multiple read only protects.
- * Note that this increased the minimum lag to 10.
- *
*-------------------------------------------------------------------------
*/
@@ -3978,13 +3837,6 @@ row_major_scan_forward(H5F_t * file_ptr,
* Programmer: John Mainzer
* 10/21/04
*
- * Modifications:
- *
- * JRM -- 1/21/05
- * Added the max_index parameter to allow the caller to
- * throttle the size of the inner loop, and thereby the
- * execution time of the function.
- *
*-------------------------------------------------------------------------
*/
@@ -4399,13 +4251,6 @@ row_major_scan_backward(H5F_t * file_ptr,
* Programmer: John Mainzer
* 10/21/04
*
- * Modifications:
- *
- * JRM -- 1/21/05
- * Added the max_index parameter to allow the caller to
- * throttle the size of the inner loop, and thereby the
- * execution time of the function.
- *
*-------------------------------------------------------------------------
*/
@@ -4620,13 +4465,6 @@ col_major_scan_forward(H5F_t * file_ptr,
* Programmer: John Mainzer
* 19/25/04
*
- * Modifications:
- *
- * JRM -- 1/21/05
- * Added the max_index parameter to allow the caller to
- * throttle the size of the inner loop, and thereby the
- * execution time of the function.
- *
*-------------------------------------------------------------------------
*/
@@ -4746,8 +4584,6 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
* Programmer: John Mainzer
* 6/23/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
@@ -4864,13 +4700,6 @@ col_major_scan_backward(H5F_t * file_ptr,
* Programmer: John Mainzer
* 10/25/04
*
- * Modifications:
- *
- * JRM -- 1/21/05
- * Added the max_index parameter to allow the caller to
- * throttle the size of the inner loop, and thereby the
- * execution time of the function.
- *
*-------------------------------------------------------------------------
*/
diff --git a/test/cache_common.h b/test/cache_common.h
index 8be56aa..07edd9b 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -31,7 +31,7 @@
#include "H5Fpkg.h"
-#define NO_CHANGE -1
+#define NO_CHANGE -1
/* with apologies for the abuse of terminology... */
@@ -72,6 +72,7 @@
#define MAX_ENTRIES (10 * 1024)
+
/* The choice of the BASE_ADDR below is arbitrary -- it just has to be
* larger than the superblock.
*/
@@ -543,26 +544,16 @@ herr_t variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
haddr_t addr, void *thing, unsigned * flags_ptr);
-void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
-void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- const void *udata1, void *udata2);
+void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
+void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr);
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index d1f861a..0e9da15 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -27,7 +27,7 @@
#include "H5Cpkg.h"
-#define H5AC_PACKAGE /*suppress error about including H5Cpkg */
+#define H5AC_PACKAGE /*suppress error about including H5ACpkg */
#include "H5ACpkg.h"
@@ -312,7 +312,7 @@ herr_t destroy_datum(H5F_t UNUSED * f, void * thing);
herr_t flush_datum(H5F_t *f, hid_t UNUSED dxpl_id, hbool_t dest, haddr_t addr,
void *thing);
void * load_datum(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr,
- const void UNUSED *udata1, void UNUSED *udata2);
+ void UNUSED *udata);
herr_t size_datum(H5F_t UNUSED * f, void * thing, size_t * size_ptr);
#define DATUM_ENTRY_TYPE H5AC_TEST_ID
@@ -1815,7 +1815,7 @@ flush_datum(H5F_t *f,
HDassert( entry_ptr->header.addr == entry_ptr->base_addr );
HDassert( ( entry_ptr->header.size == entry_ptr->len ) ||
- ( entry_ptr->header.size == entry_ptr->local_len ) );
+ ( entry_ptr->header.size == entry_ptr->local_len ) );
HDassert( entry_ptr->header.is_dirty == entry_ptr->dirty );
@@ -1824,7 +1824,7 @@ flush_datum(H5F_t *f,
ret_value = FAIL;
HDfprintf(stdout,
"%d:%s: Flushed dirty entry from non-zero file process.",
- world_mpi_rank, fcn_name);
+ world_mpi_rank, fcn_name);
}
if ( ret_value == SUCCEED ) {
@@ -1902,7 +1902,7 @@ flush_datum(H5F_t *f,
if ( entry_ptr->header.is_pinned ) {
datum_pinned_flushes++;
- HDassert( entry_ptr->global_pinned || entry_ptr->local_pinned );
+ HDassert( entry_ptr->global_pinned || entry_ptr->local_pinned );
}
return(ret_value);
@@ -1929,8 +1929,7 @@ void *
load_datum(H5F_t UNUSED *f,
hid_t UNUSED dxpl_id,
haddr_t addr,
- const void UNUSED *udata1,
- void UNUSED *udata2)
+ void UNUSED *udata)
{
const char * fcn_name = "load_datum()";
hbool_t success = TRUE;
@@ -2704,7 +2703,7 @@ lock_entry(H5C_t * cache_ptr,
cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, -1, &(types[0]),
entry_ptr->base_addr,
- NULL, NULL, H5AC_WRITE);
+ NULL, H5AC_WRITE);
if ( ( cache_entry_ptr != (void *)(&(entry_ptr->header)) ) ||
( entry_ptr->header.type != &(types[0]) ) ||
@@ -3618,7 +3617,7 @@ unlock_entry(H5C_t * cache_ptr,
entry_ptr->dirty = TRUE;
}
- result = H5AC_unprotect(file_ptr, -1, &(types[0]),
+ result = H5AC_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]),
entry_ptr->base_addr,
(void *)(&(entry_ptr->header)), flags);
@@ -3720,7 +3719,7 @@ unpin_entry(H5C_t * cache_ptr,
}
- result = H5AC_unpin_entry((void *)entry_ptr);
+ result = H5AC_unpin_entry(entry_ptr);
if ( result < 0 ) {
@@ -5240,7 +5239,7 @@ smoke_check_5(void)
* Modifications:
*
* JRM -- 7/11/06
- * Updated fro H5AC_expunge_entry() and
+ * Updated for H5AC_expunge_entry() and
* H5AC_resize_pinned_entry().
*
*****************************************************************************/
@@ -5420,8 +5419,8 @@ trace_file_check(void)
nerrors++;
HDfprintf(stdout,
- "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
- world_mpi_rank, fcn_name);
+ "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
+ world_mpi_rank, fcn_name);
}
}
}