From f8fa1029b7e056cc068583d5f08d788aa57e3635 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 30 Mar 2009 12:45:30 -0500 Subject: [svn-r16625] Description: Add mechanism for querying if an entry in the metadata cache is the parent or child in a flush dependency relationship. 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 --- src/H5AC.c | 11 ++++++- src/H5ACprivate.h | 2 ++ src/H5C.c | 20 +++++++++--- src/H5Cprivate.h | 4 ++- src/H5EAcache.c | 3 -- test/cache.c | 97 ++++++++++++++++++++++++++++++++++++++----------------- 6 files changed, 98 insertions(+), 39 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 74bed21..cf994be 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -1154,6 +1154,8 @@ H5AC_get_entry_status(H5F_t * f, hbool_t is_dirty; hbool_t is_protected; hbool_t is_pinned; + hbool_t is_flush_dep_child; + hbool_t is_flush_dep_parent; size_t entry_size; unsigned status = 0; @@ -1168,7 +1170,8 @@ H5AC_get_entry_status(H5F_t * f, } result = H5C_get_entry_status(cache_ptr, addr, &entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, &is_flush_dep_parent, + &is_flush_dep_child); if ( result < 0 ) { @@ -1188,6 +1191,12 @@ H5AC_get_entry_status(H5F_t * f, if ( is_pinned ) status |= H5AC_ES__IS_PINNED; + + if ( is_flush_dep_parent ) + status |= H5AC_ES__IS_FLUSH_DEP_PARENT; + + if ( is_flush_dep_child ) + status |= H5AC_ES__IS_FLUSH_DEP_CHILD; } *status_ptr = status; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b8de0c9..b84142a 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -266,6 +266,8 @@ extern hid_t H5AC_ind_dxpl_id; #define H5AC_ES__IS_DIRTY 0x0002 #define H5AC_ES__IS_PROTECTED 0x0004 #define H5AC_ES__IS_PINNED 0x0008 +#define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010 +#define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020 /* external function declarations: */ diff --git a/src/H5C.c b/src/H5C.c index b7d64f9..4c9c9f4 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -4535,10 +4535,12 @@ H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * in_cache_ptr, hbool_t * is_dirty_ptr, hbool_t * is_protected_ptr, - hbool_t * is_pinned_ptr) + hbool_t * is_pinned_ptr, + hbool_t * is_flush_dep_parent_ptr, + hbool_t * is_flush_dep_child_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL) @@ -4587,6 +4589,16 @@ H5C_get_entry_status(H5C_t * cache_ptr, *is_pinned_ptr = entry_ptr->is_pinned; } + + if ( is_flush_dep_parent_ptr != NULL ) { + + *is_flush_dep_parent_ptr = (entry_ptr->flush_dep_height > 0); + } + + if ( is_flush_dep_child_ptr != NULL ) { + + *is_flush_dep_child_ptr = (entry_ptr->flush_dep_parent != NULL); + } } done: @@ -8715,8 +8727,8 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing, /* More sanity checks */ if(child_entry == parent_entry) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself") - if(!parent_entry->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't protected") + if(!(parent_entry->is_protected || parent_entry->is_pinned)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected") if(NULL != child_entry->flush_dep_parent) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry already has flush dependency parent") { diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5d89313..b539068 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1047,7 +1047,9 @@ H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * in_cache_ptr, hbool_t * is_dirty_ptr, hbool_t * is_protected_ptr, - hbool_t * is_pinned_ptr); + hbool_t * is_pinned_ptr, + hbool_t * is_flush_dep_parent_ptr, + hbool_t * is_flush_dep_child_ptr); H5_DLL herr_t H5C_get_evictions_enabled(H5C_t * cache_ptr, hbool_t * evictions_enabled_ptr); diff --git a/src/H5EAcache.c b/src/H5EAcache.c index f7a7962..a2326dc 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -1703,10 +1703,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); /* Verify checksum */ if(stored_chksum != computed_chksum) -{ -HDfprintf(stderr, "%s: stored_chksum = %8x, computed_chksum = %8x\n", FUNC, stored_chksum, computed_chksum); H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for extensible array data block page") -} /* Set return value */ ret_value = dblk_page; diff --git a/test/cache.c b/test/cache.c index c3e5ee0..bacd559 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2727,7 +2727,7 @@ check_insert_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13541,7 +13541,7 @@ check_get_entry_status(void) */ result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13565,7 +13565,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13587,7 +13587,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13609,7 +13609,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13631,7 +13631,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13653,7 +13653,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13743,7 +13743,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13781,7 +13781,7 @@ check_expunge_entry(void) if ( pass ) { result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13821,7 +13821,7 @@ check_expunge_entry(void) */ result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13863,7 +13863,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13902,7 +13902,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -13943,7 +13943,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -14878,7 +14878,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -14948,7 +14948,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15021,7 +15021,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15086,7 +15086,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15147,7 +15147,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15184,7 +15184,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15290,7 +15290,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15362,7 +15362,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15435,7 +15435,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15502,7 +15502,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15563,7 +15563,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15600,7 +15600,7 @@ check_resize_entry(void) result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned); + &is_pinned, NULL, NULL); if ( result < 0 ) { @@ -15878,7 +15878,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[0]); result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -15941,7 +15941,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[1]); result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -16148,7 +16148,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[2]); result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -16184,7 +16184,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[3]); result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -16313,7 +16313,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[4]); result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -29726,6 +29726,7 @@ static unsigned check_flush_deps(void) { H5C_t * cache_ptr = NULL; /* Metadata cache for this test */ + test_entry_t *base_addr; /* Base address of entries for test */ int entry_type = PICO_ENTRY_TYPE; /* Use very small entry size (size of entries doesn't matter) */ size_t entry_size = PICO_ENTRY_SIZE; /* 1 byte */ unsigned u; /* Local index variable */ @@ -29750,6 +29751,7 @@ check_flush_deps(void) reset_entries(); cache_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + base_addr = entries[entry_type]; if ( !pass ) CACHE_ERROR("setup_cache failed") @@ -29776,12 +29778,47 @@ check_flush_deps(void) /* Create flush dependency between entries 0 (child) & 1 (parent) */ { + hbool_t in_cache, is_flush_dep_parent, is_flush_dep_child; + test_entry_t * entry_ptr; + protect_entry(cache_ptr, entry_type, 1); if ( !pass ) CACHE_ERROR("protect_entry failed") + /* Check the parent's entry status */ + entry_ptr = &(base_addr[1]); + if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + CACHE_ERROR("H5C_get_entry_status() failed") + if(!in_cache || is_flush_dep_parent || is_flush_dep_child) + CACHE_ERROR("invalid entry status") + + /* Check the child's entry status */ + entry_ptr = &(base_addr[0]); + if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + CACHE_ERROR("H5C_get_entry_status() failed") + if(!in_cache || is_flush_dep_parent || is_flush_dep_child) + CACHE_ERROR("invalid entry status") + create_flush_dependency(cache_ptr, entry_type, 1, entry_type, 0); if ( !pass ) CACHE_ERROR("create_flush_dependency failed") + /* Check the parent's entry status */ + entry_ptr = &(base_addr[1]); + if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + CACHE_ERROR("H5C_get_entry_status() failed") + if(!in_cache || !is_flush_dep_parent || is_flush_dep_child) + CACHE_ERROR("invalid entry status") + + /* Check the child's entry status */ + entry_ptr = &(base_addr[0]); + if(H5C_get_entry_status(cache_ptr, entry_ptr->addr, NULL, &in_cache, + NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + CACHE_ERROR("H5C_get_entry_status() failed") + if(!in_cache || is_flush_dep_parent || !is_flush_dep_child) + CACHE_ERROR("invalid entry status") + /* Change expected values, and verify the status of the entries * after creating flush dependency */ -- cgit v0.12