summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
diff options
context:
space:
mode:
authorJohn Mainzer <mainzer@hdfgroup.org>2008-02-18 05:28:04 (GMT)
committerJohn Mainzer <mainzer@hdfgroup.org>2008-02-18 05:28:04 (GMT)
commitcd571e4a45e5af71ae608388141e6b28a16f8171 (patch)
tree27a6b76035cd03c2b13946730225b34f0f03d98d /test/cache_common.c
parentd3e926b897b42d27e1c5f8533a8a413c448738e2 (diff)
downloadhdf5-cd571e4a45e5af71ae608388141e6b28a16f8171.zip
hdf5-cd571e4a45e5af71ae608388141e6b28a16f8171.tar.gz
hdf5-cd571e4a45e5af71ae608388141e6b28a16f8171.tar.bz2
[svn-r14594] Ported flash cache size increase code into the journaling branch --
note that both the H5C and H5C2 code have been updated. Also checked in code to track journaling status in the super block. Note that this code has not been tested -- but as best I can tell, it does not break the existing regression tests. Tested serial (debug and production) on Phoenix. Also tested parallel on kagiso. Note that regression test fails on kagiso (but not on phoenix) if the cache2 serial tests are configured to use the core file driver. Thus this code is check in with the core file driver optimization of the cache2 tests disabled. To turn it on, set the USE_CORE_DRIVER #define to TRUE.
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index d2be959..25eb988 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1722,6 +1722,91 @@ resize_entry(H5C_t * cache_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
+ *
+ * Modifications:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+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(cache_ptr,
+ (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
@@ -2460,6 +2545,12 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr,
entry_ptr->is_dirty = TRUE;
+ if ( size_changed ) {
+
+ /* update entry size now to keep the sanity checks happy */
+ entry_ptr->size = new_size;
+ }
+
result = H5C_mark_pinned_entry_dirty(cache_ptr,
(void *)entry_ptr,
size_changed,
@@ -2472,6 +2563,22 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr,
( entry_ptr->size != entry_ptr->header.size ) ||
( entry_ptr->addr != entry_ptr->header.addr ) ) {
+#if 0 /* This is useful debugging code -- keep it around */
+ HDfprintf(stdout, "result = %ld.\n", (long)result);
+ HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n",
+ (int)(entry_ptr->header.is_dirty));
+ HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n",
+ (int)(entry_ptr->header.is_pinned));
+ HDfprintf(stdout,
+ "(entry_ptr->header.type != &(types[type])) = %d.\n",
+ (int)(entry_ptr->header.type != &(types[type])));
+ HDfprintf(stdout,
+ "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n",
+ (long)(entry_ptr->size), (long)(entry_ptr->header.size));
+ HDfprintf(stdout,
+ "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n",
+ (long)(entry_ptr->addr), (long)(entry_ptr->header.addr));
+#endif
pass = FALSE;
failure_mssg = "error in H5C_mark_pinned_entry_dirty().";