[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
This commit is contained in:
Quincey Koziol 2010-05-06 21:48:15 -05:00
parent ec7f4dc603
commit 5d8a2cca07
12 changed files with 110 additions and 189 deletions

View File

@ -1694,10 +1694,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
*
@ -1707,7 +1706,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] = "";
@ -1715,7 +1714,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);
@ -1742,10 +1741,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")
@ -1753,7 +1750,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:
@ -1763,7 +1760,7 @@ done:
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_resize_pinned_entry() */
} /* H5AC_resize_entry() */
/*-------------------------------------------------------------------------

View File

@ -330,7 +330,7 @@ H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing
H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
haddr_t addr, 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_destroy_flush_dependency(void *parent_thing, void *child_thing);
H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id,

View File

@ -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 ) {
if(!entry_ptr->in_slist) {
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
} /* end if */
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)
}
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() */
/*-------------------------------------------------------------------------

View File

@ -1137,7 +1137,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);

View File

@ -717,7 +717,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 */

View File

@ -566,7 +566,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 */
@ -735,7 +735,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 */

View File

@ -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(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 {
@ -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(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 */
@ -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(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) */
@ -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(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 */
@ -784,12 +784,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 */

View File

@ -232,7 +232,7 @@ H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_chunk_proxy_t *chk_proxy,
/* Check for resizing the first chunk */
if(chk_flags & H5AC__SIZE_CHANGED_FLAG) {
/* Resize object header in cache */
if(H5AC_resize_pinned_entry(chk_proxy->oh, chk_proxy->oh->chunk[0].size) < 0)
if(H5AC_resize_entry(chk_proxy->oh, chk_proxy->oh->chunk[0].size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache")
} /* end if */

View File

@ -15138,13 +15138,13 @@ check_resize_entry(void)
if ( pass ) {
result = H5C_resize_pinned_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5C_resize_pinned_entry() reports failure 1.");
"H5C_resize_entry() reports failure 1.");
failure_mssg = msg;
}
@ -15199,13 +15199,13 @@ check_resize_entry(void)
if ( pass ) {
result = H5C_resize_pinned_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5C_resize_pinned_entry() reports failure 2.");
"H5C_resize_entry() reports failure 2.");
failure_mssg = msg;
}
@ -15571,13 +15571,13 @@ check_resize_entry(void)
if ( pass ) {
result = H5C_resize_pinned_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4));
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5C_resize_pinned_entry() reports failure 3.");
"H5C_resize_entry() reports failure 3.");
failure_mssg = msg;
}
@ -15634,13 +15634,13 @@ check_resize_entry(void)
if ( pass ) {
result = H5C_resize_pinned_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE);
if ( result < 0 ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"H5C_resize_pinned_entry() reports failure 4.");
"H5C_resize_entry() reports failure 4.");
failure_mssg = msg;
}
@ -17642,7 +17642,7 @@ check_expunge_entry_errs(void)
/*-------------------------------------------------------------------------
* Function: check_resize_entry_errs()
*
* Purpose: Verify that invalid calls to H5C_resize_pinned_entry()
* Purpose: Verify that invalid calls to H5C_resize_entry()
* generates errors as expected.
*
* Return: void
@ -17650,10 +17650,6 @@ check_expunge_entry_errs(void)
* Programmer: John Mainzer
* 7/7/06
*
* Modifications:
*
* None.
*
*-------------------------------------------------------------------------
*/
@ -17670,11 +17666,11 @@ check_resize_entry_errs(void)
pass = TRUE;
/* Allocate a cache, protect an entry, and then call
* H5C_resize_pinned_entry() to resize it -- this should fail.
* H5C_resize_entry() to resize it -- this should succeed.
*
* Unprotect the the entry with the pinned flag, and then call
* H5C_resize_pinned_entry() again with new size of zero.
* This should fail too.
* H5C_resize_entry() again with new size of zero.
* This should fail.
*
* Finally, unpin the entry and destroy the cache.
* This should succeed.
@ -17695,13 +17691,13 @@ check_resize_entry_errs(void)
if ( pass ) {
result = H5C_resize_pinned_entry((void *)entry_ptr, (size_t)1);
result = H5C_resize_entry((void *)entry_ptr, (size_t)1);
if ( result > 0 ) {
if ( result < 0 ) {
pass = FALSE;
failure_mssg =
"Call to H5C_resize_pinned_entry on a protected entry succeeded.\n";
"Call to H5C_resize_entry on a protected entry failed.\n";
} else {
@ -17712,13 +17708,13 @@ check_resize_entry_errs(void)
if ( pass ) {
result = H5C_resize_pinned_entry((void *)entry_ptr, (size_t)0);
result = H5C_resize_entry((void *)entry_ptr, (size_t)0);
if ( result > 0 ) {
if ( result >= 0 ) {
pass = FALSE;
failure_mssg =
"Call to H5C_resize_pinned_entry with 0 new size succeeded.\n";
"Call to H5C_resize_entry with 0 new size succeeded.\n";
} else {
@ -22042,7 +22038,7 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (6 * 1024) ) ||
@ -22060,7 +22056,7 @@ check_auto_cache_resize(void)
if ( pass ) {
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (13 * 1024) ) ||
@ -22081,7 +22077,7 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (22 * 1024) ) ||
@ -22102,7 +22098,7 @@ check_auto_cache_resize(void)
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
if ( ( pass ) &&
( ( ( cache_ptr->max_cache_size != (22 * 1024) ) ||

View File

@ -1820,14 +1820,15 @@ reset_entries(void)
* Function: resize_entry
*
* Purpose: Given a pointer to a cache, an entry type, an index, and
* a size, set the size of the target entry to the size. Note
* that at present, the type of the entry must be
* a new size, set the size of the target entry to the new size.
*
* Note that at present, the type of the entry must be
* VARIABLE_ENTRY_TYPE.
*
* If the resize_pin parameter is true, verify that the
* target entry is in the cache and is pinned. If it
* target entry is in the cache. If it
* isn't, scream and die. If it is, use the
* H5C_resize_pinned_entry() call to resize it.
* H5C_resize_entry() call to resize it.
*
* Do nothing if pass is false on entry.
*
@ -1848,6 +1849,7 @@ resize_entry(H5F_t * file_ptr,
{
test_entry_t * base_addr;
test_entry_t * entry_ptr;
herr_t result;
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( type == VARIABLE_ENTRY_TYPE );
@ -1875,14 +1877,28 @@ resize_entry(H5F_t * file_ptr,
} else {
if ( ! ( (entry_ptr->header).is_pinned ) ) {
if ( ! ( entry_ptr->header.is_pinned || entry_ptr->header.is_protected ) ) {
pass = FALSE;
failure_mssg = "entry to be resized pinned is not pinned.";
failure_mssg = "entry to be resized is not pinned or protected.";
} else {
resize_pinned_entry(cache_ptr, type, idx, new_size);
entry_ptr->size = new_size;
result = H5C_resize_entry((void *)entry_ptr, new_size);
entry_ptr->is_dirty = TRUE;
if ( result != SUCCEED ) {
pass = FALSE;
failure_mssg = "error(s) in H5C_resize_entry().";
} else {
HDassert( entry_ptr->size = (entry_ptr->header).size );
}
}
}
} else {
@ -1897,86 +1913,6 @@ resize_entry(H5F_t * file_ptr,
} /* resize_entry() */
/*-------------------------------------------------------------------------
* Function: resize_pinned_entry
*
* Purpose: Given a pointer to a cache, an entry type, an index, and
* a new size, change the size of the target pinned entry
* to match the supplied new size.
*
* Do nothing if pass is false on entry.
*
* Return: void
*
* Programmer: John Mainzer
* 1/11/08
*
*-------------------------------------------------------------------------
*/
void
resize_pinned_entry(H5C_t * cache_ptr,
int32_t type,
int32_t idx,
size_t new_size)
{
herr_t result;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
HDassert( type == VARIABLE_ENTRY_TYPE ) ;
HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes[type] ) );
if ( pass ) {
if ( ! entry_in_cache(cache_ptr, type, idx) ) {
pass = FALSE;
failure_mssg = "entry not in cache.";
} else {
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
if ( ! ( (entry_ptr->header).is_pinned ) ) {
pass = FALSE;
failure_mssg = "entry to be resized is not pinned.";
} else {
entry_ptr->size = new_size;
result = H5C_resize_pinned_entry((void *)entry_ptr,
new_size);
if ( result != SUCCEED ) {
pass = FALSE;
failure_mssg = "error(s) in H5C_resize_pinned_entry().";
} else {
HDassert( entry_ptr->size = (entry_ptr->header).size );
}
}
}
}
return;
} /* resize_pinned_entry() */
/*-------------------------------------------------------------------------
* Function: verify_clean

View File

@ -189,7 +189,7 @@ typedef struct flush_op
* FLUSH_OP__RESIZE: TRUE iff the
* target is pinned, and is to
* be resized via the
* H5C_mark_entry_dirty()
* H5C_resize_entry()
* call.
*
* FLUSH_OP__MOVE: TRUE iff the
@ -704,11 +704,6 @@ void resize_entry(H5F_t * file_ptr,
size_t new_size,
hbool_t resize_pin);
void resize_pinned_entry(H5C_t * cache_ptr,
int32_t type,
int32_t idx,
size_t new_size);
H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size);
void row_major_scan_forward(H5F_t * file_ptr,

View File

@ -3114,7 +3114,6 @@ resize_entry(int32_t idx,
entry_ptr = &(data[idx]);
HDassert( ((entry_ptr->header).type)->id == DATUM_ENTRY_TYPE );
HDassert( !(entry_ptr->header.is_protected) );
HDassert( !(entry_ptr->locked) );
HDassert( ( entry_ptr->global_pinned ) &&
( ! entry_ptr->local_pinned ) );
@ -3123,13 +3122,13 @@ resize_entry(int32_t idx,
HDassert( new_size > 0 );
HDassert( new_size <= entry_ptr->len );
result = H5AC_resize_pinned_entry((void *)entry_ptr, new_size);
result = H5AC_resize_entry((void *)entry_ptr, new_size);
if ( result < 0 ) {
nerrors++;
if ( verbose ) {
HDfprintf(stdout, "%d:%s: H5AC_resize_pinned_entry() failed.\n",
HDfprintf(stdout, "%d:%s: H5AC_resize_entry() failed.\n",
world_mpi_rank, fcn_name);
}
@ -5033,7 +5032,7 @@ smoke_check_4(void)
*
* JRM -- 7/12/06
* Added test code for H5AC_expunge_entry() and
* H5AC_resize_pinned_entry().
* H5AC_resize_entry().
*
*****************************************************************************/
@ -5305,7 +5304,7 @@ smoke_check_5(void)
* - H5AC_unprotect()
* - H5AC_set_cache_auto_resize_config()
* - H5AC_expunge_entry()
* - H5AC_resize_pinned_entry()
* - H5AC_resize_entry()
*
* This test is skipped if H5_METADATA_TRACE_FILE is undefined.
*
@ -5319,7 +5318,7 @@ smoke_check_5(void)
*
* JRM -- 7/11/06
* Updated for H5AC_expunge_entry() and
* H5AC_resize_pinned_entry().
* H5AC_resize_entry().
*
*****************************************************************************/
@ -5351,8 +5350,8 @@ trace_file_check(void)
"H5AC_pin_protected_entry 4 0\n",
"H5AC_unprotect 4 15 0 0 0\n",
"H5AC_mark_entry_dirty 0x4 0 0 0\n",
"H5AC_resize_pinned_entry 0x4 2 0\n",
"H5AC_resize_pinned_entry 0x4 4 0\n",
"H5AC_resize_entry 0x4 2 0\n",
"H5AC_resize_entry 0x4 4 0\n",
"H5AC_unpin_entry 4 0\n",
"H5AC_move_entry 0 8a65 15 0\n",
"H5AC_move_entry 8a65 0 15 0\n",