summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-07 03:02:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-07 03:02:03 (GMT)
commitae6f5891b5794325ee5702fec0da55bafdce1afe (patch)
tree907e8fd4d6cdd73dd007f10efb27e682a58f7df6
parente87f3dd558a96c6ebedd03a8ac8acb91cb5e1be8 (diff)
downloadhdf5-ae6f5891b5794325ee5702fec0da55bafdce1afe.zip
hdf5-ae6f5891b5794325ee5702fec0da55bafdce1afe.tar.gz
hdf5-ae6f5891b5794325ee5702fec0da55bafdce1afe.tar.bz2
[svn-r18741] Description:
Bring r18740 from trunk to 1.8 branch: 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 (h5committested on trunk)
-rw-r--r--src/H5AC.c19
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5C.c76
-rw-r--r--src/H5Cprivate.h2
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5HFiblock.c4
-rw-r--r--src/H5HL.c12
-rw-r--r--src/H5Ochunk.c2
-rw-r--r--test/cache.c48
-rw-r--r--test/cache_common.c110
-rw-r--r--test/cache_common.h7
-rw-r--r--testpar/t_cache.c15
12 files changed, 110 insertions, 189 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index bb7bb97..07ffa26 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -1625,10 +1625,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
*
@@ -1638,7 +1637,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] = "";
@@ -1646,7 +1645,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);
@@ -1673,10 +1672,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")
@@ -1684,7 +1681,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:
@@ -1694,7 +1691,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 60c4c43..03f5499 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -310,7 +310,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, 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,
diff --git a/src/H5C.c b/src/H5C.c
index 97804b9..508ad85 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -3000,10 +3000,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
@@ -3017,15 +3016,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);
@@ -3036,41 +3033,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),\
@@ -3078,10 +3081,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), \
@@ -3090,22 +3092,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() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 83e4f92..40be019 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -1080,7 +1080,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/H5HFhdr.c b/src/H5HFhdr.c
index 38c1790..67bb7b0 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -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 */
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index f2437e4..73ef6bf 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -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 */
diff --git a/src/H5HL.c b/src/H5HL.c
index 24a54f3..21ca813 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -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 */
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index e8f2afa..5fba81b 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -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 */
diff --git a/test/cache.c b/test/cache.c
index 6a35a84..7ed4d55 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -15130,13 +15130,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;
}
@@ -15190,13 +15190,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;
}
@@ -15558,13 +15558,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;
}
@@ -15620,13 +15620,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;
}
@@ -17626,7 +17626,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
@@ -17634,10 +17634,6 @@ check_expunge_entry_errs(void)
* Programmer: John Mainzer
* 7/7/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
@@ -17654,11 +17650,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.
@@ -17679,13 +17675,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 {
@@ -17696,13 +17692,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 {
@@ -22026,7 +22022,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) ) ||
@@ -22044,7 +22040,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) ) ||
@@ -22065,7 +22061,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) ) ||
@@ -22086,7 +22082,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) ) ||
diff --git a/test/cache_common.c b/test/cache_common.c
index 145e9b5..cac3dbf 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1676,14 +1676,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.
*
@@ -1704,6 +1705,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 );
@@ -1731,14 +1733,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 {
@@ -1755,86 +1771,6 @@ resize_entry(H5F_t * file_ptr,
/*-------------------------------------------------------------------------
- * 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
*
* Purpose: Verify that all cache entries are marked as clean. If any
diff --git a/test/cache_common.h b/test/cache_common.h
index c04d685..5791345 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -177,7 +177,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
@@ -655,11 +655,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,
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index d70c0a2..d53a227 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -3113,7 +3113,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 ) );
@@ -3122,13 +3121,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);
}
@@ -5032,7 +5031,7 @@ smoke_check_4(void)
*
* JRM -- 7/12/06
* Added test code for H5AC_expunge_entry() and
- * H5AC_resize_pinned_entry().
+ * H5AC_resize_entry().
*
*****************************************************************************/
@@ -5304,7 +5303,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.
*
@@ -5318,7 +5317,7 @@ smoke_check_5(void)
*
* JRM -- 7/11/06
* Updated for H5AC_expunge_entry() and
- * H5AC_resize_pinned_entry().
+ * H5AC_resize_entry().
*
*****************************************************************************/
@@ -5350,8 +5349,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",