diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-04-29 08:04:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-04-29 08:04:21 (GMT) |
commit | 01f196b31a03f072b685f998b0805c1f90322c2b (patch) | |
tree | 6e1cae004705ade1c870e4c6612a76b55be3c331 /test/cache_common.c | |
parent | da4b69097756158fdbfcbf52b5b552e2034d263d (diff) | |
parent | b3c5284692093953132c6c8227e0980b670bf4ad (diff) | |
download | hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.zip hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.gz hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into merge_hyperslab_updates
Diffstat (limited to 'test/cache_common.c')
-rw-r--r-- | test/cache_common.c | 117 |
1 files changed, 49 insertions, 68 deletions
diff --git a/test/cache_common.c b/test/cache_common.c index 52dbb52..5596601 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: John Mainzer @@ -19,6 +17,7 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" #include "cache_common.h" @@ -131,37 +130,37 @@ static herr_t monster_image_len(const void *thing, size_t *image_len_ptr); static herr_t variable_image_len(const void *thing, size_t *image_len_ptr); static herr_t notify_image_len(const void *thing, size_t *image_len_ptr); -static herr_t pico_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t pico_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t nano_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t nano_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t micro_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t micro_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t tiny_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t tiny_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t small_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t small_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t medium_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t medium_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t large_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t large_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t huge_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t huge_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t monster_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t monster_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t variable_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t variable_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t notify_pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t notify_pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); @@ -214,7 +213,7 @@ static herr_t get_final_load_size(const void *image, size_t image_len, static void *deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr, int32_t entry_type); static herr_t image_len(const void *thing, size_t *image_len_ptr, int32_t entry_type); -static herr_t pre_serialize(H5F_t *f, hid_t dxpl_id, void *thing, +static herr_t pre_serialize(H5F_t *f, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t serialize(const H5F_t *f, void *image_ptr, size_t len, @@ -1125,7 +1124,6 @@ notify_image_len(const void *thing, size_t *image_length) */ herr_t pre_serialize(H5F_t *f, - hid_t H5_ATTR_UNUSED dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1210,7 +1208,6 @@ pre_serialize(H5F_t *f, herr_t pico_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1218,13 +1215,12 @@ pico_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t nano_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1232,13 +1228,12 @@ nano_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t micro_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1246,13 +1241,12 @@ micro_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t tiny_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1260,13 +1254,12 @@ tiny_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t small_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1274,13 +1267,12 @@ small_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t medium_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1288,13 +1280,12 @@ medium_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t large_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1302,13 +1293,12 @@ large_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t huge_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1316,13 +1306,12 @@ huge_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t monster_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1330,13 +1319,12 @@ monster_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t variable_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1344,13 +1332,12 @@ variable_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } herr_t notify_pre_serialize(H5F_t *f, - hid_t dxpl_id, void *thing, haddr_t addr, size_t len, @@ -1358,7 +1345,7 @@ notify_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, dxpl_id, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -2438,8 +2425,10 @@ reset_entries(void) base_addr[j].header.ro_ref_count = FALSE; base_addr[j].header.next = NULL; base_addr[j].header.prev = NULL; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS base_addr[j].header.aux_next = NULL; base_addr[j].header.aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ base_addr[j].self = &(base_addr[j]); base_addr[j].cache_ptr = NULL; @@ -3279,6 +3268,9 @@ setup_cache(size_t max_cache_size, } /* end if */ } /* end if */ + /* Push API context */ + H5CX_push(); + if(show_progress) /* 4 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", FUNC, mile_stone++, (int)pass); @@ -3379,8 +3371,7 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { /* allocate space for test entries */ - actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5AC_ind_read_dxpl_id, - (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); if(actual_base_addr == HADDR_UNDEF) { pass = FALSE; @@ -3455,7 +3446,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3463,7 +3454,7 @@ takedown_cache(H5F_t * file_ptr, flush_cache(file_ptr, TRUE, FALSE, FALSE); - H5C_dest(file_ptr, H5AC_ind_read_dxpl_id); + H5C_dest(file_ptr); if ( saved_cache != NULL ) { @@ -3493,7 +3484,7 @@ takedown_cache(H5F_t * file_ptr, HDassert ( file_ptr ); } - H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5AC_ind_read_dxpl_id, saved_actual_base_addr, + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, saved_actual_base_addr, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); saved_actual_base_addr = HADDR_UNDEF; } @@ -3509,6 +3500,9 @@ takedown_cache(H5F_t * file_ptr, } + /* Pop API context */ + H5CX_pop(); + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) @@ -3582,8 +3576,7 @@ expunge_entry(H5F_t * file_ptr, HDassert( ! ( entry_ptr->header.is_pinned ) ); HDassert( ! ( entry_ptr->is_pinned ) ); - result = H5C_expunge_entry(file_ptr, H5AC_ind_read_dxpl_id, - types[type], entry_ptr->addr, H5C__NO_FLAGS_SET); + result = H5C_expunge_entry(file_ptr, types[type], entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -3634,12 +3627,10 @@ flush_cache(H5F_t * file_ptr, cache_ptr = file_ptr->shared->cache; if(destroy_entries) - result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, - H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG); else - result = H5C_flush_cache(file_ptr, H5AC_ind_read_dxpl_id, - H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET); if(dump_stats) H5C_stats(cache_ptr, "test cache", dump_detailed_stats); @@ -3767,7 +3758,6 @@ insert_entry(H5F_t * file_ptr, { H5C_t * cache_ptr; herr_t result; - hid_t xfer = H5AC_ind_read_dxpl_id; hbool_t insert_pinned; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -3798,13 +3788,9 @@ insert_entry(H5F_t * file_ptr, /* Set the base address of the entry type into the property list as tag */ /* Use to cork entries for the object */ - if(H5AC_tag(xfer, baddrs, NULL) < 0) { - pass = FALSE; - failure_mssg = "error in H5P_set()."; - } + H5AC_tag(baddrs, NULL); - result = H5C_insert_entry(file_ptr, xfer, - types[type], entry_ptr->addr, (void *)entry_ptr, flags); + result = H5C_insert_entry(file_ptr, types[type], entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || ( entry_ptr->header.is_protected ) || @@ -4050,7 +4036,6 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) test_entry_t * base_addr; test_entry_t * entry_ptr; haddr_t baddrs; - hid_t xfer = H5AC_ind_read_dxpl_id; H5C_cache_entry_t * cache_entry_ptr; if(pass) { @@ -4071,12 +4056,9 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) /* Set the base address of the entry type into the property list as tag */ /* Use to cork entries for the object */ - if(H5AC_tag(xfer, baddrs, NULL) < 0) { - pass = FALSE; - failure_mssg = "error in H5P_set()."; - } /* end if */ + H5AC_tag(baddrs, NULL); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, xfer, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -4180,7 +4162,7 @@ protect_entry_ro(H5F_t * file_ptr, ( ( entry_ptr->is_read_only ) && ( entry_ptr->ro_ref_count > 0 ) ) ); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_ind_read_dxpl_id, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || @@ -4396,8 +4378,7 @@ unprotect_entry(H5F_t * file_ptr, mark_flush_dep_dirty(entry_ptr); } /* end if */ - result = H5C_unprotect(file_ptr, H5AC_ind_read_dxpl_id, - entry_ptr->addr, (void *)entry_ptr, flags); + result = H5C_unprotect(file_ptr, entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || ( ( entry_ptr->header.is_protected ) && |