diff options
-rw-r--r-- | src/H5AC.c | 22 | ||||
-rw-r--r-- | src/H5ACprivate.h | 8 | ||||
-rw-r--r-- | test/cache.c | 45 | ||||
-rw-r--r-- | test/cache_api.c | 8 | ||||
-rw-r--r-- | test/cache_common.c | 6 | ||||
-rw-r--r-- | testpar/t_cache.c | 26 |
6 files changed, 64 insertions, 51 deletions
@@ -989,10 +989,11 @@ done: */ herr_t -H5AC_get_entry_status(H5C_t * cache_ptr, +H5AC_get_entry_status(H5F_t * f, haddr_t addr, unsigned * status_ptr) { + H5C_t *cache_ptr = f->shared->cache; herr_t ret_value = SUCCEED; /* Return value */ herr_t result; hbool_t in_cache; @@ -1212,11 +1213,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_mark_pinned_entry_dirty(H5C_t * cache_ptr, +H5AC_mark_pinned_entry_dirty(H5F_t * f, void * thing, hbool_t size_changed, size_t new_size) { + H5C_t *cache_ptr = f->shared->cache; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ @@ -1408,11 +1410,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_pin_protected_entry(H5C_t * cache_ptr, +H5AC_pin_protected_entry(H5F_t * f, void * thing) { - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_t *cache_ptr = f->shared->cache; + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_pin_protected_entry, FAIL) @@ -1554,11 +1557,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_unpin_entry(H5C_t * cache_ptr, +H5AC_unpin_entry(H5F_t * f, void * thing) { - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_t *cache_ptr = f->shared->cache; + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_unpin_entry, FAIL) @@ -2480,7 +2484,7 @@ done: #ifdef H5_HAVE_PARALLEL static herr_t H5AC_check_if_write_permitted(const H5F_t *f, - hid_t dxpl_id, + hid_t UNUSED dxpl_id, hbool_t * write_permitted_ptr) #else /* H5_HAVE_PARALLEL */ static herr_t diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index a6844e4..6234a5e 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -242,21 +242,21 @@ extern hid_t H5AC_ind_dxpl_id; H5_DLL herr_t H5AC_init(void); H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr); -H5_DLL herr_t H5AC_get_entry_status(H5C_t * cache_ptr, haddr_t addr, +H5_DLL herr_t H5AC_get_entry_status(H5F_t * f, haddr_t addr, unsigned * status_ptr); H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags); -H5_DLL herr_t H5AC_pin_protected_entry(H5C_t * cache_ptr, void * thing); +H5_DLL herr_t H5AC_pin_protected_entry(H5F_t * f, void * thing); H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2, H5AC_protect_t rw); -H5_DLL herr_t H5AC_unpin_entry(H5C_t * cache_ptr, +H5_DLL herr_t H5AC_unpin_entry(H5F_t * f, void * thing); H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); -H5_DLL herr_t H5AC_mark_pinned_entry_dirty(H5C_t * cache_ptr, +H5_DLL herr_t H5AC_mark_pinned_entry_dirty(H5F_t * f, void * thing, hbool_t size_changed, size_t new_size); diff --git a/test/cache.c b/test/cache.c index 3157435..f286f3d 100644 --- a/test/cache.c +++ b/test/cache.c @@ -84,7 +84,6 @@ static void check_rename_err(void); static void check_double_pin_err(void); static void check_double_unpin_err(void); static void check_pin_entry_errs(void); -static void check_pin_protected_entry(void); static void check_double_protect_err(void); static void check_double_unprotect_err(void); static void check_mark_pinned_entry_dirty_errs(void); @@ -7445,7 +7444,7 @@ check_rename_entry__run_test(H5C_t * cache_ptr, static char msg[128]; unsigned int flags = H5C__NO_FLAGS_SET; test_entry_t * base_addr; - test_entry_t * entry_ptr; + test_entry_t * entry_ptr = NULL; H5C_cache_entry_t * test_ptr = NULL; if ( cache_ptr == NULL ) { @@ -17588,7 +17587,7 @@ check_auto_cache_resize_aux_fcns(void) /*------------------------------------------------------------------------- * Function: check_get_entry_status() * - * Purpose: Verify that H5AC_get_entry_status() behaves as expected. + * Purpose: Verify that H5C_get_entry_status() behaves as expected. * * Return: void * @@ -17606,12 +17605,16 @@ check_get_entry_status(void) const char * fcn_name = "check_get_entry_status"; static char msg[128]; herr_t result; - unsigned int status; + hbool_t in_cache; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + size_t entry_size; H5C_t * cache_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; - TESTING("H5AC_check_get_entry_status() functionality"); + TESTING("H5C_get_entry_status() functionality"); pass = TRUE; @@ -17628,7 +17631,8 @@ check_get_entry_status(void) if ( pass ) { - result = H5AC_get_entry_status(cache_ptr, entry_ptr->addr, &status); + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -17637,7 +17641,7 @@ check_get_entry_status(void) "H5AC_get_entry_status() reports failure 1."); failure_mssg = msg; - } else if ( status != 0 ) { + } else if ( in_cache || is_dirty || is_protected || is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 1."); @@ -17651,7 +17655,8 @@ check_get_entry_status(void) if ( pass ) { - result = H5AC_get_entry_status(cache_ptr, entry_ptr->addr, &status); + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -17660,7 +17665,7 @@ check_get_entry_status(void) "H5AC_get_entry_status() reports failure 2."); failure_mssg = msg; - } else if ( status != H5AC_ES__IN_CACHE ) { + } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 2."); @@ -17672,7 +17677,8 @@ check_get_entry_status(void) if ( pass ) { - result = H5AC_get_entry_status(cache_ptr, entry_ptr->addr, &status); + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -17681,7 +17687,7 @@ check_get_entry_status(void) "H5AC_get_entry_status() reports failure 3."); failure_mssg = msg; - } else if ( status != (H5AC_ES__IN_CACHE | H5AC_ES__IS_PROTECTED) ) { + } else if ( !in_cache || is_dirty || !is_protected || is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 3."); @@ -17693,7 +17699,8 @@ check_get_entry_status(void) if ( pass ) { - result = H5AC_get_entry_status(cache_ptr, entry_ptr->addr, &status); + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -17702,7 +17709,7 @@ check_get_entry_status(void) "H5AC_get_entry_status() reports failure 4."); failure_mssg = msg; - } else if ( status != (H5AC_ES__IN_CACHE | H5AC_ES__IS_PINNED) ) { + } else if ( !in_cache || is_dirty || is_protected || !is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); @@ -17714,7 +17721,8 @@ check_get_entry_status(void) if ( pass ) { - result = H5AC_get_entry_status(cache_ptr, entry_ptr->addr, &status); + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -17723,9 +17731,7 @@ check_get_entry_status(void) "H5AC_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if ( status != (H5AC_ES__IN_CACHE | - H5AC_ES__IS_PINNED | - H5AC_ES__IS_DIRTY) ) { + } else if ( !in_cache || !is_dirty || is_protected || !is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); @@ -17737,7 +17743,8 @@ check_get_entry_status(void) if ( pass ) { - result = H5AC_get_entry_status(cache_ptr, entry_ptr->addr, &status); + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, &is_pinned); if ( result < 0 ) { @@ -17746,7 +17753,7 @@ check_get_entry_status(void) "H5AC_get_entry_status() reports failure 6."); failure_mssg = msg; - } else if ( status != (H5AC_ES__IN_CACHE | H5AC_ES__IS_DIRTY) ) { + } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 6."); diff --git a/test/cache_api.c b/test/cache_api.c index 902a829..c1089dd 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -1325,9 +1325,9 @@ mdc_api_call_smoke_check(void) double min_hit_rate = 0.90; hbool_t dump_cache_size = FALSE; hid_t file_id = -1; - hid_t dataspace_id; + hid_t dataspace_id = -1; hid_t filespace_ids[NUM_DSETS]; - hid_t memspace_id; + hid_t memspace_id = -1; hid_t dataset_ids[NUM_DSETS]; hid_t properties; char dset_name[64]; @@ -2734,7 +2734,7 @@ check_fapl_mdc_api_errs(void) static char msg[128]; int i; herr_t result; - hid_t fapl_id; + hid_t fapl_id = -1; H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG; H5AC_cache_config_t scratch; @@ -2904,7 +2904,7 @@ check_file_mdc_api_errs(void) static char msg[128]; int i; herr_t result; - hid_t file_id; + hid_t file_id = -1; size_t max_size; size_t min_clean_size; size_t cur_size; diff --git a/test/cache_common.c b/test/cache_common.c index 55276d0..26bddf0 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -340,7 +340,7 @@ type_and_index_to_addr(int32_t type, /*------------------------------------------------------------------------- * - * Function: H5AC_check_if_write_permitted + * Function: check_if_write_permitted * * Purpose: Determine if a write is permitted under the current * circumstances, and set *write_permitted_ptr accordingly. @@ -2021,7 +2021,7 @@ unprotect_entry(H5C_t * cache_ptr, if ( ( dirty == TRUE ) || ( dirty == FALSE ) ) { - flags |= (dirty ? H5AC__DIRTIED_FLAG : H5AC__NO_FLAGS_SET); + flags |= (dirty ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET); entry_ptr->is_dirty = (entry_ptr->is_dirty || dirty); } @@ -2058,7 +2058,7 @@ unprotect_entry(H5C_t * cache_ptr, HDassert( ((entry_ptr->header).type)->id == type ); - if ( ( flags & H5AC__DIRTIED_FLAG ) != 0 + if ( ( flags & H5C__DIRTIED_FLAG ) != 0 && ( (flags & H5C__DELETED_FLAG) == 0 ) ) { HDassert( entry_ptr->header.is_dirty ); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index f80f4b3..56a684a 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -346,8 +346,8 @@ void lock_and_unlock_random_entries(H5C_t * cache_ptr, H5F_t * file_ptr, void lock_and_unlock_random_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int min_idx, int max_idx); void lock_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx); -void mark_pinned_entry_dirty(H5C_t * cache_ptr, int32_t idx, - hbool_t size_changed, size_t new_size); +void mark_pinned_entry_dirty(H5C_t * cache_ptr, H5F_t * file_ptr, + int32_t idx, hbool_t size_changed, size_t new_size); void pin_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); void rename_entry(H5C_t * cache_ptr, H5F_t * file_ptr, @@ -1700,7 +1700,7 @@ load_datum(H5F_t UNUSED *f, if ( ! recv_mssg(&mssg) ) { nerrors++; - success = FAIL; + success = FALSE; if ( verbose ) { HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", world_mpi_rank, fcn_name); @@ -2298,6 +2298,7 @@ lock_entry(H5C_t * cache_ptr, void mark_pinned_entry_dirty(H5C_t * cache_ptr, + H5F_t * file_ptr, int32_t idx, hbool_t size_changed, size_t new_size) @@ -2308,6 +2309,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, if ( nerrors == 0 ) { + HDassert( file_ptr ); HDassert( cache_ptr ); HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); HDassert( idx < virt_num_data_entries ); @@ -2320,7 +2322,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, (entry_ptr->ver)++; entry_ptr->dirty = TRUE; - result = H5AC_mark_pinned_entry_dirty(cache_ptr, + result = H5AC_mark_pinned_entry_dirty(file_ptr, (void *)entry_ptr, size_changed, new_size); @@ -2329,7 +2331,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, nerrors++; if ( verbose ) { - HDfprintf(stdout, "%d:%s: error in H5AC_unpin_entry().\n", + HDfprintf(stdout, "%d:%s: error in H5AC_mark_pinned_entry_dirty().\n", world_mpi_rank, fcn_name); } } @@ -2998,11 +3000,11 @@ unpin_entry(H5C_t * cache_ptr, if ( dirty ) { - mark_pinned_entry_dirty(cache_ptr, idx, FALSE, (size_t)0); + mark_pinned_entry_dirty(cache_ptr, file_ptr, idx, FALSE, (size_t)0); } - result = H5AC_unpin_entry(cache_ptr, (void *)entry_ptr); + result = H5AC_unpin_entry(file_ptr, (void *)entry_ptr); if ( result < 0 ) { @@ -4231,7 +4233,7 @@ main(int argc, char **argv) { const char * fcn_name = "main()"; int express_test; - int i; + unsigned u; int mpi_size; int mpi_rank; int max_nerrors; @@ -4247,7 +4249,7 @@ main(int argc, char **argv) H5open(); - if ( express_test = do_express_test() ) { + if ( (express_test = do_express_test()) ) { #if 0 /* I'll want this from time to time */ HDfprintf(stdout, "%d:%s: Express test.\n", world_mpi_rank, fcn_name); @@ -4312,10 +4314,10 @@ main(int argc, char **argv) } /* fix the file names */ - for ( i = 0; i < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++i ) + for ( u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u ) { - if ( h5_fixname(FILENAME[i], fapl, filenames[i], - sizeof(filenames[i])) == NULL ) { + if ( h5_fixname(FILENAME[u], fapl, filenames[u], + sizeof(filenames[u])) == NULL ) { nerrors++; if ( verbose ) { |