diff options
Diffstat (limited to 'src/H5C.c')
-rw-r--r-- | src/H5C.c | 382 |
1 files changed, 165 insertions, 217 deletions
@@ -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; |