summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
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 /test/cache_common.c
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)
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c110
1 files changed, 23 insertions, 87 deletions
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