summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-04-05 04:24:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-04-05 04:24:19 (GMT)
commit935f20f142196edd6272d4621cf41ad817677da1 (patch)
tree0751b89098852a8419b1ee32ea140fc67e8d6a1f /src/H5B.c
parent1c425ac9d2dead1c028370a068ac7add6634ed85 (diff)
downloadhdf5-935f20f142196edd6272d4621cf41ad817677da1.zip
hdf5-935f20f142196edd6272d4621cf41ad817677da1.tar.gz
hdf5-935f20f142196edd6272d4621cf41ad817677da1.tar.bz2
[svn-r14797] Description:
Misc. cleanups found while compiling in other environments. Still failing on linux machines with a memory corruption error and not finished building in parallel yet either... Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c147
1 files changed, 79 insertions, 68 deletions
diff --git a/src/H5B.c b/src/H5B.c
index 01dc119..4b9d26c 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -105,7 +105,6 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5Bpkg.h" /* B-link trees */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
@@ -229,7 +228,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
*/
if (NULL==(bt = H5FL_MALLOC(H5B_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node")
- HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
+ HDmemset(&bt->cache_info,0,sizeof(H5AC2_info_t));
bt->level = 0;
bt->left = HADDR_UNDEF;
bt->right = HADDR_UNDEF;
@@ -248,7 +247,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
/*
* Cache the new B-tree node.
*/
- if(H5AC2_set(f, dxpl_id, H5AC2_BT, *addr_p, shared->sizeof_rnode, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC2_set(f, dxpl_id, H5AC2_BT, *addr_p, shared->sizeof_rnode, bt, H5AC2__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache")
#ifdef H5B_DEBUG
H5B_assert(f, dxpl_id, *addr_p, shared->type, udata);
@@ -330,7 +329,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
rt = bt->nchildren;
@@ -385,7 +384,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
}
done:
- if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -435,7 +434,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;
+ unsigned new_bt_flags = H5AC2__NO_FLAGS_SET;
H5B_t *new_bt = NULL;
unsigned nleft, nright; /* Number of keys in left & right halves */
double split_ratios[3]; /* B-tree split ratios */
@@ -520,7 +519,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
cache_udata.f = f;
cache_udata.type = shared->type;
cache_udata.rc_shared = old_bt->rc_shared;
- if(NULL == (new_bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, *new_addr_p, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (new_bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, *new_addr_p, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to protect B-tree")
new_bt->level = old_bt->level;
@@ -535,7 +534,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
* dirty again.
* -- JRM
*/
- new_bt_flags |= H5AC__DIRTIED_FLAG;
+ new_bt_flags |= H5AC2__DIRTIED_FLAG;
HDmemcpy(new_bt->native,
old_bt->native + nleft * shared->type->sizeof_nkey,
(nright+1) * shared->type->sizeof_nkey);
@@ -548,7 +547,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
/*
* Truncate the old node.
*/
- *old_bt_flags |= H5AC__DIRTIED_FLAG;
+ *old_bt_flags |= H5AC2__DIRTIED_FLAG;
old_bt->nchildren = nleft;
/*
@@ -564,12 +563,12 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
cache_udata2.f = f;
cache_udata2.type = shared->type;
cache_udata2.rc_shared = old_bt->rc_shared;
- if(NULL == (tmp_bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, old_bt->right, shared->sizeof_rnode, &cache_udata2, H5AC_WRITE)))
+ if(NULL == (tmp_bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, old_bt->right, shared->sizeof_rnode, &cache_udata2, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling")
tmp_bt->left = *new_addr_p;
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, old_bt->right, (size_t)0, tmp_bt, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, old_bt->right, (size_t)0, tmp_bt, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
} /* end if */
@@ -664,7 +663,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to locate root of B-tree")
level = bt->level;
@@ -672,18 +671,18 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
if (!lt_key_changed)
HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey);
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
bt = NULL;
/* the new node */
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, child, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, child, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new node")
if (!rt_key_changed)
HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, child, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, child, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
bt = NULL;
@@ -697,12 +696,12 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space to move root")
/* update the new child's left pointer */
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, child, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, child, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child")
bt->left = old_root;
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, child, (size_t)0, bt, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, child, (size_t)0, bt, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
bt = NULL; /* Make certain future references will be caught */
@@ -711,7 +710,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 *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child")
/* Make certain the old root info is marked as dirty before moving it, */
@@ -721,13 +720,13 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
if (NULL == (new_bt = H5B_copy(bt))) {
HCOMMON_ERROR(H5E_BTREE, H5E_CANTLOAD, "unable to copy old root");
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
HGOTO_DONE(FAIL)
}
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
bt = NULL; /* Make certain future references will be caught */
@@ -752,7 +751,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
HDmemcpy(H5B_NKEY(new_bt,shared,2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
- if(H5AC2_set(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, new_bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC2_set(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, new_bt, H5AC2__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node")
#ifdef H5B_DEBUG
@@ -842,7 +841,7 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
bt->nchildren += 1;
/* Mark node as dirty */
- *bt_flags |= H5AC__DIRTIED_FLAG;
+ *bt_flags |= H5AC2__DIRTIED_FLAG;
FUNC_LEAVE_NOAPI(SUCCEED)
}
@@ -907,7 +906,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
uint8_t *rt_key, hbool_t *rt_key_changed,
haddr_t *new_node_p/*out*/)
{
- unsigned bt_flags = H5AC__NO_FLAGS_SET, twin_flags = H5AC__NO_FLAGS_SET;
+ unsigned bt_flags = H5AC2__NO_FLAGS_SET, twin_flags = H5AC2__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 */
@@ -940,7 +939,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't retrieve B-tree's shared ref. count object")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -952,7 +951,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
rt = bt->nchildren;
@@ -976,7 +975,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
H5B_NKEY(bt,shared,1), bt->child + 0/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node")
bt->nchildren = 1;
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
idx = 0;
if (type->follow_min) {
@@ -1090,14 +1089,14 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* Update the left and right keys of the current node.
*/
if (*lt_key_changed) {
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
if (idx > 0)
*lt_key_changed = FALSE;
else
HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
}
if (*rt_key_changed) {
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
if (idx+1 < bt->nchildren)
*rt_key_changed = FALSE;
else
@@ -1108,7 +1107,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* The insertion simply changed the address for the child.
*/
bt->child[idx] = child_addr;
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
ret_value = H5B_INS_NOOP;
} else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) {
@@ -1121,7 +1120,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 *)H5AC2_protect(f, dxpl_id, H5AC2_BT, *new_node_p, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (twin = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, *new_node_p, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
if (idx<bt->nchildren) {
tmp_bt = bt;
@@ -1232,7 +1231,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op,
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
if(bt->level > 0) {
@@ -1269,7 +1268,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op,
/* Protect the next node to the right, if there is one */
if(H5F_addr_defined(bt->right)) {
next_addr = bt->right;
- if(NULL == (next_bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, next_addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (next_bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, next_addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node")
} /* end if */
else {
@@ -1278,10 +1277,10 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op,
} /* end if */
/* Unprotect this node */
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0) {
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0) {
if(next_bt) {
HDassert(H5F_addr_defined(next_addr));
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, next_addr, (size_t)0, next_bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, next_addr, (size_t)0, next_bt, H5AC2__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
} /* end if */
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
@@ -1295,7 +1294,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op,
} /* end else */
done:
- if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1342,7 +1341,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/)
{
H5B_t *bt = NULL, *sibling = NULL;
- unsigned bt_flags = H5AC__NO_FLAGS_SET;
+ unsigned bt_flags = H5AC2__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 */
@@ -1363,7 +1362,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
/* Get shared info for B-tree */
if(NULL == (rc_shared = (type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't retrieve B-tree's shared ref. count object")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object")
shared = (H5B_shared_t *)H5RC_GET_OBJ(rc_shared);
HDassert(shared);
@@ -1374,7 +1373,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load B-tree node")
rt = bt->nchildren;
@@ -1432,7 +1431,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* our right key and indicate that it changed.
*/
if (*lt_key_changed) {
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
if (idx>0)
/* Don't propagate change out of this B-tree node */
@@ -1441,7 +1440,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
}
if (*rt_key_changed) {
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
if (idx+1<bt->nchildren) {
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
@@ -1454,13 +1453,13 @@ 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 *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree")
/* Make certain the native key for the right sibling is set up */
HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey);
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->right, (size_t)0, sibling, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->right, (size_t)0, sibling, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
sibling=NULL; /* Make certain future references will be caught */
}
@@ -1478,21 +1477,21 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* keys and the subtree pointer. Free this node (unless it's the
* root node) and return H5B_INS_REMOVE.
*/
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
bt->nchildren = 0;
if (level>0) {
if (H5F_addr_defined(bt->left)) {
- if(NULL == (sibling = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->left, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->left, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree")
sibling->right = bt->right;
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->left, (size_t)0, sibling, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->left, (size_t)0, sibling, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
sibling=NULL; /* Make certain future references will be caught */
}
if (H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, 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 */
@@ -1500,7 +1499,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
sibling->left = bt->left;
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->right, (size_t)0, sibling, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->right, (size_t)0, sibling, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
sibling=NULL; /* Make certain future references will be caught */
}
@@ -1510,11 +1509,11 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)shared->sizeof_rnode)<0
|| H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, bt_flags | H5C__DELETED_FLAG) < 0) {
bt = NULL;
- bt_flags = H5AC__NO_FLAGS_SET;
+ bt_flags = H5AC2__NO_FLAGS_SET;
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node")
}
bt = NULL;
- bt_flags = H5AC__NO_FLAGS_SET;
+ bt_flags = H5AC2__NO_FLAGS_SET;
}
} else if (H5B_INS_REMOVE==ret_value && 0==idx) {
@@ -1525,7 +1524,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* key into lt_key and notify the caller that the left key has
* changed. Return H5B_INS_NOOP.
*/
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
bt->nchildren -= 1;
HDmemmove(bt->native,
@@ -1545,7 +1544,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* freed). We copy the new right-most key into rt_key and notify the
* caller that the right key has changed. Return H5B_INS_NOOP.
*/
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
bt->nchildren -= 1;
HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
*rt_key_changed = TRUE;
@@ -1556,12 +1555,12 @@ 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 *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree")
HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->right, (size_t)0, sibling, H5AC__DIRTIED_FLAG) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, bt->right, (size_t)0, sibling, H5AC2__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
sibling=NULL; /* Make certain future references will be caught */
}
@@ -1577,7 +1576,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* the right are shifted left by one place. The subtree has already
* been freed). Return H5B_INS_NOOP.
*/
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
bt->nchildren -= 1;
HDmemmove(bt->native + idx * type->sizeof_nkey,
@@ -1634,7 +1633,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
uint8_t *rt_key = (uint8_t*)_rt_key; /*right key*/
hbool_t lt_key_changed = FALSE; /*left key changed?*/
hbool_t rt_key_changed = FALSE; /*right key changed?*/
- unsigned bt_flags = H5AC__NO_FLAGS_SET;
+ unsigned bt_flags = H5AC2__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 */
@@ -1667,12 +1666,12 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree root node")
if (0==bt->nchildren && 0!=bt->level) {
bt->level = 0;
- bt_flags |= H5AC__DIRTIED_FLAG;
+ bt_flags |= H5AC2__DIRTIED_FLAG;
}
if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, bt_flags) < 0)
@@ -1734,7 +1733,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
/* Iterate over all children in tree, deleting them */
@@ -1940,7 +1939,7 @@ H5B_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type,
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
/* Keep following the left-most child until we reach a leaf node. */
@@ -1971,13 +1970,13 @@ H5B_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type,
next_addr = bt->right;
/* Unprotect current node */
- if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
/* Protect bt's next node to the right, if there is one */
if(H5F_addr_defined(next_addr)) {
addr = next_addr;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node")
} /* end if */
else
@@ -1985,7 +1984,7 @@ H5B_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type,
} /* end while */
done:
- if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2075,7 +2074,7 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
/*
@@ -2137,7 +2136,7 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
}
done:
- if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC__NO_FLAGS_SET) < 0)
+ if(bt && H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2172,7 +2171,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;
@@ -2192,8 +2193,18 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
}
}
+
+ /* Get shared info for B-tree */
+ if(NULL == (rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 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 *)H5AC2_protect(f, dxpl_id, H5AC2_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ);
assert(bt);
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
@@ -2203,7 +2214,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
cur->level = bt->level;
head = tail = cur;
- status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET);
+ status = H5AC2_unprotect(f, dxpl_id, H5AC2_BT, addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET);
assert(status >= 0);
bt=NULL; /* Make certain future references will be caught */
@@ -2214,7 +2225,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 *)H5AC2_protect(f, dxpl_id, H5AC2_BT, cur->addr, shared->sizeof_rnode, &cache_udata, H5AC2_READ);
assert(bt);
/* Check node header */
@@ -2256,7 +2267,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
}
}
/* Release node */
- status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET);
+ status = H5AC2_unprotect(f, dxpl_id, H5AC2_BT, cur->addr, (size_t)0, bt, H5AC2__NO_FLAGS_SET);
assert(status >= 0);
bt=NULL; /* Make certain future references will be caught */