diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 18:16:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-26 18:16:54 (GMT) |
commit | bbe430429dd0f922578a566a6873160ac3dfa518 (patch) | |
tree | e72ffb1860a479024419dfaa28138d00767add64 /test | |
parent | eb070568b0b396797eb66a894c596c2fba7a0c9f (diff) | |
download | hdf5-bbe430429dd0f922578a566a6873160ac3dfa518.zip hdf5-bbe430429dd0f922578a566a6873160ac3dfa518.tar.gz hdf5-bbe430429dd0f922578a566a6873160ac3dfa518.tar.bz2 |
[svn-r16618] Description:
Modify metadata cache flush dependency feature to allow it to work
with entries that are pinned through the cache API calls.
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/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) 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-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 195 | ||||
-rw-r--r-- | test/cache_common.c | 42 | ||||
-rw-r--r-- | test/cache_common.h | 4 |
3 files changed, 177 insertions, 64 deletions
diff --git a/test/cache.c b/test/cache.c index 65a6719..c3e5ee0 100644 --- a/test/cache.c +++ b/test/cache.c @@ -31214,6 +31214,145 @@ check_flush_deps(void) if ( !pass ) CACHE_ERROR("verify_entry_status failed") } +/* Test Case #6a - Make certain that flush dependency relationship with parent + * already pinned works (unpin ater destroying flush dependency) + */ + + /* Create flush dependency between entries 0 (child) & 1 (parent) */ + { + protect_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + pin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("pin_entry failed") + + create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type = entry_type; + expected[0].flush_dep_par_idx = 1; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].child_flush_dep_height_rc[0] = 1; + expected[1].flush_dep_height = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */ + { + destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + unpin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("unpin_entry failed") + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + FALSE, /* int32_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after destroy flush dependency + */ + expected[0].flush_dep_par_type = -1; + expected[0].flush_dep_par_idx = -1; + expected[1].is_protected = FALSE; + expected[1].is_pinned = FALSE; + expected[1].child_flush_dep_height_rc[0] = 0; + expected[1].flush_dep_height = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + +/* Test Case #6b - Make certain that flush dependency relationship with parent + * already pinned works (unpin before destroying flush dependency) + */ + + /* Create flush dependency between entries 0 (child) & 1 (parent) */ + { + protect_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + pin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("pin_entry failed") + + create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + + /* Change expected values, and verify the status of the entries + * after creating flush dependency + */ + expected[0].flush_dep_par_type = entry_type; + expected[0].flush_dep_par_idx = 1; + expected[1].is_protected = TRUE; + expected[1].is_pinned = TRUE; + expected[1].child_flush_dep_height_rc[0] = 1; + expected[1].flush_dep_height = 1; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + + /* Unpin entry & destroy flush dependency between entries 0 (child) & 1 (parent) */ + { + unpin_entry(cache_ptr, entry_type, 1); + if ( !pass ) CACHE_ERROR("unpin_entry failed") + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + destroy_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); + if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed") + + unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ + entry_type, /* int32_t type */ + 1, /* int32_t idx */ + FALSE, /* int32_t dirty */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after destroy flush dependency + */ + expected[0].flush_dep_par_type = -1; + expected[0].flush_dep_par_idx = -1; + expected[1].is_protected = FALSE; + expected[1].is_pinned = FALSE; + expected[1].child_flush_dep_height_rc[0] = 0; + expected[1].flush_dep_height = 0; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)0, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + } + done: if(cache_ptr) @@ -31257,7 +31396,7 @@ check_flush_deps_err(void) /* Loop over test cases, check for various errors in configuring flush * dependencies. Verify that all performs as expected. */ - for(test_count = 0; test_count < 11; test_count++) { + for(test_count = 0; test_count < 9; test_count++) { unsigned u; /* Local index variable */ herr_t result; /* Generic return value */ @@ -31421,36 +31560,14 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") break; - /* Verify that parent entry isn't already pinned */ - case 4: - protect_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - pin_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("pin_entry failed") - - result = H5C_create_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); - if( result != FAIL ) CACHE_ERROR("Creating dependency when parent is pinned") - - unpin_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("unpin_entry failed") - - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ - entry_type, /* int32_t type */ - 0, /* int32_t idx */ - FALSE, /* int32_t dirty */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - break; - /* Verify that parent entry must be protected */ - case 5: + case 4: result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); if( result != FAIL ) CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected") break; /* Verify that parent entry has flush dependency */ - case 6: + case 5: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -31465,30 +31582,8 @@ check_flush_deps_err(void) if ( !pass ) CACHE_ERROR("unprotect_entry failed") break; - /* Verify that parent entry is still pinned */ - case 7: - protect_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("protect_entry failed") - - create_flush_dependency(cache_ptr, entry_type, 0, entry_type, 1); - if ( !pass ) CACHE_ERROR("create_flush_dependency failed") - - unpin_entry(cache_ptr, entry_type, 0); - if ( !pass ) CACHE_ERROR("unpin_entry failed") - - result = H5C_destroy_flush_dependency(cache_ptr, &((entries[entry_type])[0]), &((entries[entry_type])[1])); - if( result != FAIL ) CACHE_ERROR("Destroying dependency when parent isn't in relationship") - - unprotect_entry(cache_ptr, /* H5C_t * cache_ptr */ - entry_type, /* int32_t type */ - 0, /* int32_t idx */ - FALSE, /* int32_t dirty */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ - if ( !pass ) CACHE_ERROR("unprotect_entry failed") - break; - /* Verify that child entry is in flush dependency relationship */ - case 8: + case 6: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -31510,7 +31605,7 @@ check_flush_deps_err(void) break; /* Verify that parent has child entries at this height */ - case 9: + case 7: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") @@ -31565,7 +31660,7 @@ check_flush_deps_err(void) /* Verify that child entry is child of parent */ - case 10: + case 8: protect_entry(cache_ptr, entry_type, 0); if ( !pass ) CACHE_ERROR("protect_entry failed") diff --git a/test/cache_common.c b/test/cache_common.c index 7f8a458..c0ec7c8 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1663,6 +1663,8 @@ reset_entries(void) for ( k = 0; k < H5C__NUM_FLUSH_DEP_HEIGHTS; k++ ) base_addr[j].child_flush_dep_height_rc[k] = 0; base_addr[j].flush_dep_height = 0; + base_addr[j].pinned_from_client = FALSE; + base_addr[j].pinned_from_cache = FALSE; base_addr[j].flush_order = 0; @@ -2279,8 +2281,6 @@ verify_entry_status(H5C_t * cache_ptr, i++; } /* while */ -if(!pass) - HDfprintf(stderr, "failure_mssg = '%s'\n", failure_mssg); return; @@ -2680,14 +2680,15 @@ insert_entry(H5C_t * cache_ptr, if ( insert_pinned ) { HDassert( entry_ptr->header.is_pinned ); - entry_ptr->is_pinned = TRUE; } else { HDassert( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; } + entry_ptr->is_pinned = insert_pinned; + entry_ptr->pinned_from_client = insert_pinned; + HDassert( entry_ptr->header.is_dirty ); HDassert( ((entry_ptr->header).type)->id == type ); } @@ -3201,7 +3202,7 @@ pin_entry(H5C_t * cache_ptr, HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); HDassert( entry_ptr->is_protected ); - HDassert( !(entry_ptr->is_pinned) ); + HDassert( !(entry_ptr->pinned_from_client) ); result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr); @@ -3217,7 +3218,9 @@ pin_entry(H5C_t * cache_ptr, } else { + entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; + } } /* end if */ @@ -3269,12 +3272,15 @@ unpin_entry(H5C_t * cache_ptr, HDassert( entry_ptr == entry_ptr->self ); HDassert( entry_ptr->cache_ptr == cache_ptr ); HDassert( entry_ptr->header.is_pinned ); + HDassert( entry_ptr->header.pinned_from_client ); HDassert( entry_ptr->is_pinned ); + HDassert( entry_ptr->pinned_from_client ); result = H5C_unpin_entry(cache_ptr, (void *)entry_ptr); if ( ( result < 0 ) || - ( entry_ptr->header.is_pinned ) || + ( entry_ptr->header.pinned_from_client ) || + ( entry_ptr->header.is_pinned && !entry_ptr->header.pinned_from_cache ) || ( entry_ptr->header.type != &(types[type]) ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -3284,7 +3290,9 @@ unpin_entry(H5C_t * cache_ptr, } - entry_ptr->is_pinned = FALSE; + entry_ptr->pinned_from_client = FALSE; + + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; HDassert( ((entry_ptr->header).type)->id == type ); @@ -3430,12 +3438,14 @@ unprotect_entry(H5C_t * cache_ptr, if ( pin_flag_set ) { HDassert ( entry_ptr->header.is_pinned ); + entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; + HDassert ( entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache ); + entry_ptr->pinned_from_client = FALSE; + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; } } @@ -3592,12 +3602,14 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr, if ( pin_flag_set ) { HDassert ( entry_ptr->header.is_pinned ); + entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; + HDassert ( entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache ); + entry_ptr->pinned_from_client = FALSE; + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; } } @@ -4979,6 +4991,7 @@ create_flush_dependency(H5C_t * cache_ptr, chd_entry_ptr->flush_dep_par_type = par_type; chd_entry_ptr->flush_dep_par_idx = par_idx; par_entry_ptr->child_flush_dep_height_rc[chd_entry_ptr->flush_dep_height]++; + par_entry_ptr->pinned_from_cache = TRUE; if( !par_is_pinned ) par_entry_ptr->is_pinned = TRUE; @@ -5051,6 +5064,7 @@ destroy_flush_dependency(H5C_t * cache_ptr, HDassert( par_entry_ptr->index == par_idx ); HDassert( par_entry_ptr->type == par_type ); HDassert( par_entry_ptr->is_pinned ); + HDassert( par_entry_ptr->pinned_from_cache ); HDassert( par_entry_ptr->flush_dep_height > 0 ); HDassert( par_entry_ptr == par_entry_ptr->self ); @@ -5089,8 +5103,10 @@ destroy_flush_dependency(H5C_t * cache_ptr, if((unsigned)(i + 1) < prev_par_flush_dep_height) { par_entry_ptr->flush_dep_height = (unsigned)(i + 1); - if(i < 0) - par_entry_ptr->is_pinned = FALSE; + if(i < 0) { + par_entry_ptr->pinned_from_cache = FALSE; + par_entry_ptr->is_pinned = par_entry_ptr->pinned_from_client; + } /* end if */ /* Check for parent entry being in flush dependency relationship */ if(par_entry_ptr->flush_dep_par_idx >= 0) { diff --git a/test/cache_common.h b/test/cache_common.h index 1284ea3..37e9e0c 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -35,7 +35,7 @@ #include "h5test.h" /* Macro to make error reporting easier */ -#define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; goto done;} +#define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; pass = FALSE; goto done;} #define NO_CHANGE -1 @@ -306,6 +306,8 @@ typedef struct test_entry_t * dependency children */ unsigned flush_dep_height; /* flush dependency height of entry */ + hbool_t pinned_from_client; /* entry was pinned by client call */ + hbool_t pinned_from_cache; /* entry was pinned by cache internally */ unsigned flush_order; /* Order that entry was flushed in */ } test_entry_t; |