diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 491 | ||||
-rw-r--r-- | src/H5ACprivate.h | 24 | ||||
-rw-r--r-- | src/H5C.c | 382 | ||||
-rw-r--r-- | src/H5Cprivate.h | 40 | ||||
-rw-r--r-- | src/H5Dint.c | 12 | ||||
-rw-r--r-- | src/H5FS.c | 8 | ||||
-rw-r--r-- | src/H5FScache.c | 4 | ||||
-rw-r--r-- | src/H5FSsection.c | 22 | ||||
-rw-r--r-- | src/H5Gnode.c | 4 | ||||
-rw-r--r-- | src/H5Gobj.c | 4 | ||||
-rw-r--r-- | src/H5Gstab.c | 20 | ||||
-rw-r--r-- | src/H5HFhdr.c | 6 | ||||
-rw-r--r-- | src/H5HFiblock.c | 6 | ||||
-rw-r--r-- | src/H5HL.c | 32 | ||||
-rw-r--r-- | src/H5HLcache.c | 14 | ||||
-rw-r--r-- | src/H5HLdbg.c | 2 | ||||
-rw-r--r-- | src/H5HLint.c | 4 | ||||
-rw-r--r-- | src/H5HLpkg.h | 2 | ||||
-rw-r--r-- | src/H5HLprivate.h | 2 | ||||
-rw-r--r-- | src/H5O.c | 11 | ||||
-rw-r--r-- | src/H5Oalloc.c | 2 | ||||
-rw-r--r-- | src/H5Oefl.c | 6 | ||||
-rw-r--r-- | src/H5Omessage.c | 4 | ||||
-rw-r--r-- | src/H5Oprivate.h | 2 |
24 files changed, 413 insertions, 691 deletions
@@ -154,8 +154,7 @@ static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr, haddr_t addr, unsigned int flags); -static herr_t H5AC_log_dirtied_entry(H5AC_t * cache_ptr, - H5C_cache_entry_t * entry_ptr, +static herr_t H5AC_log_dirtied_entry(const H5C_cache_entry_t *entry_ptr, haddr_t addr, hbool_t size_changed, size_t new_size); @@ -190,7 +189,7 @@ static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f, hid_t secondary_dxpl_id, H5AC_t * cache_ptr); -static herr_t H5AC_log_renamed_entry(H5AC_t * cache_ptr, +static herr_t H5AC_log_renamed_entry(const H5F_t * f, haddr_t old_addr, haddr_t new_addr); #endif /* H5_HAVE_PARALLEL */ @@ -733,25 +732,6 @@ done: * matzke@llnl.gov * Jul 9 1997 * - * Modifications: - * - * Complete re-design and re-write to support the re-designed - * metadata cache. - * JRM - 5/12/04 - * - * Abstracted the guts of the function to H5C_dest() in H5C.c, - * and then re-wrote the function as a wrapper for H5C_dest(). - * - * JRM - 6/7/04 - * - * Added code to free the auxiliary structure and its - * associated slist if present. - * JRM - 6/28/05 - * - * Added code to close the trace file if it is present. - * - * JRM - 6/8/06 - * *------------------------------------------------------------------------- */ herr_t @@ -785,7 +765,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) } #endif /* H5AC__TRACE_FILE_ENABLED */ - if ( H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id, cache) < 0 ) { + if ( H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") } @@ -844,7 +824,6 @@ H5AC_expunge_entry(H5F_t *f, { herr_t result; herr_t ret_value=SUCCEED; /* Return value */ - H5AC_t * cache_ptr = NULL; #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; @@ -860,9 +839,11 @@ H5AC_expunge_entry(H5F_t *f, HDassert(type->dest); HDassert(H5F_addr_defined(addr)); - cache_ptr = f->shared->cache; - #if H5AC__TRACE_FILE_ENABLED +{ + H5AC_t * cache_ptr = f->shared->cache; + + /* For the expunge entry call, only the addr, and type id are really * necessary in the trace file. Write the return value to catch occult * errors. @@ -875,12 +856,12 @@ H5AC_expunge_entry(H5F_t *f, (unsigned long)addr, (int)(type->id)); } +} #endif /* H5AC__TRACE_FILE_ENABLED */ result = H5C_expunge_entry(f, dxpl_id, H5AC_noblock_dxpl_id, - cache_ptr, type, addr); @@ -1059,7 +1040,6 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) status = H5C_flush_cache(f, H5AC_noblock_dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, init_flush_flags); aux_ptr->write_permitted = FALSE; @@ -1086,7 +1066,6 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) status = H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, flags); if ( status < 0 ) { @@ -1133,14 +1112,12 @@ done: * *------------------------------------------------------------------------- */ - herr_t -H5AC_get_entry_status(H5F_t * f, +H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned * status_ptr) { H5C_t *cache_ptr = f->shared->cache; - herr_t ret_value = SUCCEED; /* Return value */ herr_t result; hbool_t in_cache; hbool_t is_dirty; @@ -1148,6 +1125,7 @@ H5AC_get_entry_status(H5F_t * f, hbool_t is_pinned; size_t entry_size; unsigned status = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_get_entry_status, FAIL) @@ -1159,7 +1137,7 @@ H5AC_get_entry_status(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.") } - result = H5C_get_entry_status(cache_ptr, addr, &entry_size, &in_cache, + result = H5C_get_entry_status(f, addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -1260,7 +1238,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * { herr_t result; H5AC_info_t *info; - H5AC_t *cache; herr_t ret_value=SUCCEED; /* Return value */ #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; @@ -1303,7 +1280,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * #endif /* H5AC__TRACE_FILE_ENABLED */ /* Get local copy of this information */ - cache = f->shared->cache; info = (H5AC_info_t *)thing; info->addr = addr; @@ -1330,7 +1306,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * result = H5C_insert_entry(f, dxpl_id, H5AC_noblock_dxpl_id, - cache, type, addr, thing, @@ -1395,109 +1370,66 @@ done: * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * - * Added trace file support. JRM -- 6/6/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_mark_pinned_entry_dirty(H5F_t * f, - void * thing, - hbool_t size_changed, - size_t new_size) +H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_mark_pinned_entry_dirty, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the mark pinned entry dirty call, only the addr, size_changed, * and new_size are really necessary in the trace file. Write the result * to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_mark_pinned_entry_dirty 0x%lx %d %d", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s 0x%lx %d %d", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr), (int)size_changed, (int)new_size); - } #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL +{ + H5AC_info_t *entry_ptr = (H5AC_info_t *)thing; + H5C_t *cache_ptr = entry_ptr->cache_ptr; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && - ( NULL != cache_ptr->aux_ptr) ) { - - H5AC_info_t * entry_ptr; - - HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) ); - - entry_ptr = (H5AC_info_t *)thing; - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry is protected??") - } - - result = H5AC_log_dirtied_entry(cache_ptr, - entry_ptr, - entry_ptr->addr, - size_changed, - new_size); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if ( result < 0 ) { + if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) { + /* Check for usage errors */ + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??") - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } - } + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, size_changed, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ - result = H5C_mark_pinned_entry_dirty(cache_ptr, - thing, - size_changed, - new_size); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5C_mark_pinned_entry_dirty() failed.") - - } + if(H5C_mark_pinned_entry_dirty(thing, size_changed, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned entry dirty") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_mark_pinned_entry_dirty() */ @@ -1515,92 +1447,59 @@ done: * Programmer: John Mainzer * 5/16/06 * - * Modifications: - * - * Added trace file support. JRM -- 6/6/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f, - void * thing) +H5AC_mark_pinned_or_protected_entry_dirty(void *thing) { - H5C_t * cache_ptr = f->shared->cache; -#ifdef H5_HAVE_PARALLEL - H5AC_info_t * info_ptr; -#endif /* H5_HAVE_PARALLEL */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_mark_pinned_or_protected_entry_dirty, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the mark pinned or protected entry dirty call, only the addr * is really necessary in the trace file. Write the result to catch * occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_mark_pinned_or_protected_entry_dirty %lx", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); - } #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL +{ + H5AC_info_t *entry_ptr = (H5AC_info_t *)thing; + H5C_t *cache_ptr = entry_ptr->cache_ptr; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - info_ptr = (H5AC_info_t *)thing; - - if ( ( info_ptr->is_dirty == FALSE ) && - ( ! ( info_ptr->is_protected ) ) && - ( info_ptr->is_pinned ) && - ( NULL != cache_ptr->aux_ptr) ) { - - result = H5AC_log_dirtied_entry(cache_ptr, - info_ptr, - info_ptr->addr, - FALSE, - 0); - - if ( result < 0 ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } - } + if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && + (entry_ptr->is_pinned) && (NULL != cache_ptr->aux_ptr)) { + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, FALSE, 0) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ - result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr, thing); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5C_mark_pinned_entry_dirty() failed.") - - } + if(H5C_mark_pinned_or_protected_entry_dirty(thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_mark_pinned_entry_dirty() */ @@ -1691,16 +1590,8 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_ad #ifdef H5_HAVE_PARALLEL if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) { - - result = H5AC_log_renamed_entry(f->shared->cache, - old_addr, - new_addr); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5AC_log_renamed_entry() failed.") - } + if(H5AC_log_renamed_entry(f, old_addr, new_addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log renamed entry") } #endif /* H5_HAVE_PARALLEL */ @@ -1756,60 +1647,42 @@ done: * Programmer: John Mainzer * 4/27/06 * - * Modifications: - * - * Added trace file support. 6/6/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_pin_protected_entry(H5F_t * f, - void * thing) +H5AC_pin_protected_entry(void *thing) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_pin_protected_entry, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the pin protected entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_pin_protected_entry %lx", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); - } #endif /* H5AC__TRACE_FILE_ENABLED */ - result = H5C_pin_protected_entry(cache_ptr, thing); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \ - "H5C_pin_protected_entry() failed.") - } + if(H5C_pin_protected_entry(thing) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_pin_protected_entry() */ @@ -1959,7 +1832,6 @@ H5AC_protect(H5F_t *f, thing = H5C_protect(f, dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, type, addr, udata1, @@ -2009,104 +1881,65 @@ done: * Programmer: John Mainzer * 7/5/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t -H5AC_resize_pinned_entry(H5F_t * f, - void * thing, - size_t new_size) +H5AC_resize_pinned_entry(void *thing, size_t new_size) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_resize_pinned_entry, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the resize pinned entry call, only the addr, and new_size are * really necessary in the trace file. Write the result to catch * occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_resize_pinned_entry 0x%lx %d", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr), (int)new_size); - } #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL +{ + H5AC_info_t * entry_ptr = (H5AC_info_t *)thing; + H5C_t *cache_ptr = entry_ptr->cache_ptr; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && - ( NULL != cache_ptr->aux_ptr) ) { - - H5AC_info_t * entry_ptr; - - entry_ptr = (H5AC_info_t *)thing; - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry is protected??") - } - - result = H5AC_log_dirtied_entry(cache_ptr, - entry_ptr, - entry_ptr->addr, - TRUE, - new_size); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if ( result < 0 ) { + if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) { + /* Check for usage errors */ + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??") - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } - } + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, TRUE, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ - result = H5C_resize_pinned_entry(cache_ptr, - thing, - new_size); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "H5C_resize_pinned_entry() failed.") - - } + if(H5C_resize_pinned_entry(thing, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_resize_pinned_entry() */ @@ -2121,59 +1954,42 @@ done: * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * - * Added code supporting the trace file. JRM -- 6/7/06 - * *------------------------------------------------------------------------- */ herr_t -H5AC_unpin_entry(H5F_t * f, - void * thing) +H5AC_unpin_entry(void * thing) { - H5C_t *cache_ptr = f->shared->cache; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_unpin_entry, FAIL) + /* Sanity check */ + HDassert(thing); + #if H5AC__TRACE_FILE_ENABLED /* For the unpin entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if ( ( f != NULL ) && - ( f->shared != NULL ) && - ( f->shared->cache != NULL ) && - ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) && - ( trace_file_ptr != NULL ) ) { - - sprintf(trace, "H5AC_unpin_entry %lx", + if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) + sprintf(trace, "%s %lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); - } #endif /* H5AC__TRACE_FILE_ENABLED */ - result = H5C_unpin_entry(cache_ptr, thing); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "H5C_unpin_entry() failed.") - } + if(H5C_unpin_entry(thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") done: - #if H5AC__TRACE_FILE_ENABLED - if ( trace_file_ptr != NULL ) { - + if(trace_file_ptr) HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); - } #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_unpin_entry() */ @@ -2345,18 +2161,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, #ifdef H5_HAVE_PARALLEL if ( ( dirtied ) && ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) ) { - - result = H5AC_log_dirtied_entry(f->shared->cache, - (H5AC_info_t *)thing, - addr, - size_changed, - new_size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5AC_log_dirtied_entry() failed.") - } + if(H5AC_log_dirtied_entry((H5AC_info_t *)thing, addr, size_changed, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") } if ( ( (flags & H5C__DELETED_FLAG) != 0 ) && @@ -2379,7 +2185,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, result = H5C_unprotect(f, dxpl_id, H5AC_noblock_dxpl_id, - f->shared->cache, type, addr, thing, @@ -2555,7 +2360,7 @@ done: */ herr_t -H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, +H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr) { herr_t result; @@ -2587,7 +2392,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, } - result = H5C_get_cache_auto_resize_config((H5C_t *)cache_ptr, + result = H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config); if ( result < 0 ) { @@ -2596,7 +2401,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, "H5C_get_cache_auto_resize_config() failed.") } - result = H5C_get_evictions_enabled((H5C_t *)cache_ptr, &evictions_enabled); + result = H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled); if ( result < 0 ) { @@ -2832,10 +2637,9 @@ done: */ herr_t -H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, +H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr) { - /* const char * fcn_name = "H5AC_set_cache_auto_resize_config"; */ herr_t result; herr_t ret_value = SUCCEED; /* Return value */ H5C_auto_size_ctl_t internal_config; @@ -2846,6 +2650,8 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, FUNC_ENTER_NOAPI(H5AC_set_cache_auto_resize_config, FAIL) + HDassert( cache_ptr ); + #if H5AC__TRACE_FILE_ENABLED /* Make note of the new configuration. Don't look up the trace file * pointer, as that may change before we use it. @@ -2936,30 +2742,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, } } - if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) != - SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_ext_config_2_int_config() failed.") - } - - result = H5C_set_cache_auto_resize_config((H5C_t *)cache_ptr, - &internal_config); - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_set_cache_auto_resize_config() failed.") - } - + if(H5AC_ext_config_2_int_config(config_ptr, &internal_config) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_ext_config_2_int_config() failed.") - result = H5C_set_evictions_enabled((H5C_t *)cache_ptr, - config_ptr->evictions_enabled); - - if ( result < 0 ) { + if(H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed.") - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5C_set_evictions_enabled() failed.") - } + if(H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.") #ifdef H5_HAVE_PARALLEL if ( cache_ptr->aux_ptr != NULL ) { @@ -3830,26 +3620,28 @@ done: * * Programmer: John Mainzer, 6/29/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL static herr_t -H5AC_log_dirtied_entry(H5AC_t * cache_ptr, - H5AC_info_t * entry_ptr, +H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, haddr_t addr, hbool_t size_changed, size_t new_size) { - herr_t ret_value = SUCCEED; /* Return value */ size_t entry_size; - H5AC_aux_t * aux_ptr = NULL; - H5AC_slist_entry_t * slist_entry_ptr = NULL; + H5AC_t * cache_ptr; + H5AC_aux_t * aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_log_dirtied_entry, FAIL) + HDassert( entry_ptr != NULL ); + HDassert( entry_ptr->addr == addr ); + HDassert( entry_ptr->is_dirty == FALSE ); + + cache_ptr = entry_ptr->cache_ptr; + HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -3858,10 +3650,6 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr, HDassert( aux_ptr != NULL ); HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->is_dirty == FALSE ); - if ( size_changed ) { entry_size = new_size; @@ -3872,6 +3660,7 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr, } if ( aux_ptr->mpi_rank == 0 ) { + H5AC_slist_entry_t * slist_entry_ptr; HDassert( aux_ptr->d_slist_ptr != NULL ); HDassert( aux_ptr->c_slist_ptr != NULL ); @@ -4279,10 +4068,11 @@ done: #ifdef H5_HAVE_PARALLEL static herr_t -H5AC_log_renamed_entry(H5AC_t * cache_ptr, +H5AC_log_renamed_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) { + H5AC_t * cache_ptr; herr_t ret_value = SUCCEED; /* Return value */ hbool_t entry_in_cache; hbool_t entry_dirty; @@ -4292,7 +4082,12 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr, FUNC_ENTER_NOAPI(H5AC_log_renamed_entry, FAIL) - HDassert( cache_ptr != NULL ); + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = (H5AC_t *)f->shared->cache; + + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); aux_ptr = cache_ptr->aux_ptr; @@ -4301,7 +4096,7 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr, HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); /* get entry status, size, etc here */ - if ( H5C_get_entry_status(cache_ptr, old_addr, &entry_size, &entry_in_cache, + if ( H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache, &entry_dirty, NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.") diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index aa1df87..4f6e4e1 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -266,29 +266,23 @@ extern hid_t H5AC_ind_dxpl_id; H5_DLL herr_t H5AC_init(void); H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr); -H5_DLL herr_t H5AC_get_entry_status(H5F_t * f, haddr_t addr, +H5_DLL herr_t H5AC_get_entry_status(const H5F_t * f, haddr_t addr, unsigned * status_ptr); 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 herr_t H5AC_pin_protected_entry(H5F_t * f, void * thing); +H5_DLL herr_t H5AC_pin_protected_entry(void *thing); 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_resize_pinned_entry(H5F_t * f, - void * thing, - size_t new_size); -H5_DLL herr_t H5AC_unpin_entry(H5F_t * f, - void * thing); +H5_DLL herr_t H5AC_resize_pinned_entry(void *thing, size_t new_size); +H5_DLL herr_t H5AC_unpin_entry(void *thing); H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); -H5_DLL herr_t H5AC_mark_pinned_entry_dirty(H5F_t * f, - void * thing, - hbool_t size_changed, - size_t new_size); -H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f, - void * thing); +H5_DLL herr_t H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, + size_t new_size); +H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(void *thing); H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr); @@ -301,7 +295,7 @@ H5_DLL herr_t H5AC_set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)); H5_DLL herr_t H5AC_stats(const H5F_t *f); -H5_DLL herr_t H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, +H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_get_cache_size(H5AC_t * cache_ptr, @@ -315,7 +309,7 @@ H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t * cache_ptr, H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr); -H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, +H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t * config_ptr); @@ -3298,9 +3298,9 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, herr_t H5C_dest(H5F_t * f, hid_t primary_dxpl_id, - hid_t secondary_dxpl_id, - H5C_t * cache_ptr) + hid_t secondary_dxpl_id) { + H5C_t * cache_ptr = f->shared->cache; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_dest, FAIL) @@ -3310,7 +3310,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, H5C__FLUSH_INVALIDATE_FLAG) < 0 ) { + H5C__FLUSH_INVALIDATE_FLAG) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } @@ -3323,7 +3323,7 @@ H5C_dest(H5F_t * f, cache_ptr->magic = 0; - H5FL_FREE(H5C_t, cache_ptr); + cache_ptr = H5FL_FREE(H5C_t, cache_ptr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3405,15 +3405,14 @@ done: * *------------------------------------------------------------------------- */ - herr_t H5C_expunge_entry(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) { + H5C_t * cache_ptr; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t first_flush = TRUE; @@ -3421,12 +3420,17 @@ H5C_expunge_entry(H5F_t * f, FUNC_ENTER_NOAPI(H5C_expunge_entry, FAIL) - HDassert( H5F_addr_defined(addr) ); + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( type ); HDassert( type->clear ); HDassert( type->dest ); + HDassert( H5F_addr_defined(addr) ); #if H5C_DO_EXTREME_SANITY_CHECKS if ( H5C_validate_lru_list(cache_ptr) < 0 ) { @@ -3597,9 +3601,9 @@ herr_t H5C_flush_cache(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, unsigned flags) { + H5C_t * cache_ptr = f->shared->cache; herr_t status; herr_t ret_value = SUCCEED; hbool_t destroy; @@ -4133,8 +4137,7 @@ H5C_flush_to_min_clean(H5F_t * f, /* Flush the marked entries */ result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, - cache_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG | - H5C__FLUSH_IGNORE_PROTECTED_FLAG); + H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG); if ( result < 0 ) { @@ -4190,7 +4193,7 @@ done: */ herr_t -H5C_get_cache_auto_resize_config(H5C_t * cache_ptr, +H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4372,7 +4375,7 @@ done: */ herr_t -H5C_get_entry_status(H5C_t * cache_ptr, +H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t * size_ptr, hbool_t * in_cache_ptr, @@ -4380,11 +4383,17 @@ H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ + H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL) + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr != NULL ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( H5F_addr_defined(addr) ); @@ -4458,7 +4467,7 @@ done: */ herr_t -H5C_get_evictions_enabled(H5C_t * cache_ptr, +H5C_get_evictions_enabled(const H5C_t * cache_ptr, hbool_t * evictions_enabled_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4499,38 +4508,55 @@ done: * Programmer: John Mainzer * 1/20/06 * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t -H5C_get_trace_file_ptr(H5C_t * cache_ptr, - FILE ** trace_file_ptr_ptr) +H5C_get_trace_file_ptr(const H5C_t *cache_ptr, FILE **trace_file_ptr_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr) - FUNC_ENTER_NOAPI(H5C_get_trace_file_ptr, FAIL) + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(trace_file_ptr_ptr); - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ( ( ! cache_ptr ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + *trace_file_ptr_ptr = cache_ptr->trace_file_ptr; - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr") - } + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C_get_trace_file_ptr() */ - if ( trace_file_ptr_ptr == NULL ) { + +/*------------------------------------------------------------------------- + * Function: H5C_get_trace_file_ptr_from_entry + * + * Purpose: Get the trace_file_ptr field from the cache, via an entry. + * + * This field will either be NULL (which indicates that trace + * file logging is turned off), or contain a pointer to the + * open file to which trace file data is to be written. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 6/9/08 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr, + FILE **trace_file_ptr_ptr) +{ + FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr_from_entry) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL trace_file_ptr_ptr") - } + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(entry_ptr->cache_ptr); - *trace_file_ptr_ptr = cache_ptr->trace_file_ptr; + /* Go get the trace file pointer for the cache */ + H5C_get_trace_file_ptr(entry_ptr->cache_ptr, trace_file_ptr_ptr); -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_get_trace_file_ptr() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C_get_trace_file_ptr_from_entry() */ /*------------------------------------------------------------------------- @@ -4618,13 +4644,13 @@ herr_t H5C_insert_entry(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, void * thing, unsigned int flags) { /* const char * fcn_name = "H5C_insert_entry()"; */ + H5C_t * cache_ptr; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t first_flush = TRUE; @@ -4636,6 +4662,11 @@ H5C_insert_entry(H5F_t * f, FUNC_ENTER_NOAPI(H5C_insert_entry, FAIL) + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( cache_ptr->skip_file_checks || f ); @@ -4667,6 +4698,7 @@ H5C_insert_entry(H5F_t * f, #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ + entry_ptr->cache_ptr = cache_ptr; entry_ptr->addr = addr; entry_ptr->type = type; @@ -5189,45 +5221,30 @@ done: * Programmer: John Mainzer * 3/22/06 * - * Modifications: - * - * Added code to do a flash cache size increase if - * appropriate. - * JRM -- 1/11/08 - * *------------------------------------------------------------------------- */ herr_t -H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, - void * thing, - hbool_t size_changed, - size_t new_size) +H5C_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size) { - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; size_t size_increase; - H5C_cache_entry_t * entry_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) ); - - entry_ptr = (H5C_cache_entry_t *)thing; + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ - "Entry is protected??") - } + /* Check for usage errors */ + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??") /* mark the entry as dirty if it isn't already */ entry_ptr->is_dirty = TRUE; @@ -5243,17 +5260,9 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, size_increase = new_size - entry_ptr->size; if ( size_increase >= - cache_ptr->flash_size_increase_threshold ) { - - result = H5C__flash_increase_cache_size(cache_ptr, - entry_ptr->size, - new_size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5C__flash_increase_cache_size failed.") - } + cache_ptr->flash_size_increase_threshold ) { + if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed") } } } @@ -5290,9 +5299,7 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_mark_pinned_entry_dirty() */ @@ -5317,32 +5324,23 @@ done: * Programmer: John Mainzer * 5/15/06 * - * Modifications: - * - * JRM -- 3/29/07 - * Added sanity check to verify that the pinned entry - * is not protected read only. - * - * This sanity check is commented out for now -- uncomment - * it once we deal with the problem of entries being protected - * read only, and then dirtied. - * *------------------------------------------------------------------------- */ herr_t -H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - void * thing) +H5C_mark_pinned_or_protected_entry_dirty(void *thing) { + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; herr_t ret_value = SUCCEED; /* Return value */ - H5C_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C_mark_pinned_or_protected_entry_dirty, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - entry_ptr = (H5C_cache_entry_t *)thing; + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); if ( entry_ptr->is_protected ) { #if 0 /* JRM - uncomment this when possible */ @@ -5371,9 +5369,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_mark_pinned_or_protected_entry_dirty() */ @@ -5588,50 +5584,32 @@ done: * Programmer: John Mainzer * 7/5/06 * - * Modifications: - * - * Added code to apply a flash cache size increment if - * appropriate. - * JRM -- 1/11/08 - * *------------------------------------------------------------------------- */ herr_t -H5C_resize_pinned_entry(H5C_t * cache_ptr, - void * thing, - size_t new_size) +H5C_resize_pinned_entry(void *thing, size_t new_size) { - /* const char * fcn_name = "H5C_resize_pinned_entry()"; */ - herr_t ret_value = SUCCEED; /* Return value */ - herr_t result; - H5C_cache_entry_t * entry_ptr; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; size_t size_increase; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_resize_pinned_entry, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - entry_ptr = (H5C_cache_entry_t *)thing; - - if ( new_size <= 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "New size is non-positive.") - } - - if ( ! ( entry_ptr->is_pinned ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry isn't pinned??") - } - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \ - "Entry is protected??") - } + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + + /* Check for usage errors */ + if(new_size <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "New size is non-positive.") + if(!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??") + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??") /* resizing dirties entries -- mark the entry as dirty if it * isn't already @@ -5651,15 +5629,11 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, if ( size_increase >= cache_ptr->flash_size_increase_threshold ) { - result = H5C__flash_increase_cache_size(cache_ptr, - entry_ptr->size, - new_size); - - if ( result < 0 ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "H5C__flash_increase_cache_size failed.") - } + if(H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed") } } } @@ -5696,9 +5670,7 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_resize_pinned_entry() */ @@ -5713,64 +5685,38 @@ done: * Programmer: John Mainzer * 4/26/06 * - * Modifications: - * - * JRM -- 4/26/06 - * Modified routine to allow it to operate on protected - * entries. - * - * JRM -- 2/16/07 - * Added conditional compile to avoid unused parameter - * warning in production compile. - * - * JRM -- 4/4/07 - * Fixed typo -- canged macro call to - * H5C__UPDATE_STATS_FOR_UNPIN to call to - * H5C__UPDATE_STATS_FOR_PIN. - * *------------------------------------------------------------------------- */ -#ifndef NDEBUG -herr_t -H5C_pin_protected_entry(H5C_t * cache_ptr, - void * thing) -#else herr_t -H5C_pin_protected_entry(H5C_t UNUSED * cache_ptr, - void * thing) -#endif +H5C_pin_protected_entry(void *thing) { + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; herr_t ret_value = SUCCEED; /* Return value */ - H5C_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C_pin_protected_entry, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - entry_ptr = (H5C_cache_entry_t *)thing; - - HDassert( H5F_addr_defined(entry_ptr->addr) ); - - if ( ! ( entry_ptr->is_protected ) ) { + /* Sanity checks */ + HDassert(entry_ptr); + HDassert(H5F_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + /* Check for usage errors */ + if(!entry_ptr->is_protected) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Entry isn't protected") - } - - if ( entry_ptr->is_pinned ) { - + if(entry_ptr->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Entry is already pinned") - } + /* Pin entry */ entry_ptr->is_pinned = TRUE; + /* Update statistics for entry */ H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_pin_protected_entry() */ @@ -5865,7 +5811,6 @@ void * 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, @@ -5873,6 +5818,7 @@ H5C_protect(H5F_t * f, unsigned flags) { /* const char * fcn_name = "H5C_protect()"; */ + H5C_t * cache_ptr; hbool_t hit; hbool_t first_flush; hbool_t have_write_permitted = FALSE; @@ -5886,6 +5832,9 @@ H5C_protect(H5F_t * f, FUNC_ENTER_NOAPI(H5C_protect, NULL) /* check args */ + HDassert( f ); + HDassert( f->shared ); + cache_ptr = f->shared->cache; HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( cache_ptr->skip_file_checks || f ); @@ -6256,14 +6205,13 @@ done: */ herr_t -H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, +H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr) { - /* const char *fcn_name = "H5C_set_cache_auto_resize_config()"; */ - herr_t ret_value = SUCCEED; /* Return value */ herr_t result; size_t new_max_cache_size; size_t new_min_clean_size; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_set_cache_auto_resize_config, FAIL) @@ -6539,7 +6487,7 @@ done: */ herr_t -H5C_set_evictions_enabled(H5C_t * cache_ptr, +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { herr_t ret_value = SUCCEED; /* Return value */ @@ -7276,47 +7224,39 @@ H5C_stats__reset(H5C_t UNUSED * cache_ptr) * Programmer: John Mainzer * 3/22/06 * - * Modifications: - * - * JRM -- 4/26/06 - * Modified routine to allow it to operate on protected - * entries. - * *------------------------------------------------------------------------- */ herr_t -H5C_unpin_entry(H5C_t * cache_ptr, - void * thing) +H5C_unpin_entry(void *thing) { + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; herr_t ret_value = SUCCEED; /* Return value */ - H5C_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C_unpin_entry, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( thing ); - - entry_ptr = (H5C_cache_entry_t *)thing; - - if ( ! ( entry_ptr->is_pinned ) ) { + /* Sanity check */ + HDassert(entry_ptr); + cache_ptr = entry_ptr->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + /* Error checking */ + if(!entry_ptr->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Entry isn't pinned") - } - - if ( ! ( entry_ptr->is_protected ) ) { + /* Update unprotected entry */ + if(!entry_ptr->is_protected) H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL) - } + /* Mark entry unpinned */ entry_ptr->is_pinned = FALSE; + /* Update statistics for unpin operation */ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_unpin_entry() */ @@ -7421,7 +7361,6 @@ herr_t H5C_unprotect(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, void * thing, @@ -7429,6 +7368,7 @@ H5C_unprotect(H5F_t * f, size_t new_size) { /* const char * fcn_name = "H5C_unprotect()"; */ + H5C_t * cache_ptr; hbool_t deleted; hbool_t dirtied; hbool_t set_flush_marker; @@ -7459,6 +7399,11 @@ H5C_unprotect(H5F_t * f, dirtied |= size_changed; + HDassert( f ); + HDassert( f->shared ); + + cache_ptr = f->shared->cache; + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( cache_ptr->skip_file_checks || f ); @@ -10296,8 +10241,8 @@ H5C_flush_single_entry(H5F_t * f, /* Clear the dirty flag only, if requested */ if ( clear_only ) { -#ifndef NDEBUG if ( destroy ) { +#ifndef NDEBUG /* we are about to call the clear callback with the * destroy flag set -- this will result in *entry_ptr * being freed. Set the magic field to bad magic @@ -10305,8 +10250,9 @@ H5C_flush_single_entry(H5F_t * f, * one. */ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - } #endif /* NDEBUG */ + entry_ptr->cache_ptr = NULL; + } /* Call the callback routine to clear all dirty flags for object */ if ( (entry_ptr->type->clear)(f, entry_ptr, destroy) < 0 ) { @@ -10324,8 +10270,8 @@ H5C_flush_single_entry(H5F_t * f, } #endif /* H5C_DO_SANITY_CHECKS */ -#ifndef NDEBUG if ( destroy ) { +#ifndef NDEBUG /* we are about to call the flush callback with the * destroy flag set -- this will result in *entry_ptr * being freed. Set the magic field to bad magic @@ -10333,8 +10279,9 @@ H5C_flush_single_entry(H5F_t * f, * one. */ entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - } #endif /* NDEBUG */ + entry_ptr->cache_ptr = NULL; + } /* Only block for all the processes on the first piece of metadata */ @@ -10597,6 +10544,7 @@ H5C_load_entry(H5F_t * f, #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ + entry_ptr->cache_ptr = f->shared->cache; entry_ptr->addr = addr; entry_ptr->type = type; entry_ptr->is_protected = FALSE; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 53dcf0d..54233d8 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -473,6 +473,7 @@ typedef struct H5C_cache_entry_t #ifndef NDEBUG uint32_t magic; #endif /* NDEBUG */ + H5C_t * cache_ptr; haddr_t addr; size_t size; const H5C_class_t * type; @@ -944,22 +945,19 @@ H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, H5_DLL herr_t H5C_dest(H5F_t * f, hid_t primary_dxpl_id, - hid_t secondary_dxpl_id, - H5C_t * cache_ptr); + hid_t secondary_dxpl_id); H5_DLL herr_t H5C_dest_empty(H5C_t * cache_ptr); H5_DLL herr_t H5C_expunge_entry(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); H5_DLL herr_t H5C_flush_cache(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, - H5C_t * cache_ptr, unsigned flags); H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f, @@ -967,7 +965,7 @@ H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f, hid_t secondary_dxpl_id, H5C_t * cache_ptr); -H5_DLL herr_t H5C_get_cache_auto_resize_config(H5C_t * cache_ptr, +H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr); H5_DLL herr_t H5C_get_cache_size(H5C_t * cache_ptr, @@ -979,7 +977,7 @@ H5_DLL herr_t H5C_get_cache_size(H5C_t * cache_ptr, H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t * cache_ptr, double * hit_rate_ptr); -H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, +H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t * size_ptr, hbool_t * in_cache_ptr, @@ -987,16 +985,17 @@ H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr); -H5_DLL herr_t H5C_get_evictions_enabled(H5C_t * cache_ptr, +H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t * cache_ptr, hbool_t * evictions_enabled_ptr); -H5_DLL herr_t H5C_get_trace_file_ptr(H5C_t * cache_ptr, - FILE ** trace_file_ptr_ptr); +H5_DLL herr_t H5C_get_trace_file_ptr(const H5C_t *cache_ptr, + FILE **trace_file_ptr_ptr); +H5_DLL herr_t H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr, + FILE **trace_file_ptr_ptr); H5_DLL herr_t H5C_insert_entry(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, void * thing, @@ -1009,26 +1008,22 @@ H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t * f, int32_t ce_array_len, haddr_t * ce_array_ptr); -H5_DLL herr_t H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, - void * thing, +H5_DLL herr_t H5C_mark_pinned_entry_dirty(void * thing, hbool_t size_changed, size_t new_size); -H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr, - void * thing); +H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(void *thing); H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr, const H5C_class_t * type, haddr_t old_addr, haddr_t new_addr); -H5_DLL herr_t H5C_pin_protected_entry(H5C_t * cache_ptr, - void * thing); +H5_DLL herr_t H5C_pin_protected_entry(void *thing); H5_DLL void * 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, @@ -1037,14 +1032,12 @@ H5_DLL void * H5C_protect(H5F_t * f, H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr); -H5_DLL herr_t H5C_resize_pinned_entry(H5C_t * cache_ptr, - void * thing, - size_t new_size); +H5_DLL herr_t H5C_resize_pinned_entry(void *thing, size_t new_size); -H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, +H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); -H5_DLL herr_t H5C_set_evictions_enabled(H5C_t * cache_ptr, +H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled); H5_DLL herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix); @@ -1062,12 +1055,11 @@ H5_DLL herr_t H5C_stats(H5C_t * cache_ptr, H5_DLL void H5C_stats__reset(H5C_t * cache_ptr); -H5_DLL herr_t H5C_unpin_entry(H5C_t * cache_ptr, void * thing); +H5_DLL herr_t H5C_unpin_entry(void *thing); H5_DLL herr_t H5C_unprotect(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, void * thing, diff --git a/src/H5Dint.c b/src/H5Dint.c index c00c374..12ee37c 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -907,7 +907,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset) /* Insert "empty" name first */ if((size_t)(-1) == H5HL_insert(file, dxpl_id, heap, (size_t)1, "")) { - H5HL_unprotect(file, heap); + H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") } /* end if */ @@ -917,7 +917,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset) /* Insert file name into heap */ if((size_t)(-1) == (offset = H5HL_insert(file, dxpl_id, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) { - H5HL_unprotect(file, heap); + H5HL_unprotect(heap); HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") } /* end if */ @@ -927,7 +927,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset) } /* end for */ /* Release the heap */ - if(H5HL_unprotect(file, heap) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap") heap = NULL; @@ -972,8 +972,8 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset) done: /* Release pointer to object header itself */ - if(oloc != NULL && oh != NULL) - if(H5O_unprotect(oloc, oh) < 0) + if(oh != NULL) + if(H5O_unprotect(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect dataset object header") FUNC_LEAVE_NOAPI(ret_value) @@ -2499,7 +2499,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, unsigned flags) done: /* Release pointer to object header */ if(oh != NULL) - if(H5O_unprotect(&(dataset->oloc), oh) < 0) + if(H5O_unprotect(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect dataset object header") FUNC_LEAVE_NOAPI(ret_value) @@ -201,7 +201,7 @@ HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, fspace->sinfo); /* (could still be pinned from it's section info still hanging around in the cache) */ if(!(fspace_status & H5AC_ES__IS_PINNED)) { /* Pin free space header in the cache */ - if(H5AC_pin_protected_entry(f, fspace) < 0) + if(H5AC_pin_protected_entry(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, NULL, "unable to pin free space header") } /* end if */ @@ -342,7 +342,7 @@ HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->sinfo = %p\n", FUNC, fspac HDassert(H5F_addr_defined(fspace->sect_addr)); /* Unpin the free space section info in the cache */ - if(H5AC_unpin_entry(f, fspace->sinfo) < 0) + if(H5AC_unpin_entry(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space section info") /* If there aren't any sections being managed, free the space for the sections */ @@ -365,7 +365,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c fspace->alloc_sect_size = fspace->sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Evict the section info from the metadata cache */ @@ -387,7 +387,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c if(!(sect_status & H5AC_ES__IN_CACHE)) { /* Unpin the free space header in the cache */ /* (the section info destructor would unpin it if the section info existed) */ - if(H5AC_unpin_entry(f, fspace) < 0) + if(H5AC_unpin_entry(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") } /* end if */ } /* end else */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 7d0aad1..b32ae11 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -954,7 +954,7 @@ H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data) */ /* ARGSUSED */ herr_t -H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) +H5FS_cache_sinfo_dest(H5F_t UNUSED *f, H5FS_sinfo_t *sinfo) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -987,7 +987,7 @@ H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) /* (make certain this is last action with section info, to allow for header * disappearing immediately) */ - if(H5AC_unpin_entry(f, sinfo->fspace) < 0) + if(H5AC_unpin_entry(sinfo->fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") /* Release free space section info */ diff --git a/src/H5FSsection.c b/src/H5FSsection.c index de2fbc5..92444ab 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -225,7 +225,7 @@ HDfprintf(stderr, "%s: New section info, addr = %a, size = %Hu\n", FUNC, fspace- HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space sections to cache") /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, NULL, "unable to mark free space header as dirty") } /* end if */ else { @@ -237,7 +237,7 @@ HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space sections") /* Pin them in the cache */ - if(H5AC_pin_protected_entry(f, sinfo) < 0) + if(H5AC_pin_protected_entry(sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, NULL, "unable to pin free space sections") /* Unlock free space sections, now pinned */ @@ -318,7 +318,7 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -381,7 +381,7 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -586,7 +586,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); fspace->tot_space -= sect->size; /* Mark free space sections as changed */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") done: @@ -1097,7 +1097,7 @@ HDfprintf(stderr, "%s: fspace->hdr->tot_space = %Hu\n", FUNC, fspace->hdr->tot_s /* Mark free space sections as changed */ /* (if adding sections while deserializing sections, don't set the flag) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") } /* end if */ @@ -1369,12 +1369,12 @@ HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr, } /* end if */ else { /* Mark free space section as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space section info as dirty") } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ else { @@ -1426,12 +1426,12 @@ HDfprintf(stderr, "%s: Allocating space for smaller serialized sections, new_siz } /* end if */ else { /* Mark free space section as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space section info as dirty") } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end else */ @@ -1770,7 +1770,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") /* Mark free space sections as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace->sinfo) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") done: diff --git a/src/H5Gnode.c b/src/H5Gnode.c index f3092c1..4d96389 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1725,7 +1725,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, } /* end of for (i=0; i<sn->nsyms; i++) */ done: - if(heap && H5HL_unprotect(f, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) @@ -1924,7 +1924,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, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") - if(heap && H5HL_unprotect(f, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 467a471..38d5087 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -907,7 +907,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) for(u = 0; u < linfo->nlinks; u++) if(H5O_msg_append_oh(oloc->file, dxpl_id, oh, H5O_LINK_ID, 0, H5O_UPDATE_TIME, &(ltable.lnks[u])) < 0) { /* Release object header */ - if(H5O_unprotect(oloc, oh) < 0) + if(H5O_unprotect(oh) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to unprotect group object header") HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") @@ -919,7 +919,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) } /* end if */ /* Release object header */ - if(H5O_unprotect(oloc, oh) < 0) + if(H5O_unprotect(oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to unprotect group object header") /* Free link table information */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 604eead..2b1476d 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -136,7 +136,7 @@ H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t d done: /* Release resources */ - if(heap && H5HL_unprotect(f, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -250,7 +250,7 @@ H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name, done: /* Release resources */ - if(heap && H5HL_unprotect(f, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -343,7 +343,7 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, done: /* Release resources */ - if(heap && H5HL_unprotect(loc->file, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -401,7 +401,7 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_ done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") /* Reset the link information, if we have a copy */ @@ -453,7 +453,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree") /* Release resources */ - if(H5HL_unprotect(f, heap) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") heap = NULL; @@ -463,7 +463,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) done: /* Release resources */ - if(heap && H5HL_unprotect(f, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -553,7 +553,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, done: /* Release resources */ - if(heap && H5HL_unprotect(oloc->file, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") if(ltable.lnks && H5G_link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") @@ -760,7 +760,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, done: /* Release resources */ - if(heap && H5HL_unprotect(oloc->file, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") /* Free the duplicated name */ @@ -859,7 +859,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) @@ -973,7 +973,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, done: /* Release resources */ - if(heap && H5HL_unprotect(grp_oloc->file, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index f8a0bb0..5bf297b 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -529,7 +529,7 @@ H5HF_hdr_incr(H5HF_hdr_t *hdr) /* Mark header as un-evictable when a block is depending on it */ if(hdr->rc == 0) - if(H5AC_pin_protected_entry(hdr->f, hdr) < 0) + if(H5AC_pin_protected_entry(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap header") /* Increment reference count on shared header */ @@ -570,7 +570,7 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr) /* Mark header as evictable again when no child blocks depend on it */ if(hdr->rc == 0) { HDassert(hdr->file_rc == 0); - if(H5AC_unpin_entry(hdr->f, hdr) < 0) + if(H5AC_unpin_entry(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") } /* end if */ @@ -660,7 +660,7 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) HDassert(hdr); /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty") /* Set the dirty flags for the heap header */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 9733a0f..bc06924 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -115,7 +115,7 @@ H5HF_iblock_pin(H5HF_indirect_t *iblock) HDassert(iblock); /* Mark block as un-evictable */ - if(H5AC_pin_protected_entry(iblock->hdr->f, iblock) < 0) + if(H5AC_pin_protected_entry(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block") /* If this indirect block has a parent, update it's child iblock pointer */ @@ -199,7 +199,7 @@ H5HF_iblock_unpin(H5HF_indirect_t *iblock) } /* end if */ /* Mark block as evictable again */ - if(H5AC_unpin_entry(iblock->hdr->f, iblock) < 0) + if(H5AC_unpin_entry(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") done: @@ -335,7 +335,7 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) HDassert(iblock); /* Mark indirect block as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(iblock->hdr->f, iblock) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap indirect block as dirty") done: @@ -238,7 +238,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size) HDassert(heap->prfx); /* Resize the heap prefix in the cache */ - if(H5AC_resize_pinned_entry(f, heap->prfx, (size_t)(heap->prfx_size + new_heap_size)) < 0) + if(H5AC_resize_pinned_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache") } /* end if */ else { @@ -247,7 +247,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size) HDassert(heap->dblk); /* Resize the heap data block in the cache */ - if(H5AC_resize_pinned_entry(f, heap->dblk, (size_t)new_heap_size) < 0) + if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache") } /* end else */ } /* end if */ @@ -260,7 +260,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size) /* Resize current heap prefix */ heap->prfx_size = H5HL_SIZEOF_HDR(f); - if(H5AC_resize_pinned_entry(f, heap->prfx, (size_t)heap->prfx_size) < 0) + if(H5AC_resize_pinned_entry(heap->prfx, (size_t)heap->prfx_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache") /* Insert data block into cache (pinned) */ @@ -276,7 +276,7 @@ H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size) /* (ignore [unlikely] case where heap data block ends up * contiguous w/heap prefix again. */ - if(H5AC_resize_pinned_entry(f, heap->dblk, (size_t)new_heap_size) < 0) + if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache") /* Relocate the heap data block in the cache */ @@ -557,14 +557,13 @@ H5HL_offset_into(const H5HL_t *heap, size_t offset) *------------------------------------------------------------------------- */ herr_t -H5HL_unprotect(H5F_t *f, H5HL_t *heap) +H5HL_unprotect(H5HL_t *heap) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5HL_unprotect, FAIL) /* check arguments */ - HDassert(f); HDassert(heap); /* Decrement # of times heap is protected */ @@ -575,7 +574,7 @@ H5HL_unprotect(H5F_t *f, H5HL_t *heap) /* Check for separate heap data block */ if(heap->single_cache_obj) { /* Mark local heap prefix as evictable again */ - if(H5AC_unpin_entry(f, heap->prfx) < 0) + if(H5AC_unpin_entry(heap->prfx) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block") } /* end if */ else { @@ -584,7 +583,7 @@ H5HL_unprotect(H5F_t *f, H5HL_t *heap) /* Mark local heap data block as evictable again */ /* (data block still pins prefix) */ - if(H5AC_unpin_entry(f, heap->dblk) < 0) + if(H5AC_unpin_entry(heap->dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block") } /* end else */ } /* end if */ @@ -640,14 +639,13 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) *------------------------------------------------------------------------- */ static herr_t -H5HL_dirty(H5F_t *f, H5HL_t *heap) +H5HL_dirty(H5HL_t *heap) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HL_dirty) /* check arguments */ - HDassert(f); HDassert(heap); HDassert(heap->prfx); @@ -656,12 +654,12 @@ H5HL_dirty(H5F_t *f, H5HL_t *heap) /* Sanity check */ HDassert(heap->dblk); - if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap->dblk) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(heap->dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty") } /* end if */ /* Mark heap prefix as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap->prfx) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(heap->prfx) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty") done: @@ -706,7 +704,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ - if(H5HL_dirty(f, heap) < 0) + if(H5HL_dirty(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, UFAIL, "unable to mark heap as dirty") /* @@ -789,12 +787,12 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * /* Check for prefix & data block contiguous */ if(heap->single_cache_obj) { /* Resize prefix+data block */ - if(H5AC_resize_pinned_entry(f, heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)) < 0) + if(H5AC_resize_pinned_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap prefix in cache") } /* end if */ else { /* Resize 'standalone' data block */ - if(H5AC_resize_pinned_entry(f, heap->dblk, (size_t)new_dblk_size) < 0) + if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_dblk_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap data block in cache") } /* end else */ @@ -931,7 +929,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) * so we just accept that an extra flush of the heap info could occur * if an error occurs -QAK) */ - if(H5HL_dirty(f, heap) < 0) + if(H5HL_dirty(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty") /* @@ -1099,7 +1097,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) /* Pin the prefix, if the data block was loaded from file */ if(dblk_udata.loaded) { - if(H5AC_pin_protected_entry(f, prfx) < 0) + if(H5AC_pin_protected_entry(prfx) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin local heap prefix") } /* end if */ } /* end if */ diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 34bad8a..ca4b431 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -637,7 +637,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, done: /* Release the [possibly partially initialized] local heap on errors */ if(!ret_value && dblk) - if(H5HL_dblk_dest(f, dblk) < 0) + if(H5HL_dblk_dest(dblk) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block") FUNC_LEAVE_NOAPI(ret_value) @@ -689,7 +689,7 @@ H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Should we destroy the memory version? */ if(destroy) - if(H5HL_dblk_dest(f, dblk) < 0) + if(H5HL_dblk_dest(dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block") done: @@ -711,7 +711,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_datablock_dest(H5F_t *f, void *_thing) +H5HL_datablock_dest(H5F_t UNUSED *f, void *_thing) { H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ herr_t ret_value = SUCCEED; /* Return value */ @@ -719,14 +719,13 @@ H5HL_datablock_dest(H5F_t *f, void *_thing) FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_dest) /* check arguments */ - HDassert(f); HDassert(dblk); /* Verify that entry is clean */ HDassert(dblk->cache_info.is_dirty == FALSE); /* Destroy local heap data block */ - if(H5HL_dblk_dest(f, dblk) < 0) + if(H5HL_dblk_dest(dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap data block") done: @@ -748,7 +747,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_datablock_clear(H5F_t *f, void *_thing, hbool_t destroy) +H5HL_datablock_clear(H5F_t UNUSED *f, void *_thing, hbool_t destroy) { H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ herr_t ret_value = SUCCEED; /* Return value */ @@ -756,14 +755,13 @@ H5HL_datablock_clear(H5F_t *f, void *_thing, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_clear) /* check arguments */ - HDassert(f); HDassert(dblk); /* Mark local heap data block as clean */ dblk->cache_info.is_dirty = FALSE; if(destroy) - if(H5HL_dblk_dest(f, dblk) < 0) + if(H5HL_dblk_dest(dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block") done: diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 8107164..b8a8d35 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -125,7 +125,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); done: - if(h && H5HL_unprotect(f, h) < 0) + if(h && H5HL_unprotect(h) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") H5MM_xfree(marker); diff --git a/src/H5HLint.c b/src/H5HLint.c index 23ffe00..c6d6839 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -382,7 +382,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HL_dblk_dest(H5F_t *f, H5HL_dblk_t *dblk) +H5HL_dblk_dest(H5HL_dblk_t *dblk) { herr_t ret_value = SUCCEED; /* Return value */ @@ -397,7 +397,7 @@ H5HL_dblk_dest(H5F_t *f, H5HL_dblk_t *dblk) dblk->heap->dblk = NULL; /* Unpin the local heap prefix */ - if(H5AC_unpin_entry(f, dblk->heap->prfx) < 0) + if(H5AC_unpin_entry(dblk->heap->prfx) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix") /* Decrement ref. count on heap data structure */ diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 42a2b06..e8a8d68 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -155,7 +155,7 @@ H5_DLL herr_t H5HL_prfx_dest(H5HL_prfx_t *prfx); /* Heap data block routines */ H5_DLL H5HL_dblk_t *H5HL_dblk_new(H5HL_t *heap); -H5_DLL herr_t H5HL_dblk_dest(H5F_t *f, H5HL_dblk_t *dblk); +H5_DLL herr_t H5HL_dblk_dest(H5HL_dblk_t *dblk); #endif /* _H5HLpkg_H */ diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index b9d7f7e..6233545 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -68,7 +68,7 @@ H5_DLL H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_ H5_DLL void *H5HL_offset_into(const H5HL_t *heap, size_t offset); H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size); -H5_DLL herr_t H5HL_unprotect(H5F_t *f, H5HL_t *heap); +H5_DLL herr_t H5HL_unprotect(H5HL_t *heap); H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t size, const void *buf); H5_DLL herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); @@ -1555,7 +1555,7 @@ H5O_protect(H5O_loc_t *loc, hid_t dxpl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Mark object header as un-evictable */ - if(H5AC_pin_protected_entry(loc->file, ret_value) < 0) { + if(H5AC_pin_protected_entry(ret_value) < 0) { if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, ret_value, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header") @@ -1587,20 +1587,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_unprotect(H5O_loc_t *loc, H5O_t *oh) +H5O_unprotect(H5O_t *oh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_unprotect, FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); HDassert(oh); /* Mark object header as evictable again */ - if(H5AC_unpin_entry(loc->file, oh) < 0) + if(H5AC_unpin_entry(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") done: @@ -1682,7 +1679,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) } /* end else */ /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index ec93d9b..b50e96a 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -1018,7 +1018,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't split null message") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, UFAIL, "unable to mark object header as dirty") /* Set return value */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 56af565..d6e6ede 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -129,7 +129,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, HDassert(s && !*s); - if(H5HL_unprotect(f, heap) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") heap = NULL; #endif @@ -158,7 +158,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, HDassert(mesg->slot[u].size > 0); } /* end for */ - if(H5HL_unprotect(f, heap) < 0) + if(H5HL_unprotect(heap) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") heap = NULL; @@ -481,7 +481,7 @@ H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t *file_dst, done: /* Release resources */ - if(heap && H5HL_unprotect(file_dst, heap) < 0) + if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to unprotect EFL file name heap") if(!ret_value) if(efl_dst) diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 6c6dfb1..5dcba69 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1336,7 +1336,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ @@ -1993,7 +1993,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0) + if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") done: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index fa779bf..e7cb10f 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -547,7 +547,7 @@ H5_DLL herr_t H5O_open(H5O_loc_t *loc); H5_DLL herr_t H5O_close(H5O_loc_t *loc); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id); H5_DLL H5O_t *H5O_protect(H5O_loc_t *loc, hid_t dxpl_id); -H5_DLL herr_t H5O_unprotect(H5O_loc_t *loc, H5O_t *oh); +H5_DLL herr_t H5O_unprotect(H5O_t *oh); H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force); |