summaryrefslogtreecommitdiffstats
path: root/src/H5B2.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-07-02 16:36:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-07-02 16:36:15 (GMT)
commitddf9e4a4afc81c4be4ce38a13641ada81204b6ac (patch)
treeefd184e9c0a5687a2927d655d7bd02e546fcfe5f /src/H5B2.c
parent4cf99e9f288d42bc756f1585c72ad584620fdec9 (diff)
downloadhdf5-ddf9e4a4afc81c4be4ce38a13641ada81204b6ac.zip
hdf5-ddf9e4a4afc81c4be4ce38a13641ada81204b6ac.tar.gz
hdf5-ddf9e4a4afc81c4be4ce38a13641ada81204b6ac.tar.bz2
[svn-r11014] Purpose:
Code cleanup Description: Refactor metadata cache to merge "dirtied" flag in with other flags for H5AC_unprotect and H5C_unprotect. Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
Diffstat (limited to 'src/H5B2.c')
-rw-r--r--src/H5B2.c504
1 files changed, 154 insertions, 350 deletions
diff --git a/src/H5B2.c b/src/H5B2.c
index 60d9514..68ad206 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -63,26 +63,29 @@ static herr_t H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
static int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec,
size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
static herr_t H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2,
- hbool_t * bt2_dirtied_ptr, H5RC_t *bt2_shared);
+ unsigned *bt2_flags_ptr, H5RC_t *bt2_shared);
static herr_t H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned idx);
static herr_t H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx);
+ H5B2_node_ptr_t *curr_node_ptr, unsigned * parent_cache_info_flags_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
+static herr_t H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+ H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags,
+ H5B2_internal_t *internal, unsigned *internal_flags, unsigned idx);
static herr_t H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_internal_t *internal, hbool_t *internal_dirtied_ptr, unsigned idx);
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
static herr_t H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx);
+ H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
static herr_t H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx);
+ H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx);
static herr_t H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc);
static herr_t H5B2_insert_internal(H5F_t *f, hid_t dxpl_id,
H5RC_t *bt2_shared, unsigned depth, H5AC_info_t *parent_cache_info,
- hbool_t * parent_cache_info_dirtied_ptr,
+ unsigned *parent_cache_info_flags_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
static herr_t H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
@@ -428,13 +431,12 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr, H5RC_t *bt2_shared)
+H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr,
+ H5RC_t *bt2_shared)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
- hbool_t new_root_dirtied = FALSE;
H5B2_internal_t *new_root; /* Pointer to new root node */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- hbool_t left_child_dirtied = FALSE, right_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to child nodes */
unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native;/* Pointers to childs' native records */
@@ -448,7 +450,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
HDassert(f);
HDassert(bt2);
- HDassert(bt2_dirtied_ptr);
+ HDassert(bt2_flags_ptr);
HDassert(bt2_shared);
/* Get the pointer to the shared B-tree info */
@@ -456,7 +458,6 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
HDassert(shared);
if(bt2->depth>0) {
- hbool_t * old_int_dirtied_ptr = NULL, * new_int_dirtied_ptr = NULL;
H5B2_internal_t *old_int=NULL, *new_int=NULL; /* Pointers to old & new internal nodes */
H5B2_node_ptr_t new_int_ptr; /* Node pointer to manage new internal node */
@@ -477,9 +478,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
- old_int_dirtied_ptr = &left_child_dirtied;
left_child = old_int;
- new_int_dirtied_ptr = &right_child_dirtied;
right_child = new_int;
left_nrec = &(old_int->nrec);
right_nrec = &(new_int->nrec);
@@ -487,13 +486,8 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
right_native = new_int->int_native;
left_node_ptrs = old_int->node_ptrs;
right_node_ptrs = new_int->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *old_int_dirtied_ptr = TRUE;
- *new_int_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * old_leaf_dirtied_ptr = NULL, * new_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *old_leaf=NULL, *new_leaf=NULL; /* Pointers to old & new leaf nodes */
H5B2_node_ptr_t new_leaf_ptr; /* Node pointer to manage new leaf node */
@@ -514,18 +508,12 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
- old_leaf_dirtied_ptr = &left_child_dirtied;
left_child = old_leaf;
- new_leaf_dirtied_ptr = &right_child_dirtied;
right_child = new_leaf;
left_nrec = &(old_leaf->nrec);
right_nrec = &(new_leaf->nrec);
left_native = old_leaf->leaf_native;
right_native = new_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *old_leaf_dirtied_ptr = TRUE;
- *new_leaf_dirtied_ptr = TRUE;
} /* end if */
/* Set the old number of records in root node */
@@ -586,9 +574,6 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
/* Update record count in new internal node */
new_root->nrec = 1;
- /* Mark new internal node as dirty */
- new_root_dirtied = TRUE;
-
#ifdef H5B2_DEBUG
H5B2_assert_internal(bt2->root.all_nrec,shared,new_root);
if(bt2->depth>0) {
@@ -600,14 +585,14 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
H5B2_assert_leaf(shared,right_child);
} /* end else */
#endif /* H5B2_DEBUG */
- /* Release new internal node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, bt2->root.addr, new_root, new_root_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Release new internal node (marked as dirty) */
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, bt2->root.addr, new_root, H5AC__DIRTIED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node")
- /* Release child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Release child nodes (marked as dirty) */
+ 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 leaf node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__NO_FLAGS_SET) < 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 leaf node")
/* Update depth of B-tree */
@@ -617,7 +602,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr,
bt2->root.node_nrec = 1;
/* Mark B-tree header as dirty */
- *bt2_dirtied_ptr = TRUE;
+ *bt2_flags_ptr |= H5AC__DIRTIED_FLAG;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -649,7 +634,6 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- hbool_t left_child_dirtied = FALSE, right_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to child nodes */
unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
@@ -669,8 +653,6 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Check for the kind of B-tree node to redistribute */
if(depth>1) {
- hbool_t * left_internal_dirtied_ptr = NULL;
- hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -686,9 +668,7 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
- left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
- right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
right_nrec = &(right_internal->nrec);
@@ -696,14 +676,8 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_native = right_internal->int_native;
left_node_ptrs = left_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *left_internal_dirtied_ptr = TRUE;
- *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * left_leaf_dirtied_ptr = NULL;
- hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -719,18 +693,12 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
- left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
- right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
right_nrec = &(right_leaf->nrec);
left_native = left_leaf->leaf_native;
right_native = right_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *left_leaf_dirtied_ptr = TRUE;
- *right_leaf_dirtied_ptr = TRUE;
} /* end else */
#ifdef H5B2_DEBUG
@@ -857,10 +825,10 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
} /* end else */
#endif /* H5B2_DEBUG */
- /* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Release child nodes (marked as dirty) */
+ 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, right_child_dirtied, H5AC__NO_FLAGS_SET) < 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:
@@ -894,15 +862,12 @@ done:
*/
static herr_t
H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
- hbool_t * parent_cache_info_dirtied_ptr, H5B2_internal_t *internal,
- hbool_t * internal_dirtied_ptr, unsigned idx)
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- hbool_t left_child_dirtied = FALSE;
- hbool_t right_child_dirtied = FALSE;
- hbool_t middle_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
@@ -919,9 +884,9 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
FUNC_ENTER_NOAPI_NOINIT(H5B2_split2)
HDassert(f);
- HDassert(parent_cache_info_dirtied_ptr);
+ HDassert(parent_cache_info_flags_ptr);
HDassert(internal);
- HDassert(internal_dirtied_ptr);
+ HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
shared=H5RC_GET_OBJ(internal->shared);
@@ -933,9 +898,6 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Check for the kind of B-tree node to split */
if(depth>1) {
- hbool_t * left_internal_dirtied_ptr = NULL;
- hbool_t * middle_internal_dirtied_ptr = NULL;
- hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -964,11 +926,8 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
- left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
- middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
- right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -979,16 +938,8 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
left_node_ptrs = left_internal->node_ptrs;
middle_node_ptrs = middle_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *left_internal_dirtied_ptr = TRUE;
- *middle_internal_dirtied_ptr = TRUE;
- *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t *left_leaf_dirtied_ptr = NULL;
- hbool_t *middle_leaf_dirtied_ptr = NULL;
- hbool_t *right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -1017,11 +968,8 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
- left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
- middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
- right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -1029,11 +977,6 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
left_native = left_leaf->leaf_native;
middle_native = middle_leaf->leaf_native;
right_native = right_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *left_leaf_dirtied_ptr = TRUE;
- *middle_leaf_dirtied_ptr = TRUE;
- *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records */
@@ -1136,13 +1079,13 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
internal->nrec++;
/* Mark parent as dirty */
- *internal_dirtied_ptr = TRUE;
+ *internal_flags_ptr |= H5AC__DIRTIED_FLAG;
/* Update grandparent info */
curr_node_ptr->node_nrec++;
/* Mark grandparent as dirty */
- *parent_cache_info_dirtied_ptr = TRUE;
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -1159,12 +1102,12 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
} /* end else */
#endif /* H5B2_DEBUG */
- /* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Unlock child nodes (marked as dirty) */
+ 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, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 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, right_child_dirtied, H5AC__NO_FLAGS_SET) < 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:
@@ -1199,14 +1142,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *internal, hbool_t *internal_dirtied_ptr, unsigned idx)
+H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- hbool_t left_child_dirtied = FALSE;
- hbool_t right_child_dirtied = FALSE;
- hbool_t middle_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to child nodes */
void *middle_child; /* Pointers to middle child node */
unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
@@ -1224,6 +1165,7 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HDassert(f);
HDassert(internal);
+ HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
shared=H5RC_GET_OBJ(internal->shared);
@@ -1231,9 +1173,6 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Check for the kind of B-tree node to redistribute */
if(depth>1) {
- hbool_t * left_internal_dirtied_ptr = NULL;
- hbool_t * middle_internal_dirtied_ptr = NULL;
- hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -1253,11 +1192,8 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
- left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
- middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
- right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -1268,16 +1204,8 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
left_node_ptrs = left_internal->node_ptrs;
middle_node_ptrs = middle_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *left_internal_dirtied_ptr = TRUE;
- *middle_internal_dirtied_ptr = TRUE;
- *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * left_leaf_dirtied_ptr = NULL;
- hbool_t * middle_leaf_dirtied_ptr = NULL;
- hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -1297,11 +1225,8 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
- left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
- middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
- right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -1309,11 +1234,6 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
left_native = left_leaf->leaf_native;
middle_native = middle_leaf->leaf_native;
right_native = right_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *left_leaf_dirtied_ptr = TRUE;
- *middle_leaf_dirtied_ptr = TRUE;
- *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records */
@@ -1506,7 +1426,7 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
} /* end else */
/* Mark parent as dirty */
- *internal_dirtied_ptr = TRUE;
+ *internal_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef QAK
{
@@ -1563,12 +1483,12 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
} /* end else */
#endif /* H5B2_DEBUG */
- /* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Unlock child nodes (marked as dirty) */
+ 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, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 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, right_child_dirtied, H5AC__NO_FLAGS_SET) < 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:
@@ -1605,17 +1525,13 @@ done:
static herr_t
H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
H5B2_node_ptr_t *curr_node_ptr,
- hbool_t * parent_cache_info_dirtied_ptr, H5B2_internal_t *internal,
- hbool_t * internal_dirtied_ptr, unsigned idx)
+ unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal,
+ unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
haddr_t new_addr; /* Address of new child node */
- hbool_t left_child_dirtied = FALSE;
- hbool_t middle_child_dirtied = FALSE;
- hbool_t right_child_dirtied = FALSE;
- hbool_t new_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
void *new_child; /* Pointer to new child node */
@@ -1649,10 +1565,6 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Check for the kind of B-tree node to split */
if(depth>1) {
- hbool_t * left_internal_dirtied_ptr = NULL;
- hbool_t * right_internal_dirtied_ptr = NULL;
- hbool_t * middle_internal_dirtied_ptr = NULL;
- hbool_t * new_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
@@ -1685,13 +1597,9 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
- left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
- middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
- new_internal_dirtied_ptr = &new_child_dirtied;
new_child = new_internal;
- right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -1705,18 +1613,8 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
middle_node_ptrs = middle_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
new_node_ptrs = new_internal->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *left_internal_dirtied_ptr = TRUE;
- *middle_internal_dirtied_ptr = TRUE;
- *new_internal_dirtied_ptr = TRUE;
- *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * left_leaf_dirtied_ptr = NULL;
- hbool_t * right_leaf_dirtied_ptr = NULL;
- hbool_t * middle_leaf_dirtied_ptr = NULL;
- hbool_t * new_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
@@ -1749,13 +1647,9 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
- left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
- middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
- new_leaf_dirtied_ptr = &new_child_dirtied;
new_child = new_leaf;
- right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -1765,12 +1659,6 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
middle_native = middle_leaf->leaf_native;
new_native = new_leaf->leaf_native;
right_native = right_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *left_leaf_dirtied_ptr = TRUE;
- *middle_leaf_dirtied_ptr = TRUE;
- *new_leaf_dirtied_ptr = TRUE;
- *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records */
@@ -1909,13 +1797,13 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
internal->nrec++;
/* Mark parent as dirty */
- *internal_dirtied_ptr = TRUE;
+ *internal_flags_ptr |= H5AC__DIRTIED_FLAG;
/* Update grandparent info */
curr_node_ptr->node_nrec++;
/* Mark grandparent as dirty */
- *parent_cache_info_dirtied_ptr = TRUE;
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -1935,14 +1823,14 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end else */
#endif /* H5B2_DEBUG */
- /* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Unlock child nodes (mark as dirty) */
+ 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, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 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, new_addr, new_child, new_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, new_addr, new_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, right_child_dirtied, H5AC__NO_FLAGS_SET) < 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:
@@ -1976,13 +1864,11 @@ done:
*/
static herr_t
H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx)
+ H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
- hbool_t left_child_dirtied = FALSE;
- hbool_t right_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
@@ -1993,7 +1879,10 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge2)
HDassert(f);
+ HDassert(curr_node_ptr);
+ HDassert(parent_cache_info_flags_ptr);
HDassert(internal);
+ HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
shared=H5RC_GET_OBJ(internal->shared);
@@ -2001,8 +1890,6 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Check for the kind of B-tree node to split */
if(depth>1) {
- hbool_t * left_internal_dirtied_ptr = NULL;
- hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -2018,9 +1905,7 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
- left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
- right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
right_nrec = &(right_internal->nrec);
@@ -2028,14 +1913,8 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
right_native = right_internal->int_native;
left_node_ptrs = left_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *left_internal_dirtied_ptr = TRUE;
- *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * left_leaf_dirtied_ptr = NULL;
- hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -2051,18 +1930,12 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
- left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
- right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
right_nrec = &(right_leaf->nrec);
left_native = left_leaf->leaf_native;
right_native = right_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *left_leaf_dirtied_ptr = TRUE;
- *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records into left node */
@@ -2097,13 +1970,13 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
internal->nrec--;
/* Mark parent as dirty */
- *internal_dirtied_ptr = TRUE;
+ *internal_flags_ptr |= H5AC__DIRTIED_FLAG;
/* Update grandparent info */
curr_node_ptr->node_nrec--;
/* Mark grandparent as dirty */
- *parent_cache_info_dirtied_ptr = TRUE;
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -2115,14 +1988,14 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end else */
#endif /* H5B2_DEBUG */
- /* Unlock left node */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Unlock left node (marked as dirty) */
+ 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")
- /* Delete right node & remove from cache */
+ /* 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)
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, right_child_dirtied, 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:
@@ -2158,15 +2031,12 @@ done:
*/
static herr_t
H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx)
+ H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
- hbool_t left_child_dirtied = FALSE;
- hbool_t right_child_dirtied = FALSE;
- hbool_t middle_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
@@ -2182,9 +2052,10 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge3)
HDassert(f);
- HDassert(parent_cache_info_dirtied_ptr);
+ HDassert(curr_node_ptr);
+ HDassert(parent_cache_info_flags_ptr);
HDassert(internal);
- HDassert(internal_dirtied_ptr);
+ HDassert(internal_flags_ptr);
/* Get the pointer to the shared B-tree info */
shared=H5RC_GET_OBJ(internal->shared);
@@ -2192,9 +2063,6 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Check for the kind of B-tree node to split */
if(depth>1) {
- hbool_t * left_internal_dirtied_ptr = NULL;
- hbool_t * middle_internal_dirtied_ptr = NULL;
- hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -2214,11 +2082,8 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
- left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
- middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
- right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -2229,16 +2094,8 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
left_node_ptrs = left_internal->node_ptrs;
middle_node_ptrs = middle_internal->node_ptrs;
right_node_ptrs = right_internal->node_ptrs;
-
- /* Mark child nodes as dirty now */
- *left_internal_dirtied_ptr = TRUE;
- *middle_internal_dirtied_ptr = TRUE;
- *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * left_leaf_dirtied_ptr = NULL;
- hbool_t * middle_leaf_dirtied_ptr = NULL;
- hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -2258,11 +2115,8 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
- left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
- middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
- right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -2270,11 +2124,6 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
left_native = left_leaf->leaf_native;
middle_native = middle_leaf->leaf_native;
right_native = right_leaf->leaf_native;
-
- /* Mark child nodes as dirty now */
- *left_leaf_dirtied_ptr = TRUE;
- *middle_leaf_dirtied_ptr = TRUE;
- *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records into left node */
@@ -2352,13 +2201,13 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
internal->nrec--;
/* Mark parent as dirty */
- *internal_dirtied_ptr = TRUE;
+ *internal_flags_ptr |= H5AC__DIRTIED_FLAG;
/* Update grandparent info */
curr_node_ptr->node_nrec--;
/* Mark grandparent as dirty */
- *parent_cache_info_dirtied_ptr = TRUE;
+ *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -2372,16 +2221,16 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
} /* end else */
#endif /* H5B2_DEBUG */
- /* Unlock left & middle nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Unlock left & middle nodes (marked as dirty) */
+ 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, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 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 */
+ /* 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)
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, right_child_dirtied, 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:
@@ -2417,12 +2266,11 @@ done:
*/
static herr_t
H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr,
+ H5B2_internal_t *internal, unsigned *internal_flags_ptr,
unsigned idx, void *swap_loc)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t child_addr; /* Address of child node */
- hbool_t child_dirtied = FALSE;
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 */
@@ -2432,6 +2280,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDassert(f);
HDassert(internal);
+ HDassert(internal_flags_ptr);
HDassert(idx <= internal->nrec);
/* Get the pointer to the shared B-tree info */
@@ -2440,7 +2289,6 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Check for the kind of B-tree node to swap */
if(depth>1) {
- hbool_t * child_internal_dirtied_ptr = NULL;
H5B2_internal_t *child_internal; /* Pointer to internal node */
/* Setup information for unlocking child node */
@@ -2452,15 +2300,10 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
- child_internal_dirtied_ptr = &child_dirtied;
child = child_internal;
child_native = child_internal->int_native;
-
- /* Mark child node as dirty now */
- *child_internal_dirtied_ptr = TRUE;
} /* end if */
else {
- hbool_t * child_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *child_leaf; /* Pointer to leaf node */
/* Setup information for unlocking child nodes */
@@ -2472,12 +2315,8 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
- child_leaf_dirtied_ptr = &child_dirtied;
child = child_leaf;
child_native = child_leaf->leaf_native;
-
- /* Mark child node as dirty now */
- *child_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Swap records (use disk page as temporary buffer) */
@@ -2486,7 +2325,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDmemcpy(swap_loc, shared->page, shared->type->nrec_size);
/* Mark parent as dirty */
- *internal_dirtied_ptr = TRUE;
+ *internal_flags_ptr |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -2497,7 +2336,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, child_dirtied, H5AC__NO_FLAGS_SET) < 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:
@@ -2529,7 +2368,6 @@ static herr_t
H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
- hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
int cmp; /* Comparison value of records */
@@ -2585,12 +2423,9 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Update record count for current node */
leaf->nrec++;
- /* Mark node as dirty */
- leaf_dirtied = TRUE;
-
done:
- /* Release the B-tree leaf node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ /* Release the B-tree leaf node (marked as dirty) */
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__DIRTIED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2623,11 +2458,11 @@ done:
static herr_t
H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
unsigned depth, H5AC_info_t *parent_cache_info,
- hbool_t * parent_cache_info_dirtied_ptr,
+ unsigned *parent_cache_info_flags_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
- hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
herr_t ret_value = SUCCEED;
@@ -2639,7 +2474,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(bt2_shared);
HDassert(depth>0);
HDassert(parent_cache_info);
- HDassert(parent_cache_info_dirtied_ptr);
+ HDassert(parent_cache_info_flags_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
@@ -2687,8 +2522,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
} /* end if */
else {
if(H5B2_split2(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,
- internal,&internal_dirtied,idx)<0)
+ parent_cache_info_flags_ptr, internal,&internal_flags,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
@@ -2699,21 +2533,19 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
} /* end if */
else {
if(H5B2_split2(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,
- internal,&internal_dirtied,(idx-1))<0)
+ parent_cache_info_flags_ptr, internal,&internal_flags,(idx-1))<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries>0 && ((internal->node_ptrs[idx+1].node_nrec < split_nrec) ||
(internal->node_ptrs[idx-1].node_nrec < split_nrec))) {
- if(H5B2_redistribute3(f,dxpl_id,depth,internal,&internal_dirtied,idx)<0)
+ if(H5B2_redistribute3(f,dxpl_id,depth,internal,&internal_flags,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
if(H5B2_split3(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,
- internal,&internal_dirtied,idx)<0)
+ parent_cache_info_flags_ptr, internal,&internal_flags,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end else */
@@ -2732,7 +2564,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to insert node */
if(depth>1) {
- if(H5B2_insert_internal(f,dxpl_id,bt2_shared,depth-1,&internal->cache_info,&internal_dirtied,
+ if(H5B2_insert_internal(f,dxpl_id,bt2_shared,depth-1,&internal->cache_info,&internal_flags,
&internal->node_ptrs[idx],udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
@@ -2745,11 +2577,11 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
curr_node_ptr->all_nrec++;
/* Mark node as dirty */
- internal_dirtied = TRUE;
+ internal_flags |= H5AC__DIRTIED_FLAG;
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 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)
@@ -2780,8 +2612,8 @@ herr_t
H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata)
{
- hbool_t bt2_dirtied = FALSE;
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 */
herr_t ret_value = SUCCEED;
@@ -2807,19 +2639,19 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
/* Mark B-tree header as dirty, since we updated the address of the root node */
- bt2_dirtied = TRUE;
+ bt2_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
/* Check if we need to split the root node (equiv. to a 1->2 leaf node split) */
else if((bt2->depth==0 && bt2->root.node_nrec==shared->split_leaf_nrec) ||
(bt2->depth>0 && bt2->root.node_nrec==shared->split_int_nrec)) {
/* Split root node */
- if(H5B2_split_root(f, dxpl_id, bt2, &bt2_dirtied, bt2->shared)<0)
+ if(H5B2_split_root(f, dxpl_id, bt2, &bt2_flags, bt2->shared)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
} /* end if */
/* Attempt to insert record into B-tree */
if(bt2->depth>0) {
- if(H5B2_insert_internal(f,dxpl_id,bt2->shared,bt2->depth,&(bt2->cache_info),&bt2_dirtied,&bt2->root,udata)<0)
+ if(H5B2_insert_internal(f,dxpl_id,bt2->shared,bt2->depth,&(bt2->cache_info),&bt2_flags,&bt2->root,udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
@@ -2828,11 +2660,11 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Mark parent node as dirty */
- bt2_dirtied = TRUE;
+ bt2_flags |= H5AC__DIRTIED_FLAG;
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 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)
@@ -3038,7 +2870,6 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
- hbool_t node_dirtied = FALSE;
void *node=NULL; /* Pointers to current node */
uint8_t *native; /* Pointers to node's native records */
H5B2_node_ptr_t *node_ptrs=NULL; /* Pointers to node's node pointers */
@@ -3105,7 +2936,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
done:
/* Unlock current node */
if(node)
- if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, node_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3140,7 +2971,6 @@ herr_t
H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_operator_t op, void *op_data)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
@@ -3172,7 +3002,7 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -3227,7 +3057,6 @@ herr_t
H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata, H5B2_found_t op, void *op_data)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -3261,7 +3090,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -3276,12 +3105,9 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Walk down B-tree to find record or leaf node where record is located */
cmp = -1;
while(depth>0 && cmp != 0) {
- hbool_t internal_dirtied;
H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
- internal_dirtied = FALSE;
-
/* Lock B-tree current node */
if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, 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 internal node")
@@ -3296,7 +3122,7 @@ H5B2_find(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, internal_dirtied, 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 */
@@ -3306,14 +3132,14 @@ 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, internal_dirtied, 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")
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, 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_DONE(SUCCEED);
@@ -3324,7 +3150,6 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end while */
{
- hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
@@ -3336,7 +3161,7 @@ H5B2_find(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, leaf_dirtied, 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,
@@ -3353,7 +3178,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_LEAF_NREC(leaf,shared,idx), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, 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_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -3361,7 +3186,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, 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")
}
@@ -3403,7 +3228,6 @@ herr_t
H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hsize_t idx, H5B2_found_t op, void *op_data)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -3436,7 +3260,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -3454,13 +3278,10 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Walk down B-tree to find record or leaf node where record is located */
while(depth>0) {
- hbool_t internal_dirtied;
H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
unsigned u; /* Local index variable */
- internal_dirtied = FALSE;
-
/* Lock B-tree current node */
if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, 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 internal node")
@@ -3473,7 +3294,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[u];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, 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 */
@@ -3488,14 +3309,14 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for current record */
if ((op)(H5B2_INT_NREC(internal,shared,u), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, 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")
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, 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_DONE(SUCCEED);
@@ -3514,7 +3335,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[u];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, 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 */
@@ -3530,7 +3351,6 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end while */
{
- hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
@@ -3543,14 +3363,14 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for correct record */
if ((op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, 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_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, 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")
}
@@ -3587,10 +3407,9 @@ static herr_t
H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
- hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node */
haddr_t leaf_addr=HADDR_UNDEF; /* Leaf address on disk */
- unsigned leaf_unprotect_flags=H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
+ 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 */
herr_t ret_value = SUCCEED;
@@ -3628,7 +3447,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
leaf->nrec--;
/* Mark leaf node as dirty also */
- leaf_dirtied = TRUE;
+ leaf_flags |= H5AC__DIRTIED_FLAG;
if(leaf->nrec > 0) {
/* Pack record out of leaf */
@@ -3641,7 +3460,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree leaf node")
/* Let the cache know that the object is deleted */
- leaf_unprotect_flags = H5AC__DELETED_FLAG;
+ leaf_flags |= H5AC__DELETED_FLAG;
/* Reset address of parent node pointer */
curr_node_ptr->addr = HADDR_UNDEF;
@@ -3652,7 +3471,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree leaf node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_dirtied, leaf_unprotect_flags) < 0)
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3686,17 +3505,16 @@ done:
static herr_t
H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
hbool_t *depth_decreased, void *swap_loc, unsigned depth,
- H5AC_info_t *parent_cache_info, hbool_t * parent_cache_info_dirtied_ptr,
+ H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
- hbool_t *new_cache_info_dirtied_ptr = NULL;
H5AC_info_t *new_cache_info; /* Pointer to new cache info */
+ unsigned *new_cache_info_flags_ptr = NULL;
H5B2_node_ptr_t *new_node_ptr; /* Pointer to new node pointer */
- hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node */
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
haddr_t internal_addr; /* Address of internal node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
- unsigned internal_unprotect_flags=H5AC__NO_FLAGS_SET; /* Flags for unprotecting internal node */
unsigned idx; /* Location of record which matches key */
size_t merge_nrec; /* Number of records to merge node at */
hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */
@@ -3709,7 +3527,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(bt2_shared);
HDassert(depth>0);
HDassert(parent_cache_info);
- HDassert(parent_cache_info_dirtied_ptr);
+ HDassert(parent_cache_info_flags_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
@@ -3735,8 +3553,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Merge children of root node */
if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,
- internal,&internal_dirtied,0)<0)
+ parent_cache_info_flags_ptr, internal,&internal_flags,0)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Release space for root B-tree node on disk */
@@ -3744,7 +3561,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree leaf node")
/* Let the cache know that the object is deleted */
- internal_unprotect_flags = H5AC__DELETED_FLAG;
+ internal_flags |= H5AC__DELETED_FLAG;
/* Reset information in parent node pointer */
curr_node_ptr->addr = internal->node_ptrs[0].addr;
@@ -3755,7 +3572,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Set pointers for advancing to child node */
new_cache_info = parent_cache_info;
- new_cache_info_dirtied_ptr = parent_cache_info_dirtied_ptr;
+ new_cache_info_flags_ptr = parent_cache_info_flags_ptr;
new_node_ptr = curr_node_ptr;
/* Set flag to indicate root was collapsed */
@@ -3793,8 +3610,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
} /* end if */
else {
if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,
- internal,&internal_dirtied,idx)<0)
+ parent_cache_info_flags_ptr, internal,&internal_flags,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
@@ -3805,21 +3621,19 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
} /* end if */
else {
if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,
- internal,&internal_dirtied,(idx-1))<0)
+ parent_cache_info_flags_ptr, internal,&internal_flags,(idx-1))<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries>0 && ((internal->node_ptrs[idx+1].node_nrec > merge_nrec) ||
(internal->node_ptrs[idx-1].node_nrec > merge_nrec))) {
- if(H5B2_redistribute3(f,dxpl_id,depth,internal,&internal_dirtied,idx)<0)
+ if(H5B2_redistribute3(f,dxpl_id,depth,internal,&internal_flags,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
if(H5B2_merge3(f,dxpl_id,depth,curr_node_ptr,
- parent_cache_info_dirtied_ptr,internal,
- &internal_dirtied,idx)<0)
+ parent_cache_info_flags_ptr,internal, &internal_flags,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end else */
@@ -3844,11 +3658,11 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Swap record to delete with record from leaf, if we are the last internal node */
if(swap_loc && depth==1)
- if(H5B2_swap_leaf(f,dxpl_id,depth,internal,&internal_dirtied,idx,swap_loc) < 0)
+ if(H5B2_swap_leaf(f,dxpl_id,depth,internal,&internal_flags,idx,swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree")
/* Set pointers for advancing to child node */
- new_cache_info_dirtied_ptr = &internal_dirtied;
+ new_cache_info_flags_ptr = &internal_flags;
new_cache_info = &internal->cache_info;
new_node_ptr = &internal->node_ptrs[idx];
} /* end else */
@@ -3856,7 +3670,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to remove node */
if(depth>1) {
if(H5B2_remove_internal(f,dxpl_id,bt2_shared,depth_decreased, swap_loc, depth-1,
- new_cache_info,new_cache_info_dirtied_ptr,new_node_ptr,udata)<0)
+ new_cache_info,new_cache_info_flags_ptr,new_node_ptr,udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
@@ -3869,7 +3683,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
new_node_ptr->all_nrec--;
/* Mark node as dirty */
- internal_dirtied = TRUE;
+ internal_flags |= H5AC__DIRTIED_FLAG;
#ifdef H5B2_DEBUG
H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec-1) : new_node_ptr->all_nrec),shared,internal);
@@ -3877,7 +3691,7 @@ H5B2_remove_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, internal_addr, internal, internal_dirtied, internal_unprotect_flags) < 0)
+ if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3908,8 +3722,8 @@ herr_t
H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata)
{
- hbool_t bt2_dirtied = FALSE;
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 */
herr_t ret_value = SUCCEED;
@@ -3937,7 +3751,7 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hbool_t depth_decreased=FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
if(H5B2_remove_internal(f,dxpl_id,bt2->shared, &depth_decreased, NULL, bt2->depth,
- &(bt2->cache_info),&bt2_dirtied,&bt2->root,udata)<0)
+ &(bt2->cache_info),&bt2_flags,&bt2->root,udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
bt2->depth -= depth_decreased;
@@ -3951,11 +3765,11 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
bt2->root.all_nrec--;
/* Mark parent node as dirty */
- bt2_dirtied = TRUE;
+ bt2_flags |= H5AC__DIRTIED_FLAG;
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 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)
@@ -3986,7 +3800,6 @@ herr_t
H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hsize_t *nrec)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -4007,7 +3820,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, bt2_dirtied, 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)
@@ -4052,7 +3865,6 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data)
{
- hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
@@ -4108,7 +3920,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, leaf_dirtied, 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)
@@ -4153,7 +3965,6 @@ H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data)
{
- hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
@@ -4207,7 +4018,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, internal_dirtied, 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)
@@ -4250,7 +4061,6 @@ herr_t
H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -4282,7 +4092,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, bt2_dirtied, 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)
@@ -4316,7 +4126,6 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
- hbool_t node_dirtied = FALSE;
void *node=NULL; /* Pointers to current node */
herr_t ret_value = SUCCEED;
@@ -4367,7 +4176,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
done:
/* Unlock & delete current node */
if(node)
- if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, node_dirtied, H5AC__DELETED_FLAG) < 0)
+ if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -4397,7 +4206,6 @@ done:
herr_t
H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -4423,7 +4231,7 @@ H5B2_delete(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_dirtied, H5AC__DELETED_FLAG) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to delete B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -4460,7 +4268,6 @@ herr_t
H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata, H5B2_modify_t op, void *op_data)
{
- hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -4495,7 +4302,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -4510,7 +4317,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Walk down B-tree to find record or leaf node where record is located */
cmp = -1;
while(depth>0 && cmp != 0) {
- hbool_t internal_dirtied = FALSE;
+ unsigned internal_flags = H5AC__NO_FLAGS_SET;
H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
@@ -4528,7 +4335,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, internal_dirtied, 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 */
@@ -4541,20 +4348,19 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
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);
- internal_dirtied = changed;
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, 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")
} /* end if */
/* Mark the node as dirty if it changed */
- internal_dirtied = changed;
+ 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_dirtied, H5AC__NO_FLAGS_SET) < 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);
@@ -4565,7 +4371,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end while */
{
- hbool_t leaf_dirtied = FALSE;
+ unsigned leaf_flags = H5AC__NO_FLAGS_SET;
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
hbool_t changed; /* Whether the 'modify' callback changed the record */
@@ -4578,7 +4384,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, leaf_dirtied, 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,
@@ -4597,10 +4403,8 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed==FALSE);
- leaf_dirtied = changed;
-
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, 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")
@@ -4608,10 +4412,10 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Mark the node as dirty if it changed */
- leaf_dirtied = changed;
+ 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_dirtied, H5AC__NO_FLAGS_SET) < 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")
}