diff options
-rw-r--r-- | src/H5AC.c | 10 | ||||
-rw-r--r-- | src/H5ACprivate.h | 3 | ||||
-rw-r--r-- | src/H5B.c | 182 | ||||
-rw-r--r-- | src/H5B2.c | 504 | ||||
-rw-r--r-- | src/H5B2dbg.c | 15 | ||||
-rw-r--r-- | src/H5B2test.c | 3 | ||||
-rw-r--r-- | src/H5BT.c | 62 | ||||
-rw-r--r-- | src/H5BTdbg.c | 3 | ||||
-rw-r--r-- | src/H5BTtest.c | 6 | ||||
-rw-r--r-- | src/H5C.c | 3 | ||||
-rw-r--r-- | src/H5Cprivate.h | 12 | ||||
-rw-r--r-- | src/H5D.c | 20 | ||||
-rw-r--r-- | src/H5G.c | 12 | ||||
-rw-r--r-- | src/H5Gent.c | 2 | ||||
-rw-r--r-- | src/H5Gnode.c | 81 | ||||
-rw-r--r-- | src/H5HG.c | 42 | ||||
-rw-r--r-- | src/H5HGdbg.c | 3 | ||||
-rw-r--r-- | src/H5HL.c | 38 | ||||
-rw-r--r-- | src/H5HLdbg.c | 3 | ||||
-rw-r--r-- | src/H5HLprivate.h | 2 | ||||
-rw-r--r-- | src/H5O.c | 131 | ||||
-rw-r--r-- | src/H5Oefl.c | 4 | ||||
-rw-r--r-- | src/H5Oprivate.h | 8 | ||||
-rw-r--r-- | src/H5S.c | 6 | ||||
-rw-r--r-- | src/H5SH.c | 3 | ||||
-rw-r--r-- | src/H5SHdbg.c | 3 | ||||
-rw-r--r-- | src/H5Sprivate.h | 2 | ||||
-rw-r--r-- | test/cache.c | 10 | ||||
-rw-r--r-- | test/lheap.c | 3 |
29 files changed, 444 insertions, 732 deletions
@@ -1102,14 +1102,15 @@ done: * H5C_unprotect(). * * JRM - 6/6/05 - * Added the dirtied parameter and supporting code. This is + * Added the dirtied flag and supporting code. This is * part of a collection of changes directed at moving * management of cache entry dirty flags into the H5C code. * *------------------------------------------------------------------------- */ herr_t -H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, hbool_t dirtied, unsigned int flags) +H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, + void *thing, unsigned flags) { herr_t result; herr_t ret_value=SUCCEED; /* Return value */ @@ -1149,8 +1150,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, ((H5AC_info_t *)thing)->is_protected = FALSE; /* mark the entry as dirty if appropriate. JRM - 6/6/05 */ - ((H5AC_info_t *)thing)->is_dirty = - ((H5AC_info_t *)thing)->is_dirty || dirtied; + ((H5AC_info_t *)thing)->is_dirty |= + (flags & H5AC__DIRTIED_FLAG) ? TRUE : FALSE; /* * FIXME: If the metadata is *really* deleted at this point @@ -1206,7 +1207,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, type, addr, thing, - dirtied, flags); if ( result < 0 ) { diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index d746718..314c96b 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -213,6 +213,7 @@ extern hid_t H5AC_ind_dxpl_id; #define H5AC__NO_FLAGS_SET H5C__NO_FLAGS_SET #define H5AC__SET_FLUSH_MARKER_FLAG H5C__SET_FLUSH_MARKER_FLAG #define H5AC__DELETED_FLAG H5C__DELETED_FLAG +#define H5AC__DIRTIED_FLAG H5C__DIRTIED_FLAG #define H5AC__FLUSH_INVALIDATE_FLAG H5C__FLUSH_INVALIDATE_FLAG #define H5AC__FLUSH_CLEAR_ONLY_FLAG H5C__FLUSH_CLEAR_ONLY_FLAG #define H5AC__FLUSH_MARKED_ENTRIES_FLAG H5C__FLUSH_MARKED_ENTRIES_FLAG @@ -228,7 +229,7 @@ H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, H5AC_protect_t rw); H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, - void *thing, hbool_t dirtied, unsigned int flags); + void *thing, unsigned flags); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr); @@ -132,11 +132,11 @@ static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, uint8_t *rt_key, hbool_t *rt_key_changed, haddr_t *retval); -static herr_t H5B_insert_child(H5B_t *bt, hbool_t * bt_dirtied_ptr, +static herr_t H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key); static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, - hbool_t * old_bt_dirtied_ptr, haddr_t old_addr, + unsigned *old_bt_flags, haddr_t old_addr, unsigned idx, void *udata, haddr_t *new_addr/*out*/); static H5B_t * H5B_copy(const H5B_t *old_bt); static herr_t H5B_serialize(const H5F_t *f, const H5B_t *bt); @@ -744,7 +744,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u } done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE, H5AC__NO_FLAGS_SET) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") @@ -789,14 +789,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, hbool_t * old_bt_dirtied_ptr, - haddr_t old_addr, unsigned idx, void *udata, - haddr_t *new_addr_p/*out*/) +H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, + haddr_t old_addr, unsigned idx, void *udata, haddr_t *new_addr_p/*out*/) { H5P_genplist_t *dx_plist; /* Data transfer property list */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ - hbool_t new_bt_dirtied = FALSE, tmp_bt_dirtied = FALSE; - H5B_t *new_bt = NULL, *tmp_bt = NULL; + unsigned new_bt_flags = H5AC__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 */ herr_t ret_value = SUCCEED; /* Return value */ @@ -808,7 +807,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, hbool_t * old_bt_dirtied_ptr, */ assert(f); assert(old_bt); - assert(old_bt_dirtied_ptr); + assert(old_bt_flags); assert(H5F_addr_defined(old_addr)); /* @@ -892,7 +891,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, hbool_t * old_bt_dirtied_ptr, * dirty again. * -- JRM */ - new_bt_dirtied = TRUE; + new_bt_flags |= H5AC__DIRTIED_FLAG; HDmemcpy(new_bt->native, old_bt->native + nleft * shared->type->sizeof_nkey, (nright+1) * shared->type->sizeof_nkey); @@ -905,7 +904,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, hbool_t * old_bt_dirtied_ptr, /* * Truncate the old node. */ - *old_bt_dirtied_ptr = TRUE; + *old_bt_flags |= H5AC__DIRTIED_FLAG; old_bt->nchildren = nleft; /* @@ -915,23 +914,23 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, hbool_t * old_bt_dirtied_ptr, new_bt->right = old_bt->right; if (H5F_addr_defined(old_bt->right)) { + H5B_t *tmp_bt; + if (NULL == (tmp_bt = H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling") - tmp_bt_dirtied = TRUE; tmp_bt->left = *new_addr_p; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, - tmp_bt_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED) + H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") - tmp_bt=NULL; /* Make certain future references will be caught */ } old_bt->right = *new_addr_p; done: if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, - new_bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + new_bt_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) @@ -986,9 +985,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, hbool_t lt_key_changed = FALSE, rt_key_changed = FALSE; haddr_t child, old_root; unsigned level; - hbool_t bt_dirtied = FALSE; H5B_t *bt; - hbool_t new_bt_dirtied = FALSE; H5B_t *new_bt; /* Copy of B-tree info */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_ins_t my_ins = H5B_INS_ERROR; @@ -1020,12 +1017,9 @@ 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 (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt = NULL; - bt_dirtied = FALSE; /* the new node */ if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ))) @@ -1034,12 +1028,9 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if (!rt_key_changed) HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt = NULL; - bt_dirtied = FALSE; /* * Copy the old root node to some other file location and make the new @@ -1054,15 +1045,11 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child") - bt_dirtied = TRUE; bt->left = old_root; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt=NULL; /* Make certain future references will be caught */ - bt_dirtied = FALSE; /* * Move the node to the new location by checking it out & checking it in @@ -1074,32 +1061,26 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /* Make certain the old root info is marked as dirty before moving it, */ /* so it is certain to be written out at the new location */ - bt_dirtied = TRUE; /* Make a copy of the old root information */ if (NULL == (new_bt = H5B_copy(bt))) { HCOMMON_ERROR(H5E_BTREE, H5E_CANTLOAD, "unable to copy old root"); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") HGOTO_DONE(FAIL) } - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt=NULL; /* Make certain future references will be caught */ - bt_dirtied = FALSE; /* Move the location of the old root on the disk */ if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") /* clear the old root info at the old address (we already copied it) */ - new_bt_dirtied = TRUE; new_bt->left = HADDR_UNDEF; new_bt->right = HADDR_UNDEF; @@ -1156,7 +1137,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_insert_child(H5B_t *bt, hbool_t * bt_dirtied_ptr, unsigned idx, +H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key) { H5B_shared_t *shared; /* Pointer to shared B-tree info */ @@ -1165,13 +1146,11 @@ H5B_insert_child(H5B_t *bt, hbool_t * bt_dirtied_ptr, unsigned idx, FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_insert_child) assert(bt); - assert(bt_dirtied_ptr); + assert(bt_flags); shared=H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); assert(bt->nchildren<shared->two_k); - *bt_dirtied_ptr = TRUE; - /* Check for inserting right-most key into node (common when just appending * records to an unlimited dimension chunked dataset) */ @@ -1207,6 +1186,9 @@ H5B_insert_child(H5B_t *bt, hbool_t * bt_dirtied_ptr, unsigned idx, bt->child[idx] = child; bt->nchildren += 1; + /* Mark node as dirty */ + *bt_flags |= H5AC__DIRTIED_FLAG; + FUNC_LEAVE_NOAPI(SUCCEED) } @@ -1270,7 +1252,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*/) { - hbool_t bt_dirtied = FALSE, twin_dirtied = FALSE; + unsigned bt_flags = H5AC__NO_FLAGS_SET, twin_flags = H5AC__NO_FLAGS_SET; H5B_t *bt = NULL, *twin = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ unsigned lt = 0, idx = 0, rt; /* Left, final & right index values */ @@ -1330,7 +1312,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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; idx = 0; if (type->follow_min) { @@ -1444,14 +1426,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_dirtied = TRUE; + bt_flags |= H5AC__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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; if (idx+1 < bt->nchildren) *rt_key_changed = FALSE; else @@ -1462,37 +1444,36 @@ 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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; ret_value = H5B_INS_NOOP; } else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) { - hbool_t *tmp_bt_dirtied_ptr = NULL; + hbool_t *tmp_bt_flags_ptr = NULL; H5B_t *tmp_bt; /* * If this node is full then split it before inserting the new child. */ if (bt->nchildren == shared->two_k) { - if (H5B_split(f, dxpl_id, bt, &bt_dirtied, addr, idx, udata, new_node_p/*out*/)<0) + 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 = H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node") if (idx<bt->nchildren) { tmp_bt = bt; - tmp_bt_dirtied_ptr = &bt_dirtied; + tmp_bt_flags_ptr = &bt_flags; } else { idx -= bt->nchildren; tmp_bt = twin; - tmp_bt_dirtied_ptr = &twin_dirtied; + tmp_bt_flags_ptr = &twin_flags; } } else { tmp_bt = bt; - tmp_bt_dirtied_ptr = &bt_dirtied; + tmp_bt_flags_ptr = &bt_flags; } /* Insert the child */ - if (H5B_insert_child(tmp_bt, tmp_bt_dirtied_ptr, idx, - child_addr, my_ins, md_key) < 0) + if (H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, child_addr, my_ins, md_key) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child") } @@ -1519,10 +1500,9 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type done: { herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, - bt_dirtied, H5AC__NO_FLAGS_SET) < 0); + bt_flags) < 0); herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, - twin, twin_dirtied, - H5AC__NO_FLAGS_SET)<0); + twin, twin_flags)<0); if (e1 || e2) /*use vars to prevent short-circuit of side effects */ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node(s)") } @@ -1563,7 +1543,6 @@ done: herr_t H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op, haddr_t addr, void *udata) { - hbool_t bt_dirtied = FALSE; H5B_t *bt = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ haddr_t next_addr; @@ -1595,12 +1574,9 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op level = bt->level; left_child = bt->child[0]; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) < 0) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") - bt = NULL; /* Make certain future references will be caught */ - bt_dirtied = FALSE; if (level > 0) { /* Keep following the left-most child until we reach a leaf node. */ @@ -1630,12 +1606,9 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op next_addr = bt->right; nchildren = bt->nchildren; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, cur_addr, bt, - bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, cur_addr, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") - bt = NULL; - bt_dirtied = FALSE; /* * Perform the iteration operator, which might invoke an @@ -1698,8 +1671,8 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type hbool_t *lt_key_changed/*out*/, void *udata, uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/) { - hbool_t bt_dirtied = FALSE, sibling_dirtied = FALSE; H5B_t *bt = NULL, *sibling = NULL; + unsigned bt_flags = H5AC__NO_FLAGS_SET; H5B_shared_t *shared; /* Pointer to shared B-tree info */ unsigned idx=0, lt=0, rt; /* Final, left & right indices */ int cmp=1; /* Key comparison value */ @@ -1780,16 +1753,16 @@ 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_dirtied = TRUE; - if (idx>0) { + bt_flags |= H5AC__DIRTIED_FLAG; + + if (idx>0) /* Don't propagate change out of this B-tree node */ *lt_key_changed = FALSE; - } else { + else HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); - } } if (*rt_key_changed) { - bt_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; if (idx+1<bt->nchildren) { /* Don't propagate change out of this B-tree node */ *rt_key_changed = FALSE; @@ -1807,15 +1780,11 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type /* 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); - sibling_dirtied = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - sibling_dirtied, H5AC__NO_FLAGS_SET) - != SUCCEED) + H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - sibling_dirtied = FALSE; } } } @@ -1831,7 +1800,7 @@ 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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; bt->nchildren = 0; if (level>0) { if (H5F_addr_defined(bt->left)) { @@ -1839,15 +1808,11 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree") sibling->right = bt->right; - sibling_dirtied = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, - sibling_dirtied, H5AC__NO_FLAGS_SET) - != SUCCEED) + H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - sibling_dirtied = FALSE; } if (H5F_addr_defined(bt->right)) { if (NULL == (sibling = H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) @@ -1857,27 +1822,23 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,0), type->sizeof_nkey); sibling->left = bt->left; - sibling_dirtied = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - sibling_dirtied, H5AC__NO_FLAGS_SET) - != SUCCEED) + H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - sibling_dirtied = FALSE; } bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t); if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)shared->sizeof_rnode)<0 - || H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, H5C__DELETED_FLAG)<0) { + || H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags | H5C__DELETED_FLAG)<0) { bt = NULL; - bt_dirtied = FALSE; + bt_flags = H5AC__NO_FLAGS_SET; HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node") } bt = NULL; - bt_dirtied = FALSE; + bt_flags = H5AC__NO_FLAGS_SET; } } else if (H5B_INS_REMOVE==ret_value && 0==idx) { @@ -1888,7 +1849,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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; bt->nchildren -= 1; HDmemmove(bt->native, @@ -1908,7 +1869,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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; bt->nchildren -= 1; HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); *rt_key_changed = TRUE; @@ -1923,15 +1884,11 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type 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); - sibling_dirtied = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - sibling_dirtied, H5AC__NO_FLAGS_SET) - != SUCCEED) + H5AC__DIRTIED_FLAG) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") - sibling=NULL; /* Make certain future references will be caught */ - sibling_dirtied = FALSE; } } @@ -1945,7 +1902,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_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; bt->nchildren -= 1; HDmemmove(bt->native + idx * type->sizeof_nkey, @@ -1961,7 +1918,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type } done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET)<0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags)<0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) @@ -2002,7 +1959,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?*/ - hbool_t bt_dirtied = FALSE; + unsigned bt_flags = H5AC__NO_FLAGS_SET; H5B_t *bt = NULL; /*btree node */ herr_t ret_value=SUCCEED; /* Return value */ @@ -2028,16 +1985,12 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void if (0==bt->nchildren && 0!=bt->level) { bt->level = 0; - bt_dirtied = TRUE; + bt_flags |= H5AC__DIRTIED_FLAG; } - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, - H5AC__NO_FLAGS_SET) - != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") - bt=NULL; /* Make certain future references will be caught */ - bt_dirtied = FALSE; #ifdef H5B_DEBUG H5B_assert(f, dxpl_id, addr, type, udata); @@ -2070,7 +2023,6 @@ done: herr_t H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { - hbool_t bt_dirtied = FALSE; H5B_t *bt; /* B-tree node being operated on */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ unsigned u; /* Local index variable */ @@ -2117,7 +2069,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree node") done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, H5C__DELETED_FLAG)<0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5C__DELETED_FLAG)<0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache") FUNC_LEAVE_NOAPI(ret_value) @@ -2351,8 +2303,7 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f } done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE, - H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) @@ -2386,7 +2337,6 @@ done: static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata) { - hbool_t bt_dirtied = FALSE; H5B_t *bt = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ int i, ncell, cmp; @@ -2419,11 +2369,9 @@ 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, bt_dirtied, - H5AC__NO_FLAGS_SET); + status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET); assert(status >= 0); bt=NULL; /* Make certain future references will be caught */ - bt_dirtied = FALSE; /* * Do a breadth-first search of the tree. New nodes are added to the end @@ -2474,11 +2422,9 @@ 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, bt_dirtied, - H5AC__NO_FLAGS_SET); + status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET); assert(status >= 0); bt=NULL; /* Make certain future references will be caught */ - bt_dirtied = FALSE; /* Advance current location in queue */ prev = cur; @@ -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") } diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index d308bdb..d73cfbc 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -56,7 +56,6 @@ herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type) { - hbool_t bt2_dirtied = FALSE; H5B2_t *bt2 = NULL; H5B2_shared_t *shared; /* Shared B-tree information */ herr_t ret_value=SUCCEED; /* Return value */ @@ -137,7 +136,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, shared->merge_leaf_nrec); done: - 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_PROTECT, FAIL, "unable to release B-tree header") FUNC_LEAVE_NOAPI(ret_value) @@ -168,9 +167,7 @@ herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec) { - hbool_t bt2_dirtied = FALSE; H5B2_t *bt2 = NULL; - hbool_t internal_dirtied = FALSE; H5B2_internal_t *internal = NULL; H5B2_shared_t *shared; /* Shared B-tree information */ unsigned u; /* Local index variable */ @@ -205,7 +202,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") /* Release the B-tree header */ - if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") bt2 = NULL; @@ -258,7 +255,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); done: - if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node") FUNC_LEAVE_NOAPI(ret_value) @@ -289,9 +286,7 @@ herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec) { - hbool_t bt2_dirtied = FALSE; H5B2_t *bt2 = NULL; - hbool_t leaf_dirtied = FALSE; H5B2_leaf_t *leaf = NULL; H5B2_shared_t *shared; /* Shared B-tree information */ unsigned u; /* Local index variable */ @@ -326,7 +321,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node") /* Release the B-tree header */ - if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") bt2 = NULL; @@ -363,7 +358,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end for */ done: - if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2test.c b/src/H5B2test.c index 5469e5d..0428b35 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -239,7 +239,6 @@ herr_t H5B2_get_root_addr(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, haddr_t *root_addr) { - hbool_t bt2_dirtied = FALSE; H5B2_t *bt2=NULL; /* Pointer to the B-tree header */ herr_t ret_value = SUCCEED; @@ -260,7 +259,7 @@ H5B2_get_root_addr(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, 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) @@ -211,7 +211,7 @@ H5BT_insert_modify_cb(void *_record, void *_op_data, hbool_t *changed) herr_t H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t length) { - hbool_t bt_dirtied = FALSE; + unsigned bt_flags = H5AC__NO_FLAGS_SET; H5BT_t *bt = NULL; /* The new B-tree header information */ H5BT_blk_info_t lower, upper; /* Info for blocks less than & greater than new block */ hbool_t lower_valid = FALSE, upper_valid = FALSE; /* Lower & upper blocks valid? */ @@ -315,9 +315,12 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt if(new_block.len > bt->max_block_size) { bt->max_block_size = new_block.len; bt->max_block_cnt = 1; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - else if(new_block.len == bt->max_block_size) + else if(new_block.len == bt->max_block_size) { bt->max_block_cnt++; + bt_flags |= H5AC__DIRTIED_FLAG; + } /* Check for adjusting the min. block size tracked */ if(old_block->len < bt->min_block_size) { @@ -327,6 +330,7 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt if(new_block.len < bt->min_block_size) { bt->min_block_size = new_block.len; bt->min_block_cnt = 1; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ } /* end if */ else if(old_block->len == bt->min_block_size) { @@ -336,10 +340,13 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt if(bt->min_block_cnt == 1) { bt->min_block_size = new_block.len; bt->status &= ~H5BT_STATUS_MIN_VALID; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - else + else { /* Decrement the ref. count for the min. block size */ bt->min_block_cnt--; + bt_flags |= H5AC__DIRTIED_FLAG; + } /* end else */ } /* end if */ } /* end if */ else if(merged == 2) { @@ -347,9 +354,12 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt if(new_block.len > bt->max_block_size) { bt->max_block_size = new_block.len; bt->max_block_cnt = 1; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - else if(new_block.len == bt->max_block_size) + else if(new_block.len == bt->max_block_size) { bt->max_block_cnt++; + bt_flags |= H5AC__DIRTIED_FLAG; + } /* end else */ /* Check for adjusting the min. block size tracked */ if(upper.len < bt->min_block_size || lower.len < bt->min_block_size) { @@ -359,6 +369,7 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt if(new_block.len < bt->min_block_size) { bt->min_block_size = new_block.len; bt->min_block_cnt = 1; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ } /* end if */ else if(upper.len == bt->min_block_size || lower.len == bt->min_block_size) { @@ -368,10 +379,13 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt if(bt->min_block_cnt == 1) { bt->min_block_size = new_block.len; bt->status &= ~H5BT_STATUS_MIN_VALID; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - else + else { /* Decrement the ref. count for the min. block size */ bt->min_block_cnt--; + bt_flags |= H5AC__DIRTIED_FLAG; + } /* end else */ } /* end if */ } /* end if */ } /* end if */ @@ -397,23 +411,30 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt bt->min_block_size = length; bt->min_block_cnt = 1; bt->status |= H5BT_STATUS_MIN_VALID; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { /* Update maximum block size */ if (length > bt->max_block_size) { bt->max_block_size = length; bt->max_block_cnt = 1; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - else if (length == bt->max_block_size) + else if (length == bt->max_block_size) { bt->max_block_cnt++; + bt_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ /* Update minimum block size */ if (length < bt->min_block_size) { bt->min_block_size = length; bt->min_block_cnt = 1; + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ - else if (length == bt->min_block_size) + else if (length == bt->min_block_size) { bt->min_block_cnt++; + bt_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ } /* end if */ } /* end if */ @@ -422,7 +443,7 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_flags) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -452,7 +473,6 @@ done: herr_t H5BT_get_total_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *tot_size) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt = NULL; /* The new B-tree header information */ herr_t ret_value=SUCCEED; @@ -474,7 +494,7 @@ H5BT_get_total_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *tot_size) done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -535,7 +555,7 @@ H5BT_remove_find_cb(const void *_record, void *_op_data) herr_t H5BT_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t length) { - hbool_t bt_dirtied = FALSE; + unsigned bt_flags = H5AC__NO_FLAGS_SET; H5BT_t *bt = NULL; /* The new B-tree header information */ H5BT_blk_info_t found; /* Block info found */ hsize_t nblks; /* Number of blocks tracked */ @@ -621,6 +641,9 @@ HGOTO_ERROR(H5E_BLKTRK, H5E_UNSUPPORTED, FAIL, "Couldn't find block to remove") /* Decrement total amount of blocks tracked */ bt->tot_block_size -= length; + + /* Flag block tracker info as changed */ + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else if(found.len > length) { H5BT_blk_info_t new_block; /* Updated block info */ @@ -668,6 +691,9 @@ HGOTO_ERROR(H5E_BLKTRK, H5E_UNSUPPORTED, FAIL, "Couldn't find block to remove") /* Decrement total amount of blocks tracked */ bt->tot_block_size -= length; + + /* Flag block tracker info as changed */ + bt_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { /* Check for blocks at higher address, if necessary */ @@ -678,7 +704,7 @@ HGOTO_ERROR(H5E_BLKTRK, H5E_UNSUPPORTED, FAIL, "Couldn't find block to remove") done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_flags) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -745,7 +771,6 @@ H5BT_locate_cb(const void *_record, void *_op_data) htri_t H5BT_locate(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *locate_addr, hsize_t *locate_size) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt = NULL; /* The new B-tree header information */ H5BT_locate_t found; /* Block info found */ htri_t ret_value=TRUE; @@ -780,7 +805,7 @@ H5BT_locate(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *locate done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -813,7 +838,6 @@ done: herr_t H5BT_iterate(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_operator_t op, void *op_data) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt = NULL; /* The new B-tree header information */ herr_t ret_value; @@ -836,7 +860,7 @@ H5BT_iterate(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_operator_t op, void *op done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -898,7 +922,6 @@ herr_t H5BT_neighbor(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_compare_t range, haddr_t range_addr, H5BT_blk_info_t *found_block) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt = NULL; /* The new B-tree header information */ H5BT_blk_info_t find; /* Information for locating block */ H5BT_blk_info_t found; /* Block info found */ @@ -930,7 +953,7 @@ H5BT_neighbor(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_compare_t range, done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -960,7 +983,6 @@ done: herr_t H5BT_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt = NULL; /* The new B-tree header information */ herr_t ret_value=SUCCEED; @@ -986,7 +1008,7 @@ H5BT_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__DELETED_FLAG) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5BTdbg.c b/src/H5BTdbg.c index 9079083..dbce2b0 100644 --- a/src/H5BTdbg.c +++ b/src/H5BTdbg.c @@ -54,7 +54,6 @@ herr_t H5BT_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -104,7 +103,7 @@ H5BT_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, bt->bt2_addr); done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5BTtest.c b/src/H5BTtest.c index 61d25b9..cb94ad2 100644 --- a/src/H5BTtest.c +++ b/src/H5BTtest.c @@ -56,7 +56,6 @@ herr_t H5BT_get_max_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *size, uint32_t *count, hbool_t *valid) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt=NULL; /* Pointer to the block tracker info */ herr_t ret_value = SUCCEED; @@ -80,7 +79,7 @@ H5BT_get_max_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *size, done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -112,7 +111,6 @@ herr_t H5BT_get_min_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *size, uint32_t *count, hbool_t *valid) { - hbool_t bt_dirtied = FALSE; H5BT_t *bt=NULL; /* Pointer to the block tracker info */ herr_t ret_value = SUCCEED; @@ -136,7 +134,7 @@ H5BT_get_min_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *size, done: /* Release the block tracker info */ - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info") FUNC_LEAVE_NOAPI(ret_value) @@ -4186,7 +4186,6 @@ H5C_unprotect(H5F_t * f, const H5C_class_t * type, haddr_t addr, void * thing, - hbool_t dirtied, unsigned int flags) { hbool_t deleted; @@ -4221,7 +4220,7 @@ H5C_unprotect(H5F_t * f, } /* mark the entry as dirty if appropriate */ - entry_ptr->is_dirty = ( (entry_ptr->is_dirty) || dirtied ); + entry_ptr->is_dirty = ( (entry_ptr->is_dirty) || (flags & H5AC__DIRTIED_FLAG) ); H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, FAIL) diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 6ae0604..ed3f394 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -676,10 +676,13 @@ typedef struct H5C_auto_size_ctl_t #define H5C__SET_FLUSH_MARKER_FLAG 0x0001 #define H5C__DELETED_FLAG 0x0002 +/* This flag applies only to H5C_unprotect() */ +#define H5C__DIRTIED_FLAG 0x0004 + /* These flags apply to H5C_flush() & H5C_flush_single_entry() */ -#define H5C__FLUSH_INVALIDATE_FLAG 0x0004 -#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x0008 -#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x0010 +#define H5C__FLUSH_INVALIDATE_FLAG 0x0008 +#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x0010 +#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x0020 H5_DLL H5C_t * H5C_create(size_t max_cache_size, @@ -767,8 +770,7 @@ H5_DLL herr_t H5C_unprotect(H5F_t * f, const H5C_class_t * type, haddr_t addr, void * thing, - hbool_t dirtied, - unsigned int flags); + unsigned flags); H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, unsigned int tests); @@ -1829,7 +1829,6 @@ done: static herr_t H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *plist) { - hbool_t oh_dirtied = FALSE; size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */ H5G_entry_t *ent=NULL; /* Dataset's group entry */ H5O_layout_t *layout; /* Dataset's layout information */ @@ -1845,6 +1844,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p H5D_fill_value_t fill_status; struct H5O_t *oh=NULL; /* Pointer to dataset's object header */ + unsigned oh_flags = H5AC__DIRTIED_FLAG; /* return code */ herr_t ret_value = SUCCEED; @@ -1936,7 +1936,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to create dataset") /* Write new fill value message */ - if (H5O_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_FLAG_CONSTANT, &fill, &oh_dirtied) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_FLAG_CONSTANT, &fill, &oh_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message") /* If there is valid information for the old fill value struct, update it */ @@ -1950,7 +1950,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL,"unable to copy fill value") /* Write old fill value */ - if (fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_FLAG_CONSTANT, fill_prop, &oh_dirtied) < 0) + if (fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_FLAG_CONSTANT, fill_prop, &oh_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message") /* Update dataset creation property */ @@ -1960,8 +1960,8 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p } /* end if */ /* Update the type and space header messages */ - if (H5O_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_FLAG_CONSTANT | H5O_FLAG_SHARED, type, &oh_dirtied) < 0 || - H5S_append(file, dxpl_id, oh, space, &oh_dirtied) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_FLAG_CONSTANT | H5O_FLAG_SHARED, type, &oh_flags) < 0 || + H5S_append(file, dxpl_id, oh, space, &oh_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update type or space header messages") /* Update the filters message, if this is a chunked dataset */ @@ -1971,7 +1971,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p if (H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve pipeline filter") - if (pline.nused > 0 && H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_FLAG_CONSTANT, &pline, &oh_dirtied) < 0) + if (pline.nused > 0 && H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_FLAG_CONSTANT, &pline, &oh_flags) < 0) HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message") } /* end if */ @@ -2007,14 +2007,14 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p efl->slot[u].name_offset = offset; } - if (H5O_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_FLAG_CONSTANT, efl, &oh_dirtied) < 0) + if (H5O_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_FLAG_CONSTANT, efl, &oh_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message") } /* Update layout message */ /* (Don't make layout message constant unless allocation time is early, since space may not be allocated) */ /* Note: this is relying on H5D_alloc_storage not calling H5O_modify during dataset creation */ - if (H5D_COMPACT != layout->type && H5O_append(file, dxpl_id, oh, H5O_LAYOUT_ID, (alloc_time == H5D_ALLOC_TIME_EARLY ? H5O_FLAG_CONSTANT : 0), layout, &oh_dirtied) < 0) + if (H5D_COMPACT != layout->type && H5O_append(file, dxpl_id, oh, H5O_LAYOUT_ID, (alloc_time == H5D_ALLOC_TIME_EARLY ? H5O_FLAG_CONSTANT : 0), layout, &oh_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout") #ifdef H5O_ENABLE_BOGUS @@ -2026,7 +2026,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p #endif /* H5O_ENABLE_BOGUS */ /* Add a modification time message. */ - if (H5O_touch_oh(file, oh, TRUE, &oh_dirtied) < 0) + if (H5O_touch_oh(file, oh, TRUE, &oh_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message") done: @@ -2036,7 +2036,7 @@ done: /* Release pointer to object header itself */ if(ent!=NULL && oh!=NULL) - if(H5O_unprotect(ent,oh, dxpl_id, oh_dirtied)<0) + if(H5O_unprotect(ent,oh, dxpl_id, oh_flags)<0) HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to unprotect dataset object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1715,8 +1715,8 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, char *linkval = NULL; /*the copied link value */ H5G_entry_t tmp_grp_ent; /* Temporary copy of group entry */ H5RS_str_t *tmp_user_path_r=NULL, *tmp_canon_path_r=NULL; /* Temporary pointer to object's user path & canonical path */ - hbool_t dirtied = FALSE; const H5HL_t *heap; + unsigned heap_flags = H5AC__NO_FLAGS_SET; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_slink); @@ -1736,7 +1736,7 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/, linkval = H5MM_xstrdup (clv); assert(linkval); - if (H5HL_unprotect(grp_ent->file, dxpl_id, heap, stab_mesg.heap_addr, dirtied) < 0) + if (H5HL_unprotect(grp_ent->file, dxpl_id, heap, stab_mesg.heap_addr, heap_flags) < 0) HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value") /* Hold the entry's name (& old_name) to restore later */ @@ -2821,8 +2821,8 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, */ if (statbuf) { if (H5G_CACHED_SLINK==obj_ent.type) { - hbool_t dirtied = FALSE; const H5HL_t *heap; + unsigned heap_flags = H5AC__NO_FLAGS_SET; /* Named object is a symbolic link */ if (NULL == H5O_read(&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id)) @@ -2835,7 +2835,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link, statbuf->linklen = HDstrlen(s) + 1; /*count the null terminator*/ - if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, dirtied) < 0) + if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, heap_flags) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value") statbuf->objno = 0; @@ -3065,8 +3065,8 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/, const char *s = NULL; H5G_entry_t grp_ent, obj_ent; H5O_stab_t stab_mesg; - hbool_t dirtied = FALSE; const H5HL_t *heap; + unsigned heap_flags = H5AC__NO_FLAGS_SET; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_linkval, FAIL); @@ -3097,7 +3097,7 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/, if (size>0 && buf) HDstrncpy (buf, s, size); - if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, dirtied) < 0) + if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, heap_flags) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value") done: diff --git a/src/H5Gent.c b/src/H5Gent.c index 181d816..209845c 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -496,7 +496,7 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, "Link value:", lval); - H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, FALSE); + H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET); } else HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!"); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 9cfabe3..f88c89c 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -315,7 +315,7 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt s = H5HL_offset_into(f, heap, key->offset); HDfprintf (stream, "%s\n", s); - if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); done: @@ -834,7 +834,7 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke ret_value = HDstrcmp(s1, s2); done: - if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0) + if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); FUNC_LEAVE_NOAPI(ret_value); @@ -898,7 +898,7 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke HGOTO_DONE(1); done: - if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0) + if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); FUNC_LEAVE_NOAPI(ret_value); @@ -945,7 +945,6 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key void *_udata) { H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; const H5HL_t *heap = NULL; int lt = 0, idx = 0, rt, cmp = 1; @@ -990,7 +989,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key } } - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name"); heap=NULL; base=NULL; @@ -1008,7 +1007,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key done: if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, - sn_dirtied, H5AC__NO_FLAGS_SET) < 0) + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1068,8 +1067,8 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; - hbool_t sn_dirtied = FALSE, snrt_dirtied = FALSE; H5G_node_t *sn = NULL, *snrt = NULL; + unsigned sn_flags = H5AC__NO_FLAGS_SET, snrt_flags = H5AC__NO_FLAGS_SET; const H5HL_t *heap = NULL; size_t offset; /*offset of name in heap */ const char *s; @@ -1114,7 +1113,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, if (0 == (cmp = HDstrcmp(bt_udata->name, s))) /*already present */ { HCOMMON_ERROR(H5E_SYM, H5E_CANTINSERT, "symbol is already present in symbol table"); - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); heap=NULL; base=NULL; @@ -1129,7 +1128,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, } idx += cmp > 0 ? 1 : 0; - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); heap=NULL; base=NULL; @@ -1160,13 +1159,13 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); snrt->nsyms = H5F_SYM_LEAF_K(f); - snrt_dirtied = TRUE; + snrt_flags |= H5AC__DIRTIED_FLAG; /* The left node */ HDmemset(sn->entry + H5F_SYM_LEAF_K(f), 0, H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); sn->nsyms = H5F_SYM_LEAF_K(f); - sn_dirtied = TRUE; + sn_flags |= H5AC__DIRTIED_FLAG; /* The middle key */ md_key->offset = sn->entry[sn->nsyms - 1].name_off; @@ -1187,7 +1186,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, } else { /* Where to insert the new entry? */ ret_value = H5B_INS_NOOP; - sn_dirtied = TRUE; + sn_flags |= H5AC__DIRTIED_FLAG; insert_into = sn; if (idx == sn->nsyms) { rt_key->offset = offset; @@ -1204,11 +1203,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, insert_into->nsyms += 1; done: - if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, - snrt_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, snrt_flags) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, - sn_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_flags) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1267,8 +1264,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, H5G_node_key_t *lt_key = (H5G_node_key_t*)_lt_key; H5G_node_key_t *rt_key = (H5G_node_key_t*)_rt_key; H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t*)_udata; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; + unsigned sn_flags = H5AC__NO_FLAGS_SET; const H5HL_t *heap = NULL; int lt=0, rt, idx=0, cmp=1; const char *s = NULL; @@ -1312,7 +1309,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, } } - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); heap=NULL; base=NULL; @@ -1332,7 +1329,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, else found=0; - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); heap=NULL; s=NULL; @@ -1360,7 +1357,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, else found=0; - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name"); heap=NULL; s=NULL; @@ -1381,9 +1378,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, *rt_key = *lt_key; *rt_key_changed = TRUE; sn->nsyms = 0; - sn_dirtied = TRUE; if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0 - || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5C__DELETED_FLAG)<0) { + || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG)<0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node"); } @@ -1397,7 +1393,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * change. */ sn->nsyms -= 1; - sn_dirtied = TRUE; + sn_flags |= H5AC__DIRTIED_FLAG; HDmemmove(sn->entry+idx, sn->entry+idx+1, (sn->nsyms-idx)*sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1409,7 +1405,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * should be changed to reflect the new right-most entry. */ sn->nsyms -= 1; - sn_dirtied = TRUE; + sn_flags |= H5AC__DIRTIED_FLAG; rt_key->offset = sn->entry[sn->nsyms-1].name_off; *rt_key_changed = TRUE; ret_value = H5B_INS_NOOP; @@ -1420,7 +1416,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * node. */ sn->nsyms -= 1; - sn_dirtied = TRUE; + sn_flags |= H5AC__DIRTIED_FLAG; HDmemmove(sn->entry+idx, sn->entry+idx+1, (sn->nsyms-idx)*sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1447,9 +1443,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, *rt_key = *lt_key; *rt_key_changed = TRUE; sn->nsyms = 0; - sn_dirtied = TRUE; if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0 - || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5C__DELETED_FLAG)<0) { + || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG)<0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node"); } @@ -1458,8 +1453,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, } /* end else */ done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, - sn_dirtied, H5AC__NO_FLAGS_SET)<0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_flags)<0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1496,7 +1490,6 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a const void UNUSED *_rt_key, void *_udata) { H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; const H5HL_t *heap = NULL; int i, nsyms; @@ -1526,8 +1519,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a for (i=0; i<nsyms; i++) name_off[i] = sn->entry[i].name_off; - if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5AC__NO_FLAGS_SET) - != SUCCEED) { + if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); } @@ -1556,7 +1548,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a } HDstrcpy (s, name); - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name"); heap=NULL; name=NULL; @@ -1573,11 +1565,10 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed"); done: - if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0) + if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name"); - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); if(name_off) @@ -1612,7 +1603,6 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr const void UNUSED *_rt_key, void *_udata) { hsize_t *num_objs = (hsize_t *)_udata; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; int ret_value = H5B_ITER_CONT; @@ -1632,8 +1622,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr *num_objs += sn->nsyms; done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1670,7 +1659,6 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, size_t name_off; hsize_t loc_idx; const char *name; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; int ret_value = H5B_ITER_CONT; @@ -1699,7 +1687,7 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, bt_udata->name = H5MM_strdup (name); assert(bt_udata->name); - if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name"); heap=NULL; name=NULL; @@ -1709,8 +1697,7 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, } done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1744,7 +1731,6 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, { H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t*)_udata; hsize_t loc_idx; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; int ret_value = H5B_ITER_CONT; @@ -1768,8 +1754,7 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, } done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1927,7 +1912,6 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, haddr_t heap) { int i; - hbool_t sn_dirtied = FALSE; H5G_node_t *sn = NULL; const char *s; const H5HL_t *heap_ptr = NULL; @@ -1992,8 +1976,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, } done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, - H5AC__NO_FLAGS_SET) < 0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -675,7 +675,7 @@ H5HG_compute_size(const H5F_t UNUSED *f, const H5HG_heap_t *heap, size_t *size_p *------------------------------------------------------------------------- */ static size_t -H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_ptr) +H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned * heap_flags_ptr) { size_t idx; uint8_t *p = NULL; @@ -687,7 +687,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_ptr /* Check args */ assert (heap); assert (heap->obj[0].size>=need); - assert (heap_dirtied_ptr); + assert (heap_flags_ptr); /* * Find an ID for the new object. ID zero is reserved for the free space @@ -763,7 +763,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_ptr } /* Mark the heap as dirty */ - *heap_dirtied_ptr = TRUE; + *heap_flags_ptr |= H5AC__DIRTIED_FLAG; /* Set the return value */ ret_value=idx; @@ -801,7 +801,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_ptr) +H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned * heap_flags_ptr) { size_t need; /* Actual space needed to store object */ size_t old_size; /* Previous size of the heap's chunk */ @@ -815,7 +815,7 @@ H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_pt /* Check args */ assert (f); assert (heap); - assert (heap_dirtied_ptr); + assert (heap_flags_ptr); /* Compute total space need to add to this heap */ need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); @@ -866,7 +866,7 @@ HDmemset(new_chunk+heap->size,0,need); assert(H5HG_ISALIGNED(heap->obj[0].size)); /* Mark the heap as dirty */ - *heap_dirtied_ptr = TRUE; + *heap_flags_ptr |= H5AC__DIRTIED_FLAG; done: FUNC_LEAVE_NOAPI(ret_value); @@ -926,8 +926,8 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* int cwfsno; size_t idx; haddr_t addr = HADDR_UNDEF; - hbool_t heap_dirtied = FALSE; H5HG_heap_t *heap = NULL; + unsigned heap_flags = H5AC__NO_FLAGS_SET; hbool_t found=0; /* Flag to indicate a heap with enough space was found */ herr_t ret_value=SUCCEED; /* Return value */ @@ -990,7 +990,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* new_need = MAX(f->shared->cwfs[cwfsno]->size, new_need); if((f->shared->cwfs[cwfsno]->size+new_need)<=H5HG_MAXSIZE && H5MF_can_extend(f,H5FD_MEM_GHEAP,f->shared->cwfs[cwfsno]->addr,(hsize_t)f->shared->cwfs[cwfsno]->size,(hsize_t)new_need)) { - if(H5HG_extend(f,f->shared->cwfs[cwfsno],size,&heap_dirtied)<0) + if(H5HG_extend(f,f->shared->cwfs[cwfsno],size, &heap_flags)<0) HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL, "unable to extend global heap collection"); addr = f->shared->cwfs[cwfsno]->addr; found=1; @@ -1031,7 +1031,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); /* Split the free space to make room for the new object */ - idx = H5HG_alloc (f, heap, size, &heap_dirtied); + idx = H5HG_alloc (f, heap, size, &heap_flags); /* Copy data into the heap */ if(size>0) { @@ -1042,15 +1042,14 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* need-(H5HG_SIZEOF_OBJHDR(f)+size)); #endif /* OLD_WAY */ } /* end if */ - heap_dirtied = TRUE; + heap_flags |= H5AC__DIRTIED_FLAG; /* Return value */ hobj->addr = heap->addr; hobj->idx = idx; done: - if ( heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, heap->addr, heap, - heap_dirtied, H5AC__NO_FLAGS_SET) < 0 ) + if ( heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, heap->addr, heap, heap_flags) < 0 ) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to unprotect heap."); FUNC_LEAVE_NOAPI(ret_value); @@ -1084,7 +1083,6 @@ done: void * H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/) { - hbool_t heap_dirtied = FALSE; H5HG_heap_t *heap = NULL; int i; size_t size; @@ -1129,8 +1127,7 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/) ret_value=object; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_dirtied, - H5AC__NO_FLAGS_SET)<0) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1165,8 +1162,8 @@ done: int H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) { - hbool_t heap_dirtied = FALSE; H5HG_heap_t *heap = NULL; + unsigned heap_flags = H5AC__NO_FLAGS_SET; int ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5HG_link, FAIL); @@ -1189,15 +1186,14 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) if (heap->obj[hobj->idx].nrefs+adjust>H5HG_MAXLINK) HGOTO_ERROR (H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range"); heap->obj[hobj->idx].nrefs += adjust; - heap_dirtied = TRUE; + heap_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Set return value */ ret_value=heap->obj[hobj->idx].nrefs; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, - heap_dirtied, H5AC__NO_FLAGS_SET)<0) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags)<0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1227,7 +1223,6 @@ herr_t H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) { uint8_t *p=NULL, *obj_start=NULL; - hbool_t heap_dirtied = FALSE; H5HG_heap_t *heap = NULL; size_t need; int i; @@ -1275,17 +1270,16 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); } HDmemset (heap->obj+hobj->idx, 0, sizeof(H5HG_obj_t)); - heap_dirtied = TRUE; + flags |= H5AC__DIRTIED_FLAG; if (heap->obj[0].size+H5HG_SIZEOF_HDR(f)==heap->size) { /* * The collection is empty. Remove it from the CWFS list and return it * to the file free list. */ - heap_dirtied = TRUE; H5_CHECK_OVERFLOW(heap->size,size_t,hsize_t); H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, heap->addr, (hsize_t)heap->size); - flags=H5C__DELETED_FLAG; /* Indicate that the object was deleted, for the unprotect call */ + flags |= H5C__DELETED_FLAG; /* Indicate that the object was deleted, for the unprotect call */ } else { /* * If the heap is in the CWFS list then advance it one position. The @@ -1308,7 +1302,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) } done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_dirtied, flags) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, flags) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index 9de8268..d1543d6 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -58,7 +58,6 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, { unsigned u, nused, maxobj; unsigned j, k; - hbool_t h_dirtied = FALSE; H5HG_heap_t *h = NULL; char buf[64]; uint8_t *p = NULL; @@ -132,7 +131,7 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } done: - if (h && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, addr, h, h_dirtied, FALSE) != SUCCEED) + if (h && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, addr, h, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -763,8 +763,7 @@ H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, voi ret_value=buf; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, - FALSE, H5AC__NO_FLAGS_SET) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -881,7 +880,7 @@ H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset) *------------------------------------------------------------------------- */ herr_t -H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr, hbool_t heap_dirtied) +H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr, unsigned heap_flags) { herr_t ret_value = SUCCEED; @@ -892,8 +891,7 @@ H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr, hbool_ assert(heap); assert(H5F_addr_defined(addr)); - if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap, heap_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap, heap_flags) != SUCCEED) HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); done: @@ -958,8 +956,8 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *buf) { - hbool_t heap_dirtied = FALSE; H5HL_t *heap = NULL; + unsigned heap_flags = H5AC__NO_FLAGS_SET; H5HL_free_t *fl = NULL, *max_fl = NULL; size_t offset = 0; size_t need_size, old_size, need_more; @@ -982,7 +980,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void * if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap"); - heap_dirtied = TRUE; + heap_flags |= H5AC__DIRTIED_FLAG; /* Cache this for later */ sizeof_hdr= H5HL_SIZEOF_HDR(f); @@ -1115,8 +1113,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void * ret_value=offset; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, - heap_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1155,8 +1152,8 @@ done: static herr_t H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, const void *buf) { - hbool_t heap_dirtied = FALSE; H5HL_t *heap = NULL; + unsigned heap_flags = H5AC__NO_FLAGS_SET; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_write, FAIL); @@ -1176,14 +1173,12 @@ H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, co assert(offset < heap->mem_alloc); assert(offset + size <= heap->mem_alloc); - heap_dirtied = TRUE; + heap_flags |= H5AC__DIRTIED_FLAG; HDmemcpy(heap->chunk + H5HL_SIZEOF_HDR(f) + offset, buf, size); done: - if (heap && - H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_dirtied, - H5AC__NO_FLAGS_SET) != SUCCEED && - ret_value != FAIL) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED && + ret_value != FAIL) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1227,8 +1222,8 @@ done: herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size) { - hbool_t heap_dirtied = FALSE; H5HL_t *heap = NULL; + unsigned heap_flags = H5AC__NO_FLAGS_SET; H5HL_free_t *fl = NULL, *fl2 = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -1252,7 +1247,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size) assert(offset + size <= heap->mem_alloc); fl = heap->freelist; - heap_dirtied = TRUE; + heap_flags |= H5AC__DIRTIED_FLAG; /* * Check if this chunk can be prepended or appended to an already @@ -1327,8 +1322,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size) heap->freelist = fl; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, - heap_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_flags) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1358,7 +1352,6 @@ done: herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) { - hbool_t heap_dirtied = FALSE; H5HL_t *heap = NULL; size_t sizeof_hdr; /* Cache H5HL header size for file */ herr_t ret_value=SUCCEED; /* Return value */ @@ -1401,15 +1394,14 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) } /* end else */ /* Release the local heap metadata from the cache */ - if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_dirtied, H5C__DELETED_FLAG)<0) { + if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG)<0) { heap = NULL; HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap"); } heap = NULL; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_dirtied, - H5AC__NO_FLAGS_SET)<0) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap"); FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 684ac8a..bf1251c 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -53,7 +53,6 @@ herr_t H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth) { - hbool_t h_dirtied = FALSE; H5HL_t *h = NULL; int i, j, overlap, free_block; uint8_t c; @@ -169,7 +168,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int } done: - if (h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, h_dirtied, FALSE) != SUCCEED) + if (h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, FALSE) != SUCCEED) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); H5MM_xfree(marker); diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index b0b0910..7321bb9 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -65,7 +65,7 @@ H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *ad H5_DLL const H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr); H5_DLL void *H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset); H5_DLL herr_t H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, - haddr_t addr, hbool_t heap_dirtied); + haddr_t addr, unsigned heap_flags); H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size); @@ -68,11 +68,11 @@ static int H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id); static int H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, unsigned flags, const void *mesg, - hbool_t * oh_dirtied_ptr); + unsigned * oh_flags_ptr); static herr_t H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id); static unsigned H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, - size_t size, hbool_t * oh_dirtied_ptr); + size_t size, unsigned * oh_flags_ptr); static unsigned H5O_alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size); static unsigned H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size); static herr_t H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh); @@ -80,10 +80,10 @@ static herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg); static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_class_t **new_type, const void **new_mesg, hid_t dxpl_id, - hbool_t * oh_dirtied_ptr); + unsigned * oh_flags_ptr); static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, const void *mesg, unsigned flags, unsigned update_flags, - hbool_t * oh_dirtied_ptr); + unsigned * oh_flags_ptr); /* Metadata cache callbacks */ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1, @@ -1228,8 +1228,7 @@ int H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) { H5O_t *oh = NULL; - hbool_t oh_dirtied = FALSE; - unsigned int flags=H5AC__NO_FLAGS_SET; /* used to indicate whether the + unsigned oh_flags=H5AC__NO_FLAGS_SET; /* used to indicate whether the * object was deleted as a result * of this action. */ @@ -1254,7 +1253,7 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) if (oh->nlink + adjust < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative"); oh->nlink += adjust; - oh_dirtied = TRUE; + oh_flags |= H5AC__DIRTIED_FLAG; /* Check if the object should be deleted */ if(oh->nlink==0) { @@ -1270,7 +1269,7 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file"); /* Mark the object header as deleted */ - flags = H5C__DELETED_FLAG; + oh_flags = H5C__DELETED_FLAG; } /* end else */ } /* end if */ } else if (adjust>0) { @@ -1285,14 +1284,14 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) } /* end if */ oh->nlink += adjust; - oh_dirtied = TRUE; + oh_flags |= H5AC__DIRTIED_FLAG; } /* Set return value */ ret_value = oh->nlink; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_dirtied, flags) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_flags) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1365,7 +1364,6 @@ done: static int H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh = NULL; int acc; unsigned u; @@ -1392,8 +1390,7 @@ H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) ret_value=acc; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1475,7 +1472,6 @@ done: static htri_t H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh=NULL; unsigned u; htri_t ret_value; /* Return value */ @@ -1503,8 +1499,7 @@ H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d ret_value=(sequence<0); done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1605,7 +1600,6 @@ done: void * H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mesg, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh = NULL; int idx; H5G_cache_t *cache = NULL; @@ -1661,8 +1655,7 @@ H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mes } done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1871,7 +1864,7 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id) { H5O_t *oh=NULL; - hbool_t oh_dirtied = FALSE; + unsigned oh_flags = H5AC__NO_FLAGS_SET; int sequence; unsigned idx; /* Index of message to modify */ H5O_mesg_t *idx_msg; /* Pointer to message to modify */ @@ -1914,7 +1907,7 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, /* Check for creating new message */ if (overwrite < 0) { /* Create a new message */ - if((idx=H5O_new_mesg(ent->file,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,&oh_dirtied))==UFAIL) + if((idx=H5O_new_mesg(ent->file,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,&oh_flags))==UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message"); /* Set the correct sequence number for the message created */ @@ -1927,19 +1920,18 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, } /* Write the information to the message */ - if(H5O_write_mesg(oh,idx,type,mesg,flags,update_flags,&oh_dirtied)<0) + if(H5O_write_mesg(oh,idx,type,mesg,flags,update_flags,&oh_flags)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message"); /* Update the modification time message if any */ if(update_flags&H5O_UPDATE_TIME) - H5O_touch_oh(ent->file, oh, FALSE, &oh_dirtied); + H5O_touch_oh(ent->file, oh, FALSE, &oh_flags); /* Set return value */ ret_value = sequence; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_flags) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -2014,7 +2006,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id, hbool_t oh_dirtied) +H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id, unsigned oh_flags) { herr_t ret_value=SUCCEED; /* Return value */ @@ -2026,8 +2018,7 @@ H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id, hbool_t oh_dirtied) assert(H5F_addr_defined(ent->header)); assert(oh); - if (H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); done: @@ -2065,7 +2056,7 @@ done: */ int H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned flags, - const void *mesg, hbool_t * oh_dirtied_ptr) + const void *mesg, unsigned * oh_flags_ptr) { const H5O_class_t *type; /* Actual H5O class type for the ID */ int ret_value; /* Return value */ @@ -2080,10 +2071,10 @@ H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned flags, assert(type); assert(0==(flags & ~H5O_FLAG_BITS)); assert(mesg); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); /* Call the "real" append routine */ - if((ret_value=H5O_append_real( f, dxpl_id, oh, type, flags, mesg, oh_dirtied_ptr))<0) + if((ret_value=H5O_append_real( f, dxpl_id, oh, type, flags, mesg, oh_flags_ptr))<0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header"); done: @@ -2117,7 +2108,7 @@ done: */ static int H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, - unsigned flags, const void *mesg, hbool_t * oh_dirtied_ptr) + unsigned flags, const void *mesg, unsigned * oh_flags_ptr) { unsigned idx; /* Index of message to modify */ H5O_shared_t sh_mesg; @@ -2131,14 +2122,14 @@ H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, assert(type); assert(0==(flags & ~H5O_FLAG_BITS)); assert(mesg); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); /* Create a new message */ - if((idx=H5O_new_mesg(f,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,oh_dirtied_ptr))==UFAIL) + if((idx=H5O_new_mesg(f,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,oh_flags_ptr))==UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message"); /* Write the information to the message */ - if(H5O_write_mesg(oh,idx,type,mesg,flags,0,oh_dirtied_ptr)<0) + if(H5O_write_mesg(oh,idx,type,mesg,flags,0,oh_flags_ptr)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message"); /* Set return value */ @@ -2173,7 +2164,7 @@ done: static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_class_t **new_type, - const void **new_mesg, hid_t dxpl_id, hbool_t * oh_dirtied_ptr) + const void **new_mesg, hid_t dxpl_id, unsigned * oh_flags_ptr) { size_t size; /* Size of space allocated for object header */ unsigned ret_value=UFAIL; /* Return value */ @@ -2189,7 +2180,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type, assert(sh_mesg); assert(new_mesg); assert(new_type); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); /* Check for shared message */ if (*flags & H5O_FLAG_SHARED) { @@ -2220,7 +2211,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type, HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large (16k max)"); /* Allocate space in the object headed for the message */ - if ((ret_value = H5O_alloc(f, oh, orig_type, size, oh_dirtied_ptr)) == UFAIL) + if ((ret_value = H5O_alloc(f, oh, orig_type, size, oh_flags_ptr)) == UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message"); /* Increment any links in message */ @@ -2255,7 +2246,7 @@ done: static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, const void *mesg, unsigned flags, unsigned update_flags, - hbool_t * oh_dirtied_ptr) + unsigned * oh_flags_ptr) { H5O_mesg_t *idx_msg; /* Pointer to message to modify */ @@ -2267,7 +2258,7 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, assert(oh); assert(type); assert(mesg); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); /* Set pointer to the correct message */ idx_msg=&oh->mesg[idx]; @@ -2282,7 +2273,7 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, idx_msg->flags = flags; idx_msg->dirty = TRUE; - *oh_dirtied_ptr = TRUE; + *oh_flags_ptr |= H5AC__DIRTIED_FLAG; done: FUNC_LEAVE_NOAPI(ret_value); @@ -2312,7 +2303,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force, hbool_t * oh_dirtied_ptr) +H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force, unsigned * oh_flags_ptr) { unsigned idx; #ifdef H5_HAVE_GETTIMEOFDAY @@ -2325,7 +2316,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force, hbool_t * oh_dirtied_ptr) FUNC_ENTER_NOAPI_NOINIT(H5O_touch_oh); assert(oh); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); /* Look for existing message */ for (idx=0; idx<oh->nmesgs; idx++) { @@ -2345,7 +2336,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force, hbool_t * oh_dirtied_ptr) if (!force) HGOTO_DONE(SUCCEED); /*nothing to do*/ size = (H5O_MTIME_NEW->raw_size)(f, &now); - if ((idx=H5O_alloc(f, oh, H5O_MTIME_NEW, size, oh_dirtied_ptr))==UFAIL) + if ((idx=H5O_alloc(f, oh, H5O_MTIME_NEW, size, oh_flags_ptr))==UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message"); } @@ -2356,7 +2347,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force, hbool_t * oh_dirtied_ptr) } *((time_t*)(oh->mesg[idx].native)) = now; oh->mesg[idx].dirty = TRUE; - *oh_dirtied_ptr = TRUE; + *oh_flags_ptr |= H5AC__DIRTIED_FLAG; done: FUNC_LEAVE_NOAPI(ret_value); @@ -2387,8 +2378,8 @@ done: herr_t H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh = NULL; + unsigned oh_flags = H5AC__NO_FLAGS_SET; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_touch, FAIL); @@ -2405,12 +2396,11 @@ H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Create/Update the modification time message */ - if (H5O_touch_oh(ent->file, oh, force, &oh_dirtied)<0) + if (H5O_touch_oh(ent->file, oh, force, &oh_flags)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object modificaton time"); done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_flags)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -2440,7 +2430,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_bogus_oh(H5F_t *f, H5O_t *oh, hbool_t * oh_dirtied_ptr) +H5O_bogus_oh(H5F_t *f, H5O_t *oh, hbool_t * oh_flags_ptr) { int idx; size_t size; @@ -2450,7 +2440,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, hbool_t * oh_dirtied_ptr) assert(f); assert(oh); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); /* Look for existing message */ for (idx=0; idx<oh->nmesgs; idx++) @@ -2460,7 +2450,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, hbool_t * oh_dirtied_ptr) /* Create a new message */ if (idx==oh->nmesgs) { size = (H5O_BOGUS->raw_size)(f, NULL); - if ((idx=H5O_alloc(f, oh, H5O_BOGUS, size, oh_dirtied_ptr))<0) + if ((idx=H5O_alloc(f, oh, H5O_BOGUS, size, oh_flags_ptr))<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message"); /* Allocate the native message in memory */ @@ -2502,8 +2492,8 @@ done: herr_t H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh = NULL; + unsigned oh_flags = H5AC__NO_FLAGS_SET; herr_t ret_value = SUCCEED; FUNC_ENTER(H5O_bogus, FAIL); @@ -2522,12 +2512,11 @@ H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Create the "bogus" message */ - if (H5O_bogus_oh(ent->file, oh, &oh_dirtied)<0) + if (H5O_bogus_oh(ent->file, oh, &oh_flags)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object 'bogus' message"); done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_flags)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE(ret_value); @@ -2623,7 +2612,7 @@ static herr_t H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t dxpl_id) { H5O_t *oh = NULL; - hbool_t oh_dirtied = FALSE; + unsigned oh_flags = H5AC__NO_FLAGS_SET; H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ int seq, nfailed = 0; unsigned u; @@ -2670,8 +2659,8 @@ H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d else curr_msg->native = H5O_free_real(type, curr_msg->native); curr_msg->dirty = TRUE; - oh_dirtied = TRUE; - H5O_touch_oh(ent->file, oh, FALSE, &oh_dirtied); + oh_flags |= H5AC__DIRTIED_FLAG; + H5O_touch_oh(ent->file, oh, FALSE, &oh_flags); } } @@ -2680,8 +2669,7 @@ H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)"); done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_flags) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3061,7 +3049,7 @@ done: *------------------------------------------------------------------------- */ static unsigned -H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size, hbool_t * oh_dirtied_ptr) +H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size, unsigned * oh_flags_ptr) { unsigned idx; H5O_mesg_t *msg; /* Pointer to newly allocated message */ @@ -3073,7 +3061,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size, hbool_t * o /* check args */ assert (oh); assert (type); - assert (oh_dirtied_ptr); + assert (oh_flags_ptr); /* look for a null message which is large enough */ for (idx = 0; idx < oh->nmesgs; idx++) { @@ -3158,7 +3146,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size, hbool_t * o msg->dirty = TRUE; msg->native = NULL; - *oh_dirtied_ptr = TRUE; + *oh_flags_ptr |= H5AC__DIRTIED_FLAG; /* Set return value */ ret_value=idx; @@ -3328,7 +3316,6 @@ done: herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) { - hbool_t oh_dirtied = FALSE; H5O_t *oh=NULL; /* Object header information */ herr_t ret_value=SUCCEED; /* Return value */ @@ -3348,7 +3335,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) done: if (oh && - H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, oh_dirtied, H5C__DELETED_FLAG)<0) + H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3499,7 +3486,6 @@ done: herr_t H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh=NULL; /* Object header information */ H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ hsize_t total_size; /* Total amount of space used in file */ @@ -3536,8 +3522,7 @@ H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id) ostat->nchunks=oh->nchunks; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3665,7 +3650,6 @@ herr_t H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op, void *op_data, hid_t dxpl_id) { - hbool_t oh_dirtied = FALSE; H5O_t *oh=NULL; /* Pointer to actual object header */ const H5O_class_t *type; /* Actual H5O class type for the ID */ unsigned idx; /* Absolute index of current message in all messages */ @@ -3718,8 +3702,7 @@ H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op, } /* end for */ done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3793,7 +3776,6 @@ done: herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - hbool_t oh_dirtied = FALSE; H5O_t *oh = NULL; unsigned i, chunkno; size_t mesg_total = 0, chunk_total = 0; @@ -3952,8 +3934,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: - if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, - oh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 271de47..8959233 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -123,7 +123,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s assert (s && !*s); - if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") #endif @@ -143,7 +143,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s mesg->slot[u].name = H5MM_xstrdup (s); assert(mesg->slot[u].name); - if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr, FALSE) < 0) + if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") /* File offset */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index ba307f1..3f6edb5 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -243,16 +243,16 @@ H5_DLL int H5O_modify(H5G_entry_t *ent, unsigned type_id, int overwrite, unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id); H5_DLL struct H5O_t * H5O_protect(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, struct H5O_t *oh, hid_t dxpl_id, - hbool_t oh_dirtied); + unsigned oh_flags); H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id, - unsigned flags, const void *mesg, hbool_t * oh_dirtied_ptr); + unsigned flags, const void *mesg, unsigned * oh_flags_ptr); H5_DLL herr_t H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id); H5_DLL herr_t H5O_touch_oh(H5F_t *f, struct H5O_t *oh, hbool_t force, - hbool_t * oh_dirtied_ptr); + unsigned * oh_flags_ptr); #ifdef H5O_ENABLE_BOGUS H5_DLL herr_t H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5O_bogus_oh(H5F_t *f, struct H5O_t *oh, - hbool_t * oh_dirtied_ptr); + unsigned * oh_flags_ptr); #endif /* H5O_ENABLE_BOGUS */ H5_DLL herr_t H5O_remove(H5G_entry_t *ent, unsigned type_id, int sequence, hid_t dxpl_id); @@ -1098,7 +1098,7 @@ done: */ herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds, - hbool_t * oh_dirtied_ptr) + unsigned * oh_flags_ptr) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1107,13 +1107,13 @@ H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds, assert(f); assert(oh); assert(ds); - assert(oh_dirtied_ptr); + assert(oh_flags_ptr); switch (H5S_GET_EXTENT_TYPE(ds)) { case H5S_NULL: case H5S_SCALAR: case H5S_SIMPLE: - if (H5O_append(f, dxpl_id, oh, H5O_SDSPACE_ID, 0, &(ds->extent), oh_dirtied_ptr)<0) + if (H5O_append(f, dxpl_id, oh, H5O_SDSPACE_ID, 0, &(ds->extent), oh_flags_ptr)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message"); break; @@ -245,7 +245,6 @@ done: herr_t H5SH_alloc(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *obj_addr_p) { - hbool_t sh_dirtied = FALSE; H5SH_t *sh = NULL; /* Segmented heap info */ haddr_t free_addr; /* Address of free block */ hsize_t free_len; /* Address of free block */ @@ -330,7 +329,7 @@ H5SH_alloc(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *obj_add done: /* Release the block tracker info */ - if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, sh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release segmented heap info") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5SHdbg.c b/src/H5SHdbg.c index 4f3f9ba..85dea67 100644 --- a/src/H5SHdbg.c +++ b/src/H5SHdbg.c @@ -54,7 +54,6 @@ herr_t H5SH_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - hbool_t sh_dirtied = FALSE; H5SH_t *sh = NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -95,7 +94,7 @@ H5SH_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int sh->bt_free_addr); done: - if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, sh_dirtied, H5AC__NO_FLAGS_SET) < 0) + if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release segmented heap info") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 8d8c7f8..2fdda74 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -201,7 +201,7 @@ H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/, H5_DLL herr_t H5S_modify(struct H5G_entry_t *ent, const H5S_t *space, hbool_t update_time, hid_t dxpl_id); H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, - const H5S_t *ds, hbool_t * oh_dirtied_ptr); + const H5S_t *ds, unsigned * oh_flags_ptr); H5_DLL size_t H5S_raw_size(const H5F_t *f, const H5S_t *space); H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent, hid_t dxpl_id); H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size); diff --git a/test/cache.c b/test/cache.c index e046a07..c53d8aa 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2199,7 +2199,6 @@ unprotect_entry(H5C_t * cache_ptr, unsigned int flags) { /* const char * fcn_name = "unprotect_entry()"; */ - hbool_t dirtied = FALSE; herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -2221,13 +2220,13 @@ unprotect_entry(H5C_t * cache_ptr, if ( ( dirty == TRUE ) || ( dirty == FALSE ) ) { - dirtied = dirty; + flags |= (dirty ? H5AC__DIRTIED_FLAG : H5AC__NO_FLAGS_SET); entry_ptr->is_dirty = (entry_ptr->is_dirty || dirty); } result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]), entry_ptr->addr, (void *)entry_ptr, - dirtied, flags); + flags); if ( ( result < 0 ) || ( entry_ptr->header.is_protected ) || @@ -2246,7 +2245,8 @@ unprotect_entry(H5C_t * cache_ptr, HDassert( ((entry_ptr->header).type)->id == type ); - if ( ( dirtied ) && ( (flags & H5C__DELETED_FLAG) == 0 ) ) { + if ( ( flags & H5AC__DIRTIED_FLAG ) != 0 + && ( (flags & H5C__DELETED_FLAG) == 0 ) ) { HDassert( entry_ptr->header.is_dirty ); HDassert( entry_ptr->is_dirty ); @@ -8568,7 +8568,7 @@ check_double_unprotect_err(void) result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]), entry_ptr->addr, (void *)entry_ptr, - FALSE, H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); if ( result > 0 ) { diff --git a/test/lheap.c b/test/lheap.c index 5fcccf3..09343e9 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -19,6 +19,7 @@ * Purpose: Test local heaps used by symbol tables (groups). */ #include "h5test.h" +#include "H5ACprivate.h" #include "H5HLprivate.h" #include "H5Iprivate.h" @@ -137,7 +138,7 @@ main(void) goto error; } - if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr, FALSE) < 0) { + if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr, H5AC__NO_FLAGS_SET) < 0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; |