diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 35 | ||||
-rw-r--r-- | src/H5ACprivate.h | 24 | ||||
-rw-r--r-- | src/H5B.c | 68 | ||||
-rw-r--r-- | src/H5C.c | 212 | ||||
-rw-r--r-- | src/H5Cprivate.h | 39 | ||||
-rw-r--r-- | src/H5F.c | 17 | ||||
-rw-r--r-- | src/H5Gnode.c | 36 | ||||
-rw-r--r-- | src/H5HG.c | 17 | ||||
-rw-r--r-- | src/H5HL.c | 24 | ||||
-rw-r--r-- | src/H5O.c | 47 |
10 files changed, 384 insertions, 135 deletions
@@ -623,10 +623,18 @@ done: * in H5C.c, and then re-wrote the function as a wrapper for * H5C_insert_entry(). * + * JRM - 1/6/05 + * Added the flags parameter. At present, this parameter is + * only used to set the new flush_marker field on the new + * entry. Since this doesn't apply to the SAP code, no change + * is needed there. Thus the only change to the body of the + * code is to pass the flags parameter through to + * H5C_insert_entry(). + * *------------------------------------------------------------------------- */ herr_t -H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing) +H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags) { herr_t result; H5AC_info_t *info; @@ -727,7 +735,8 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * cache, type, addr, - thing); + thing, + flags); if ( result < 0 ) { @@ -1085,14 +1094,21 @@ done: * Abstracted the guts of the function to H5C_unprotect() * in H5C.c, and then re-wrote the function as a wrapper for * H5C_unprotect(). + * + * JRM - 1/6/05 + * Replaced the deleted parameter with the new flags parameter. + * Since the deleted parameter is not used by the FPHDF5 code, + * the only change in the body is to replace the deleted + * parameter with the flags parameter in the call to + * H5C_unprotect(). * *------------------------------------------------------------------------- */ herr_t -H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, hbool_t deleted) +H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags) { herr_t result; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_unprotect, FAIL) @@ -1133,6 +1149,15 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, * (deleted == TRUE), we need to send a request to the SAP * telling it to remove that bit of metadata from its cache. */ + /* the deleted parameter has been replaced with the flags + * parameter. The actual value of deleted is still passed + * in as a bit in flags. If it is needed, it can be extracted + * as follows: + * + * deleted = ( (flags & H5C__DELETED_FLAG) != 0 ); + * + * JRM -- 1/6/05 + */ if ( H5FP_request_release_lock(H5FD_fphdf5_file_id(lf), addr, TRUE, &req_id, &status) < 0 ) HGOTO_ERROR(H5E_FPHDF5, H5E_CANTUNLOCK, FAIL, \ @@ -1173,7 +1198,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, type, addr, thing, - deleted); + flags); if ( result < 0 ) { diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 8c34d92..b26bd1e 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -162,15 +162,31 @@ extern hid_t H5AC_ind_dxpl_id; /* * Library prototypes. */ + +/* #defines of flags used in the flags parameters in some of the + * following function calls. Note that they are just copies of + * the equivalent flags from H5Cprivate.h. + */ + +#define H5AC__NO_FLAGS_SET H5C__NO_FLAGS_SET +#define H5AC__SET_FLUSH_MARKER_FLAG H5C__SET_FLUSH_MARKER_FLAG +#define H5AC__DELETED_FLAG H5C__DELETED_FLAG +#define H5AC__FLUSH_INVALIDATE_FLAG H5C__FLUSH_INVALIDATE_FLAG +#define H5AC__FLUSH_CLEAR_ONLY_FLAG H5C__FLUSH_CLEAR_ONLY_FLAG +#define H5AC__FLUSH_MARKED_ENTRIES_FLAG H5C__FLUSH_MARKED_ENTRIES_FLAG + + + H5_DLL herr_t H5AC_init(void); H5_DLL herr_t H5AC_create(const H5F_t *f, int size_hint); -H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, - void *thing); +H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, + haddr_t addr, void *thing, unsigned int flags); H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2, H5AC_protect_t rw); -H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, - void *thing, hbool_t deleted); +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); 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); @@ -241,7 +241,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, /* * Cache the new B-tree node. */ - if (H5AC_set(f, dxpl_id, H5AC_BT, *addr_p, bt) < 0) + if (H5AC_set(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache") #ifdef H5B_DEBUG H5B_assert(f, dxpl_id, *addr_p, shared->type, udata); @@ -738,7 +738,8 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u } done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) + < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) @@ -892,7 +893,8 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr, tmp_bt->cache_info.is_dirty = TRUE; tmp_bt->left = *new_addr_p; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, + 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,7 +902,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, FALSE) < 0) + if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, + new_bt, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) @@ -981,7 +984,8 @@ 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, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) + != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") bt = NULL; @@ -993,7 +997,8 @@ 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, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) + != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") bt = NULL; @@ -1014,7 +1019,8 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, bt->cache_info.is_dirty = TRUE; bt->left = old_root; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) + != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") bt=NULL; /* Make certain future references will be caught */ @@ -1035,13 +1041,15 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if (NULL == (new_bt = H5B_copy(bt))) { HCOMMON_ERROR(H5E_BTREE, H5E_CANTLOAD, "unable to copy old root"); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) + != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") HGOTO_DONE(FAIL) } - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) + != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") bt=NULL; /* Make certain future references will be caught */ @@ -1068,7 +1076,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDmemcpy(H5B_NKEY(new_bt,shared,2), rt_key, shared->type->sizeof_nkey); /* Insert the modified copy of the old root into the file again */ - if (H5AC_set(f, dxpl_id, H5AC_BT, addr, new_bt) < 0) + if (H5AC_set(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node") #ifdef H5B_DEBUG @@ -1448,8 +1456,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, FALSE) < 0); - herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, twin, FALSE)<0); + herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, + 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); 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)") } @@ -1515,7 +1525,7 @@ 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, FALSE) < 0) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") bt = NULL; /* Make certain future references will be caught */ @@ -1548,7 +1558,8 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op next_addr = bt->right; nchildren = bt->nchildren; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, cur_addr, bt, FALSE) < 0) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, cur_addr, bt, + H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") bt = NULL; @@ -1718,7 +1729,8 @@ 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,idx+1), type->sizeof_nkey); sibling->cache_info.is_dirty = TRUE; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, + 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 */ @@ -1747,7 +1759,8 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type sibling->right = bt->right; sibling->cache_info.is_dirty = TRUE; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, + 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 */ @@ -1762,7 +1775,8 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type sibling->left = bt->left; sibling->cache_info.is_dirty = TRUE; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, + 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 */ @@ -1771,7 +1785,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type 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, TRUE)<0) { + || H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5C__DELETED_FLAG)<0) { bt = NULL; HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node") } @@ -1823,7 +1837,8 @@ 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,bt->nchildren), type->sizeof_nkey); sibling->cache_info.is_dirty = TRUE; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, + 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 */ @@ -1856,7 +1871,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, FALSE)<0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) @@ -1919,7 +1934,8 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void bt->cache_info.is_dirty = TRUE; } - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) + != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") bt=NULL; /* Make certain future references will be caught */ @@ -1996,7 +2012,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, TRUE)<0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5C__DELETED_FLAG)<0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache") FUNC_LEAVE_NOAPI(ret_value) @@ -2230,7 +2246,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, FALSE) < 0) + if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) + < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) @@ -2290,7 +2307,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void cur->level = bt->level; head = tail = cur; - status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE); + status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET); assert(status >= 0); bt=NULL; /* Make certain future references will be caught */ @@ -2343,7 +2360,8 @@ 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, FALSE); + status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt, + H5AC__NO_FLAGS_SET); assert(status >= 0); bt=NULL; /* Make certain future references will be caught */ @@ -29,7 +29,7 @@ * in an attempt to support re-use. * * For a detailed overview of the cache, please see the - * header comment for H5C_t in this file. + * header comment for H5C_t in H5Cpkg.h. * * Modifications: * @@ -37,6 +37,18 @@ * Switched over to using skip list routines instead of TBBT * routines. * + * JRM - 12/15/04 + * Added code supporting manual and automatic cache resizing. + * See the header for H5C_auto_size_ctl_t in H5Cprivate.h for + * an overview. + * + * Some elements of the automatic cache resize code depend on + * the LRU list. Thus if we ever choose to support a new + * replacement policy, we will either have to disable those + * elements of the auto resize code when running the new + * policy, or modify them to make use of similar information + * maintained by the new policy code. + * *------------------------------------------------------------------------- */ @@ -145,7 +157,7 @@ * JRM - 12/9/04 * * - * In the H5C__DLL_PRE_INSERT_SC macro, replaced the lines: + * - In the H5C__DLL_PRE_INSERT_SC macro, replaced the lines: * * ( ( (len) == 1 ) && * ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || @@ -167,6 +179,29 @@ * take on negative values, and thus the revised clause "( (Size) < 0 )" * caused compiler warnings. * JRM - 12/22/04 + * + * - In the H5C__DLL_SC macro, replaced the lines: + * + * ( ( (len) == 1 ) && + * ( ( (head_ptr) != (tail_ptr) ) || ( (cache_ptr)->size <= 0 ) || + * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) + * ) + * ) || + * + * with + * + * ( ( (len) == 1 ) && + * ( ( (head_ptr) != (tail_ptr) ) || + * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) + * ) + * ) || + * + * Epoch markers have size 0, so we can now have a non-empty list with + * zero size. Hence the "( (Size) <= 0 )" clause cause false failures + * in the sanity check. Since "Size" is typically a size_t, it can't + * take on negative values, and thus the revised clause "( (Size) < 0 )" + * caused compiler warnings. + * JRM - 1/10/05 * ****************************************************************************/ @@ -200,7 +235,7 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ( (len) < 0 ) || \ ( (Size) < 0 ) || \ ( ( (len) == 1 ) && \ - ( ( (head_ptr) != (tail_ptr) ) || ( (cache_ptr)->size <= 0 ) || \ + ( ( (head_ptr) != (tail_ptr) ) || \ ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ ) \ ) || \ @@ -1695,7 +1730,7 @@ static herr_t H5C_make_space_in_cache(H5F_t * f, ****************************************************************************/ /* Note that H5C__MAX_EPOCH_MARKERS is defined in H5Cpkg.h, not here because - * it is needed to dimension an array in H5C_t. + * it is needed to dimension arrays in H5C_t. */ #define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS @@ -2229,7 +2264,7 @@ H5C_dest(H5F_t * f, HDassert( cache_ptr->skip_file_checks || f ); if ( H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, - cache_ptr, H5F_FLUSH_INVALIDATE) < 0 ) { + cache_ptr, H5C__FLUSH_INVALIDATE_FLAG) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } @@ -2341,6 +2376,23 @@ done: * list, never in the index or in the tree. However, it * never hurts to tidy up. * + * JRM -- 1/6/05 + * Reworked code to support the new + * H5C__FLUSH_MARKED_ENTRIES_FLAG, and for the replacement of + * H5F_FLUSH_INVALIDATE flag with H5C__FLUSH_INVALIDATE_FLAG. + * + * Note that the H5C__FLUSH_INVALIDATE_FLAG takes precidence + * over the H5C__FLUSH_MARKED_ENTRIES_FLAG. Thus if both are + * set, the functions behaves as if just the + * H5C__FLUSH_INVALIDATE_FLAG was set. + * + * The H5C__FLUSH_CLEAR_ONLY_FLAG flag can co-exist with + * either the H5C__FLUSH_MARKED_ENTRIES_FLAG, or the + * H5C__FLUSH_INVALIDATE_FLAG. In all cases, it is simply + * passed along to H5C_flush_single_entry(). In the case of + * H5C__FLUSH_MARKED_ENTRIES_FLAG, it will only apply to + * the marked entries. + * *------------------------------------------------------------------------- */ herr_t @@ -2352,7 +2404,8 @@ H5C_flush_cache(H5F_t * f, { herr_t status; herr_t ret_value = SUCCEED; - hbool_t destroy = ( (flags & H5F_FLUSH_INVALIDATE) != 0 ); + hbool_t destroy; + hbool_t flush_marked_entries; hbool_t first_flush = TRUE; int32_t protected_entries = 0; int32_t i; @@ -2370,6 +2423,14 @@ H5C_flush_cache(H5F_t * f, HDassert( cache_ptr->skip_file_checks || f ); HDassert( cache_ptr->slist_ptr ); + destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); + + /* note that flush_marked_entries is set to FALSE if destroy is TRUE */ + flush_marked_entries = ( ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ) + && + ( ! destroy ) + ); + if ( ( destroy ) && ( cache_ptr->epoch_markers_active > 0 ) ) { status = H5C__autoadjust__ageout__remove_all_markers(cache_ptr); @@ -2404,31 +2465,34 @@ H5C_flush_cache(H5F_t * f, actual_slist_size += entry_ptr->size; #endif /* H5C_DO_SANITY_CHECKS */ - if ( entry_ptr->is_protected ) { + if ( ( ! flush_marked_entries ) || ( entry_ptr->flush_marker ) ) { - /* we have major problems -- but lets flush everything - * we can before we flag an error. - */ - protected_entries++; + if ( entry_ptr->is_protected ) { - } else { + /* we have major problems -- but lets flush everything + * we can before we flag an error. + */ + protected_entries++; - status = H5C_flush_single_entry(f, - primary_dxpl_id, - secondary_dxpl_id, - cache_ptr, - NULL, - entry_ptr->addr, - flags, - &first_flush, - FALSE); - if ( status < 0 ) { + } else { - /* This shouldn't happen -- if it does, we are toast so - * just scream and die. - */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Can't flush entry.") + status = H5C_flush_single_entry(f, + primary_dxpl_id, + secondary_dxpl_id, + cache_ptr, + NULL, + entry_ptr->addr, + flags, + &first_flush, + FALSE); + if ( status < 0 ) { + + /* This shouldn't happen -- if it does, we are toast so + * just scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "Can't flush entry.") + } } } @@ -2750,10 +2814,15 @@ done: * Added code to set the cache_full flag to TRUE when ever * we need to make space in the cache. * - * JRM --11/22/04 + * JRM -- 11/22/04 * Updated function for the addition of the first_flush_ptr * parameter to H5C_make_space_in_cache(). * + * JRM -- 1/6/05 + * Added the flags parameter, and code supporting + * H5C__SET_FLUSH_MARKER_FLAG. Note that this flag is + * ignored unless the new entry is dirty. + * *------------------------------------------------------------------------- */ @@ -2764,11 +2833,13 @@ H5C_insert_entry(H5F_t * f, H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, - void * thing) + void * thing, + unsigned int flags) { herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t first_flush = TRUE; + hbool_t set_flush_marker; hbool_t write_permitted = TRUE; H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * test_entry_ptr; @@ -2784,6 +2855,8 @@ H5C_insert_entry(H5F_t * f, HDassert( H5F_addr_defined(addr) ); HDassert( thing ); + set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 ); + entry_ptr = (H5C_cache_entry_t *)thing; entry_ptr->addr = addr; @@ -2905,7 +2978,12 @@ H5C_insert_entry(H5F_t * f, if ( entry_ptr->is_dirty ) { + entry_ptr->flush_marker = set_flush_marker; H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr) + + } else { + + entry_ptr->flush_marker = FALSE; } H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL) @@ -4109,6 +4187,13 @@ H5C_stats__reset(H5C_t * cache_ptr) * In particular, we now add dirty entries to the tree if * they aren't in the tree already. * + * JRM -- 1/6/05 + * Added the flags parameter, and code supporting + * H5C__SET_FLUSH_MARKER_FLAG. Note that this flag is + * ignored unless the new entry is dirty. Also note that + * once the flush_marker field of an entry is set, the + * only way it can be reset is by being flushed. + * *------------------------------------------------------------------------- */ herr_t @@ -4119,8 +4204,10 @@ H5C_unprotect(H5F_t * f, const H5C_class_t * type, haddr_t addr, void * thing, - hbool_t deleted) + unsigned int flags) { + hbool_t deleted; + hbool_t set_flush_marker; herr_t ret_value = SUCCEED; /* Return value */ H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * test_entry_ptr; @@ -4136,6 +4223,9 @@ H5C_unprotect(H5F_t * f, HDassert( H5F_addr_defined(addr) ); HDassert( thing ); + deleted = ( (flags & H5C__DELETED_FLAG) != 0 ); + set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 ); + entry_ptr = (H5C_cache_entry_t *)thing; HDassert( entry_ptr->addr == addr ); @@ -4151,13 +4241,18 @@ H5C_unprotect(H5F_t * f, entry_ptr->is_protected = FALSE; - /* add the entry to the tree if it is dirty, and it isn't already in - * the tree. + /* if the entry is dirty, or its flush_marker with the set flush flag, + * and then add it to the skip list if it isn't there already. */ - if ( ( entry_ptr->is_dirty ) && ( ! (entry_ptr->in_slist) ) ) { + if ( entry_ptr->is_dirty ) { - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr) + entry_ptr->flush_marker |= set_flush_marker; + + if ( ! (entry_ptr->in_slist) ) { + + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr) + } } /* this implementation of the "deleted" option is a bit inefficient, as @@ -4172,9 +4267,9 @@ H5C_unprotect(H5F_t * f, if ( deleted ) { /* the following first flush flag will never be used as we are - * calling H5C_flush_single_entry with both the H5F_FLUSH_CLEAR_ONLY - * and H5F_FLUSH_INVALIDATE flags. However, it is needed for the - * function call. + * calling H5C_flush_single_entry with both the + * H5C__FLUSH_CLEAR_ONLY_FLAG and H5C__FLUSH_INVALIDATE_FLAG flags. + * However, it is needed for the function call. */ hbool_t dummy_first_flush = TRUE; @@ -4199,7 +4294,8 @@ H5C_unprotect(H5F_t * f, cache_ptr, type, addr, - (H5F_FLUSH_CLEAR_ONLY|H5F_FLUSH_INVALIDATE), + (H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__FLUSH_INVALIDATE_FLAG), &dummy_first_flush, TRUE) < 0 ) { @@ -4906,7 +5002,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - (unsigned)0, + H5C__NO_FLAGS_SET, first_flush_ptr, FALSE); } else { @@ -4919,7 +5015,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - H5F_FLUSH_INVALIDATE, + H5C__FLUSH_INVALIDATE_FLAG, first_flush_ptr, TRUE); } @@ -4985,7 +5081,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - H5F_FLUSH_INVALIDATE, + H5C__FLUSH_INVALIDATE_FLAG, first_flush_ptr, TRUE); @@ -5304,7 +5400,7 @@ done: * secondary_dxpl_id is used in any subsequent flush where * *first_flush_ptr is FALSE on entry. * - * If the H5F_FLUSH_CLEAR_ONLY flag is set, the entry will + * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will * be cleared and not flushed -- in the case *first_flush_ptr, * primary_dxpl_id, and secondary_dxpl_id are all irrelevent, * and the call can't be part of a sequence of flushes. @@ -5332,6 +5428,13 @@ done: * QAK -- 11/26/04 * Updated function for the switch from TBBTs to skip lists. * + * JRM -- 1/6/05 + * Updated function to reset the flush_marker field. + * Also replace references to H5F_FLUSH_INVALIDATE and + * H5F_FLUSH_CLEAR_ONLY with references to + * H5C__FLUSH_INVALIDATE_FLAG and H5C__FLUSH_CLEAR_ONLY_FLAG + * respectively. + * *------------------------------------------------------------------------- */ static herr_t @@ -5345,8 +5448,8 @@ H5C_flush_single_entry(H5F_t * f, hbool_t * first_flush_ptr, hbool_t del_entry_from_slist_on_destroy) { - hbool_t destroy = ( (flags & H5F_FLUSH_INVALIDATE) != 0 ); - hbool_t clear_only = ( (flags & H5F_FLUSH_CLEAR_ONLY) != 0); + hbool_t destroy; + hbool_t clear_only; herr_t ret_value = SUCCEED; /* Return value */ herr_t status; H5C_cache_entry_t * entry_ptr = NULL; @@ -5359,6 +5462,9 @@ H5C_flush_single_entry(H5F_t * f, HDassert( H5F_addr_defined(addr) ); HDassert( first_flush_ptr ); + destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); + clear_only = ( (flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); + /* attempt to find the target entry in the hash table */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) @@ -5367,14 +5473,17 @@ H5C_flush_single_entry(H5F_t * f, if ( entry_ptr->in_slist ) { - if ( entry_ptr->addr != addr ) { + if ( ( ( entry_ptr->flush_marker ) && ( ! entry_ptr->is_dirty ) ) || + ( entry_ptr->addr != addr ) ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "entry in slist failed sanity checks.") } } else { - if ( ( entry_ptr->is_dirty ) || ( entry_ptr->addr != addr ) ) { + if ( ( entry_ptr->is_dirty ) || + ( entry_ptr->flush_marker ) || + ( entry_ptr->addr != addr ) ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "entry failed sanity checks.") @@ -5449,6 +5558,8 @@ H5C_flush_single_entry(H5F_t * f, #endif /* NDEBUG */ #endif /* H5_HAVE_PARALLEL */ + entry_ptr->flush_marker = FALSE; + if ( clear_only ) { H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) } else { @@ -5527,6 +5638,7 @@ H5C_flush_single_entry(H5F_t * f, if ( ! destroy ) { HDassert( !(entry_ptr->is_dirty) ); + HDassert( !(entry_ptr->flush_marker) ); } } @@ -5727,7 +5839,7 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - (unsigned)0, + H5C__NO_FLAGS_SET, first_flush_ptr, FALSE); } else { @@ -5738,7 +5850,7 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - H5F_FLUSH_INVALIDATE, + H5C__FLUSH_INVALIDATE_FLAG, first_flush_ptr, TRUE); } @@ -5781,7 +5893,7 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - (unsigned)0, + H5C__NO_FLAGS_SET, first_flush_ptr, FALSE); @@ -5824,7 +5936,7 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr, entry_ptr->type, entry_ptr->addr, - H5F_FLUSH_INVALIDATE, + H5C__FLUSH_INVALIDATE_FLAG, first_flush_ptr, TRUE); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 71cdc90..7830b26 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -153,7 +153,7 @@ typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f, * out of a hat -- you should be able to change them as necessary. * * However, if you need a very big cache, you should also increase the - * size of the hash table (H5C__HASH_TABLE_LEN in H5C.c). The current + * size of the hash table (H5C__HASH_TABLE_LEN in H5Cpkg.h). The current * upper bound on cache size is rather large for the current hash table * size. */ @@ -234,6 +234,11 @@ typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f, * are marked dirty. However they may remain in the list after * being flushed. * + * flush_marker: Boolean flag indicating that the entry is to be flushed + * the next time H5C_flush_cache() is called with the + * H5AC__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when + * the entry is flushed for whatever reason. + * * * Fields supporting the hash table: * @@ -275,7 +280,7 @@ typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f, * clean and dirty LRU lists to the usual LRU list. When reading in * parallel mode, we evict from the clean LRU list only. This implies * that we must try to ensure that the clean LRU list is reasonably well - * stocked. See the comments on H5C_t in H5C.c for more details. + * stocked. See the comments on H5C_t in H5Cpkg.h for more details. * * Note that even if we start with a completely clean cache, a sequence * of protects without unprotects can empty the clean LRU list. In this @@ -338,6 +343,7 @@ typedef struct H5C_cache_entry_t hbool_t is_dirty; hbool_t is_protected; hbool_t in_slist; + hbool_t flush_marker; /* fields supporting the hash table: */ @@ -475,7 +481,7 @@ typedef struct H5C_cache_entry_t * automatically. * * When this increment mode is selected, the remaining fields - * in the cache size decrease section ar ignored. + * in the cache size decrease section are ignored. * * H5C_decr__threshold: Attempt to decrease the size of the cache * whenever the average hit rate over the last epoch rises @@ -502,7 +508,7 @@ typedef struct H5C_cache_entry_t * ignored. * * H5C_decr__threshold: If the hit rate exceeds this threshold in any - * epoch, attempt todecrement the cache size by size_decrement. + * epoch, attempt to decrement the cache size by size_decrement. * * Note that cache size may not be decremented below min_size. * @@ -655,6 +661,26 @@ typedef struct H5C_auto_size_ctl_t /* * Library prototypes. */ + +/* #defines of flags used in the flags parameters in some of the + * following function calls. Note that not all flags are applicable + * to all function calls. Flags that don't apply to a particular + * function are ignored in that function. + */ + +/* Generic "no flags set" value for all function calls */ +#define H5C__NO_FLAGS_SET 0x0000 + +/* These flags apply to H5C_insert_entry() & H5C_unprotect() */ +#define H5C__SET_FLUSH_MARKER_FLAG 0x0001 +#define H5C__DELETED_FLAG 0x0002 + +/* These flags apply to H5C_flush() & H5C_flush_single_entry() */ +#define H5C__FLUSH_INVALIDATE_FLAG 0x0004 +#define H5C__FLUSH_CLEAR_ONLY_FLAG 0x0008 +#define H5C__FLUSH_MARKED_ENTRIES_FLAG 0x0010 + + H5_DLL H5C_t * H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, @@ -701,7 +727,8 @@ H5_DLL herr_t H5C_insert_entry(H5F_t * f, H5C_t * cache_ptr, const H5C_class_t * type, haddr_t addr, - void * thing); + void * thing, + unsigned int flags); H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr, const H5C_class_t * type, @@ -739,7 +766,7 @@ H5_DLL herr_t H5C_unprotect(H5F_t * f, const H5C_class_t * type, haddr_t addr, void * thing, - hbool_t deleted); + unsigned int flags); #endif /* !_H5Cprivate_H */ @@ -2909,6 +2909,11 @@ done: * Modified the flags being passed in to be one flag instead * of several. * + * John Mainzer, 2005-01-07 + * H5AC (and H5C) now have their own system of flags. Hence + * we must now translate between the H5F_FLUSH flags and the + * H5AC flags. Added code to handle this detail. + * *------------------------------------------------------------------------- */ static herr_t @@ -2916,6 +2921,7 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) { unsigned nerrors = 0; /* Errors from nested flushes */ unsigned i; /* Index variable */ + unsigned int H5AC_flags; /* translated flags for H5AC_flush() */ herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5F_flush) @@ -3012,7 +3018,16 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) * allocates object headers (calls the H5O_init function...via a * lot of other functions first).... */ - if (H5AC_flush(f, dxpl_id, flags & (H5F_FLUSH_INVALIDATE | H5F_FLUSH_CLEAR_ONLY)) < 0) + + H5AC_flags = 0; + + if ( (flags & H5F_FLUSH_INVALIDATE) != 0 ) + H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG; + + if ( (flags & H5F_FLUSH_CLEAR_ONLY) != 0 ) + H5AC_flags |= H5AC__FLUSH_CLEAR_ONLY_FLAG; + + if (H5AC_flush(f, dxpl_id, H5AC_flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush meta data cache") /* Write the superblock to disk */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index e6c1776..5d30559 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -750,7 +750,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, 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"); - if (H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym) < 0) + if (H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); /* * The left and right symbols in an empty tree are both the @@ -996,7 +996,8 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "internal erorr (unknown symbol find operation)"); done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, FALSE) < 0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -1185,9 +1186,11 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, insert_into->nsyms += 1; done: - if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, FALSE) < 0) + if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, + 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, FALSE) < 0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + 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); @@ -1356,7 +1359,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, sn->nsyms = 0; sn->cache_info.is_dirty = 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, TRUE)<0) { + || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5C__DELETED_FLAG)<0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node"); } @@ -1422,7 +1425,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, sn->nsyms = 0; sn->cache_info.is_dirty = 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, TRUE)<0) { + || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5C__DELETED_FLAG)<0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node"); } @@ -1431,7 +1434,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, } /* end else */ done: - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, FALSE)<0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + 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); @@ -1491,7 +1495,8 @@ 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, FALSE) != SUCCEED) { + if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) + != SUCCEED) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); } @@ -1540,7 +1545,8 @@ done: if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr) < 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, FALSE) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); if(name_off) @@ -1589,7 +1595,8 @@ 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, FALSE) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1659,7 +1666,8 @@ 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, FALSE) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1710,7 +1718,8 @@ 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, FALSE) != SUCCEED) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1925,7 +1934,8 @@ 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, FALSE) < 0) + if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value); @@ -278,7 +278,7 @@ HDmemset(heap->chunk,0,size); } /* Add the heap to the cache */ - if (H5AC_set (f, dxpl_id, H5AC_GHEAP, addr, heap)<0) + if (H5AC_set (f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET)<0) HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, \ "unable to cache global heap collection"); @@ -1021,7 +1021,8 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* hobj->idx = idx; done: - if ( heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, heap->addr, heap, FALSE) < 0 ) + if ( heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, heap->addr, heap, + H5AC__NO_FLAGS_SET) < 0 ) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to unprotect heap."); FUNC_LEAVE_NOAPI(ret_value); @@ -1094,7 +1095,8 @@ 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, FALSE)<0) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, + H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1154,7 +1156,8 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) ret_value=heap->obj[hobj->idx].nrefs; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, FALSE)<0) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, + H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1183,7 +1186,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) size_t need; int i; unsigned u; - hbool_t deleted=FALSE; /* Whether the heap gets deleted */ + unsigned flags=H5AC__NO_FLAGS_SET;/* Whether the heap gets deleted */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HG_remove, FAIL); @@ -1236,7 +1239,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) heap->cache_info.is_dirty = FALSE; H5_CHECK_OVERFLOW(heap->size,size_t,hsize_t); H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, heap->addr, (hsize_t)heap->size); - deleted=TRUE; /* Indicate that the object was deleted, for the unprotect call */ + flags=H5C__DELETED_FLAG; /* Indicate that the object was deleted, for the unprotect call */ } else { /* * If the heap is in the CWFS list then advance it one position. The @@ -1259,7 +1262,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, deleted) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, flags) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -172,7 +172,7 @@ 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) < 0) + 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"); done: @@ -764,7 +764,8 @@ H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, voi ret_value=buf; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -884,7 +885,8 @@ 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, FALSE) != SUCCEED) + if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap, + H5AC__NO_FLAGS_SET) != SUCCEED) HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); done: @@ -1099,7 +1101,8 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void * ret_value=offset; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1156,7 +1159,10 @@ H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, co HDmemcpy(heap->chunk + H5HL_SIZEOF_HDR(f) + offset, buf, size); done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED && ret_value != FAIL) + if (heap && + H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) + != SUCCEED && + ret_value != FAIL) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1293,7 +1299,8 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size) heap->freelist = fl; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, FALSE) != SUCCEED) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1360,14 +1367,15 @@ 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, TRUE)<0) { + if (H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, 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, FALSE)<0) + if (heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, + H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap"); FUNC_LEAVE_NOAPI(ret_value); @@ -318,7 +318,7 @@ H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, had oh->mesg[0].chunkno = 0; /* cache it */ - if (H5AC_set(f, dxpl_id, H5AC_OHDR, ent->header, oh) < 0) + if (H5AC_set(f, dxpl_id, H5AC_OHDR, ent->header, oh, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header"); /* open it */ @@ -1220,7 +1220,10 @@ int H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) { H5O_t *oh = NULL; - hbool_t deleted=FALSE; /* Whether the object was deleted as a result of this action */ + unsigned int flags=H5AC__NO_FLAGS_SET; /* used to indicate whether the + * object was deleted as a result + * of this action. + */ int ret_value = FAIL; FUNC_ENTER_NOAPI(H5O_link, FAIL); @@ -1258,7 +1261,7 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file"); /* Mark the object header as deleted */ - deleted=TRUE; + flags = H5C__DELETED_FLAG; } /* end else */ } /* end if */ } else if (adjust>0) { @@ -1280,7 +1283,7 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) ret_value = oh->nlink; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, deleted) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, flags) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1379,7 +1382,8 @@ H5O_count_real (H5G_entry_t *ent, const H5O_class_t *type, hid_t dxpl_id) ret_value=acc; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) != SUCCEED) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1484,7 +1488,8 @@ H5O_exists_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d ret_value=(sequence<0); done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) != SUCCEED) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) != SUCCEED) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1634,7 +1639,8 @@ 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, FALSE) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1904,7 +1910,8 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, ret_value = sequence; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -1986,7 +1993,8 @@ H5O_unprotect(H5G_entry_t *ent, H5O_t *oh, hid_t dxpl_id) assert(H5F_addr_defined(ent->header)); assert(oh); - if (H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) < 0) + if (H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); done: @@ -2328,7 +2336,8 @@ H5O_touch(H5G_entry_t *ent, hbool_t force, hid_t dxpl_id) 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, FALSE)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -2432,7 +2441,8 @@ H5O_bogus(H5G_entry_t *ent, hid_t dxpl_id) 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, FALSE)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE(ret_value); @@ -2580,7 +2590,8 @@ H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)"); done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3238,7 +3249,8 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file"); done: - if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, TRUE)<0) + if (oh && + H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5C__DELETED_FLAG)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3421,7 +3433,8 @@ H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id) ostat->nchunks=oh->nchunks; done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE)<0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET)<0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3597,7 +3610,8 @@ H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op, } /* end for */ done: - if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) < 0) + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); @@ -3825,7 +3839,8 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: - if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, FALSE) < 0) + if (oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, + H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value); |