diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 19 | ||||
-rw-r--r-- | src/H5ACprivate.h | 2 | ||||
-rw-r--r-- | src/H5C.c | 76 | ||||
-rw-r--r-- | src/H5Cprivate.h | 2 | ||||
-rw-r--r-- | src/H5FSsection.c | 4 | ||||
-rw-r--r-- | src/H5HFhdr.c | 2 | ||||
-rw-r--r-- | src/H5HFiblock.c | 4 | ||||
-rw-r--r-- | src/H5HL.c | 12 | ||||
-rw-r--r-- | src/H5Ochunk.c | 2 |
9 files changed, 62 insertions, 61 deletions
@@ -2317,10 +2317,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_resize_pinned_entry + * Function: H5AC_resize_entry * - * Purpose: Resize a pinned entry. The target entry MUST be - * be pinned, and MUST not be unprotected. + * Purpose: Resize a pinned or protected entry. * * Return: Non-negative on success/Negative on failure * @@ -2330,7 +2329,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_resize_pinned_entry(void *thing, size_t new_size) +H5AC_resize_entry(void *thing, size_t new_size) { #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; @@ -2338,7 +2337,7 @@ H5AC_resize_pinned_entry(void *thing, size_t new_size) #endif /* H5AC__TRACE_FILE_ENABLED */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5AC_resize_pinned_entry, FAIL) + FUNC_ENTER_NOAPI(H5AC_resize_entry, FAIL) /* Sanity check */ HDassert(thing); @@ -2365,10 +2364,8 @@ H5AC_resize_pinned_entry(void *thing, size_t new_size) 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??") + if(!(entry_ptr->is_pinned || entry_ptr->is_protected)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned or protected??") 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") @@ -2376,7 +2373,7 @@ H5AC_resize_pinned_entry(void *thing, size_t new_size) } #endif /* H5_HAVE_PARALLEL */ - if(H5C_resize_pinned_entry(thing, new_size) < 0) + if(H5C_resize_entry(thing, new_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") done: @@ -2386,7 +2383,7 @@ done: #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_resize_pinned_entry() */ +} /* H5AC_resize_entry() */ /*------------------------------------------------------------------------- diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 2989a5a..1bbeee5 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -308,7 +308,7 @@ 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, size_t len, void *udata, H5AC_protect_t rw); -H5_DLL herr_t H5AC_resize_pinned_entry(void *thing, size_t new_size); +H5_DLL herr_t H5AC_resize_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, @@ -3210,10 +3210,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_resize_pinned_entry + * Function: H5C_resize_entry * - * Purpose: Resize a pinned entry. The target entry MUST be - * be pinned, and MUST not be unprotected. + * Purpose: Resize a pinned or protected entry. * * Resizing an entry dirties it, so if the entry is not * already dirty, the function places the entry on the @@ -3227,14 +3226,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_resize_pinned_entry(void *thing, size_t new_size) +H5C_resize_entry(void *thing, size_t new_size) { 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) + FUNC_ENTER_NOAPI(H5C_resize_entry, FAIL) /* Sanity checks */ HDassert(entry_ptr); @@ -3245,21 +3244,17 @@ H5C_resize_pinned_entry(void *thing, size_t new_size) /* 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 - */ - entry_ptr->is_dirty = TRUE; - entry_ptr->image_up_to_date = FALSE; + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive.") + if(!(entry_ptr->is_pinned || entry_ptr->is_protected)) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") /* update for change in entry size if necessary */ if ( entry_ptr->size != new_size ) { + /* mark the entry as dirty if it isn't already */ + entry_ptr->is_dirty = TRUE; + entry_ptr->image_up_to_date = FALSE; + /* Release the current image */ if( entry_ptr->image_ptr ) entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); @@ -3273,15 +3268,23 @@ H5C_resize_pinned_entry(void *thing, size_t new_size) if(size_increase >= 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") + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "flash cache increase failed") } } } - /* update the protected entry list */ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ - (cache_ptr->pel_size), \ - (entry_ptr->size), (new_size)); + /* update the pinned or protected entry list */ + if(entry_ptr->is_pinned) { + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ + (cache_ptr->pel_size), \ + (entry_ptr->size), (new_size)) + } /* end if */ + else { + HDassert(entry_ptr->is_protected); + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \ + (cache_ptr->pl_size), \ + (entry_ptr->size), (new_size)) + } /* end else */ /* update the hash table */ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ @@ -3289,10 +3292,9 @@ H5C_resize_pinned_entry(void *thing, size_t new_size) /* if the entry is in the skip list, update that too */ if ( entry_ptr->in_slist ) { - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ (new_size)); - } + } /* end if */ /* if journaling is enabled, and the entry is already in the * transaction list, update that list for the size change as well. @@ -3307,24 +3309,26 @@ H5C_resize_pinned_entry(void *thing, size_t new_size) /* finally, update the entry size proper */ entry_ptr->size = new_size; - } - if ( ! (entry_ptr->in_slist) ) { + if( !entry_ptr->in_slist ) { + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) + } /* end if */ - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - } + /* if journaling is enabled, check to see if the entry is in the + * transaction list. If it isn't, insert it. If it is, move it to + * the head of the list. + */ + H5C__UPDATE_TL_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, FAIL) - /* if journaling is enabled, check to see if the entry is in the - * transaction list. If it isn't, insert it. If it is, move it to - * the head of the list. - */ - H5C__UPDATE_TL_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, FAIL) + if(entry_ptr->is_pinned) { + H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) + } /* end if */ - H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_resize_pinned_entry() */ +} /* H5C_resize_entry() */ /*------------------------------------------------------------------------- @@ -5302,8 +5306,8 @@ H5C_unprotect(H5F_t * f, } - /* H5C__UPDATE_RP_FOR_UNPROTECT will places the unprotected entry on - * the pinned entry list if entry_ptr->is_pined is TRUE. + /* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on + * the pinned entry list if entry_ptr->is_pinned is TRUE. */ H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, FAIL) diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 47cc0c6..202221e 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1418,7 +1418,7 @@ 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(void *thing, size_t new_size); +H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size); H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 618fb0e..09f75d6 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -1371,7 +1371,7 @@ HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr, /* Resize pinned section info in the cache, if its changed size */ if(old_alloc_sect_size != fspace->alloc_sect_size) { - if(H5AC_resize_pinned_entry(fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0) + if(H5AC_resize_entry(fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRESIZE, FAIL, "unable to resize free space section info") } /* end if */ @@ -1436,7 +1436,7 @@ HDfprintf(stderr, "%s: Allocating space for smaller serialized sections, new_siz /* Resize pinned section info in the cache, if its changed size */ if(old_alloc_sect_size != fspace->alloc_sect_size) { - if(H5AC_resize_pinned_entry(fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0) + if(H5AC_resize_entry(fspace->sinfo, (size_t)fspace->alloc_sect_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRESIZE, FAIL, "unable to resize free space section info") } /* end if */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 4da956d..3041bf1 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -708,7 +708,7 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) /* Resize pinned header in cache if I/O filter is present. */ if(hdr->filter_len > 0) { - if(H5AC_resize_pinned_entry(hdr, (size_t)hdr->heap_size) < 0) + if(H5AC_resize_entry(hdr, (size_t)hdr->heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header") } /* end if */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index c8d02af..d56c093 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -559,7 +559,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si /* Resize pinned indirect block in the cache, if its changed size */ if(old_iblock_size != iblock->size) { - if(H5AC_resize_pinned_entry(iblock, (size_t)iblock->size) < 0) + if(H5AC_resize_entry(iblock, (size_t)iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block") } /* end if */ @@ -718,7 +718,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) /* Resize pinned indirect block in the cache, if it has changed size */ if(old_size != iblock->size) { - if(H5AC_resize_pinned_entry(iblock, (size_t)iblock->size) < 0) + if(H5AC_resize_entry(iblock, (size_t)iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block") } /* end if */ @@ -244,7 +244,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(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)) < 0) + if(H5AC_resize_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 { @@ -253,7 +253,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(heap->dblk, (size_t)new_heap_size) < 0) + if(H5AC_resize_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 */ @@ -266,7 +266,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(heap->prfx, (size_t)heap->prfx_size) < 0) + if(H5AC_resize_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) */ @@ -282,7 +282,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(heap->dblk, (size_t)new_heap_size) < 0) + if(H5AC_resize_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 */ @@ -795,12 +795,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(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)) < 0) + if(H5AC_resize_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(heap->dblk, (size_t)new_dblk_size) < 0) + if(H5AC_resize_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 */ diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 304b296..fb4bfe1 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -224,7 +224,7 @@ H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_p /* Check for resizing the first chunk */ if(chk_flags & H5AC__SIZE_CHANGED_FLAG) { /* Resize object header in cache */ - if(H5AC_resize_pinned_entry(oh, oh->chunk[0].size) < 0) + if(H5AC_resize_entry(oh, oh->chunk[0].size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache") } /* end if */ /* Check for dirtying the first chunk */ |