summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-07 02:48:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-07 02:48:15 (GMT)
commit5d8a2cca07e42684a323f0f007149f549bdbf307 (patch)
tree6d04c84977990ab0f332203e2703bf4235fbd902 /src/H5C.c
parentec7f4dc603484d18cde1af79c2906c68cec1ad3b (diff)
downloadhdf5-5d8a2cca07e42684a323f0f007149f549bdbf307.zip
hdf5-5d8a2cca07e42684a323f0f007149f549bdbf307.tar.gz
hdf5-5d8a2cca07e42684a323f0f007149f549bdbf307.tar.bz2
[svn-r18740] Description:
Bring r18738 from metadata journaling 'merging' branch to trunk: Switch H5AC_resize_pinned_entry() to work on protected entries as well, and rename to H5AC_resize_entry() Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c76
1 files changed, 37 insertions, 39 deletions
diff --git a/src/H5C.c b/src/H5C.c
index 20fb0e7..6d81128 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -3030,10 +3030,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 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
@@ -3047,15 +3046,13 @@ 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;
- hbool_t was_clean;
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);
@@ -3066,41 +3063,47 @@ 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??")
-
- /* make note of whether the entry was clean to begin with */
- was_clean = ! ( entry_ptr->is_dirty );
-
- /* resizing dirties entries -- mark the entry as dirty if it
- * isn't already
- */
- entry_ptr->is_dirty = TRUE;
+ 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_CANTRESIZE, FAIL, "Entry isn't pinned or protected??")
/* update for change in entry size if necessary */
if ( entry_ptr->size != new_size ) {
+ hbool_t was_clean;
+
+ /* make note of whether the entry was clean to begin with */
+ was_clean = ! ( entry_ptr->is_dirty );
+
+ /* mark the entry as dirty if it isn't already */
+ entry_ptr->is_dirty = TRUE;
/* do a flash cache size increase if appropriate */
if ( cache_ptr->flash_size_increase_possible ) {
if ( new_size > entry_ptr->size ) {
+ size_t size_increase;
size_increase = new_size - entry_ptr->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),\
@@ -3108,10 +3111,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 */
/* update statistics just before changing the entry size */
H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE((cache_ptr), (entry_ptr), \
@@ -3120,22 +3122,18 @@ H5C_resize_pinned_entry(void *thing, size_t new_size)
/* finally, update the entry size proper */
entry_ptr->size = new_size;
- } else if ( was_clean ) {
-
- H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr)
- }
-
-
- if ( ! (entry_ptr->in_slist) ) {
-
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
- }
+ if(!entry_ptr->in_slist) {
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
+ } /* end if */
- H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
+ if(entry_ptr->is_pinned) {
+ H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_resize_pinned_entry() */
+} /* H5C_resize_entry() */
/*-------------------------------------------------------------------------