summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Mainzer <mainzer@hdfgroup.org>2005-06-24 06:30:29 (GMT)
committerJohn Mainzer <mainzer@hdfgroup.org>2005-06-24 06:30:29 (GMT)
commit7f8e3460261851cdad1e344d8929d2817e3149ad (patch)
tree760d0e8dd581c4d4245a7e8acf51254f0c29d1ad
parent2ab6b12b552e9260e2e76640a788b5a3744c6a9f (diff)
downloadhdf5-7f8e3460261851cdad1e344d8929d2817e3149ad.zip
hdf5-7f8e3460261851cdad1e344d8929d2817e3149ad.tar.gz
hdf5-7f8e3460261851cdad1e344d8929d2817e3149ad.tar.bz2
[svn-r10978] Purpose:
Interim checkin of code changes moving management of the is_dirty flag into the cache code. Description: Prior to this checkin, management of the is_dirty flag was handled above the level of the metadata cache. This can no longer be allowed, as it introduces a race condition in the proposed fix for a cache coherency bug in PHDF5. Solution: Move management fo the is_dirty flag to the cache code proper. Entries are now marked as dirty via a flag on the unprotect call. Platforms tested: h5committested Misc. update:
-rw-r--r--src/H5AC.c35
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5B.c239
-rw-r--r--src/H5B2.c708
-rw-r--r--src/H5B2dbg.c36
-rw-r--r--src/H5B2test.c8
-rw-r--r--src/H5BT.c81
-rw-r--r--src/H5BTdbg.c10
-rw-r--r--src/H5BTtest.c16
-rw-r--r--src/H5C.c315
-rw-r--r--src/H5Cprivate.h1
-rw-r--r--src/H5D.c24
-rw-r--r--src/H5G.c24
-rw-r--r--src/H5Gent.c2
-rw-r--r--src/H5Gnode.c128
-rw-r--r--src/H5HG.c79
-rw-r--r--src/H5HGdbg.c9
-rw-r--r--src/H5HL.c65
-rw-r--r--src/H5HLdbg.c9
-rw-r--r--src/H5HLprivate.h3
-rw-r--r--src/H5O.c206
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5Oprivate.h11
-rw-r--r--src/H5S.c11
-rw-r--r--src/H5SH.c16
-rw-r--r--src/H5SHdbg.c10
-rw-r--r--src/H5Sprivate.h3
-rw-r--r--test/cache.c85
-rw-r--r--test/lheap.c2
29 files changed, 1663 insertions, 479 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index c68cd86..5daac7b 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -607,6 +607,13 @@ done:
* code is to pass the flags parameter through to
* H5C_insert_entry().
*
+ * JRM - 6/6/05
+ * Added code to force newly inserted entries to be dirty
+ * in the flexible parallel case. The normal case is handled
+ * in H5C.c. This is part of a series of changes directed at
+ * moving management of the dirty flag on cache entries into
+ * the cache code.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -650,6 +657,9 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *
lf = f->shared->lf;
if ( H5FD_is_fphdf5_driver(lf) ) {
+
+ /* Newly inserted entry are presumed to be dirty */
+ info->is_dirty = TRUE;
/*
* This is the FPHDF5 driver. Grab a lock for this piece of
@@ -785,6 +795,19 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_ad
if ( H5FD_is_fphdf5_driver(lf) ) {
+ /* We really should mark the target entry as dirty here, but
+ * the parameter list doesn't give us the information we need
+ * to do the job easily.
+ *
+ * Fortunately, this function is called exactly once in the
+ * the library, so it may be possible to finesse the issue.
+ * If not, I'll have to fix this properly.
+ *
+ * In any case, don't check this code in without revisiting this
+ * issue.
+ * JRM -- 6/6/05
+ */
+
HGOTO_DONE(SUCCEED);
}
}
@@ -1078,10 +1101,15 @@ done:
* parameter with the flags parameter in the call to
* H5C_unprotect().
*
+ * JRM - 6/6/05
+ * Added the dirtied parameter 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, unsigned int flags)
+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)
{
herr_t result;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1120,6 +1148,10 @@ 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;
+
/*
* FIXME: If the metadata is *really* deleted at this point
* (deleted == TRUE), we need to send a request to the SAP
@@ -1174,6 +1206,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
type,
addr,
thing,
+ dirtied,
flags);
if ( result < 0 ) {
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index a3d357d..d746718 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -228,7 +228,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, unsigned int flags);
+ void *thing, hbool_t dirtied, unsigned int 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);
diff --git a/src/H5B.c b/src/H5B.c
index aa752cf..41aae64 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -132,11 +132,12 @@ 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, unsigned idx, haddr_t child,
+static herr_t H5B_insert_child(H5B_t *bt, hbool_t * bt_dirtied_ptr,
+ 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,
- haddr_t old_addr, unsigned idx,
- void *udata, haddr_t *new_addr/*out*/);
+ hbool_t * old_bt_dirtied_ptr, 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);
#ifdef H5B_DEBUG
@@ -195,6 +196,14 @@ H5FL_DEFINE_STATIC(H5B_t);
* Changed the name of the ADDR argument to ADDR_P to make it
* obvious that the address is passed by reference unlike most
* other functions that take addresses.
+ *
+ * John Mainzer 6/9/05
+ * Removed code setting the is_dirty field of the cache info.
+ * This is no longer pemitted, as the cache code is now
+ * manageing this field. Since this function uses a call to
+ * H5AC_set() (which marks the entry dirty automaticly), no
+ * other change is required.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -220,7 +229,6 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
if (NULL==(bt = H5FL_MALLOC(H5B_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node")
HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
- bt->cache_info.is_dirty = TRUE;
bt->level = 0;
bt->left = HADDR_UNDEF;
bt->right = HADDR_UNDEF;
@@ -736,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, H5AC__NO_FLAGS_SET)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE, H5AC__NO_FLAGS_SET)
< 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node")
@@ -768,14 +776,26 @@ done:
* Robb Matzke, 1999-07-28
* The OLD_ADDR argument is passed by value. The NEW_ADDR
* argument has been renamed to NEW_ADDR_P
+ *
+ * John Mainzer, 6/9/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * old_bt_dirtied_ptr parameter to the function's argument
+ * list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, 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, hbool_t * old_bt_dirtied_ptr,
+ 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 nleft, nright; /* Number of keys in left & right halves */
double split_ratios[3]; /* B-tree split ratios */
@@ -788,6 +808,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr,
*/
assert(f);
assert(old_bt);
+ assert(old_bt_dirtied_ptr);
assert(H5F_addr_defined(old_addr));
/*
@@ -863,6 +884,15 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr,
/*
* Copy data from the old node to the new node.
*/
+
+ /* this function didn't used to mark the new bt entry as dirty. Since
+ * we just inserted the entry, this doesn't matter unless the entry
+ * somehow gets flushed between the insert and the protect. At present,
+ * I don't think this can happen, but it doesn't hurt to mark the entry
+ * dirty again.
+ * -- JRM
+ */
+ new_bt_dirtied = TRUE;
HDmemcpy(new_bt->native,
old_bt->native + nleft * shared->type->sizeof_nkey,
(nright+1) * shared->type->sizeof_nkey);
@@ -875,7 +905,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr,
/*
* Truncate the old node.
*/
- old_bt->cache_info.is_dirty = TRUE;
+ *old_bt_dirtied_ptr = TRUE;
old_bt->nchildren = nleft;
/*
@@ -888,11 +918,11 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr,
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->cache_info.is_dirty = TRUE;
+ tmp_bt_dirtied = TRUE;
tmp_bt->left = *new_addr_p;
if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ tmp_bt_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
tmp_bt=NULL; /* Make certain future references will be caught */
}
@@ -900,8 +930,8 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr,
old_bt->right = *new_addr_p;
done:
- if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p,
- new_bt, H5AC__NO_FLAGS_SET) < 0)
+ if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt,
+ new_bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -933,6 +963,12 @@ done:
*
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/9/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -950,7 +986,9 @@ 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;
@@ -982,11 +1020,12 @@ 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, H5AC__NO_FLAGS_SET)
- != SUCCEED)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied,
+ 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)))
@@ -995,11 +1034,12 @@ 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, H5AC__NO_FLAGS_SET)
- != SUCCEED)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, bt_dirtied,
+ 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
@@ -1014,14 +1054,15 @@ 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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
bt->left = old_root;
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET)
- != SUCCEED)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, bt_dirtied,
+ H5AC__NO_FLAGS_SET) != 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
@@ -1033,31 +1074,32 @@ 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->cache_info.is_dirty = TRUE;
+ 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, H5AC__NO_FLAGS_SET)
- != SUCCEED)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied,
+ H5AC__NO_FLAGS_SET) != 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, H5AC__NO_FLAGS_SET)
- != SUCCEED)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied,
+ H5AC__NO_FLAGS_SET) != 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->cache_info.is_dirty = TRUE;
+ new_bt_dirtied = TRUE;
new_bt->left = HADDR_UNDEF;
new_bt->right = HADDR_UNDEF;
@@ -1102,11 +1144,20 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The CHILD argument is passed by value.
+ *
+ * John Mainzer, 6/9/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new dirtied_ptr
+ * parameter to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B_insert_child(H5B_t *bt, unsigned idx, haddr_t child,
- H5B_ins_t anchor, const void *md_key)
+H5B_insert_child(H5B_t *bt, hbool_t * bt_dirtied_ptr, unsigned idx,
+ haddr_t child, H5B_ins_t anchor, const void *md_key)
{
H5B_shared_t *shared; /* Pointer to shared B-tree info */
uint8_t *base; /* Base offset for move */
@@ -1114,11 +1165,12 @@ H5B_insert_child(H5B_t *bt, unsigned idx, haddr_t child,
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_insert_child)
assert(bt);
+ assert(bt_dirtied_ptr);
shared=H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
assert(bt->nchildren<shared->two_k);
- bt->cache_info.is_dirty = TRUE;
+ *bt_dirtied_ptr = TRUE;
/* Check for inserting right-most key into node (common when just appending
* records to an unlimited dimension chunked dataset)
@@ -1203,6 +1255,12 @@ H5B_insert_child(H5B_t *bt, unsigned idx, haddr_t child,
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value. The NEW_NODE argument is
* renamed NEW_NODE_P
+ *
+ * John Mainzer, 6/9/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static H5B_ins_t
@@ -1212,6 +1270,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;
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 */
@@ -1271,7 +1330,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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
idx = 0;
if (type->follow_min) {
@@ -1385,14 +1444,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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
if (idx > 0)
*lt_key_changed = FALSE;
else
HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
}
if (*rt_key_changed) {
- bt->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
if (idx+1 < bt->nchildren)
*rt_key_changed = FALSE;
else
@@ -1403,32 +1462,37 @@ 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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
ret_value = H5B_INS_NOOP;
} else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) {
+ hbool_t *tmp_bt_dirtied_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, addr, idx, udata, new_node_p/*out*/)<0)
+ if (H5B_split(f, dxpl_id, bt, &bt_dirtied, 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;
} else {
idx -= bt->nchildren;
tmp_bt = twin;
+ tmp_bt_dirtied_ptr = &twin_dirtied;
}
} else {
tmp_bt = bt;
+ tmp_bt_dirtied_ptr = &bt_dirtied;
}
/* Insert the child */
- if (H5B_insert_child(tmp_bt, idx, child_addr, my_ins, md_key) < 0)
+ if (H5B_insert_child(tmp_bt, tmp_bt_dirtied_ptr, idx,
+ child_addr, my_ins, md_key) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child")
}
@@ -1455,9 +1519,10 @@ 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,
- H5AC__NO_FLAGS_SET) < 0);
+ bt_dirtied, H5AC__NO_FLAGS_SET) < 0);
herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p,
- twin, H5AC__NO_FLAGS_SET)<0);
+ twin, twin_dirtied,
+ H5AC__NO_FLAGS_SET)<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)")
}
@@ -1487,11 +1552,18 @@ done:
*
* Quincey Koziol, 2002-04-22
* Changed callback to function pointer from static function
+ *
+ * John Mainzer, 6/10/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -1523,10 +1595,12 @@ 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, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied,
+ 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. */
@@ -1557,10 +1631,11 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op
nchildren = bt->nchildren;
if (H5AC_unprotect(f, dxpl_id, H5AC_BT, cur_addr, bt,
- H5AC__NO_FLAGS_SET) < 0)
+ bt_dirtied, 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
@@ -1609,6 +1684,12 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/10/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static H5B_ins_t
@@ -1617,6 +1698,7 @@ 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;
H5B_shared_t *shared; /* Pointer to shared B-tree info */
unsigned idx=0, lt=0, rt; /* Final, left & right indices */
@@ -1698,7 +1780,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* our right key and indicate that it changed.
*/
if (*lt_key_changed) {
- bt->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
if (idx>0) {
/* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
@@ -1707,7 +1789,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
}
}
if (*rt_key_changed) {
- bt->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
if (idx+1<bt->nchildren) {
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
@@ -1725,13 +1807,15 @@ 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->cache_info.is_dirty = TRUE;
+ sibling_dirtied = TRUE;
if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ sibling_dirtied, H5AC__NO_FLAGS_SET)
+ != 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;
}
}
}
@@ -1747,7 +1831,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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
bt->nchildren = 0;
if (level>0) {
if (H5F_addr_defined(bt->left)) {
@@ -1755,13 +1839,15 @@ 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->cache_info.is_dirty = TRUE;
+ sibling_dirtied = TRUE;
if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ sibling_dirtied, H5AC__NO_FLAGS_SET)
+ != 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)))
@@ -1771,23 +1857,27 @@ 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->cache_info.is_dirty = TRUE;
+ sibling_dirtied = TRUE;
if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ sibling_dirtied, H5AC__NO_FLAGS_SET)
+ != 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, H5C__DELETED_FLAG)<0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, H5C__DELETED_FLAG)<0) {
bt = NULL;
+ bt_dirtied = FALSE;
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node")
}
bt = NULL;
+ bt_dirtied = FALSE;
}
} else if (H5B_INS_REMOVE==ret_value && 0==idx) {
@@ -1798,7 +1888,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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
bt->nchildren -= 1;
HDmemmove(bt->native,
@@ -1818,7 +1908,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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
bt->nchildren -= 1;
HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
*rt_key_changed = TRUE;
@@ -1833,13 +1923,15 @@ 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->cache_info.is_dirty = TRUE;
+ sibling_dirtied = TRUE;
if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ sibling_dirtied, H5AC__NO_FLAGS_SET)
+ != 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;
}
}
@@ -1853,7 +1945,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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
bt->nchildren -= 1;
HDmemmove(bt->native + idx * type->sizeof_nkey,
@@ -1869,7 +1961,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, H5AC__NO_FLAGS_SET)<0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1893,6 +1985,12 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1904,6 +2002,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;
H5B_t *bt = NULL; /*btree node */
herr_t ret_value=SUCCEED; /* Return value */
@@ -1929,14 +2028,16 @@ 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->cache_info.is_dirty = TRUE;
+ bt_dirtied = TRUE;
}
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied,
+ H5AC__NO_FLAGS_SET)
!= 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);
@@ -1959,11 +2060,17 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/10/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -2010,7 +2117,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, H5C__DELETED_FLAG)<0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied, H5C__DELETED_FLAG)<0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2244,8 +2351,8 @@ 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, H5AC__NO_FLAGS_SET)
- < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE,
+ H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2267,12 +2374,19 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
#ifdef H5B_DEBUG
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;
@@ -2305,9 +2419,11 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
cur->level = bt->level;
head = tail = cur;
- status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET);
+ status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_dirtied,
+ 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
@@ -2358,10 +2474,11 @@ 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,
+ status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt, bt_dirtied,
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;
diff --git a/src/H5B2.c b/src/H5B2.c
index b33e760..60d9514 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -63,30 +63,32 @@ static herr_t H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
static int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec,
size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
static herr_t H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2,
- H5RC_t *bt2_shared);
+ hbool_t * bt2_dirtied_ptr, H5RC_t *bt2_shared);
static herr_t H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth,
H5B2_internal_t *internal, unsigned idx);
static herr_t H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, H5AC_info_t *parent_cache_info,
- H5B2_internal_t *internal, unsigned idx);
+ H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx);
static herr_t H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_internal_t *internal, unsigned idx);
+ H5B2_internal_t *internal, hbool_t *internal_dirtied_ptr, unsigned idx);
static herr_t H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, H5AC_info_t *parent_cache_info,
- H5B2_internal_t *internal, unsigned idx);
+ H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx);
static herr_t H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_node_ptr_t *curr_node_ptr, H5AC_info_t *parent_cache_info,
- H5B2_internal_t *internal, unsigned idx);
+ H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx);
static herr_t H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_internal_t *internal, unsigned idx, void *swap_loc);
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr,
+ unsigned idx, void *swap_loc);
static herr_t H5B2_insert_internal(H5F_t *f, hid_t dxpl_id,
H5RC_t *bt2_shared, unsigned depth, H5AC_info_t *parent_cache_info,
+ hbool_t * parent_cache_info_dirtied_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
static herr_t H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
static herr_t H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
- H5B2_node_ptr_t *curr_node_ptr, void *udata);
+ hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, void *udata);
static herr_t H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata);
static herr_t H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
@@ -286,6 +288,16 @@ done:
* koziol@ncsa.uiuc.edu
* Jan 31 2005
*
+ *
+ * Modifications:
+ *
+ * John Mainzer 6/10/05
+ * Removed code setting the is_dirty field of the cache info.
+ * This is no longer pemitted, as the cache code is now
+ * manageing this field. Since this function uses a call to
+ * H5AC_set() (which marks the entry dirty automaticly), no
+ * other change is required.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -317,7 +329,6 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
/* Assign internal information */
HDmemset(&bt2->cache_info,0,sizeof(H5AC_info_t));
- bt2->cache_info.is_dirty = TRUE;
bt2->depth = 0;
bt2->root.addr = HADDR_UNDEF;
bt2->root.node_nrec = 0;
@@ -404,14 +415,26 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
* koziol@ncsa.uiuc.edu
* Feb 3 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/10/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new bt2_dirtied_ptr
+ * parameter to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
+H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, hbool_t * bt2_dirtied_ptr, H5RC_t *bt2_shared)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
+ hbool_t new_root_dirtied = FALSE;
H5B2_internal_t *new_root; /* Pointer to new root node */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ hbool_t left_child_dirtied = FALSE, right_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to child nodes */
unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native;/* Pointers to childs' native records */
@@ -425,6 +448,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
HDassert(f);
HDassert(bt2);
+ HDassert(bt2_dirtied_ptr);
HDassert(bt2_shared);
/* Get the pointer to the shared B-tree info */
@@ -432,6 +456,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
HDassert(shared);
if(bt2->depth>0) {
+ hbool_t * old_int_dirtied_ptr = NULL, * new_int_dirtied_ptr = NULL;
H5B2_internal_t *old_int=NULL, *new_int=NULL; /* Pointers to old & new internal nodes */
H5B2_node_ptr_t new_int_ptr; /* Node pointer to manage new internal node */
@@ -452,7 +477,9 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
+ old_int_dirtied_ptr = &left_child_dirtied;
left_child = old_int;
+ new_int_dirtied_ptr = &right_child_dirtied;
right_child = new_int;
left_nrec = &(old_int->nrec);
right_nrec = &(new_int->nrec);
@@ -462,10 +489,11 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
right_node_ptrs = new_int->node_ptrs;
/* Mark child nodes as dirty now */
- old_int->cache_info.is_dirty = TRUE;
- new_int->cache_info.is_dirty = TRUE;
+ *old_int_dirtied_ptr = TRUE;
+ *new_int_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * old_leaf_dirtied_ptr = NULL, * new_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *old_leaf=NULL, *new_leaf=NULL; /* Pointers to old & new leaf nodes */
H5B2_node_ptr_t new_leaf_ptr; /* Node pointer to manage new leaf node */
@@ -486,7 +514,9 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
+ old_leaf_dirtied_ptr = &left_child_dirtied;
left_child = old_leaf;
+ new_leaf_dirtied_ptr = &right_child_dirtied;
right_child = new_leaf;
left_nrec = &(old_leaf->nrec);
right_nrec = &(new_leaf->nrec);
@@ -494,8 +524,8 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
right_native = new_leaf->leaf_native;
/* Mark child nodes as dirty now */
- old_leaf->cache_info.is_dirty = TRUE;
- new_leaf->cache_info.is_dirty = TRUE;
+ *old_leaf_dirtied_ptr = TRUE;
+ *new_leaf_dirtied_ptr = TRUE;
} /* end if */
/* Set the old number of records in root node */
@@ -557,7 +587,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
new_root->nrec = 1;
/* Mark new internal node as dirty */
- new_root->cache_info.is_dirty = TRUE;
+ new_root_dirtied = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal(bt2->root.all_nrec,shared,new_root);
@@ -571,13 +601,13 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
} /* end else */
#endif /* H5B2_DEBUG */
/* Release new internal node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, bt2->root.addr, new_root, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, bt2->root.addr, new_root, new_root_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node")
/* Release child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
/* Update depth of B-tree */
@@ -587,7 +617,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
bt2->root.node_nrec = 1;
/* Mark B-tree header as dirty */
- bt2->cache_info.is_dirty = TRUE;
+ *bt2_dirtied_ptr = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -607,6 +637,11 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 9 2005
*
+ * John Mainzer, 6/14/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -614,6 +649,7 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ hbool_t left_child_dirtied = FALSE, right_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to child nodes */
unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
@@ -633,6 +669,8 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Check for the kind of B-tree node to redistribute */
if(depth>1) {
+ hbool_t * left_internal_dirtied_ptr = NULL;
+ hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -648,7 +686,9 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
+ left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
+ right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
right_nrec = &(right_internal->nrec);
@@ -658,10 +698,12 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_node_ptrs = right_internal->node_ptrs;
/* Mark child nodes as dirty now */
- left_internal->cache_info.is_dirty = TRUE;
- right_internal->cache_info.is_dirty = TRUE;
+ *left_internal_dirtied_ptr = TRUE;
+ *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * left_leaf_dirtied_ptr = NULL;
+ hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -677,7 +719,9 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
+ left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
+ right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
right_nrec = &(right_leaf->nrec);
@@ -685,8 +729,8 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_native = right_leaf->leaf_native;
/* Mark child nodes as dirty now */
- left_leaf->cache_info.is_dirty = TRUE;
- right_leaf->cache_info.is_dirty = TRUE;
+ *left_leaf_dirtied_ptr = TRUE;
+ *right_leaf_dirtied_ptr = TRUE;
} /* end else */
#ifdef H5B2_DEBUG
@@ -814,9 +858,9 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
#endif /* H5B2_DEBUG */
/* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -837,15 +881,28 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 9 2005
*
+ * John Mainzer, 6/14/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
+ * parameters to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
- H5AC_info_t *parent_cache_info, H5B2_internal_t *internal, unsigned idx)
+ hbool_t * parent_cache_info_dirtied_ptr, H5B2_internal_t *internal,
+ hbool_t * internal_dirtied_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
+ hbool_t left_child_dirtied = FALSE;
+ hbool_t right_child_dirtied = FALSE;
+ hbool_t middle_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
@@ -862,7 +919,9 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
FUNC_ENTER_NOAPI_NOINIT(H5B2_split2)
HDassert(f);
+ HDassert(parent_cache_info_dirtied_ptr);
HDassert(internal);
+ HDassert(internal_dirtied_ptr);
/* Get the pointer to the shared B-tree info */
shared=H5RC_GET_OBJ(internal->shared);
@@ -874,6 +933,9 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Check for the kind of B-tree node to split */
if(depth>1) {
+ hbool_t * left_internal_dirtied_ptr = NULL;
+ hbool_t * middle_internal_dirtied_ptr = NULL;
+ hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -902,8 +964,11 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
+ left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
+ middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
+ right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -916,11 +981,14 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_node_ptrs = right_internal->node_ptrs;
/* Mark child nodes as dirty now */
- left_internal->cache_info.is_dirty = TRUE;
- middle_internal->cache_info.is_dirty = TRUE;
- right_internal->cache_info.is_dirty = TRUE;
+ *left_internal_dirtied_ptr = TRUE;
+ *middle_internal_dirtied_ptr = TRUE;
+ *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t *left_leaf_dirtied_ptr = NULL;
+ hbool_t *middle_leaf_dirtied_ptr = NULL;
+ hbool_t *right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -949,8 +1017,11 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
+ left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
+ middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
+ right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -960,9 +1031,9 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_native = right_leaf->leaf_native;
/* Mark child nodes as dirty now */
- left_leaf->cache_info.is_dirty = TRUE;
- middle_leaf->cache_info.is_dirty = TRUE;
- right_leaf->cache_info.is_dirty = TRUE;
+ *left_leaf_dirtied_ptr = TRUE;
+ *middle_leaf_dirtied_ptr = TRUE;
+ *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records */
@@ -1065,13 +1136,13 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
internal->nrec++;
/* Mark parent as dirty */
- internal->cache_info.is_dirty = TRUE;
+ *internal_dirtied_ptr = TRUE;
/* Update grandparent info */
curr_node_ptr->node_nrec++;
/* Mark grandparent as dirty */
- parent_cache_info->is_dirty = TRUE;
+ *parent_cache_info_dirtied_ptr = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -1089,11 +1160,11 @@ H5B2_split2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
#endif /* H5B2_DEBUG */
/* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1114,14 +1185,28 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 9 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/14/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * internal_dirtied_ptr parameter to the function's
+ * argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *internal, unsigned idx)
+H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *internal, hbool_t *internal_dirtied_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
+ hbool_t left_child_dirtied = FALSE;
+ hbool_t right_child_dirtied = FALSE;
+ hbool_t middle_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to child nodes */
void *middle_child; /* Pointers to middle child node */
unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
@@ -1146,6 +1231,9 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
/* Check for the kind of B-tree node to redistribute */
if(depth>1) {
+ hbool_t * left_internal_dirtied_ptr = NULL;
+ hbool_t * middle_internal_dirtied_ptr = NULL;
+ hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -1165,8 +1253,11 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for child nodes */
+ left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
+ middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
+ right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -1179,11 +1270,14 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_node_ptrs = right_internal->node_ptrs;
/* Mark child nodes as dirty now */
- left_internal->cache_info.is_dirty = TRUE;
- middle_internal->cache_info.is_dirty = TRUE;
- right_internal->cache_info.is_dirty = TRUE;
+ *left_internal_dirtied_ptr = TRUE;
+ *middle_internal_dirtied_ptr = TRUE;
+ *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * left_leaf_dirtied_ptr = NULL;
+ hbool_t * middle_leaf_dirtied_ptr = NULL;
+ hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -1203,8 +1297,11 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
+ left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
+ middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
+ right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -1214,9 +1311,9 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
right_native = right_leaf->leaf_native;
/* Mark child nodes as dirty now */
- left_leaf->cache_info.is_dirty = TRUE;
- middle_leaf->cache_info.is_dirty = TRUE;
- right_leaf->cache_info.is_dirty = TRUE;
+ *left_leaf_dirtied_ptr = TRUE;
+ *middle_leaf_dirtied_ptr = TRUE;
+ *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records */
@@ -1409,7 +1506,7 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
} /* end else */
/* Mark parent as dirty */
- internal->cache_info.is_dirty = TRUE;
+ *internal_dirtied_ptr = TRUE;
#ifdef QAK
{
@@ -1467,11 +1564,11 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
#endif /* H5B2_DEBUG */
/* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1492,16 +1589,33 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
+ * parameters to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
- H5AC_info_t *parent_cache_info, H5B2_internal_t *internal, unsigned idx)
+H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+ H5B2_node_ptr_t *curr_node_ptr,
+ hbool_t * parent_cache_info_dirtied_ptr, H5B2_internal_t *internal,
+ hbool_t * internal_dirtied_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
haddr_t new_addr; /* Address of new child node */
+ hbool_t left_child_dirtied = FALSE;
+ hbool_t middle_child_dirtied = FALSE;
+ hbool_t right_child_dirtied = FALSE;
+ hbool_t new_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
void *new_child; /* Pointer to new child node */
@@ -1535,6 +1649,10 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Check for the kind of B-tree node to split */
if(depth>1) {
+ hbool_t * left_internal_dirtied_ptr = NULL;
+ hbool_t * right_internal_dirtied_ptr = NULL;
+ hbool_t * middle_internal_dirtied_ptr = NULL;
+ hbool_t * new_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
@@ -1567,9 +1685,13 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
+ left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
+ middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
+ new_internal_dirtied_ptr = &new_child_dirtied;
new_child = new_internal;
+ right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -1585,12 +1707,16 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
new_node_ptrs = new_internal->node_ptrs;
/* Mark child nodes as dirty now */
- left_internal->cache_info.is_dirty = TRUE;
- middle_internal->cache_info.is_dirty = TRUE;
- new_internal->cache_info.is_dirty = TRUE;
- right_internal->cache_info.is_dirty = TRUE;
+ *left_internal_dirtied_ptr = TRUE;
+ *middle_internal_dirtied_ptr = TRUE;
+ *new_internal_dirtied_ptr = TRUE;
+ *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * left_leaf_dirtied_ptr = NULL;
+ hbool_t * right_leaf_dirtied_ptr = NULL;
+ hbool_t * middle_leaf_dirtied_ptr = NULL;
+ hbool_t * new_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
@@ -1623,9 +1749,13 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
+ left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
+ middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
+ new_leaf_dirtied_ptr = &new_child_dirtied;
new_child = new_leaf;
+ right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -1637,10 +1767,10 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_native = right_leaf->leaf_native;
/* Mark child nodes as dirty now */
- left_leaf->cache_info.is_dirty = TRUE;
- middle_leaf->cache_info.is_dirty = TRUE;
- new_leaf->cache_info.is_dirty = TRUE;
- right_leaf->cache_info.is_dirty = TRUE;
+ *left_leaf_dirtied_ptr = TRUE;
+ *middle_leaf_dirtied_ptr = TRUE;
+ *new_leaf_dirtied_ptr = TRUE;
+ *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records */
@@ -1779,13 +1909,13 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
internal->nrec++;
/* Mark parent as dirty */
- internal->cache_info.is_dirty = TRUE;
+ *internal_dirtied_ptr = TRUE;
/* Update grandparent info */
curr_node_ptr->node_nrec++;
/* Mark grandparent as dirty */
- parent_cache_info->is_dirty = TRUE;
+ *parent_cache_info_dirtied_ptr = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -1806,13 +1936,13 @@ H5B2_split3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
#endif /* H5B2_DEBUG */
/* Unlock child nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, new_addr, new_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, new_addr, new_child, new_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1833,14 +1963,26 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 4 2005
*
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
+ * parameters to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
- H5AC_info_t *parent_cache_info, H5B2_internal_t *internal, unsigned idx)
+H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
+ H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
+ hbool_t left_child_dirtied = FALSE;
+ hbool_t right_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
@@ -1859,6 +2001,8 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Check for the kind of B-tree node to split */
if(depth>1) {
+ hbool_t * left_internal_dirtied_ptr = NULL;
+ hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -1874,7 +2018,9 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
+ left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
+ right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
right_nrec = &(right_internal->nrec);
@@ -1884,10 +2030,12 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_node_ptrs = right_internal->node_ptrs;
/* Mark child nodes as dirty now */
- left_internal->cache_info.is_dirty = TRUE;
- right_internal->cache_info.is_dirty = TRUE;
+ *left_internal_dirtied_ptr = TRUE;
+ *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * left_leaf_dirtied_ptr = NULL;
+ hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -1903,7 +2051,9 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
+ left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
+ right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
right_nrec = &(right_leaf->nrec);
@@ -1911,8 +2061,8 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_native = right_leaf->leaf_native;
/* Mark child nodes as dirty now */
- left_leaf->cache_info.is_dirty = TRUE;
- right_leaf->cache_info.is_dirty = TRUE;
+ *left_leaf_dirtied_ptr = TRUE;
+ *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records into left node */
@@ -1947,13 +2097,13 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
internal->nrec--;
/* Mark parent as dirty */
- internal->cache_info.is_dirty = TRUE;
+ *internal_dirtied_ptr = TRUE;
/* Update grandparent info */
curr_node_ptr->node_nrec--;
/* Mark grandparent as dirty */
- parent_cache_info->is_dirty = TRUE;
+ *parent_cache_info_dirtied_ptr = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -1966,13 +2116,13 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
#endif /* H5B2_DEBUG */
/* Unlock left node */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache */
if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, right_addr, (hsize_t)shared->node_size)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree leaf node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DELETED_FLAG) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__DELETED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -1993,15 +2143,30 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 4 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
+ * parameters to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ptr,
- H5AC_info_t *parent_cache_info, H5B2_internal_t *internal, unsigned idx)
+H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
+ H5B2_node_ptr_t *curr_node_ptr, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr, unsigned idx)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
haddr_t middle_addr; /* Address of middle child node */
+ hbool_t left_child_dirtied = FALSE;
+ hbool_t right_child_dirtied = FALSE;
+ hbool_t middle_child_dirtied = FALSE;
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
@@ -2017,7 +2182,9 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
FUNC_ENTER_NOAPI_NOINIT(H5B2_merge3)
HDassert(f);
+ HDassert(parent_cache_info_dirtied_ptr);
HDassert(internal);
+ HDassert(internal_dirtied_ptr);
/* Get the pointer to the shared B-tree info */
shared=H5RC_GET_OBJ(internal->shared);
@@ -2025,6 +2192,9 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
/* Check for the kind of B-tree node to split */
if(depth>1) {
+ hbool_t * left_internal_dirtied_ptr = NULL;
+ hbool_t * middle_internal_dirtied_ptr = NULL;
+ hbool_t * right_internal_dirtied_ptr = NULL;
H5B2_internal_t *left_internal; /* Pointer to left internal node */
H5B2_internal_t *middle_internal; /* Pointer to middle internal node */
H5B2_internal_t *right_internal; /* Pointer to right internal node */
@@ -2044,8 +2214,11 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
+ left_internal_dirtied_ptr = &left_child_dirtied;
left_child = left_internal;
+ middle_internal_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_internal;
+ right_internal_dirtied_ptr = &right_child_dirtied;
right_child = right_internal;
left_nrec = &(left_internal->nrec);
middle_nrec = &(middle_internal->nrec);
@@ -2058,11 +2231,14 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_node_ptrs = right_internal->node_ptrs;
/* Mark child nodes as dirty now */
- left_internal->cache_info.is_dirty = TRUE;
- middle_internal->cache_info.is_dirty = TRUE;
- right_internal->cache_info.is_dirty = TRUE;
+ *left_internal_dirtied_ptr = TRUE;
+ *middle_internal_dirtied_ptr = TRUE;
+ *right_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * left_leaf_dirtied_ptr = NULL;
+ hbool_t * middle_leaf_dirtied_ptr = NULL;
+ hbool_t * right_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *left_leaf; /* Pointer to left leaf node */
H5B2_leaf_t *middle_leaf; /* Pointer to middle leaf node */
H5B2_leaf_t *right_leaf; /* Pointer to right leaf node */
@@ -2082,8 +2258,11 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
+ left_leaf_dirtied_ptr = &left_child_dirtied;
left_child = left_leaf;
+ middle_leaf_dirtied_ptr = &middle_child_dirtied;
middle_child = middle_leaf;
+ right_leaf_dirtied_ptr = &right_child_dirtied;
right_child = right_leaf;
left_nrec = &(left_leaf->nrec);
middle_nrec = &(middle_leaf->nrec);
@@ -2093,9 +2272,9 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
right_native = right_leaf->leaf_native;
/* Mark child nodes as dirty now */
- left_leaf->cache_info.is_dirty = TRUE;
- middle_leaf->cache_info.is_dirty = TRUE;
- right_leaf->cache_info.is_dirty = TRUE;
+ *left_leaf_dirtied_ptr = TRUE;
+ *middle_leaf_dirtied_ptr = TRUE;
+ *right_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Redistribute records into left node */
@@ -2173,13 +2352,13 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
internal->nrec--;
/* Mark parent as dirty */
- internal->cache_info.is_dirty = TRUE;
+ *internal_dirtied_ptr = TRUE;
/* Update grandparent info */
curr_node_ptr->node_nrec--;
/* Mark grandparent as dirty */
- parent_cache_info->is_dirty = TRUE;
+ *parent_cache_info_dirtied_ptr = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -2194,15 +2373,15 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
#endif /* H5B2_DEBUG */
/* Unlock left & middle nodes */
- if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, left_addr, left_child, left_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
- if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, middle_addr, middle_child, middle_child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
/* Delete right node & remove from cache */
if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, right_addr, (hsize_t)shared->node_size)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free B-tree leaf node")
- if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, H5AC__DELETED_FLAG) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, right_addr, right_child, right_child_dirtied, H5AC__DELETED_FLAG) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -2223,14 +2402,27 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 4 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * internal_dirtied_ptr parameter to the function's
+ * argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
- H5B2_internal_t *internal, unsigned idx, void *swap_loc)
+ H5B2_internal_t *internal, hbool_t * internal_dirtied_ptr,
+ unsigned idx, void *swap_loc)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t child_addr; /* Address of child node */
+ hbool_t child_dirtied = FALSE;
void *child; /* Pointer to child node */
uint8_t *child_native; /* Pointer to child's native records */
H5B2_shared_t *shared; /* B-tree's shared info */
@@ -2248,6 +2440,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
/* Check for the kind of B-tree node to swap */
if(depth>1) {
+ hbool_t * child_internal_dirtied_ptr = NULL;
H5B2_internal_t *child_internal; /* Pointer to internal node */
/* Setup information for unlocking child node */
@@ -2259,13 +2452,15 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* More setup for accessing child node information */
+ child_internal_dirtied_ptr = &child_dirtied;
child = child_internal;
child_native = child_internal->int_native;
/* Mark child node as dirty now */
- child_internal->cache_info.is_dirty = TRUE;
+ *child_internal_dirtied_ptr = TRUE;
} /* end if */
else {
+ hbool_t * child_leaf_dirtied_ptr = NULL;
H5B2_leaf_t *child_leaf; /* Pointer to leaf node */
/* Setup information for unlocking child nodes */
@@ -2277,11 +2472,12 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
+ child_leaf_dirtied_ptr = &child_dirtied;
child = child_leaf;
child_native = child_leaf->leaf_native;
/* Mark child node as dirty now */
- child_leaf->cache_info.is_dirty = TRUE;
+ *child_leaf_dirtied_ptr = TRUE;
} /* end else */
/* Swap records (use disk page as temporary buffer) */
@@ -2290,7 +2486,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
HDmemcpy(swap_loc, shared->page, shared->type->nrec_size);
/* Mark parent as dirty */
- internal->cache_info.is_dirty = TRUE;
+ *internal_dirtied_ptr = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal((hsize_t)0,shared,internal);
@@ -2301,7 +2497,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
#endif /* H5B2_DEBUG */
/* Unlock child node */
- if (H5AC_unprotect(f, dxpl_id, child_class, child_addr, child, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, child_class, child_addr, child, child_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node")
done:
@@ -2320,12 +2516,20 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 3 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
+ hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
int cmp; /* Comparison value of records */
@@ -2382,11 +2586,11 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
leaf->nrec++;
/* Mark node as dirty */
- leaf->cache_info.is_dirty = TRUE;
+ leaf_dirtied = TRUE;
done:
/* Release the B-tree leaf node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2404,13 +2608,25 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 2 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/14/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new dirtied_ptr
+ * parameter to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
- unsigned depth, H5AC_info_t *parent_cache_info,
+ unsigned depth, H5AC_info_t *parent_cache_info,
+ hbool_t * parent_cache_info_dirtied_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
+ hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
@@ -2423,6 +2639,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(bt2_shared);
HDassert(depth>0);
HDassert(parent_cache_info);
+ HDassert(parent_cache_info_dirtied_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
@@ -2469,7 +2686,9 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_split2(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,idx)<0)
+ if(H5B2_split2(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,
+ internal,&internal_dirtied,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
@@ -2479,18 +2698,22 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_split2(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,(idx-1))<0)
+ if(H5B2_split2(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,
+ internal,&internal_dirtied,(idx-1))<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries>0 && ((internal->node_ptrs[idx+1].node_nrec < split_nrec) ||
(internal->node_ptrs[idx-1].node_nrec < split_nrec))) {
- if(H5B2_redistribute3(f,dxpl_id,depth,internal,idx)<0)
+ if(H5B2_redistribute3(f,dxpl_id,depth,internal,&internal_dirtied,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_split3(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,idx)<0)
+ if(H5B2_split3(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,
+ internal,&internal_dirtied,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
} /* end else */
} /* end else */
@@ -2509,7 +2732,8 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Attempt to insert node */
if(depth>1) {
- if(H5B2_insert_internal(f,dxpl_id,bt2_shared,depth-1,&internal->cache_info,&internal->node_ptrs[idx],udata)<0)
+ if(H5B2_insert_internal(f,dxpl_id,bt2_shared,depth-1,&internal->cache_info,&internal_dirtied,
+ &internal->node_ptrs[idx],udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
@@ -2521,11 +2745,11 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
curr_node_ptr->all_nrec++;
/* Mark node as dirty */
- internal->cache_info.is_dirty = TRUE;
+ internal_dirtied = TRUE;
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2543,12 +2767,20 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/10/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
herr_t ret_value = SUCCEED;
@@ -2575,19 +2807,19 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node")
/* Mark B-tree header as dirty, since we updated the address of the root node */
- bt2->cache_info.is_dirty = TRUE;
+ bt2_dirtied = TRUE;
} /* end if */
/* Check if we need to split the root node (equiv. to a 1->2 leaf node split) */
else if((bt2->depth==0 && bt2->root.node_nrec==shared->split_leaf_nrec) ||
(bt2->depth>0 && bt2->root.node_nrec==shared->split_int_nrec)) {
/* Split root node */
- if(H5B2_split_root(f, dxpl_id, bt2, bt2->shared)<0)
+ if(H5B2_split_root(f, dxpl_id, bt2, &bt2_dirtied, bt2->shared)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
} /* end if */
/* Attempt to insert record into B-tree */
if(bt2->depth>0) {
- if(H5B2_insert_internal(f,dxpl_id,bt2->shared,bt2->depth,&(bt2->cache_info),&bt2->root,udata)<0)
+ if(H5B2_insert_internal(f,dxpl_id,bt2->shared,bt2->depth,&(bt2->cache_info),&bt2_dirtied,&bt2->root,udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node")
} /* end if */
else {
@@ -2596,11 +2828,11 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Mark parent node as dirty */
- bt2->cache_info.is_dirty = TRUE;
+ bt2_dirtied = TRUE;
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2619,6 +2851,16 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to avoid modifying the is_dirty
+ * field of the cache info, as that field is now maintained
+ * by the cache code. Since this function uses a call to
+ * H5AC_set(), and that function presumes that the newly
+ * inserted entry is dirty, we need only remove the reference
+ * to the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2641,7 +2883,6 @@ H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, H5B2_node_ptr_t *n
/* Set metadata cache info */
HDmemset(&leaf->cache_info,0,sizeof(H5AC_info_t));
- leaf->cache_info.is_dirty = TRUE;
/* Share common B-tree information */
leaf->shared = bt2_shared;
@@ -2691,6 +2932,16 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 3 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to avoid modifying the is_dirty
+ * field of the cache info, as that field is now maintained
+ * by the cache code. Since this function uses a call to
+ * H5AC_set(), and that function presumes that the newly
+ * inserted entry is dirty, we need only remove the reference
+ * to the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2713,7 +2964,6 @@ H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, H5B2_node_ptr_
/* Set metadata cache info */
HDmemset(&internal->cache_info,0,sizeof(H5AC_info_t));
- internal->cache_info.is_dirty = TRUE;
/* Share common B-tree information */
internal->shared = bt2_shared;
@@ -2773,6 +3023,13 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 11 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2781,6 +3038,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
+ hbool_t node_dirtied = FALSE;
void *node=NULL; /* Pointers to current node */
uint8_t *native; /* Pointers to node's native records */
H5B2_node_ptr_t *node_ptrs=NULL; /* Pointers to node's node pointers */
@@ -2847,7 +3105,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
done:
/* Unlock current node */
if(node)
- if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, node_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -2869,12 +3127,20 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 11 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_operator_t op, void *op_data)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
@@ -2906,7 +3172,7 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -2948,12 +3214,20 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 23 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata, H5B2_found_t op, void *op_data)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -2987,7 +3261,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -3002,9 +3276,12 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Walk down B-tree to find record or leaf node where record is located */
cmp = -1;
while(depth>0 && cmp != 0) {
+ hbool_t internal_dirtied;
H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
+ internal_dirtied = FALSE;
+
/* Lock B-tree current node */
if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
@@ -3019,7 +3296,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[idx];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -3029,14 +3306,14 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for current record */
if ( op && (op)(H5B2_INT_NREC(internal,shared,idx), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -3047,6 +3324,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end while */
{
+ hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
@@ -3058,7 +3336,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
if(cmp != 0) {
/* Unlock leaf node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Note: don't push error on stack, leave that to next higher level,
@@ -3075,7 +3353,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for current record */
if ( op && (op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
@@ -3083,7 +3361,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
}
@@ -3112,12 +3390,20 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 23 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hsize_t idx, H5B2_found_t op, void *op_data)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -3150,7 +3436,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -3168,10 +3454,13 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Walk down B-tree to find record or leaf node where record is located */
while(depth>0) {
+ hbool_t internal_dirtied;
H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
unsigned u; /* Local index variable */
+ internal_dirtied = FALSE;
+
/* Lock B-tree current node */
if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), bt2_shared, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
@@ -3184,7 +3473,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[u];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -3199,14 +3488,14 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for current record */
if ((op)(H5B2_INT_NREC(internal,shared,u), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -3225,7 +3514,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[u];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -3241,6 +3530,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end while */
{
+ hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
/* Lock B-tree leaf node */
@@ -3253,14 +3543,14 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make callback for correct record */
if ((op)(H5B2_LEAF_NREC(leaf,shared,idx), op_data) <0) {
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation")
} /* end if */
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
}
@@ -3284,12 +3574,20 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 3 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
+ hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node */
haddr_t leaf_addr=HADDR_UNDEF; /* Leaf address on disk */
unsigned leaf_unprotect_flags=H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */
@@ -3330,7 +3628,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
leaf->nrec--;
/* Mark leaf node as dirty also */
- leaf->cache_info.is_dirty = TRUE;
+ leaf_dirtied = TRUE;
if(leaf->nrec > 0) {
/* Pack record out of leaf */
@@ -3354,7 +3652,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree leaf node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_unprotect_flags) < 0)
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_dirtied, leaf_unprotect_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3372,15 +3670,29 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 3 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/14/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new
+ * parent_cache_info_dirtied_ptr parameter to the
+ * function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
hbool_t *depth_decreased, void *swap_loc, unsigned depth,
- H5AC_info_t *parent_cache_info, H5B2_node_ptr_t *curr_node_ptr, void *udata)
+ H5AC_info_t *parent_cache_info, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, void *udata)
{
+ hbool_t *new_cache_info_dirtied_ptr = NULL;
H5AC_info_t *new_cache_info; /* Pointer to new cache info */
H5B2_node_ptr_t *new_node_ptr; /* Pointer to new node pointer */
+ hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node */
haddr_t internal_addr; /* Address of internal node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -3397,6 +3709,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HDassert(bt2_shared);
HDassert(depth>0);
HDassert(parent_cache_info);
+ HDassert(parent_cache_info_dirtied_ptr);
HDassert(curr_node_ptr);
HDassert(H5F_addr_defined(curr_node_ptr->addr));
@@ -3421,7 +3734,9 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) {
/* Merge children of root node */
- if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,0)<0)
+ if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,
+ internal,&internal_dirtied,0)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
/* Release space for root B-tree node on disk */
@@ -3440,6 +3755,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Set pointers for advancing to child node */
new_cache_info = parent_cache_info;
+ new_cache_info_dirtied_ptr = parent_cache_info_dirtied_ptr;
new_node_ptr = curr_node_ptr;
/* Set flag to indicate root was collapsed */
@@ -3476,7 +3792,9 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,idx)<0)
+ if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,
+ internal,&internal_dirtied,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
@@ -3486,18 +3804,22 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,(idx-1))<0)
+ if(H5B2_merge2(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,
+ internal,&internal_dirtied,(idx-1))<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end if */
else { /* Middle child */
if(retries>0 && ((internal->node_ptrs[idx+1].node_nrec > merge_nrec) ||
(internal->node_ptrs[idx-1].node_nrec > merge_nrec))) {
- if(H5B2_redistribute3(f,dxpl_id,depth,internal,idx)<0)
+ if(H5B2_redistribute3(f,dxpl_id,depth,internal,&internal_dirtied,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records")
} /* end if */
else {
- if(H5B2_merge3(f,dxpl_id,depth,curr_node_ptr,parent_cache_info,internal,idx)<0)
+ if(H5B2_merge3(f,dxpl_id,depth,curr_node_ptr,
+ parent_cache_info_dirtied_ptr,internal,
+ &internal_dirtied,idx)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node")
} /* end else */
} /* end else */
@@ -3522,17 +3844,19 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
/* Swap record to delete with record from leaf, if we are the last internal node */
if(swap_loc && depth==1)
- if(H5B2_swap_leaf(f,dxpl_id,depth,internal,idx,swap_loc) < 0)
+ if(H5B2_swap_leaf(f,dxpl_id,depth,internal,&internal_dirtied,idx,swap_loc) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree")
/* Set pointers for advancing to child node */
+ new_cache_info_dirtied_ptr = &internal_dirtied;
new_cache_info = &internal->cache_info;
new_node_ptr = &internal->node_ptrs[idx];
} /* end else */
/* Attempt to remove node */
if(depth>1) {
- if(H5B2_remove_internal(f,dxpl_id,bt2_shared,depth_decreased, swap_loc, depth-1,new_cache_info,new_node_ptr,udata)<0)
+ if(H5B2_remove_internal(f,dxpl_id,bt2_shared,depth_decreased, swap_loc, depth-1,
+ new_cache_info,new_cache_info_dirtied_ptr,new_node_ptr,udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
} /* end if */
else {
@@ -3545,7 +3869,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
new_node_ptr->all_nrec--;
/* Mark node as dirty */
- internal->cache_info.is_dirty = TRUE;
+ internal_dirtied = TRUE;
#ifdef H5B2_DEBUG
H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec-1) : new_node_ptr->all_nrec),shared,internal);
@@ -3553,7 +3877,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_unprotect_flags) < 0)
+ if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, internal_addr, internal, internal_dirtied, internal_unprotect_flags) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3571,12 +3895,20 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 25 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/15/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
herr_t ret_value = SUCCEED;
@@ -3604,7 +3936,8 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
if(bt2->depth>0) {
hbool_t depth_decreased=FALSE; /* Flag to indicate whether the depth of the B-tree decreased */
- if(H5B2_remove_internal(f,dxpl_id,bt2->shared, &depth_decreased, NULL, bt2->depth,&(bt2->cache_info),&bt2->root,udata)<0)
+ if(H5B2_remove_internal(f,dxpl_id,bt2->shared, &depth_decreased, NULL, bt2->depth,
+ &(bt2->cache_info),&bt2_dirtied,&bt2->root,udata)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node")
bt2->depth -= depth_decreased;
@@ -3618,11 +3951,11 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
bt2->root.all_nrec--;
/* Mark parent node as dirty */
- bt2->cache_info.is_dirty = TRUE;
+ bt2_dirtied = TRUE;
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3640,12 +3973,20 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 25 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
hsize_t *nrec)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -3666,7 +4007,7 @@ H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
done:
/* Release B-tree header node */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3697,6 +4038,13 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3704,6 +4052,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data)
{
+ hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
@@ -3759,7 +4108,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3790,6 +4139,13 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3797,6 +4153,7 @@ H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data)
{
+ hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
unsigned idx; /* Location of record which matches key */
@@ -3850,7 +4207,7 @@ H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
done:
/* Release the B-tree internal node */
- if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3880,12 +4237,20 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 8 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -3917,7 +4282,7 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3936,6 +4301,13 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3944,6 +4316,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
{
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
const H5AC_class_t *curr_node_class=NULL; /* Pointer to current node's class info */
+ hbool_t node_dirtied = FALSE;
void *node=NULL; /* Pointers to current node */
herr_t ret_value = SUCCEED;
@@ -3994,7 +4367,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
done:
/* Unlock & delete current node */
if(node)
- if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__DELETED_FLAG) < 0)
+ if (H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, node_dirtied, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -4012,11 +4385,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED;
@@ -4042,7 +4423,7 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr)
done:
/* Release the B-tree header info */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__DELETED_FLAG) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to delete B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -4066,12 +4447,20 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata, H5B2_modify_t op, void *op_data)
{
+ hbool_t bt2_dirtied = FALSE;
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
@@ -4106,7 +4495,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
depth=bt2->depth;
/* Release header */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
bt2=NULL;
@@ -4121,6 +4510,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Walk down B-tree to find record or leaf node where record is located */
cmp = -1;
while(depth>0 && cmp != 0) {
+ hbool_t internal_dirtied = FALSE;
H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
@@ -4138,7 +4528,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
next_node_ptr=internal->node_ptrs[idx];
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Set pointer to next node to load */
@@ -4151,19 +4541,20 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
if ( (op)(H5B2_INT_NREC(internal,shared,idx), op_data, &changed) <0) {
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed==FALSE);
+ internal_dirtied = changed;
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
} /* end if */
/* Mark the node as dirty if it changed */
- internal->cache_info.is_dirty = changed;
+ internal_dirtied = changed;
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_DONE(SUCCEED);
@@ -4174,6 +4565,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end while */
{
+ hbool_t leaf_dirtied = FALSE;
H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
hbool_t changed; /* Whether the 'modify' callback changed the record */
@@ -4186,7 +4578,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
if(cmp != 0) {
/* Unlock leaf node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
/* Note: don't push error on stack, leave that to next higher level,
@@ -4205,8 +4597,10 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Make certain that the callback didn't modify the value if it failed */
HDassert(changed==FALSE);
+ leaf_dirtied = changed;
+
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree find operation")
@@ -4214,10 +4608,10 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
} /* end else */
/* Mark the node as dirty if it changed */
- leaf->cache_info.is_dirty = changed;
+ leaf_dirtied = changed;
/* Unlock current node */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
}
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index b73bf49..d308bdb 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -43,12 +43,20 @@
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -129,7 +137,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -147,13 +155,22 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 4 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -188,7 +205,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, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
bt2 = NULL;
@@ -241,7 +258,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, H5AC__NO_FLAGS_SET) < 0)
+ if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, internal_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node")
FUNC_LEAVE_NOAPI(ret_value)
@@ -259,13 +276,22 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 7 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -300,7 +326,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, H5AC__NO_FLAGS_SET) < 0)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
bt2 = NULL;
@@ -337,7 +363,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, H5AC__NO_FLAGS_SET) < 0)
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, leaf_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5B2test.c b/src/H5B2test.c
index cac5e30..5469e5d 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -228,12 +228,18 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i
*
* Modifications:
*
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -254,7 +260,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, bt2_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5BT.c b/src/H5BT.c
index 20c35a7..5ee8a00 100644
--- a/src/H5BT.c
+++ b/src/H5BT.c
@@ -69,6 +69,16 @@ H5FL_DEFINE(H5BT_t);
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ *
+ * John Mainzer 6/8/05
+ * Removed code setting the is_dirty field of the cache info.
+ * This is no longer pemitted, as the cache code is now
+ * manageing this field. Since this function uses a call to
+ * H5AC_set() (which marks the entry dirty automaticly), no
+ * other change is required.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -91,7 +101,6 @@ H5BT_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block tracker info")
/* Assign internal information */
- bt->cache_info.is_dirty = TRUE;
bt->max_block_size = 0; /* Indicate that the value is invalid */
bt->min_block_size = HSIZET_MAX; /* Indicate that the value is invalid */
@@ -190,11 +199,19 @@ H5BT_insert_modify_cb(void *_record, void *_op_data, hbool_t *changed)
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
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? */
@@ -405,7 +422,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -423,11 +440,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -449,7 +474,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -498,11 +523,19 @@ H5BT_remove_find_cb(const void *_record, void *_op_data)
* koziol@ncsa.uiuc.edu
* Mar 11 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
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 */
@@ -645,7 +678,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -700,11 +733,19 @@ H5BT_locate_cb(const void *_record, void *_op_data)
* koziol@ncsa.uiuc.edu
* Mar 24 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -739,7 +780,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -760,11 +801,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 25 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -787,7 +836,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -836,12 +885,20 @@ H5BT_neighbor_cb(const void *_record, void *_op_data)
* koziol@ncsa.uiuc.edu
* Mar 28 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -873,7 +930,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -891,11 +948,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 14 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -921,7 +986,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, H5AC__DELETED_FLAG) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5BTdbg.c b/src/H5BTdbg.c
index 16c497b..9079083 100644
--- a/src/H5BTdbg.c
+++ b/src/H5BTdbg.c
@@ -42,11 +42,19 @@
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -96,7 +104,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5BTtest.c b/src/H5BTtest.c
index 974cfb3..61d25b9 100644
--- a/src/H5BTtest.c
+++ b/src/H5BTtest.c
@@ -45,12 +45,18 @@
*
* Modifications:
*
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -74,7 +80,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -95,12 +101,18 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -124,7 +136,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, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5C.c b/src/H5C.c
index 28cb17a..663ee36 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1437,88 +1437,107 @@ if ( ( (cache_ptr) == NULL ) || \
* dirty LRU lists, and the other not. Yet another attempt
* at optimization.
*
+ * JRM - 6/23/05
+ * Added the was_dirty parameter. It is possible that
+ * the entry was clean when it was renamed -- if so it
+ * it is in the clean LRU regardless of the current
+ * value of the is_dirty field.
+ *
+ * At present, all renamed entries are forced to be
+ * dirty. This macro is a bit more general that that,
+ * to allow it to function correctly should that policy
+ * be relaxed in the future.
+ *
*-------------------------------------------------------------------------
*/
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
-#define H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, fail_val) \
-{ \
- HDassert( (cache_ptr) ); \
- HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
- HDassert( (entry_ptr) ); \
- HDassert( !((entry_ptr)->is_protected) ); \
- HDassert( (entry_ptr)->size > 0 ); \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the head. */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* move the entry to the head of either the clean or dirty LRU list \
- * as appropriate. \
- */ \
- \
- if ( (entry_ptr)->is_dirty ) { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
- (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, \
- (cache_ptr)->dLRU_list_size, (fail_val)) \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
- (cache_ptr)->dLRU_tail_ptr, \
- (cache_ptr)->dLRU_list_len, \
- (cache_ptr)->dLRU_list_size, (fail_val)) \
- \
- } else { \
- \
- H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
- (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, \
- (cache_ptr)->cLRU_list_size, (fail_val)) \
- \
- H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
- (cache_ptr)->cLRU_tail_ptr, \
- (cache_ptr)->cLRU_list_len, \
- (cache_ptr)->cLRU_list_size, (fail_val)) \
- } \
- \
- /* End modified LRU specific code. */ \
- \
+#define H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, was_dirty, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the head. */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* remove the entry from either the clean or dirty LUR list as \
+ * indicated by the was_dirty parameter \
+ */ \
+ if ( was_dirty ) { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* insert the entry at the head of either the clean or dirty LRU list \
+ * as appropriate. \
+ */ \
+ \
+ if ( (entry_ptr)->is_dirty ) { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
+ (cache_ptr)->dLRU_tail_ptr, \
+ (cache_ptr)->dLRU_list_len, \
+ (cache_ptr)->dLRU_list_size, (fail_val)) \
+ \
+ } else { \
+ \
+ H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
+ (cache_ptr)->cLRU_tail_ptr, \
+ (cache_ptr)->cLRU_list_len, \
+ (cache_ptr)->cLRU_list_size, (fail_val)) \
+ } \
+ \
+ /* End modified LRU specific code. */ \
+ \
} /* H5C__UPDATE_RP_FOR_RENAME */
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
-#define H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, fail_val) \
-{ \
- HDassert( (cache_ptr) ); \
- HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
- HDassert( (entry_ptr) ); \
- HDassert( !((entry_ptr)->is_protected) ); \
- HDassert( (entry_ptr)->size > 0 ); \
- \
- /* modified LRU specific code */ \
- \
- /* remove the entry from the LRU list, and re-insert it at the head. */ \
- \
- H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
- (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
- (cache_ptr)->LRU_list_size, (fail_val)) \
- \
- /* End modified LRU specific code. */ \
- \
+#define H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, was_dirty, fail_val) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ \
+ /* modified LRU specific code */ \
+ \
+ /* remove the entry from the LRU list, and re-insert it at the head. */ \
+ \
+ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
+ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
+ (cache_ptr)->LRU_list_size, (fail_val)) \
+ \
+ /* End modified LRU specific code. */ \
+ \
} /* H5C__UPDATE_RP_FOR_RENAME */
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
@@ -2821,6 +2840,11 @@ done:
* H5C__SET_FLUSH_MARKER_FLAG. Note that this flag is
* ignored unless the new entry is dirty.
*
+ * JRM -- 6/6/05
+ * Added code to force all inserted entries to be dirty.
+ * This is part of a set of changes moving management of the
+ * is_dirty field of H5C_cache_entry_t into the H5C code.
+ *
*-------------------------------------------------------------------------
*/
@@ -2860,6 +2884,9 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->addr = addr;
entry_ptr->type = type;
+ /* newly inserted entries are assumed to be dirty */
+ entry_ptr->is_dirty = TRUE;
+
if ( (type->size)(f, thing, &(entry_ptr->size)) < 0 ) {
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \
@@ -2979,6 +3006,10 @@ H5C_insert_entry(H5F_t * f,
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
+ /* New entries are presumed to be dirty, so this if statement is
+ * unnecessary. Rework it once the rest of the code changes are
+ * in and tested. -- JRM
+ */
if ( entry_ptr->is_dirty ) {
entry_ptr->flush_marker = set_flush_marker;
@@ -3017,6 +3048,12 @@ done:
* JRM -- 7/21/04
* Updated function for the addition of the hash table.
*
+ * JRM -- 6/6/05
+ * Updated function to force all renamed entries to be
+ * dirty. This is part of a series of code modifications
+ * moving management of the is_dirty field of
+ * H5C_cache_entry_t into the H5C code.
+ *
*-------------------------------------------------------------------------
*/
@@ -3027,6 +3064,7 @@ H5C_rename_entry(H5C_t * cache_ptr,
haddr_t new_addr)
{
herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t was_dirty;
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * test_entry_ptr = NULL;
@@ -3063,12 +3101,13 @@ H5C_rename_entry(H5C_t * cache_ptr,
HGOTO_ERROR(H5E_CACHE, H5E_CANTRENAME, FAIL, \
"New address already in use?.")
+
}
}
/* If we get this far, we have work to do. Remove *entry_ptr from
* the hash table (and skip list if necessary), change its address to the
- * new address, and then re-insert.
+ * new address, mark it as dirty (if it isn't already) and then re-insert.
*
* Update the replacement policy for a hit to avoid an eviction before
* the renamed entry is touched. Update stats for a rename.
@@ -3076,6 +3115,7 @@ H5C_rename_entry(H5C_t * cache_ptr,
* Note that we do not check the size of the cache, or evict anything.
* Since this is a simple re-name, cache size should be unaffected.
*/
+
H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr)
if ( entry_ptr->in_slist ) {
@@ -3086,15 +3126,21 @@ H5C_rename_entry(H5C_t * cache_ptr,
}
entry_ptr->addr = new_addr;
+ was_dirty = entry_ptr->is_dirty;
+ entry_ptr->is_dirty = TRUE;
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
+ /* remove this if statement once this set of mods
+ * is up and running. -- JRM
+ */
+
if ( entry_ptr->is_dirty ) {
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr)
}
- H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, FAIL)
+ H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, was_dirty, FAIL)
H5C__UPDATE_STATS_FOR_RENAME(cache_ptr, entry_ptr)
@@ -3162,14 +3208,14 @@ done:
*/
void *
-H5C_protect(H5F_t * f,
- hid_t primary_dxpl_id,
- hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
+H5C_protect(H5F_t * f,
+ hid_t primary_dxpl_id,
+ hid_t secondary_dxpl_id,
+ H5C_t * cache_ptr,
const H5C_class_t * type,
- haddr_t addr,
- const void * udata1,
- void * udata2)
+ haddr_t addr,
+ const void * udata1,
+ void * udata2)
{
hbool_t hit = FALSE;
hbool_t first_flush = TRUE;
@@ -4124,6 +4170,12 @@ H5C_stats__reset(H5C_t * cache_ptr)
* once the flush_marker field of an entry is set, the
* only way it can be reset is by being flushed.
*
+ * JRM -- 6/3/05
+ * Added the dirtied parameter and supporting code. This
+ * is part of an effort to move management of the is_dirty
+ * field into the cache code. This has become necessary
+ * to repair a cache coherency bug in PHDF5.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4134,6 +4186,7 @@ H5C_unprotect(H5F_t * f,
const H5C_class_t * type,
haddr_t addr,
void * thing,
+ hbool_t dirtied,
unsigned int flags)
{
hbool_t deleted;
@@ -4167,6 +4220,9 @@ H5C_unprotect(H5F_t * f,
"Entry already unprotected??")
}
+ /* mark the entry as dirty if appropriate */
+ entry_ptr->is_dirty = ( (entry_ptr->is_dirty) || dirtied );
+
H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, FAIL)
entry_ptr->is_protected = FALSE;
@@ -5761,6 +5817,101 @@ H5C_flush_single_entry(H5F_t * f,
*/
if ( destroy ) { /* AKA eviction */
+#if 0 /* JRM */
+ /* This test code may come in handy -- lets keep it for a while */
+ {
+ if ( entry_ptr->is_dirty )
+ {
+ if ( cache_ptr->dLRU_head_ptr == NULL )
+ HDfprintf(stdout,"cache_ptr->dLRU_head_ptr == NULL.\n");
+
+ if ( cache_ptr->dLRU_tail_ptr == NULL )
+ HDfprintf(stdout,"cache_ptr->dLRU_tail_ptr == NULL.\n");
+
+ if ( cache_ptr->dLRU_list_len <= 0 )
+ HDfprintf(stdout,"cache_ptr->dLRU_list_len <= 0.\n");
+
+ if ( cache_ptr->dLRU_list_size <= 0 )
+ HDfprintf(stdout,"cache_ptr->dLRU_list_size <= 0.\n");
+
+ if ( cache_ptr->dLRU_list_size < entry_ptr->size )
+ HDfprintf(stdout,
+ "cache_ptr->dLRU_list_size < entry_ptr->size.\n");
+
+ if ( ( (cache_ptr->dLRU_list_size) == entry_ptr->size ) &&
+ ( ! ( (cache_ptr->dLRU_list_len) == 1 ) ) )
+ HDfprintf(stdout,
+ "dLRU_list_size == size && dLRU_list_len != 1\n");
+
+ if ( ( entry_ptr->aux_prev == NULL ) &&
+ ( cache_ptr->dLRU_head_ptr != entry_ptr ) )
+ HDfprintf(stdout, "entry_ptr->aux_prev == NULL && dLRU_head_ptr != entry_ptr\n");
+
+ if ( ( entry_ptr->aux_next == NULL ) &&
+ ( cache_ptr->dLRU_tail_ptr != entry_ptr ) )
+ HDfprintf(stdout, "entry_ptr->aux_next == NULL && dLRU_tail_ptr != entry_ptr\n");
+
+ if ( ( cache_ptr->dLRU_list_len == 1 ) &&
+ ( ! ( ( cache_ptr->dLRU_head_ptr == entry_ptr ) &&
+ ( cache_ptr->dLRU_tail_ptr == entry_ptr ) &&
+ ( entry_ptr->aux_next == NULL ) &&
+ ( entry_ptr->aux_prev == NULL ) &&
+ ( cache_ptr->dLRU_list_size == entry_ptr->size )
+ )
+ )
+ )
+ {
+ HDfprintf(stdout, "single entry dlru sanity check fails\n");
+ }
+
+ }
+ else
+ {
+ if ( cache_ptr->cLRU_head_ptr == NULL )
+ HDfprintf(stdout,"cache_ptr->cLRU_head_ptr == NULL.\n");
+
+ if ( cache_ptr->cLRU_tail_ptr == NULL )
+ HDfprintf(stdout,"cache_ptr->cLRU_tail_ptr == NULL.\n");
+
+ if ( cache_ptr->cLRU_list_len <= 0 )
+ HDfprintf(stdout,"cache_ptr->cLRU_list_len <= 0.\n");
+
+ if ( cache_ptr->cLRU_list_size <= 0 )
+ HDfprintf(stdout,"cache_ptr->cLRU_list_size <= 0.\n");
+
+ if ( cache_ptr->cLRU_list_size < entry_ptr->size )
+ HDfprintf(stdout,
+ "cache_ptr->cLRU_list_size < entry_ptr->size.\n");
+
+ if ( ( (cache_ptr->cLRU_list_size) == entry_ptr->size ) &&
+ ( ! ( (cache_ptr->cLRU_list_len) == 1 ) ) )
+ HDfprintf(stdout,
+ "cLRU_list_size == size && cLRU_list_len != 1\n");
+
+ if ( ( entry_ptr->aux_prev == NULL ) &&
+ ( cache_ptr->cLRU_head_ptr != entry_ptr ) )
+ HDfprintf(stdout, "entry_ptr->aux_prev == NULL && cLRU_head_ptr != entry_ptr\n");
+
+ if ( ( entry_ptr->aux_next == NULL ) &&
+ ( cache_ptr->cLRU_tail_ptr != entry_ptr ) )
+ HDfprintf(stdout, "entry_ptr->aux_next == NULL && cLRU_tail_ptr != entry_ptr\n");
+
+ if ( ( cache_ptr->cLRU_list_len == 1 ) &&
+ ( ! ( ( cache_ptr->cLRU_head_ptr == entry_ptr ) &&
+ ( cache_ptr->cLRU_tail_ptr == entry_ptr ) &&
+ ( entry_ptr->aux_next == NULL ) &&
+ ( entry_ptr->aux_prev == NULL ) &&
+ ( cache_ptr->cLRU_list_size == entry_ptr->size )
+ )
+ )
+ )
+ {
+ HDfprintf(stdout, "single entry clru sanity check fails\n");
+ }
+ }
+ }
+#endif /* JRM */
+
H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
} else {
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 9f8dd78..6ae0604 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -767,6 +767,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);
H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
diff --git a/src/H5D.c b/src/H5D.c
index 0f12a93..a3741ea 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1818,12 +1818,18 @@ done:
* Thursday, October 31, 2002
*
* Modifications:
+ *
+ * John Mainzer 6/6/05
+ * Modified function to use the new dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
*
*-------------------------------------------------------------------------
*/
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 */
@@ -1930,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) < 0)
+ if (H5O_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_FLAG_CONSTANT, &fill, &oh_dirtied) < 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 */
@@ -1944,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) < 0)
+ if (fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_FLAG_CONSTANT, fill_prop, &oh_dirtied) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
/* Update dataset creation property */
@@ -1954,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) < 0 ||
- H5S_append(file, dxpl_id, oh, space) < 0)
+ 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)
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 */
@@ -1965,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) < 0)
+ if (pline.nused > 0 && H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_FLAG_CONSTANT, &pline, &oh_dirtied) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
@@ -2001,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) < 0)
+ if (H5O_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_FLAG_CONSTANT, efl, &oh_dirtied) < 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) < 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_dirtied) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
#ifdef H5O_ENABLE_BOGUS
@@ -2020,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) < 0)
+ if (H5O_touch_oh(file, oh, TRUE, &oh_dirtied) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
done:
@@ -2030,7 +2036,7 @@ done:
/* Release pointer to object header itself */
if(ent!=NULL && oh!=NULL)
- if(H5O_unprotect(ent,oh, dxpl_id)<0)
+ if(H5O_unprotect(ent,oh, dxpl_id, oh_dirtied)<0)
HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to unprotect dataset object header")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5G.c b/src/H5G.c
index 5c19ced..4a37da3 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -1698,6 +1698,11 @@ done:
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
* Added `id to name' support.
*
+ * John Mainzer - 6/8/05
+ * Modified function to use the new dirtied parmeter of
+ * H5AC_unprotect(), which allows management of the is_dirty
+ * field of the cache info to be moved into the cache code.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1710,6 +1715,7 @@ 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;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1730,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) < 0)
+ if (H5HL_unprotect(grp_ent->file, dxpl_id, heap, stab_mesg.heap_addr, dirtied) < 0)
HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
/* Hold the entry's name (& old_name) to restore later */
@@ -2781,6 +2787,11 @@ done:
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
* Added `id to name' support.
*
+ * John Mainzer - 6/8/05
+ * Modified function to use the new dirtied parmeter of
+ * H5AC_unprotect(), which allows management of the is_dirty
+ * field of the cache info to be moved into the cache code.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2810,6 +2821,7 @@ 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;
/* Named object is a symbolic link */
@@ -2823,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) < 0)
+ if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, dirtied) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
statbuf->objno = 0;
@@ -3040,6 +3052,11 @@ done:
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
* Added `id to name' support.
*
+ * John Mainzer - 6/8/05
+ * Modified function to use the new dirtied parmeter of
+ * H5AC_unprotect(), which allows management of the is_dirty
+ * field of the cache info to be moved into the cache code.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3048,6 +3065,7 @@ 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;
herr_t ret_value=SUCCEED; /* Return value */
@@ -3079,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) < 0)
+ if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr, dirtied) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
done:
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 08b3988..181d816 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -496,7 +496,7 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str
HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"Link value:",
lval);
- H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap);
+ H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, FALSE);
}
else
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!");
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 3223557..9cfabe3 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -315,7 +315,7 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt
s = H5HL_offset_into(f, heap, key->offset);
HDfprintf (stream, "%s\n", s);
- if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
done:
@@ -718,6 +718,13 @@ H5G_compute_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr)
*
* Modifications:
*
+ * John Mainzer 6/8/05
+ * Removed code setting the is_dirty field of the cache info.
+ * This is no longer pemitted, as the cache code is now
+ * manageing this field. Since this function uses a call to
+ * H5AC_set() (which marks the entry dirty automaticly), no
+ * other change is required.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -743,7 +750,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
size = H5G_node_size(f);
if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space");
- sym->cache_info.is_dirty = TRUE;
+
sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f)));
if (NULL==sym->entry)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
@@ -827,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) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
FUNC_LEAVE_NOAPI(ret_value);
@@ -891,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) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
FUNC_LEAVE_NOAPI(ret_value);
@@ -925,6 +932,12 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -932,6 +945,7 @@ 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;
@@ -976,7 +990,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -994,7 +1008,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,
- H5AC__NO_FLAGS_SET) < 0)
+ sn_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1036,6 +1050,12 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static H5B_ins_t
@@ -1048,6 +1068,7 @@ 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;
const H5HL_t *heap = NULL;
size_t offset; /*offset of name in heap */
@@ -1093,7 +1114,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1108,7 +1129,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1139,13 +1160,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->cache_info.is_dirty = TRUE;
+ snrt_dirtied = TRUE;
/* 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->cache_info.is_dirty = TRUE;
+ sn_dirtied = TRUE;
/* The middle key */
md_key->offset = sn->entry[sn->nsyms - 1].name_off;
@@ -1166,7 +1187,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->cache_info.is_dirty = TRUE;
+ sn_dirtied = TRUE;
insert_into = sn;
if (idx == sn->nsyms) {
rt_key->offset = offset;
@@ -1184,10 +1205,10 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
done:
if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt,
- H5AC__NO_FLAGS_SET) < 0)
+ snrt_dirtied, H5AC__NO_FLAGS_SET) < 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,
- H5AC__NO_FLAGS_SET) < 0)
+ sn_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1230,6 +1251,11 @@ done:
* Quincey Koziol, 2003-03-22
* Added support for deleting all the entries at once.
*
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
static H5B_ins_t
@@ -1241,6 +1267,7 @@ 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;
const H5HL_t *heap = NULL;
int lt=0, rt, idx=0, cmp=1;
@@ -1285,7 +1312,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1305,7 +1332,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; s=NULL;
@@ -1333,7 +1360,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; s=NULL;
@@ -1354,9 +1381,9 @@ 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->cache_info.is_dirty = TRUE;
+ 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, H5C__DELETED_FLAG)<0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5C__DELETED_FLAG)<0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node");
}
@@ -1370,7 +1397,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
* change.
*/
sn->nsyms -= 1;
- sn->cache_info.is_dirty = TRUE;
+ sn_dirtied = TRUE;
HDmemmove(sn->entry+idx, sn->entry+idx+1,
(sn->nsyms-idx)*sizeof(H5G_entry_t));
ret_value = H5B_INS_NOOP;
@@ -1382,7 +1409,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->cache_info.is_dirty = TRUE;
+ sn_dirtied = TRUE;
rt_key->offset = sn->entry[sn->nsyms-1].name_off;
*rt_key_changed = TRUE;
ret_value = H5B_INS_NOOP;
@@ -1393,7 +1420,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
* node.
*/
sn->nsyms -= 1;
- sn->cache_info.is_dirty = TRUE;
+ sn_dirtied = TRUE;
HDmemmove(sn->entry+idx, sn->entry+idx+1,
(sn->nsyms-idx)*sizeof(H5G_entry_t));
ret_value = H5B_INS_NOOP;
@@ -1420,9 +1447,9 @@ 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->cache_info.is_dirty = TRUE;
+ 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, H5C__DELETED_FLAG)<0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5C__DELETED_FLAG)<0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node");
}
@@ -1432,7 +1459,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
done:
if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn,
- H5AC__NO_FLAGS_SET)<0)
+ sn_dirtied, H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1456,6 +1483,12 @@ done:
*
* Quincey Koziol, 2002-04-22
* Changed to callback from H5B_iterate
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
int
@@ -1463,6 +1496,7 @@ 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;
@@ -1492,7 +1526,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, H5AC__NO_FLAGS_SET)
+ if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5AC__NO_FLAGS_SET)
!= SUCCEED) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
@@ -1522,7 +1556,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
@@ -1539,10 +1573,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) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 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,
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
@@ -1566,6 +1600,11 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
int
@@ -1573,6 +1612,7 @@ 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;
@@ -1592,7 +1632,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,
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
@@ -1614,6 +1654,11 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
int
@@ -1625,6 +1670,7 @@ 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;
@@ -1653,7 +1699,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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
@@ -1663,7 +1709,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,
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
@@ -1683,6 +1729,12 @@ done:
* Programmer: Raymond Lu
* Nov 20, 2002
*
+ * Modifications:
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
*
*-------------------------------------------------------------------------
*/
@@ -1692,6 +1744,7 @@ 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;
@@ -1715,7 +1768,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,
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
@@ -1861,6 +1914,12 @@ H5G_node_shared_free (void *_shared)
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR and HEAP arguments are passed by value.
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1868,6 +1927,7 @@ 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;
@@ -1921,7 +1981,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
if (s)
fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s);
- if (H5HL_unprotect(f, dxpl_id, heap_ptr, heap) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap_ptr, heap, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
heap_ptr=NULL; s=NULL;
}
@@ -1932,7 +1992,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,
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node");
diff --git a/src/H5HG.c b/src/H5HG.c
index a72752b..16c4515 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -181,6 +181,13 @@ H5FL_BLK_DEFINE_STATIC(heap_chunk);
* moved the code which places the new collection on the cwfs
* list to just before the call to H5AC_set().
*
+ * John Mainzer 6/8/05
+ * Removed code setting the is_dirty field of the cache info.
+ * This is no longer pemitted, as the cache code is now
+ * manageing this field. Since this function uses a call to
+ * H5AC_set() (which marks the entry dirty automaticly), no
+ * other change is required.
+ *
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -211,7 +218,7 @@ H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size)
"memory allocation failed");
heap->addr = addr;
heap->size = size;
- heap->cache_info.is_dirty = TRUE;
+
if (NULL==(heap->chunk = H5FL_BLK_MALLOC (heap_chunk,size)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \
"memory allocation failed");
@@ -657,10 +664,18 @@ H5HG_compute_size(const H5F_t UNUSED *f, const H5HG_heap_t *heap, size_t *size_p
*
* Modifications:
*
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new heap_dirtied_ptr
+ * parameter to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static size_t
-H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size)
+H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_ptr)
{
size_t idx;
uint8_t *p = NULL;
@@ -672,6 +687,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size)
/* Check args */
assert (heap);
assert (heap->obj[0].size>=need);
+ assert (heap_dirtied_ptr);
/*
* Find an ID for the new object. ID zero is reserved for the free space
@@ -747,7 +763,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size)
}
/* Mark the heap as dirty */
- heap->cache_info.is_dirty = TRUE;
+ *heap_dirtied_ptr = TRUE;
/* Set the return value */
ret_value=idx;
@@ -774,10 +790,18 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
+ * In this case, that required adding the new heap_dirtied_ptr
+ * parameter to the function's argument list.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size)
+H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size, hbool_t * heap_dirtied_ptr)
{
size_t need; /* Actual space needed to store object */
size_t old_size; /* Previous size of the heap's chunk */
@@ -791,6 +815,7 @@ H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size)
/* Check args */
assert (f);
assert (heap);
+ assert (heap_dirtied_ptr);
/* Compute total space need to add to this heap */
need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
@@ -841,7 +866,7 @@ HDmemset(new_chunk+heap->size,0,need);
assert(H5HG_ISALIGNED(heap->obj[0].size));
/* Mark the heap as dirty */
- heap->cache_info.is_dirty = TRUE;
+ *heap_dirtied_ptr = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -887,6 +912,11 @@ done:
* entry inserted in it via H5AC_set(). I then modified
* this function to account for the change in H5HG_create().
*
+ * John Mainzer - 6/8/05
+ * Modified function to use the dirtied parameter of
+ * H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -896,6 +926,7 @@ 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;
hbool_t found=0; /* Flag to indicate a heap with enough space was found */
herr_t ret_value=SUCCEED; /* Return value */
@@ -959,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)<0)
+ if(H5HG_extend(f,f->shared->cwfs[cwfsno],size,&heap_dirtied)<0)
HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, FAIL, "unable to extend global heap collection");
addr = f->shared->cwfs[cwfsno]->addr;
found=1;
@@ -1000,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);
+ idx = H5HG_alloc (f, heap, size, &heap_dirtied);
/* Copy data into the heap */
if(size>0) {
@@ -1011,7 +1042,7 @@ 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->cache_info.is_dirty = TRUE;
+ heap_dirtied = TRUE;
/* Return value */
hobj->addr = heap->addr;
@@ -1019,7 +1050,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*
done:
if ( heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, heap->addr, heap,
- H5AC__NO_FLAGS_SET) < 0 )
+ heap_dirtied, H5AC__NO_FLAGS_SET) < 0 )
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to unprotect heap.");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1043,11 +1074,17 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -1092,7 +1129,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,
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_dirtied,
H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
@@ -1118,11 +1155,17 @@ done:
*
* Modifications:
*
+ * John Mainzer - 6/8/05
+ * Modified function to use the dirtied parameter of
+ * H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
int ret_value; /* Return value */
@@ -1146,7 +1189,7 @@ 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->cache_info.is_dirty = TRUE;
+ heap_dirtied = TRUE;
} /* end if */
/* Set return value */
@@ -1154,7 +1197,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust)
done:
if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap,
- H5AC__NO_FLAGS_SET)<0)
+ heap_dirtied, H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1173,12 +1216,18 @@ done:
*
* Modifications:
*
+ * John Mainzer - 6/8/05
+ * Modified function to use the dirtied parameter of
+ * H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -1226,14 +1275,14 @@ 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->cache_info.is_dirty = TRUE;
+ heap_dirtied = TRUE;
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->cache_info.is_dirty = FALSE;
+ 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 */
@@ -1259,7 +1308,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, flags) != SUCCEED)
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_dirtied, flags) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c
index 4444fdb..9de8268 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -44,6 +44,12 @@
*
* Robb Matzke, LLNL, 2003-06-05
* The size does not include the object header, just the data.
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -52,6 +58,7 @@ 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;
@@ -125,7 +132,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, FALSE) != SUCCEED)
+ if (h && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, addr, h, h_dirtied, FALSE) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5HL.c b/src/H5HL.c
index eba6a5a..ca26266 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -118,6 +118,9 @@ H5FL_BLK_DEFINE_STATIC(heap_chunk);
* Takes a flag that determines the type of heap that is
* created.
*
+ * John Mainzer, 6/7/05
+ * Removed code modifying the is_dirty field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -168,7 +171,6 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)
}
/* add to cache */
- heap->cache_info.is_dirty = TRUE;
if (H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap");
@@ -762,7 +764,7 @@ H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, voi
done:
if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ FALSE, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -868,10 +870,18 @@ H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset)
*
* Modifications:
*
+ * John Mainzer - 6/8/05/
+ * Modified function to use the new dirtied parmeter of
+ * H5AC_unprotect(), which allows management of the is_dirty
+ * field of the cache info to be moved into the cache code.
+ *
+ * This required the addition of the heap_dirtied parameter
+ * to the function's parameter list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr)
+H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr, hbool_t heap_dirtied)
{
herr_t ret_value = SUCCEED;
@@ -882,7 +892,7 @@ H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap, haddr_t addr)
assert(heap);
assert(H5F_addr_defined(addr));
- if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap,
+ if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap, heap_dirtied,
H5AC__NO_FLAGS_SET) != SUCCEED)
HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
@@ -937,11 +947,18 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl)
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/7/05
+ * Modified code to use the dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
+ *
*-------------------------------------------------------------------------
*/
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;
H5HL_free_t *fl = NULL, *max_fl = NULL;
size_t offset = 0;
@@ -965,7 +982,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->cache_info.is_dirty=TRUE;
+ heap_dirtied = TRUE;
/* Cache this for later */
sizeof_hdr= H5HL_SIZEOF_HDR(f);
@@ -1099,7 +1116,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void *
done:
if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ heap_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1127,12 +1144,19 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/7/05
+ * Modified code to use the dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, const void *buf)
{
- H5HL_t *heap = NULL;
+ hbool_t heap_dirtied = FALSE;
+ H5HL_t *heap = NULL;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_write, FAIL);
@@ -1152,13 +1176,13 @@ 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->cache_info.is_dirty=TRUE;
+ heap_dirtied = TRUE;
HDmemcpy(heap->chunk + H5HL_SIZEOF_HDR(f) + offset, buf, size);
done:
if (heap &&
- H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET)
- != SUCCEED &&
+ H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_dirtied,
+ H5AC__NO_FLAGS_SET) != SUCCEED &&
ret_value != FAIL)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
@@ -1192,11 +1216,18 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/7/05
+ * Modified code to use the dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
+ *
*-------------------------------------------------------------------------
*/
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;
H5HL_free_t *fl = NULL, *fl2 = NULL;
herr_t ret_value=SUCCEED; /* Return value */
@@ -1221,7 +1252,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->cache_info.is_dirty=TRUE;
+ heap_dirtied = TRUE;
/*
* Check if this chunk can be prepended or appended to an already
@@ -1297,7 +1328,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size)
done:
if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ heap_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1317,11 +1348,17 @@ done:
*
* Modifications:
*
+ * John Mainzer - 6/17/05
+ * Modified function to use the new dirtied parmeter of
+ * H5AC_unprotect(), which allows management of the is_dirty
+ * field of the cache info to be moved into the cache code.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -1364,14 +1401,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, H5C__DELETED_FLAG)<0) {
+ if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_dirtied, 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,
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, heap_dirtied,
H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap");
diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c
index e2e4978..684ac8a 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -42,11 +42,18 @@
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -162,7 +169,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, FALSE) != SUCCEED)
+ if (h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, h_dirtied, FALSE) != SUCCEED)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
H5MM_xfree(marker);
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 5b56ad7..b0b0910 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -64,7 +64,8 @@ typedef struct H5HL_t H5HL_t;
H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/);
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);
+H5_DLL herr_t H5HL_unprotect(H5F_t *f, hid_t dxpl_id, const H5HL_t *heap,
+ haddr_t addr, hbool_t heap_dirtied);
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);
diff --git a/src/H5O.c b/src/H5O.c
index edd3424..23cc888 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -67,20 +67,23 @@ static int 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);
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);
+ const H5O_class_t *type, unsigned flags, const void *mesg,
+ hbool_t * oh_dirtied_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);
+ size_t size, hbool_t * oh_dirtied_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);
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);
+ const H5O_class_t **new_type, const void **new_mesg, hid_t dxpl_id,
+ hbool_t * oh_dirtied_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);
+ const void *mesg, unsigned flags, unsigned update_flags,
+ hbool_t * oh_dirtied_ptr);
/* Metadata cache callbacks */
static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
@@ -258,6 +261,11 @@ done:
*
* Modifications:
*
+ * JRM -- 6/6/05
+ * Removed code modifying the is_dirty field of the
+ * cache_info. This field is now managed by the cache
+ * proper.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -281,7 +289,6 @@ H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, had
if (NULL == (oh = H5FL_MALLOC(H5O_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- oh->cache_info.is_dirty = TRUE;
oh->version = H5O_VERSION;
oh->nlink = 0;
@@ -1211,12 +1218,17 @@ done:
* if zero is passed for ADJUST. If that's the case then we don't check
* for write access on the file.
*
+ * John Mainzer, 6/6/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
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
* object was deleted as a result
* of this action.
@@ -1242,7 +1254,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->cache_info.is_dirty = TRUE;
+ oh_dirtied = TRUE;
/* Check if the object should be deleted */
if(oh->nlink==0) {
@@ -1273,14 +1285,14 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id)
} /* end if */
oh->nlink += adjust;
- oh->cache_info.is_dirty = TRUE;
+ oh_dirtied = TRUE;
}
/* Set return value */
ret_value = oh->nlink;
done:
- if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, flags) < 0)
+ if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, oh_dirtied, flags) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1353,6 +1365,7 @@ 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;
@@ -1380,7 +1393,7 @@ H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id)
done:
if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ oh_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1453,11 +1466,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/6/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -1486,7 +1504,7 @@ H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d
done:
if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ oh_dirtied, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1570,17 +1588,24 @@ done:
* Aug 6 1997
*
* Modifications:
+ *
* Bill Wendling, 2003-09-30
* Protect the object header and pass it into the H5O_find_in_ohdr
* function. This is done because the H5O_find_in_ohdr used to
* protect the ohdr, find the message, and then unprotect it. This
* saves time and also helps the FPHDF5 stuff, where unprotecting
* actually destroys the object in the cache.
+ *
+ * John Mainzer, 6/6/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
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;
@@ -1637,7 +1662,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,
- H5AC__NO_FLAGS_SET) < 0)
+ oh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1834,6 +1859,11 @@ done:
* constant it can never become non-constant. Constant messages cannot
* be modified.
*
+ * John Mainzer, 6/6/05
+ * Updated function to use the new dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
+ *
*-------------------------------------------------------------------------
*/
static int
@@ -1841,6 +1871,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;
int sequence;
unsigned idx; /* Index of message to modify */
H5O_mesg_t *idx_msg; /* Pointer to message to modify */
@@ -1880,10 +1911,10 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite,
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message not found");
} /* end if */
- /* Check for creating new message */
+ /* 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))==UFAIL)
+ if((idx=H5O_new_mesg(ent->file,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,&oh_dirtied))==UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message");
/* Set the correct sequence number for the message created */
@@ -1896,19 +1927,19 @@ 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)<0)
+ if(H5O_write_mesg(oh,idx,type,mesg,flags,update_flags,&oh_dirtied)<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);
+ H5O_touch_oh(ent->file, oh, FALSE, &oh_dirtied);
/* Set return value */
ret_value = sequence;
done:
if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET) < 0)
+ oh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1975,10 +2006,15 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/6/05
+ * Updated function to use the new dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id)
+H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id, hbool_t oh_dirtied)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -1991,7 +2027,7 @@ H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id)
assert(oh);
if (H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET) < 0)
+ oh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
done:
@@ -2020,11 +2056,16 @@ done:
* Quincey Koziol
* Feb 14 2003
*
+ * John Mainzer, 6/6/05
+ * Updated function to use the new dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info directly.
+ *
*-------------------------------------------------------------------------
*/
int
H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned flags,
- const void *mesg)
+ const void *mesg, hbool_t * oh_dirtied_ptr)
{
const H5O_class_t *type; /* Actual H5O class type for the ID */
int ret_value; /* Return value */
@@ -2039,9 +2080,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);
/* Call the "real" append routine */
- if((ret_value=H5O_append_real( f, dxpl_id, oh, type, flags, mesg))<0)
+ if((ret_value=H5O_append_real( f, dxpl_id, oh, type, flags, mesg, oh_dirtied_ptr))<0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header");
done:
@@ -2066,11 +2108,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/6/05
+ * Updated function to use the new dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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)
+ unsigned flags, const void *mesg, hbool_t * oh_dirtied_ptr)
{
unsigned idx; /* Index of message to modify */
H5O_shared_t sh_mesg;
@@ -2084,13 +2131,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);
/* Create a new message */
- if((idx=H5O_new_mesg(f,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id))==UFAIL)
+ if((idx=H5O_new_mesg(f,oh,&flags,type,mesg,&sh_mesg,&type,&mesg,dxpl_id,oh_dirtied_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)<0)
+ if(H5O_write_mesg(oh,idx,type,mesg,flags,0,oh_dirtied_ptr)<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message");
/* Set return value */
@@ -2114,12 +2162,18 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/7/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ * In this case, that requires the addition of the oh_dirtied_ptr
+ * parameter to track whether *oh is dirty.
+ *
*-------------------------------------------------------------------------
*/
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)
+ const void **new_mesg, hid_t dxpl_id, hbool_t * oh_dirtied_ptr)
{
size_t size; /* Size of space allocated for object header */
unsigned ret_value=UFAIL; /* Return value */
@@ -2135,6 +2189,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);
/* Check for shared message */
if (*flags & H5O_FLAG_SHARED) {
@@ -2165,7 +2220,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)) == UFAIL)
+ if ((ret_value = H5O_alloc(f, oh, orig_type, size, oh_dirtied_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message");
/* Increment any links in message */
@@ -2189,13 +2244,21 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/6/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ * In this case, that requires the addition of the oh_dirtied_ptr
+ * parameter to track whether *oh is dirty.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
- const void *mesg, unsigned flags, unsigned update_flags)
+ const void *mesg, unsigned flags, unsigned update_flags,
+ hbool_t * oh_dirtied_ptr)
{
H5O_mesg_t *idx_msg; /* Pointer to message to modify */
+
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_write_mesg);
@@ -2204,6 +2267,7 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
assert(oh);
assert(type);
assert(mesg);
+ assert(oh_dirtied_ptr);
/* Set pointer to the correct message */
idx_msg=&oh->mesg[idx];
@@ -2218,7 +2282,7 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
idx_msg->flags = flags;
idx_msg->dirty = TRUE;
- oh->cache_info.is_dirty = TRUE;
+ *oh_dirtied_ptr = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -2239,10 +2303,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/6/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ * In this case, that requires the addition of the oh_dirtied_ptr
+ * parameter to track whether *oh is dirty.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
+H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force, hbool_t * oh_dirtied_ptr)
{
unsigned idx;
#ifdef H5_HAVE_GETTIMEOFDAY
@@ -2255,6 +2325,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
FUNC_ENTER_NOAPI_NOINIT(H5O_touch_oh);
assert(oh);
+ assert(oh_dirtied_ptr);
/* Look for existing message */
for (idx=0; idx<oh->nmesgs; idx++) {
@@ -2274,7 +2345,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
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))==UFAIL)
+ if ((idx=H5O_alloc(f, oh, H5O_MTIME_NEW, size, oh_dirtied_ptr))==UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message");
}
@@ -2285,7 +2356,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force)
}
*((time_t*)(oh->mesg[idx].native)) = now;
oh->mesg[idx].dirty = TRUE;
- oh->cache_info.is_dirty = TRUE;
+ *oh_dirtied_ptr = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -2307,11 +2378,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/16/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id)
{
+ hbool_t oh_dirtied = FALSE;
H5O_t *oh = NULL;
herr_t ret_value=SUCCEED; /* Return value */
@@ -2329,12 +2405,12 @@ 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)<0)
+ if (H5O_touch_oh(ent->file, oh, force, &oh_dirtied)<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,
- H5AC__NO_FLAGS_SET)<0)
+ oh_dirtied, H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -2355,10 +2431,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/16/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ * In this case, that requires the addition of the oh_dirtied_ptr
+ * parameter to track whether *oh is dirty.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5O_bogus_oh(H5F_t *f, H5O_t *oh)
+H5O_bogus_oh(H5F_t *f, H5O_t *oh, hbool_t * oh_dirtied_ptr)
{
int idx;
size_t size;
@@ -2368,6 +2450,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh)
assert(f);
assert(oh);
+ assert(oh_dirtied_ptr);
/* Look for existing message */
for (idx=0; idx<oh->nmesgs; idx++)
@@ -2377,7 +2460,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh)
/* Create a new message */
if (idx==oh->nmesgs) {
size = (H5O_BOGUS->raw_size)(f, NULL);
- if ((idx=H5O_alloc(f, oh, H5O_BOGUS, size))<0)
+ if ((idx=H5O_alloc(f, oh, H5O_BOGUS, size, oh_dirtied_ptr))<0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message");
/* Allocate the native message in memory */
@@ -2410,11 +2493,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/16/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id)
{
+ hbool_t oh_dirtied = FALSE;
H5O_t *oh = NULL;
herr_t ret_value = SUCCEED;
@@ -2434,12 +2522,12 @@ 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)<0)
+ if (H5O_bogus_oh(ent->file, oh, &oh_dirtied)<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,
- H5AC__NO_FLAGS_SET)<0)
+ oh_dirtied, H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE(ret_value);
@@ -2525,12 +2613,17 @@ done:
* Robb Matzke, 7 Jan 1998
* Does not remove constant messages.
*
+ * John Mainzer, 6/6/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
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;
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
int seq, nfailed = 0;
unsigned u;
@@ -2577,8 +2670,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->cache_info.is_dirty = TRUE;
- H5O_touch_oh(ent->file, oh, FALSE);
+ oh_dirtied = TRUE;
+ H5O_touch_oh(ent->file, oh, FALSE, &oh_dirtied);
}
}
@@ -2588,7 +2681,7 @@ H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d
done:
if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET) < 0)
+ oh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -2959,10 +3052,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/7/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ * In this case, that requires the addition of the oh_dirtied_ptr
+ * parameter to track whether *oh is dirty.
+ *
*-------------------------------------------------------------------------
*/
static unsigned
-H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
+H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size, hbool_t * oh_dirtied_ptr)
{
unsigned idx;
H5O_mesg_t *msg; /* Pointer to newly allocated message */
@@ -2974,6 +3073,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
/* check args */
assert (oh);
assert (type);
+ assert (oh_dirtied_ptr);
/* look for a null message which is large enough */
for (idx = 0; idx < oh->nmesgs; idx++) {
@@ -3058,7 +3158,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
msg->dirty = TRUE;
msg->native = NULL;
- oh->cache_info.is_dirty = TRUE;
+ *oh_dirtied_ptr = TRUE;
/* Set return value */
ret_value=idx;
@@ -3228,6 +3328,7 @@ 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 */
@@ -3247,7 +3348,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, H5C__DELETED_FLAG)<0)
+ H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, oh_dirtied, H5C__DELETED_FLAG)<0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -3389,11 +3490,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/16/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -3431,7 +3537,7 @@ H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id)
done:
if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET)<0)
+ oh_dirtied, H5AC__NO_FLAGS_SET)<0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -3549,12 +3655,17 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/16/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -3608,7 +3719,7 @@ H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op,
done:
if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh,
- H5AC__NO_FLAGS_SET) < 0)
+ oh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -3673,11 +3784,16 @@ done:
* Modifications:
* Robb Matzke, 1999-07-28
* The ADDR argument is passed by value.
+ *
+ * John Mainzer, 6/16/05
+ * Modified function to use the new dirtied parameter to
+ * H5AC_unprotect() instead of modfying the is_dirty field.
*-------------------------------------------------------------------------
*/
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;
@@ -3837,7 +3953,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
done:
if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh,
- H5AC__NO_FLAGS_SET) < 0)
+ oh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 974b86f..271de47 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -123,7 +123,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *s
assert (s && !*s);
- if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr, FALSE) < 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) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr, FALSE) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value")
/* File offset */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 568f67b..ba307f1 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -242,14 +242,17 @@ H5_DLL void *H5O_read(H5G_entry_t *ent, unsigned type_id, int sequence,
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);
+H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, struct H5O_t *oh, hid_t dxpl_id,
+ hbool_t oh_dirtied);
H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id,
- unsigned flags, const void *mesg);
+ unsigned flags, const void *mesg, hbool_t * oh_dirtied_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);
+H5_DLL herr_t H5O_touch_oh(H5F_t *f, struct H5O_t *oh, hbool_t force,
+ hbool_t * oh_dirtied_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);
+H5_DLL herr_t H5O_bogus_oh(H5F_t *f, struct H5O_t *oh,
+ hbool_t * oh_dirtied_ptr);
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_remove(H5G_entry_t *ent, unsigned type_id, int sequence,
hid_t dxpl_id);
diff --git a/src/H5S.c b/src/H5S.c
index de7da2e..075eb18 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1089,10 +1089,16 @@ done:
*
* Modifications:
*
+ * John Mainzer, 6/6/05
+ * Updated function to use the new dirtied parameter of
+ * H5AC_unprotect() instead of manipulating the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds)
+H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds,
+ hbool_t * oh_dirtied_ptr)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -1101,12 +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);
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))<0)
+ if (H5O_append(f, dxpl_id, oh, H5O_SDSPACE_ID, 0, &(ds->extent), oh_dirtied_ptr)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message");
break;
diff --git a/src/H5SH.c b/src/H5SH.c
index a72a8c0..de6af80 100644
--- a/src/H5SH.c
+++ b/src/H5SH.c
@@ -71,6 +71,11 @@ H5FL_DEFINE(H5SH_t);
* koziol@ncsa.uiuc.edu
* Mar 23 2005
*
+ * Changes: John Mainzer -- 6/7/05
+ * Removed code modifying the is_dirty field of the cache
+ * info. Management of this field is in the process of
+ * being moved to the H5C code.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -96,7 +101,6 @@ H5SH_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p, H5SH_data_type_t heap_type
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for segmented heap info")
/* Assign internal information */
- sh->cache_info.is_dirty = TRUE;
sh->heap_type = heap_type;
if(sh->heap_type == H5SH_RAW)
sh->file_mem_type = H5FD_MEM_DRAW;
@@ -229,11 +233,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 25 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -318,7 +330,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, H5AC__NO_FLAGS_SET) < 0)
+ if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, sh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release segmented heap info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5SHdbg.c b/src/H5SHdbg.c
index 42b2769..4f3f9ba 100644
--- a/src/H5SHdbg.c
+++ b/src/H5SHdbg.c
@@ -42,11 +42,19 @@
* koziol@ncsa.uiuc.edu
* Mar 24 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/16/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
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 */
@@ -87,7 +95,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, H5AC__NO_FLAGS_SET) < 0)
+ if (sh && H5AC_unprotect(f, dxpl_id, H5AC_SGHP, addr, sh, sh_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release segmented heap info")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index ac6a297..8d8c7f8 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -200,7 +200,8 @@ H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/,
hsize_t max_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);
+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);
H5_DLL size_t H5S_raw_size(const H5F_t *f, const H5S_t *space);
H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size);
diff --git a/test/cache.c b/test/cache.c
index 658aa4e..e046a07 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -1160,6 +1160,7 @@ flush(H5F_t *f,
HDassert( entry_ptr->addr == addr );
HDassert( entry_ptr->header.size == entry_ptr->size );
HDassert( entry_ptr->size == entry_sizes[entry_ptr->type] );
+ HDassert( entry_ptr->header.is_dirty == entry_ptr->is_dirty );
entry_ptr->flushed = TRUE;
@@ -1296,6 +1297,7 @@ load(H5F_t UNUSED *f,
entry_ptr->loaded = TRUE;
+ entry_ptr->header.is_dirty = FALSE;
entry_ptr->is_dirty = FALSE;
(entry_ptr->reads)++;
@@ -1901,6 +1903,10 @@ flush_cache(H5C_t * cache_ptr,
* Updated function for the flags parameter in
* H5C_insert_entry(), and to allow access to this parameter.
*
+ * JRM -- 6/17/05
+ * The interface no longer permits clean inserts.
+ * Accordingly, the dirty parameter is no longer meaningfull.
+ *
*-------------------------------------------------------------------------
*/
@@ -1929,11 +1935,7 @@ insert_entry(H5C_t * cache_ptr,
HDassert( entry_ptr == entry_ptr->self );
HDassert( !(entry_ptr->is_protected) );
- if ( dirty ) {
-
- (entry_ptr->header).is_dirty = dirty;
- entry_ptr->is_dirty = dirty;
- }
+ entry_ptr->is_dirty = TRUE;
result = H5C_insert_entry(NULL, -1, -1, cache_ptr, &(types[type]),
entry_ptr->addr, (void *)entry_ptr, flags);
@@ -1964,6 +1966,7 @@ insert_entry(H5C_t * cache_ptr,
#endif
}
+ HDassert( entry_ptr->header.is_dirty );
HDassert( ((entry_ptr->header).type)->id == type );
}
@@ -1986,6 +1989,10 @@ insert_entry(H5C_t * cache_ptr,
*
* Modifications:
*
+ * JRM -- 6/17/05
+ * Updated code to reflect the fact that renames automatically
+ * dirty entries.
+ *
*-------------------------------------------------------------------------
*/
@@ -2038,6 +2045,8 @@ rename_entry(H5C_t * cache_ptr,
if ( ! done ) {
+ entry_ptr->is_dirty = TRUE;
+
result = H5C_rename_entry(cache_ptr, &(types[type]),
old_addr, new_addr);
}
@@ -2058,6 +2067,9 @@ rename_entry(H5C_t * cache_ptr,
HDassert( ((entry_ptr->header).type)->id == type );
+ HDassert( entry_ptr->header.is_dirty );
+ HDassert( entry_ptr->is_dirty );
+
return;
} /* rename_entry() */
@@ -2170,6 +2182,10 @@ protect_entry(H5C_t * cache_ptr,
* Updated for the replacement of the deleted parameter in
* H5C_unprotect() with the new flags parameter.
*
+ * JRM - 6/17/05
+ * Modified function to use the new dirtied parameter of
+ * H5C_unprotect().
+ *
*-------------------------------------------------------------------------
*/
@@ -2183,6 +2199,7 @@ 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;
@@ -2204,12 +2221,13 @@ unprotect_entry(H5C_t * cache_ptr,
if ( ( dirty == TRUE ) || ( dirty == FALSE ) ) {
- entry_ptr->header.is_dirty = dirty;
- entry_ptr->is_dirty = dirty;
+ dirtied = dirty;
+ 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, flags);
+ entry_ptr->addr, (void *)entry_ptr,
+ dirtied, flags);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||
@@ -2227,6 +2245,12 @@ unprotect_entry(H5C_t * cache_ptr,
}
HDassert( ((entry_ptr->header).type)->id == type );
+
+ if ( ( dirtied ) && ( (flags & H5C__DELETED_FLAG) == 0 ) ) {
+
+ HDassert( entry_ptr->header.is_dirty );
+ HDassert( entry_ptr->is_dirty );
+ }
}
return;
@@ -5428,6 +5452,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
failure_mssg = "cache not empty at beginning of multi entry case.";
}
+ if ( pass )
{
int test_num = 1;
unsigned int flush_flags = H5C__NO_FLAGS_SET;
@@ -5467,7 +5492,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
- /* expected_flushed = */ FALSE,
+ /* expected_flushed = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
@@ -5515,7 +5540,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
- /* expected_flushed = */ FALSE,
+ /* expected_flushed = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
@@ -5537,6 +5562,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 2;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG;
@@ -5646,6 +5672,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 3;
unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG;
@@ -5684,7 +5711,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* dirty_flag = */ FALSE,
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ FALSE,
- /* expected_cleared = */ FALSE,
+ /* expected_cleared = */ TRUE,
/* expected_flushed = */ FALSE,
/* expected_destroyed = */ FALSE
},
@@ -5732,7 +5759,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* dirty_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
- /* expected_cleared = */ FALSE,
+ /* expected_cleared = */ TRUE,
/* expected_flushed = */ FALSE,
/* expected_destroyed = */ FALSE
},
@@ -5755,6 +5782,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 4;
unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG;
@@ -5842,7 +5870,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
- /* expected_flushed = */ FALSE,
+ /* expected_flushed = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
@@ -5864,6 +5892,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 5;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
@@ -5974,6 +6003,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 6;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
@@ -6084,6 +6114,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 7;
unsigned int flush_flags = H5C__FLUSH_CLEAR_ONLY_FLAG |
@@ -6171,7 +6202,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* dirty_flag = */ FALSE,
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
- /* expected_cleared = */ FALSE,
+ /* expected_cleared = */ TRUE,
/* expected_flushed = */ FALSE,
/* expected_destroyed = */ FALSE
},
@@ -6194,6 +6225,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
}
+ if ( pass )
{
int test_num = 8;
unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG |
@@ -6306,6 +6338,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* verify that all other flags are ignored */
+ if ( pass )
{
int test_num = 9;
unsigned int flush_flags = (unsigned)
@@ -6348,7 +6381,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* flags = */ H5C__NO_FLAGS_SET,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
- /* expected_flushed = */ FALSE,
+ /* expected_flushed = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
@@ -6396,7 +6429,7 @@ check_flush_cache__multi_entry(H5C_t * cache_ptr)
/* flags = */ H5C__SET_FLUSH_MARKER_FLAG,
/* expected_loaded = */ FALSE,
/* expected_cleared = */ FALSE,
- /* expected_flushed = */ FALSE,
+ /* expected_flushed = */ TRUE,
/* expected_destroyed = */ FALSE
},
{
@@ -6462,6 +6495,7 @@ check_flush_cache__multi_entry_test(H5C_t * cache_ptr,
( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
+
HDsnprintf(msg, (size_t)128,
"cache not empty at beginning of multi entry test #%d.",
test_num);
@@ -7309,7 +7343,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_loaded */ FALSE,
/* expected_cleared */ FALSE,
- /* expected_flushed */ FALSE,
+ /* expected_flushed */ TRUE,
/* expected_destroyed */ FALSE
);
}
@@ -7346,7 +7380,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
/* flags */ H5C__NO_FLAGS_SET,
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_loaded */ FALSE,
- /* expected_cleared */ FALSE,
+ /* expected_cleared */ TRUE,
/* expected_flushed */ FALSE,
/* expected_destroyed */ FALSE
);
@@ -7623,7 +7657,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
/* flush_flags */ H5C__NO_FLAGS_SET,
/* expected_loaded */ FALSE,
/* expected_cleared */ FALSE,
- /* expected_flushed */ FALSE,
+ /* expected_flushed */ TRUE,
/* expected_destroyed */ FALSE
);
}
@@ -7660,7 +7694,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
/* flags */ H5C__SET_FLUSH_MARKER_FLAG,
/* flush_flags */ H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_loaded */ FALSE,
- /* expected_cleared */ FALSE,
+ /* expected_cleared */ TRUE,
/* expected_flushed */ FALSE,
/* expected_destroyed */ FALSE
);
@@ -7737,7 +7771,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG,
/* expected_loaded */ FALSE,
/* expected_cleared */ FALSE,
- /* expected_flushed */ FALSE,
+ /* expected_flushed */ TRUE,
/* expected_destroyed */ FALSE
);
}
@@ -7815,7 +7849,7 @@ check_flush_cache__single_entry(H5C_t * cache_ptr)
/* flush_flags */ H5C__FLUSH_MARKED_ENTRIES_FLAG |
H5C__FLUSH_CLEAR_ONLY_FLAG,
/* expected_loaded */ FALSE,
- /* expected_cleared */ FALSE,
+ /* expected_cleared */ TRUE,
/* expected_flushed */ FALSE,
/* expected_destroyed */ FALSE
);
@@ -8492,6 +8526,10 @@ check_double_protect_err(void)
*
* Modifications:
*
+ * JRM -- 6/17/05
+ * Modified function to use the new dirtied parameter in
+ * H5C_unprotect().
+ *
*-------------------------------------------------------------------------
*/
@@ -8530,7 +8568,7 @@ check_double_unprotect_err(void)
result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[0]),
entry_ptr->addr, (void *)entry_ptr,
- H5C__NO_FLAGS_SET);
+ FALSE, H5C__NO_FLAGS_SET);
if ( result > 0 ) {
@@ -20482,6 +20520,7 @@ main(void)
#else /* NDEBUG */
run_full_test = FALSE;
#endif /* NDEBUG */
+
#if 1
smoke_check_1();
smoke_check_2();
diff --git a/test/lheap.c b/test/lheap.c
index 76c11a0..46ed193 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -136,7 +136,7 @@ main(void)
goto error;
}
- if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) {
+ if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr, FALSE) < 0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;