mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
[svn-r11014] Purpose:
Code cleanup Description: Refactor metadata cache to merge "dirtied" flag in with other flags for H5AC_unprotect and H5C_unprotect. Platforms tested: FreeBSD 4.11 (sleipnir) h5committest
This commit is contained in:
parent
4cf99e9f28
commit
ddf9e4a4af
10
src/H5AC.c
10
src/H5AC.c
@ -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 ) {
|
||||
|
@ -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);
|
||||
|
182
src/H5B.c
182
src/H5B.c
@ -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;
|
||||
|
504
src/H5B2.c
504
src/H5B2.c
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
|
@ -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)
|
||||
|
62
src/H5BT.c
62
src/H5BT.c
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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);
|
||||
|
20
src/H5D.c
20
src/H5D.c
@ -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)
|
||||
|
12
src/H5G.c
12
src/H5G.c
@ -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:
|
||||
|
@ -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!");
|
||||
|
@ -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);
|
||||
|
42
src/H5HG.c
42
src/H5HG.c
@ -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);
|
||||
|
@ -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);
|
||||
|
38
src/H5HL.c
38
src/H5HL.c
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
131
src/H5O.c
131
src/H5O.c
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
10
test/cache.c
10
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 ) {
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user