From 243942105f21773689d449606e1763740ef6cd61 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 20 Jun 2012 10:27:37 -0500 Subject: [svn-r22480] Description: Bring changes from "trunk merging" branch back to this feature branch, to make further work on the branch easier. Tested on: N/A - this branch is not compilable currently. --- src/H5ACprivate.h | 2 +- src/H5C.c | 399 +++++------------------------- src/H5Cprivate.h | 7 +- test/cache.c | 689 ++++++++++++++++++++++++++++++++-------------------- test/cache_api.c | 143 +---------- test/cache_common.c | 189 ++++++++------ test/cache_common.h | 133 ++++------ testpar/t_cache.c | 685 +++++++++++++++++++-------------------------------- 8 files changed, 921 insertions(+), 1326 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 6fd3c33..9454257 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -156,7 +156,7 @@ extern hid_t H5AC_dxpl_id; /* Dataset transfer property list for independent metadata I/O calls */ /* (just "library internal" set - i.e. independent transfer mode) */ /* (Global variable declaration, definition is in H5AC.c) */ -extern hid_t H5AC_ind_dxpl_id; +H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* Cache config field limit #defines */ diff --git a/src/H5C.c b/src/H5C.c index dd27ec2..4b6383b 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -468,37 +468,18 @@ H5C_create(size_t max_cache_size, cache_ptr->epoch_marker_ringbuf_last = 0; cache_ptr->epoch_marker_ringbuf_size = 0; + /* Initialize all epoch marker entries' fields to zero/FALSE/NULL */ + HDmemset(cache_ptr->epoch_markers, 0, sizeof(cache_ptr->epoch_markers)); + + /* Set non-zero/FALSE/NULL fields for epoch markers */ for ( i = 0; i < H5C__MAX_EPOCH_MARKERS; i++ ) { - (cache_ptr->epoch_marker_active)[i] = FALSE; #ifndef NDEBUG ((cache_ptr->epoch_markers)[i]).magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; - ((cache_ptr->epoch_markers)[i]).size = (size_t)0; - ((cache_ptr->epoch_markers)[i]).image_ptr = NULL; - ((cache_ptr->epoch_markers)[i]).image_up_to_date = FALSE; ((cache_ptr->epoch_markers)[i]).type = &epoch_marker_class; - ((cache_ptr->epoch_markers)[i]).is_dirty = FALSE; - ((cache_ptr->epoch_markers)[i]).dirtied = FALSE; - ((cache_ptr->epoch_markers)[i]).is_protected = FALSE; - ((cache_ptr->epoch_markers)[i]).is_read_only = FALSE; - ((cache_ptr->epoch_markers)[i]).ro_ref_count = 0; - ((cache_ptr->epoch_markers)[i]).is_pinned = FALSE; - ((cache_ptr->epoch_markers)[i]).in_slist = FALSE; - ((cache_ptr->epoch_markers)[i]).ht_next = NULL; - ((cache_ptr->epoch_markers)[i]).ht_prev = NULL; - ((cache_ptr->epoch_markers)[i]).next = NULL; - ((cache_ptr->epoch_markers)[i]).prev = NULL; - ((cache_ptr->epoch_markers)[i]).aux_next = NULL; - ((cache_ptr->epoch_markers)[i]).aux_prev = NULL; -#if H5C_COLLECT_CACHE_ENTRY_STATS - ((cache_ptr->epoch_markers)[i]).accesses = 0; - ((cache_ptr->epoch_markers)[i]).clears = 0; - ((cache_ptr->epoch_markers)[i]).flushes = 0; - ((cache_ptr->epoch_markers)[i]).pins = 0; -#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ } /* metadata journaling related fields */ @@ -674,6 +655,12 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, switch ( (cache_ptr->resize_ctl).decr_mode ) { + case H5C_decr__off: + HDfprintf(stdout, + "%sAuto cache resize -- decrease off. HR = %lf\n", + cache_ptr->prefix, hit_rate); + break; + case H5C_decr__threshold: HDassert( hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold ); @@ -835,57 +822,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_dest_empty - * - * Purpose: Destroy an empty cache. - * - * This function fails if the cache is not empty on entry. - * - * Note that *cache_ptr has been freed upon successful return. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/2/04 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_dest_empty(H5C_t * cache_ptr) -{ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5C_dest_empty, FAIL) - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ( ( ! cache_ptr ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( cache_ptr->index_len != 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad cache_ptr or non-empty cache on entry.") - } - - - if ( cache_ptr->slist_ptr != NULL ) { - - H5SL_close(cache_ptr->slist_ptr); - cache_ptr->slist_ptr = NULL; - } - - cache_ptr->magic = 0; - - cache_ptr = H5FL_FREE(H5C_t, cache_ptr); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_dest_empty() */ - - -/*------------------------------------------------------------------------- * * Function: H5C_expunge_entry * @@ -1080,30 +1016,17 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) { flushed_entries_last_pass = FALSE; node_ptr = H5SL_first(cache_ptr->slist_ptr); + HDassert( node_ptr != NULL ); - if ( node_ptr != NULL ) { - - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 1 ?!?!"); - } + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") #ifndef NDEBUG - HDassert( next_entry_ptr->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC ); + HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); #endif /* NDEBUG */ - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - - } else { - - next_entry_ptr = NULL; - - } + HDassert( next_entry_ptr->is_dirty ); + HDassert( next_entry_ptr->in_slist ); - HDassert( node_ptr != NULL ); #if H5C_DO_SANITY_CHECKS /* For sanity checking, try to verify that the skip list has @@ -1182,8 +1105,7 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) #ifndef NDEBUG if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "entry_ptr->magic invalid ?!?!"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!") } else #endif /* NDEBUG */ @@ -1206,11 +1128,8 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( next_entry_ptr == NULL ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 2 ?!?!"); - } + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") #ifndef NDEBUG HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); @@ -1531,9 +1450,7 @@ H5C_flush_to_min_clean(H5F_t * f, #endif /* end modified code -- commented out for now */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_flush_to_min_clean() */ @@ -1726,7 +1643,7 @@ H5C_get_entry_status(const H5F_t *f, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr) { - H5C_t * cache_ptr; + H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -1972,6 +1889,20 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); entry_ptr = (H5C_cache_entry_t *)thing; + + /* verify that the new entry isn't already in the hash table -- scream + * and die if it is. + */ + + H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) + + if(test_entry_ptr != NULL) { + if(test_entry_ptr == entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache.") + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache.") + } /* end if */ + #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ @@ -1982,6 +1913,12 @@ H5C_insert_entry(H5F_t * f, entry_ptr->image_ptr = NULL; entry_ptr->image_up_to_date = FALSE; + entry_ptr->is_protected = FALSE; + entry_ptr->is_read_only = FALSE; + entry_ptr->ro_ref_count = 0; + + entry_ptr->is_pinned = insert_pinned; + /* newly inserted entries are assumed to be dirty */ entry_ptr->is_dirty = TRUE; @@ -2099,38 +2036,6 @@ H5C_insert_entry(H5F_t * f, } } - /* verify that the new entry isn't already in the hash table -- scream - * and die if it is. - */ - - H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - - if ( test_entry_ptr != NULL ) { - - if ( test_entry_ptr == entry_ptr ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "entry already in cache.") - - } else { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "duplicate entry in cache, addr = %llu", (unsigned long long)addr) - } - } - - /* we don't initialize the protected field until here as it is - * possible that the entry is already in the cache, and already - * protected. If it is, we don't want to make things worse by - * marking it unprotected. - */ - - entry_ptr->is_protected = FALSE; - entry_ptr->is_read_only = FALSE; - entry_ptr->ro_ref_count = 0; - - entry_ptr->is_pinned = insert_pinned; - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) /* New entries are presumed to be dirty, so this if statement is @@ -2745,9 +2650,8 @@ done: herr_t H5C_resize_entry(void *thing, size_t new_size) { - H5C_t * cache_ptr; + H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; - size_t size_increase; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_resize_entry, FAIL) @@ -2780,6 +2684,7 @@ H5C_resize_entry(void *thing, size_t new_size) if ( cache_ptr->flash_size_increase_possible ) { if ( new_size > entry_ptr->size ) { + size_t size_increase; size_increase = new_size - entry_ptr->size; @@ -2862,8 +2767,8 @@ done: herr_t H5C_pin_protected_entry(void *thing) { - H5C_t * cache_ptr; - H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_pin_protected_entry, FAIL) @@ -4212,8 +4117,8 @@ H5C_stats__reset(H5C_t UNUSED * cache_ptr) herr_t H5C_unpin_entry(void *_entry_ptr) { - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_entry_ptr; + H5C_t * cache_ptr; + H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)_entry_ptr; /* Pointer to entry to unpin */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_unpin_entry, FAIL) @@ -6214,27 +6119,19 @@ H5C_flush_invalidate_cache(const H5F_t * f, if ( cache_ptr->slist_len == 0 ) { node_ptr = NULL; - next_entry_ptr = NULL; HDassert( cache_ptr->slist_size == 0 ); } else { + /* Start at beginning of skip list each time */ node_ptr = H5SL_first(cache_ptr->slist_ptr); + HDassert( node_ptr != NULL ); - if ( node_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "slist_len != 0 && node_ptr == NULL"); - } - + /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 1 ?!?!"); - } -#ifndef NDEBUG + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); -#endif /* NDEBUG */ HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); @@ -6304,8 +6201,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, #ifndef NDEBUG if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "entry_ptr->magic is invalid ?!?!"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!") } else #endif /* NDEBUG */ @@ -6327,19 +6223,13 @@ H5C_flush_invalidate_cache(const H5F_t * f, next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( next_entry_ptr == NULL ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL 2 ?!?!"); - } -#ifndef NDEBUG - HDassert( next_entry_ptr->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC ); -#endif /* NDEBUG */ + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); } else { - next_entry_ptr = NULL; } @@ -6592,7 +6482,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, } else if ( cur_pel_len > 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Can't unpin all pinned entries 2.") + "Can't unpin all pinned entries.") } @@ -6650,7 +6540,7 @@ H5C_flush_single_entry(const H5F_t * f, hbool_t was_dirty; herr_t status; int type_id; - unsigned serialize_flags = 0; + unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; haddr_t new_addr; size_t new_len; void * new_image_ptr; @@ -6695,17 +6585,6 @@ H5C_flush_single_entry(const H5F_t * f, } } } -#if 0 - /* this should be useful for debugging from time to time. - * lets leave it in for now. -- JRM 12/15/04 - */ - else { - HDfprintf(stdout, - "H5C_flush_single_entry(): non-existant entry. addr = %a\n", - addr); - HDfflush(stdout); - } -#endif #endif /* H5C_DO_SANITY_CHECKS */ if ( ( entry_ptr != NULL ) && ( entry_ptr->is_protected ) ) @@ -6745,7 +6624,7 @@ H5C_flush_single_entry(const H5F_t * f, if ( NULL == (dxpl = H5I_object(dxpl_id)) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ - "not a dataset creation property list") + "not a dataset transfer property list") } /* Get the transfer mode property */ @@ -6756,12 +6635,6 @@ H5C_flush_single_entry(const H5F_t * f, } /* Sanity check transfer mode */ - /* I'm surprised that this sanity check is working at - * present -- will need to look into it at some point. - * - * JRM -- 7/7/07 - */ - HDassert( xfer_mode == H5FD_MPIO_COLLECTIVE ); } @@ -6811,133 +6684,6 @@ H5C_flush_single_entry(const H5F_t * f, /* Update the replacement policy for the flush or eviction. */ if ( destroy ) { /* AKA eviction */ -#if 0 /* JRM */ - /* This test code may come in handy -- lets keep it for a while. - * - * Note that it will cause spurious errors in the serial case - * unless we are maintaining the clean and dirty LRU lists. - */ - { - if ( entry_ptr->is_dirty ) - { - if ( cache_ptr->dLRU_head_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_head_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->dLRU_tail_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_tail_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->dLRU_list_len <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_list_len <= 0.\n", - FUNC); - - if ( cache_ptr->dLRU_list_size <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_list_size <= 0.\n", - FUNC); - - if ( cache_ptr->dLRU_list_size < entry_ptr->size ) - HDfprintf(stdout, - "%s: cache_ptr->dLRU_list_size < entry_ptr->size.\n", - FUNC); - - if ( ( (cache_ptr->dLRU_list_size) == entry_ptr->size ) && - ( ! ( (cache_ptr->dLRU_list_len) == 1 ) ) ) - HDfprintf(stdout, - "%s: dLRU_list_size == size && dLRU_list_len != 1\n", - FUNC); - - if ( ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->dLRU_head_ptr != entry_ptr ) ) - HDfprintf(stdout, - "%s: entry_ptr->aux_prev == NULL && dLRU_head_ptr != entry_ptr\n", - FUNC); - - if ( ( entry_ptr->aux_next == NULL ) && - ( cache_ptr->dLRU_tail_ptr != entry_ptr ) ) - HDfprintf(stdout, - "%s: entry_ptr->aux_next == NULL && dLRU_tail_ptr != entry_ptr\n", - FUNC); - - if ( ( cache_ptr->dLRU_list_len == 1 ) && - ( ! ( ( cache_ptr->dLRU_head_ptr == entry_ptr ) && - ( cache_ptr->dLRU_tail_ptr == entry_ptr ) && - ( entry_ptr->aux_next == NULL ) && - ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->dLRU_list_size == entry_ptr->size ) - ) - ) - ) - { - HDfprintf(stdout, - "%s: single entry dlru sanity check fails\n", - FUNC); - } - - } - else - { - if ( cache_ptr->cLRU_head_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_head_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->cLRU_tail_ptr == NULL ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_tail_ptr == NULL.\n", - FUNC); - - if ( cache_ptr->cLRU_list_len <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_list_len <= 0.\n", - FUNC); - - if ( cache_ptr->cLRU_list_size <= 0 ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_list_size <= 0.\n", - FUNC); - - if ( cache_ptr->cLRU_list_size < entry_ptr->size ) - HDfprintf(stdout, - "%s: cache_ptr->cLRU_list_size < entry_ptr->size.\n", - FUNC); - - if ( ( (cache_ptr->cLRU_list_size) == entry_ptr->size ) && - ( ! ( (cache_ptr->cLRU_list_len) == 1 ) ) ) - HDfprintf(stdout, - "%s: cLRU_list_size == size && cLRU_list_len != 1\n", - FUNC); - - if ( ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->cLRU_head_ptr != entry_ptr ) ) - HDfprintf(stdout, "%s: entry_ptr->aux_prev == NULL && cLRU_head_ptr != entry_ptr\n", FUNC); - - if ( ( entry_ptr->aux_next == NULL ) && - ( cache_ptr->cLRU_tail_ptr != entry_ptr ) ) - HDfprintf(stdout, "%s: entry_ptr->aux_next == NULL && cLRU_tail_ptr != entry_ptr\n", FUNC); - - if ( ( cache_ptr->cLRU_list_len == 1 ) && - ( ! ( ( cache_ptr->cLRU_head_ptr == entry_ptr ) && - ( cache_ptr->cLRU_tail_ptr == entry_ptr ) && - ( entry_ptr->aux_next == NULL ) && - ( entry_ptr->aux_prev == NULL ) && - ( cache_ptr->cLRU_list_size == entry_ptr->size ) - ) - ) - ) - { - HDfprintf(stdout, - "%s: single entry clru sanity check fails\n", - FUNC); - } - } - } -#endif /* JRM */ - H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) } else { @@ -7108,7 +6854,7 @@ H5C_flush_single_entry(const H5F_t * f, * the image was up to date on entry, serialize_flags should * still be 0 at this point. */ - if ( serialize_flags != 0 ) { + if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { /* In the parallel case, resizes and moves in * the serialize operation can cause problems. @@ -7196,9 +6942,7 @@ H5C_flush_single_entry(const H5F_t * f, } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_flush_single_entry() */ @@ -7365,13 +7109,13 @@ H5C_load_entry(H5F_t * f, */ HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6) ); - HDassert( entry->size < H5C_MAX_ENTRY_SIZE ); #ifndef NDEBUG entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; #endif /* NDEBUG */ entry->cache_ptr = f->shared->cache; entry->addr = addr; entry->size = len; + HDassert(entry->size < H5C_MAX_ENTRY_SIZE); entry->image_ptr = image; entry->image_up_to_date = TRUE; entry->type = type; @@ -7666,27 +7410,6 @@ H5C_make_space_in_cache(H5F_t * f, * from the tail. */ -#if 0 /* This debuging code may be useful in the future -- keep it for now. */ - if ( ! ( prev_ptr->is_dirty ) ) { - HDfprintf(stdout, "%s: ! prev_ptr->is_dirty\n", - FUNC); - } - if ( prev_ptr->aux_next != next_ptr ) { - HDfprintf(stdout, "%s: prev_ptr->next != next_ptr\n", - FUNC); - } - if ( prev_ptr->is_protected ) { - HDfprintf(stdout, "%s: prev_ptr->is_protected\n", - FUNC); - } - if ( prev_ptr->is_pinned ) { - HDfprintf(stdout, "%s:prev_ptr->is_pinned\n", - FUNC); - } - - HDfprintf(stdout, "%s: re-starting scan of dirty list\n", - FUNC); -#endif /* JRM */ entry_ptr = cache_ptr->dLRU_tail_ptr; } else { diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index a6f2ae1..b35a221 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -32,7 +32,7 @@ #include "H5Cpublic.h" /* public prototypes */ -/* Pivate headers needed by this header */ +/* Private headers needed by this header */ #include "H5private.h" /* Generic Functions */ #include "H5Fprivate.h" /* File access */ @@ -60,7 +60,7 @@ /* H5C_COLLECT_CACHE_STATS controls overall collection of statistics * on cache activity. In general, this #define should be set to 0. */ -#define H5C_COLLECT_CACHE_STATS 1 +#define H5C_COLLECT_CACHE_STATS 0 /* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics * in individual cache entries. @@ -427,6 +427,7 @@ typedef void *(*H5C_deserialize_func_t)(const void *image_ptr, typedef herr_t (*H5C_image_len_func_t)(const void *thing, size_t *image_len_ptr); +#define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0) #define H5C__SERIALIZE_RESIZED_FLAG ((unsigned)0x1) #define H5C__SERIALIZE_MOVED_FLAG ((unsigned)0x2) @@ -1393,8 +1394,6 @@ H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, H5_DLL herr_t H5C_dest(H5F_t * f, hid_t dxpl_id); -H5_DLL herr_t H5C_dest_empty(H5C_t * cache_ptr); - H5_DLL herr_t H5C_expunge_entry(H5F_t * f, hid_t dxpl_id, const H5C_class_t * type, diff --git a/test/cache.c b/test/cache.c index b56888b..63d1437 100644 --- a/test/cache.c +++ b/test/cache.c @@ -103,17 +103,17 @@ struct move_entry_test_spec /* private function declarations: */ -static unsigned smoke_check_1(void); -static unsigned smoke_check_2(void); -static unsigned smoke_check_3(void); -static unsigned smoke_check_4(void); -static unsigned smoke_check_5(void); -static unsigned smoke_check_6(void); -static unsigned smoke_check_7(void); -static unsigned smoke_check_8(void); -static unsigned smoke_check_9(void); -static unsigned smoke_check_10(void); -static unsigned write_permitted_check(void); +static unsigned smoke_check_1(int express_test); +static unsigned smoke_check_2(int express_test); +static unsigned smoke_check_3(int express_test); +static unsigned smoke_check_4(int express_test); +static unsigned smoke_check_5(int express_test); +static unsigned smoke_check_6(int express_test); +static unsigned smoke_check_7(int express_test); +static unsigned smoke_check_8(int express_test); +static unsigned smoke_check_9(int express_test); +static unsigned smoke_check_10(int express_test); +static unsigned write_permitted_check(int express_test); static unsigned check_insert_entry(void); static unsigned check_flush_cache(void); static void check_flush_cache__empty_cache(H5F_t * file_ptr); @@ -225,7 +225,7 @@ static unsigned check_auto_cache_resize_aux_fcns(void); */ static unsigned -smoke_check_1(void) +smoke_check_1(int express_test) { const char * fcn_name = "smoke_check_1"; hbool_t show_progress = FALSE; @@ -412,7 +412,7 @@ smoke_check_1(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_1() */ @@ -440,7 +440,7 @@ smoke_check_1(void) */ static unsigned -smoke_check_2(void) +smoke_check_2(int express_test) { const char * fcn_name = "smoke_check_2"; hbool_t show_progress = FALSE; @@ -627,7 +627,7 @@ smoke_check_2(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_2() */ @@ -654,7 +654,7 @@ smoke_check_2(void) */ static unsigned -smoke_check_3(void) +smoke_check_3(int express_test) { const char * fcn_name = "smoke_check_3"; hbool_t show_progress = FALSE; @@ -841,7 +841,7 @@ smoke_check_3(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_3() */ @@ -869,7 +869,7 @@ smoke_check_3(void) */ static unsigned -smoke_check_4(void) +smoke_check_4(int express_test) { const char * fcn_name = "smoke_check_4"; hbool_t show_progress = FALSE; @@ -1056,7 +1056,7 @@ smoke_check_4(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_4() */ @@ -1084,7 +1084,7 @@ smoke_check_4(void) */ static unsigned -smoke_check_5(void) +smoke_check_5(int express_test) { const char * fcn_name = "smoke_check_5"; herr_t result; @@ -1308,7 +1308,7 @@ smoke_check_5(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_5() */ @@ -1336,7 +1336,7 @@ smoke_check_5(void) */ static unsigned -smoke_check_6(void) +smoke_check_6(int express_test) { const char * fcn_name = "smoke_check_6"; herr_t result; @@ -1560,7 +1560,7 @@ smoke_check_6(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_6() */ @@ -1588,7 +1588,7 @@ smoke_check_6(void) */ static unsigned -smoke_check_7(void) +smoke_check_7(int express_test) { const char * fcn_name = "smoke_check_7"; herr_t result; @@ -1813,7 +1813,7 @@ smoke_check_7(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_7() */ @@ -1841,7 +1841,7 @@ smoke_check_7(void) */ static unsigned -smoke_check_8(void) +smoke_check_8(int express_test) { const char * fcn_name = "smoke_check_8"; herr_t result; @@ -1939,8 +1939,7 @@ smoke_check_8(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - file_ptr = setup_cache((size_t)(2 * 1024), - (size_t)(1 * 1024)); + file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); cache_ptr = file_ptr->shared->cache; if ( pass ) { @@ -2066,7 +2065,7 @@ smoke_check_8(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_8() */ @@ -2095,7 +2094,7 @@ smoke_check_8(void) */ static unsigned -smoke_check_9(void) +smoke_check_9(int express_test) { const char * fcn_name = "smoke_check_9"; herr_t result; @@ -2396,7 +2395,7 @@ smoke_check_9(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_9() */ @@ -2425,7 +2424,7 @@ smoke_check_9(void) */ static unsigned -smoke_check_10(void) +smoke_check_10(int express_test) { const char * fcn_name = "smoke_check_10"; herr_t result; @@ -2721,7 +2720,7 @@ smoke_check_10(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* smoke_check_10() */ @@ -2746,7 +2745,7 @@ smoke_check_10(void) */ static unsigned -write_permitted_check(void) +write_permitted_check(int express_test) { #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS @@ -2943,7 +2942,7 @@ write_permitted_check(void) #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - return !pass; + return (unsigned)!pass; } /* write_permitted_check() */ @@ -3250,7 +3249,7 @@ check_insert_entry(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_insert_entry() */ @@ -3344,7 +3343,7 @@ check_flush_cache(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_flush_cache() */ @@ -12853,8 +12852,8 @@ check_get_entry_status(void) hbool_t is_pinned; size_t entry_size; H5F_t * file_ptr = NULL; - test_entry_t * base_addr; - test_entry_t * entry_ptr; + test_entry_t * base_addr = NULL; + test_entry_t * entry_ptr = NULL; TESTING("H5C_get_entry_status() functionality"); @@ -12869,8 +12868,18 @@ check_get_entry_status(void) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); - base_addr = entries[0]; - entry_ptr = &(base_addr[0]); + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else { + + base_addr = entries[0]; + entry_ptr = &(base_addr[0]); + + } } if ( pass ) { @@ -12897,9 +12906,13 @@ check_get_entry_status(void) } } - protect_entry(file_ptr, 0, 0); + if ( pass ) { - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, 0, 0); + + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + + } if ( pass ) { @@ -12921,7 +12934,11 @@ check_get_entry_status(void) } } - protect_entry(file_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -12943,7 +12960,11 @@ check_get_entry_status(void) } } - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + if ( pass ) { + + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + + } if ( pass ) { @@ -12965,7 +12986,11 @@ check_get_entry_status(void) } } - mark_entry_dirty(0, 0); + if ( pass ) { + + mark_entry_dirty(0, 0); + + } if ( pass ) { @@ -12987,7 +13012,11 @@ check_get_entry_status(void) } } - unpin_entry(0, 0); + if ( pass ) { + + unpin_entry(0, 0); + + } if ( pass ) { @@ -13029,7 +13058,7 @@ check_get_entry_status(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_get_entry_status() */ @@ -13120,9 +13149,13 @@ check_expunge_entry(void) * it without marking it dirty. */ - protect_entry(file_ptr, 0, 0); + if ( pass ) { - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, 0, 0); + + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + + } if ( pass ) { @@ -13157,7 +13190,11 @@ check_expunge_entry(void) * Also verify that the entry was loaded and destroyed, but * not flushed. */ - expunge_entry(file_ptr, 0, 0); + if ( pass ) { + + expunge_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -13237,9 +13274,13 @@ check_expunge_entry(void) * it with the dirty flag set. */ - protect_entry(file_ptr, 0, 1); + if ( pass ) { + + protect_entry(file_ptr, 0, 1); + + unprotect_entry(file_ptr, 0, 1, H5C__DIRTIED_FLAG); - unprotect_entry(file_ptr, 0, 1, H5C__DIRTIED_FLAG); + } if ( pass ) { @@ -13275,7 +13316,11 @@ check_expunge_entry(void) * Also verify that the entry was loaded and destroyed, but not * flushed. */ - expunge_entry(file_ptr, 0, 1); + if ( pass ) { + + expunge_entry(file_ptr, 0, 1); + + } if ( pass ) { @@ -13331,7 +13376,7 @@ check_expunge_entry(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_expunge_entry() */ @@ -13761,7 +13806,7 @@ check_multiple_read_protect(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_multiple_read_protect() */ @@ -13883,7 +13928,7 @@ check_move_entry(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_move_entry() */ @@ -13961,14 +14006,18 @@ check_move_entry__run_test(H5F_t * file_ptr, } } - protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index); + if ( pass ) { + + protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index); + + if(spec_ptr->is_dirty) + flags |= H5C__DIRTIED_FLAG; - if(spec_ptr->is_dirty) - flags |= H5C__DIRTIED_FLAG; + unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags); - unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags); + move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE); - move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE); + } if ( pass ) { @@ -14083,9 +14132,20 @@ check_pin_protected_entry(void) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); + + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } } - protect_entry(file_ptr, 0, 0); + if ( pass ) { + + protect_entry(file_ptr, 0, 0); + + } if ( pass ) { @@ -14135,7 +14195,7 @@ check_pin_protected_entry(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_pin_protected_entry() */ @@ -14214,11 +14274,20 @@ check_resize_entry(void) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024)); - cache_ptr = file_ptr->shared->cache; + if ( file_ptr == NULL ) { - base_addr = entries[LARGE_ENTRY_TYPE]; - entry_ptr = &(base_addr[0]); - entry_size = LARGE_ENTRY_SIZE; + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else + { + cache_ptr = file_ptr->shared->cache; + + base_addr = entries[LARGE_ENTRY_TYPE]; + entry_ptr = &(base_addr[0]); + entry_size = LARGE_ENTRY_SIZE; + } } if ( pass ) { @@ -14235,7 +14304,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + + } if ( pass ) { @@ -14361,7 +14434,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + + } if ( pass ) { @@ -14442,9 +14519,13 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__PIN_ENTRY_FLAG); + + } if ( pass ) { @@ -14564,10 +14645,14 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + if ( pass ) { - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, - H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, + H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + + } if ( pass ) { @@ -14614,7 +14699,7 @@ check_resize_entry(void) } - /* now repreat the above tests with several entries in the cache: */ + /* now repeat the above tests with several entries in the cache: */ if ( pass ) { @@ -14633,14 +14718,18 @@ check_resize_entry(void) entry_size = LARGE_ENTRY_SIZE; } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); + if ( pass ) { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); + + } if ( pass ) { @@ -14657,7 +14746,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + + } if ( pass ) { @@ -14785,7 +14878,11 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + + } if ( pass ) { @@ -14866,9 +14963,13 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__PIN_ENTRY_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__PIN_ENTRY_FLAG); + + } if ( pass ) { @@ -14990,10 +15091,14 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, - H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, + H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); + + } if ( pass ) { @@ -15039,15 +15144,18 @@ check_resize_entry(void) } } - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DELETED_FLAG); + if ( pass ) { + + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DELETED_FLAG); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DELETED_FLAG); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__DELETED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__DELETED_FLAG); + } if ( pass ) { @@ -15083,7 +15191,7 @@ check_resize_entry(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_resize_entry() */ @@ -15119,7 +15227,7 @@ check_evictions_enabled(void) size_t entry_size; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; - test_entry_t * base_addr; + test_entry_t * base_addr = NULL; test_entry_t * entry_ptr; TESTING("evictions enabled/disabled functionality"); @@ -15174,10 +15282,19 @@ check_evictions_enabled(void) file_ptr = setup_cache((size_t)(1 * 1024 * 1024), (size_t)( 512 * 1024)); - cache_ptr = file_ptr->shared->cache; + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else + { + cache_ptr = file_ptr->shared->cache; - base_addr = entries[MONSTER_ENTRY_TYPE]; - entry_size = MONSTER_ENTRY_SIZE; + base_addr = entries[MONSTER_ENTRY_TYPE]; + entry_size = MONSTER_ENTRY_SIZE; + } } if ( show_progress ) /* 2 */ @@ -15221,11 +15338,15 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* fill the cache */ - for ( i = 0; i < 16 ; i++ ) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* fill the cache */ + for ( i = 0; i < 16 ; i++ ) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); + } + } if ( show_progress ) /* 5 */ @@ -15253,9 +15374,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect another entry */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect another entry */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15316,8 +15441,12 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* insert an entry */ - insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* insert an entry */ + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 10 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15415,9 +15544,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect another entry */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect another entry */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 15 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15443,8 +15576,12 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* insert another entry */ - insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* insert another entry */ + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 17 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15487,9 +15624,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect an entry that is in the cache */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect an entry that is in the cache */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 20 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15515,9 +15656,13 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect an entry that isn't in the cache */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect an entry that isn't in the cache */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 22 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15633,12 +15778,15 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* protect and unprotect an entry that isn't in the cache, forcing - * the cache to grow. - */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* protect and unprotect an entry that isn't in the cache, forcing + * the cache to grow. + */ + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21, H5C__NO_FLAGS_SET); + } if ( show_progress ) /* 27 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15681,8 +15829,12 @@ check_evictions_enabled(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - /* insert an entry */ - insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, H5C__NO_FLAGS_SET); + if ( pass ) { + + /* insert an entry */ + insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, H5C__NO_FLAGS_SET); + + } if ( show_progress ) /* 30 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -15784,7 +15936,7 @@ check_evictions_enabled(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_evictions_enabled() */ @@ -15867,7 +16019,7 @@ check_flush_protected_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_flush_protected_err() */ @@ -15968,7 +16120,7 @@ check_destroy_pinned_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_destroy_pinned_err() */ @@ -16063,7 +16215,7 @@ check_destroy_protected_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_destroy_protected_err() */ @@ -16088,7 +16240,7 @@ static unsigned check_duplicate_insert_err(void) { const char * fcn_name = "check_duplicate_insert_err"; - herr_t result; + herr_t result = -1; H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -16151,7 +16303,7 @@ check_duplicate_insert_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_duplicate_insert_err() */ @@ -16255,7 +16407,7 @@ check_move_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_move_err() */ @@ -16352,7 +16504,7 @@ check_double_pin_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_double_pin_err() */ @@ -16460,7 +16612,7 @@ check_double_unpin_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_double_unpin_err() */ @@ -16580,7 +16732,7 @@ check_pin_entry_errs(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_pin_entry_errs() */ @@ -16632,7 +16784,7 @@ check_double_protect_err(void) if ( pass ) { - cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -16668,7 +16820,7 @@ check_double_protect_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_double_protect_err() */ @@ -16754,7 +16906,7 @@ check_double_unprotect_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_double_unprotect_err() */ @@ -16843,7 +16995,7 @@ check_mark_entry_dirty_errs(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_mark_entry_dirty_errs() */ @@ -16976,7 +17128,7 @@ check_expunge_entry_errs(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_expunge_entry_errs() */ @@ -17087,7 +17239,7 @@ check_resize_entry_errs(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_resize_entry_errs() */ @@ -17222,7 +17374,7 @@ check_unprotect_ro_dirty_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_unprotect_ro_dirty_err() */ @@ -17279,7 +17431,7 @@ check_protect_ro_rw_err(void) if ( pass ) { - thing_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -17315,7 +17467,7 @@ check_protect_ro_rw_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_protect_ro_rw_err() */ @@ -17443,7 +17595,7 @@ check_check_evictions_enabled_err(void) } - if ( pass ) { + if ( cache_ptr ) { takedown_cache(file_ptr, FALSE, FALSE); } @@ -17463,7 +17615,7 @@ check_check_evictions_enabled_err(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_evictions_enabled_err() */ @@ -20628,6 +20780,10 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* now repeat the above tests using the add space flash cache size + * increment algorithm. + */ + if ( pass ) { auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; @@ -20837,6 +20993,7 @@ check_auto_cache_resize(void) if ( pass ) { insert_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); + /* protect and unprotect a couple times to increment cache_accesses */ protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1); unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); @@ -21684,7 +21841,7 @@ check_auto_cache_resize(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize() */ @@ -21784,7 +21941,17 @@ check_auto_cache_resize_disable(void) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - cache_ptr = file_ptr->shared->cache; + + if ( file_ptr == NULL ) { + + pass = FALSE; + failure_mssg = "file_ptr NULL from setup_cache."; + + } + else { + + cache_ptr = file_ptr->shared->cache; + } } if ( pass ) { @@ -22826,8 +22993,12 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(file_ptr, TRUE, FALSE, FALSE); + if ( pass ) { + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23049,8 +23220,12 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(file_ptr, TRUE, FALSE, FALSE); + if ( pass ) { + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23279,8 +23454,12 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* flush the cache and destroy all entries so we start from a known point */ - flush_cache(file_ptr, TRUE, FALSE, FALSE); + if ( pass ) { + + /* flush the cache and destroy all entries so we start from a known point */ + flush_cache(file_ptr, TRUE, FALSE, FALSE); + + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -24401,7 +24580,7 @@ check_auto_cache_resize_disable(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_disable() */ @@ -25115,7 +25294,7 @@ check_auto_cache_resize_epoch_markers(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_epoch_markers() */ @@ -25141,34 +25320,6 @@ check_auto_cache_resize_epoch_markers(void) *------------------------------------------------------------------------- */ -#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \ -( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn == (b).rpt_fcn ) && \ - ( ( ! compare_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! compare_init ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) - static unsigned check_auto_cache_resize_input_errs(void) { @@ -25277,8 +25428,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 1."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 1."; @@ -25349,8 +25500,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 2."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 2."; @@ -25424,8 +25575,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 3."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 3."; @@ -25500,8 +25651,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 4."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 4."; @@ -25573,8 +25724,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 5."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 5."; @@ -25648,8 +25799,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 6."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 6."; @@ -25720,8 +25871,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 7."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 7."; @@ -25796,8 +25947,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 8."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 8."; @@ -25868,8 +26019,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 9."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 9."; @@ -25940,8 +26091,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 10."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 10."; @@ -26015,8 +26166,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 11."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 11."; @@ -26087,8 +26238,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 12."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 12."; @@ -26163,8 +26314,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 13."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 13."; @@ -26236,8 +26387,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 14."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 14."; @@ -26311,8 +26462,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 15."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 15."; @@ -26383,8 +26534,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 16."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 16."; @@ -26455,8 +26606,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 17."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 17."; @@ -26531,8 +26682,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 18."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 18."; @@ -26606,8 +26757,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 19."; @@ -26681,8 +26832,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 20."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 20."; @@ -26754,8 +26905,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 21."; @@ -26829,8 +26980,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 22."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 22."; @@ -26902,8 +27053,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 23."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 23."; @@ -26978,8 +27129,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 24."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 24."; @@ -27051,8 +27202,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 25."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 25."; @@ -27126,8 +27277,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 26."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 26."; @@ -27198,8 +27349,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 27."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 27."; @@ -27272,8 +27423,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 28."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 28."; @@ -27344,8 +27495,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 29."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 29."; @@ -27418,8 +27569,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 30."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 30."; @@ -27490,8 +27641,8 @@ check_auto_cache_resize_input_errs(void) pass = FALSE; failure_mssg = "H5C_get_cache_auto_resize_config failed 31."; - } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ - ref_auto_size_ctl, FALSE) ) { + } else if ( ! resize_configs_are_equal(&test_auto_size_ctl, \ + &ref_auto_size_ctl, FALSE) ) { pass = FALSE; failure_mssg = "Unexpected auto resize config 31."; @@ -27540,7 +27691,7 @@ check_auto_cache_resize_input_errs(void) } } - if ( pass ) { + if ( cache_ptr ) { takedown_cache(file_ptr, FALSE, FALSE); } @@ -27560,7 +27711,7 @@ check_auto_cache_resize_input_errs(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_input_errs() */ @@ -27711,7 +27862,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( hit_rate != 0.0 ) { + } else if ( hit_rate > FP_EPSILON ) { /* i.e. hit_rate != 0.0 */ pass = FALSE; failure_mssg = @@ -27744,7 +27895,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( hit_rate != 0.0 ) { + } else if ( hit_rate > FP_EPSILON ) { /* i.e. hit_rate != 0.0 */ pass = FALSE; failure_mssg = @@ -27789,7 +27940,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, 0.00001) ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = @@ -27872,7 +28023,7 @@ check_auto_cache_resize_aux_fcns(void) pass = FALSE; failure_mssg = "H5C_get_cache_hit_rate failed.\n"; - } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, 0.00001) ) { + } else if ( ! DBL_REL_EQUAL(hit_rate, 0.5, FP_EPSILON) ) { /* i.e. hit_rate != 0.5 */ pass = FALSE; failure_mssg = @@ -28128,7 +28279,7 @@ check_auto_cache_resize_aux_fcns(void) } } - if ( pass ) { + if ( cache_ptr ) { takedown_cache(file_ptr, FALSE, FALSE); } @@ -28148,7 +28299,7 @@ check_auto_cache_resize_aux_fcns(void) fcn_name); } - return !pass; + return (unsigned)!pass; } /* check_auto_cache_resize_aux_fcns() */ @@ -28178,6 +28329,7 @@ main(void) hbool_t core_file_driver_recommended = FALSE; const char *envval = NULL; unsigned nerrs = 0; + int express_test; core_file_driver_recommended = recommend_core_file_driver(); @@ -28243,17 +28395,18 @@ main(void) printf("\n"); } - nerrs += smoke_check_1(); - nerrs += smoke_check_2(); - nerrs += smoke_check_3(); - nerrs += smoke_check_4(); - nerrs += smoke_check_5(); - nerrs += smoke_check_6(); - nerrs += smoke_check_7(); - nerrs += smoke_check_8(); - nerrs += smoke_check_9(); - nerrs += smoke_check_10(); - nerrs += write_permitted_check(); + nerrs += smoke_check_1(express_test); + nerrs += smoke_check_2(express_test); + nerrs += smoke_check_3(express_test); + nerrs += smoke_check_4(express_test); + nerrs += smoke_check_5(express_test); + nerrs += smoke_check_6(express_test); + nerrs += smoke_check_7(express_test); + nerrs += smoke_check_8(express_test); + nerrs += smoke_check_9(express_test); + nerrs += smoke_check_10(express_test); + + nerrs += write_permitted_check(express_test); /* for shorter tests, the overhead of using the core file driver doesn't * seem to allow us to realize any significant time saveings. Thus diff --git a/test/cache_api.c b/test/cache_api.c index 9e5dd6b..a2db969 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -39,7 +39,7 @@ static unsigned check_fapl_mdc_api_calls(void); static unsigned check_file_mdc_api_calls(void); -static unsigned mdc_api_call_smoke_check(void); +static unsigned mdc_api_call_smoke_check(int express_test); static unsigned check_fapl_mdc_api_errs(void); @@ -68,11 +68,8 @@ static unsigned check_file_mdc_api_errs(void); * Programmer: John Mainzer * 4/12/04 * - * Modifications: - * *------------------------------------------------------------------------- */ - static unsigned check_fapl_mdc_api_calls(void) { @@ -266,8 +263,8 @@ check_fapl_mdc_api_calls(void) /* conpare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! RESIZE_CONFIGS_ARE_EQUAL(default_auto_size_ctl, \ - cache_ptr->resize_ctl, TRUE) ) { + if ( ! resize_configs_are_equal(&default_auto_size_ctl, \ + &cache_ptr->resize_ctl, TRUE) ) { pass = FALSE; @@ -415,8 +412,8 @@ check_fapl_mdc_api_calls(void) /* conpare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! RESIZE_CONFIGS_ARE_EQUAL(mod_auto_size_ctl, \ - cache_ptr->resize_ctl, TRUE) ) { + if ( ! resize_configs_are_equal(&mod_auto_size_ctl, \ + &cache_ptr->resize_ctl, TRUE) ) { pass = FALSE; @@ -866,12 +863,11 @@ check_file_mdc_api_calls(void) #define NUM_RANDOM_ACCESSES 200000 static unsigned -mdc_api_call_smoke_check(void) +mdc_api_call_smoke_check(int express_test) { const char * fcn_name = "mdc_api_call_smoke_check()"; char filename[512]; hbool_t valid_chunk; - hbool_t report_progress = FALSE; hbool_t dump_hit_rate = FALSE; int64_t min_accesses = 1000; double min_hit_rate = 0.90; @@ -884,7 +880,6 @@ mdc_api_call_smoke_check(void) hid_t properties; char dset_name[64]; int i, j, k, l, m, n; - int progress_counter; herr_t status; hsize_t dims[2]; hsize_t a_size[2]; @@ -994,7 +989,7 @@ mdc_api_call_smoke_check(void) TESTING("MDC API smoke check"); - if ( skip_long_tests > 0 ) { + if ( express_test > 0 ) { SKIPPED(); @@ -1015,12 +1010,6 @@ mdc_api_call_smoke_check(void) /* setup the file name */ - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"\nSetting up file ... "); - HDfflush(stdout); - } - if ( pass ) { if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) @@ -1059,21 +1048,9 @@ mdc_api_call_smoke_check(void) /* verify that the cache is now set to the alternate config */ validate_mdc_config(file_id, &mod_config_1, TRUE, 2); - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Done.\n"); /* setting up file */ - HDfflush(stdout); - } - /* create the datasets */ - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Creating datasets ... "); - HDfflush(stdout); - } - if ( pass ) { i = 0; @@ -1122,8 +1099,7 @@ mdc_api_call_smoke_check(void) sprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, - properties, H5P_DEFAULT); + dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1179,21 +1155,8 @@ mdc_api_call_smoke_check(void) } } - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Done.\n"); - HDfflush(stdout); - } - /* initialize all datasets on a round robin basis */ i = 0; - progress_counter = 0; - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, "Initializing datasets "); - HDfflush(stdout); - } while ( ( pass ) && ( i < DSET_SIZE ) ) { @@ -1261,23 +1224,6 @@ mdc_api_call_smoke_check(void) i += CHUNK_SIZE; - if ( ( pass ) && ( report_progress ) ) { - - progress_counter += CHUNK_SIZE; - - if ( progress_counter >= DSET_SIZE / 20 ) { - - progress_counter = 0; - HDfprintf(stdout, "."); - HDfflush(stdout); - } - } - } - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout," Done.\n"); /* initializing data sets */ - HDfflush(stdout); } /* set alternate config 2 */ @@ -1295,14 +1241,7 @@ mdc_api_call_smoke_check(void) /* do random reads on all datasets */ - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, "Doing random reads on all datasets "); - HDfflush(stdout); - } - n = 0; - progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) { m = rand() % NUM_DSETS; @@ -1385,24 +1324,6 @@ mdc_api_call_smoke_check(void) } n++; - - if ( ( pass ) && ( report_progress ) ) { - - progress_counter++; - - if ( progress_counter >= NUM_RANDOM_ACCESSES / 20 ) { - - progress_counter = 0; - HDfprintf(stdout, "."); - HDfflush(stdout); - } - } - } - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, " Done.\n"); /* random reads on all data sets */ - HDfflush(stdout); } @@ -1446,15 +1367,8 @@ mdc_api_call_smoke_check(void) /* do random reads on data set 0 only */ - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, "Doing random reads on dataset 0 "); - HDfflush(stdout); - } - m = 0; n = 0; - progress_counter = 0; while ( ( pass ) && ( n < NUM_RANDOM_ACCESSES ) ) { i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; @@ -1532,31 +1446,6 @@ mdc_api_call_smoke_check(void) } n++; - - if ( ( pass ) && ( report_progress ) ) { - - progress_counter++; - - if ( progress_counter >= NUM_RANDOM_ACCESSES / 20 ) { - - progress_counter = 0; - HDfprintf(stdout, "."); - HDfflush(stdout); - } - } - } - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout, " Done.\n"); /* random reads data set 0 */ - HDfflush(stdout); - } - - - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Shutting down ... "); - HDfflush(stdout); } @@ -1616,13 +1505,6 @@ mdc_api_call_smoke_check(void) } } - if ( ( pass ) && ( report_progress ) ) { - - HDfprintf(stdout,"Done.\n"); /* shutting down */ - HDfflush(stdout); - } - - if ( pass ) { PASSED(); } else { H5_FAILED(); } if ( ! pass ) @@ -2152,7 +2034,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* size_t max_size = */ (16 * 1024 * 1024), /* size_t min_size = */ ( 1 * 1024 * 1024), /* long int epoch_length = */ 50000, - /* enum H5C_cache_incr_mode incr_mode = */ -1, + /* enum H5C_cache_incr_mode incr_mode = */ (enum H5C_cache_incr_mode)-1, /* double lower_hr_threshold = */ 0.9, /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, @@ -2323,7 +2205,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ -1, + /* flash_incr_mode = */ (enum H5C_cache_flash_incr_mode)-1, /* double flash_multiple = */ 2.0, /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, @@ -2491,7 +2373,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* flash_incr_mode = */ H5C_flash_incr__off, /* double flash_multiple = */ 2.0, /* double flash_threshold = */ 0.5, - /* enum H5C_cache_decr_mode decr_mode = */ -1, + /* enum H5C_cache_decr_mode decr_mode = */ (enum H5C_cache_decr_mode)-1, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, /* hbool_t apply_max_decrement = */ TRUE, @@ -3532,6 +3414,7 @@ int main(void) { unsigned nerrs = 0; + int express_test; H5open(); @@ -3561,7 +3444,7 @@ main(void) nerrs += check_file_mdc_api_calls(); #endif #if 1 - nerrs += mdc_api_call_smoke_check(); + nerrs += mdc_api_call_smoke_check(express_test); #endif #if 1 nerrs += check_fapl_mdc_api_errs(); diff --git a/test/cache_common.c b/test/cache_common.c index e1757af..e786b61 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -23,7 +23,7 @@ #include #include "h5test.h" -#include "H5ACprivate.h" +#include "H5Cprivate.h" #include "H5Iprivate.h" #include "H5MFprivate.h" #include "H5MMprivate.h" @@ -66,19 +66,17 @@ hbool_t run_full_test = TRUE; hbool_t try_core_file_driver = TRUE; hbool_t core_file_driver_failed = FALSE; const char *failure_mssg = NULL; -int failures = 0; -int express_test = 0; - -test_entry_t pico_entries[NUM_PICO_ENTRIES]; -test_entry_t nano_entries[NUM_NANO_ENTRIES]; -test_entry_t micro_entries[NUM_MICRO_ENTRIES]; -test_entry_t tiny_entries[NUM_TINY_ENTRIES]; -test_entry_t small_entries[NUM_SMALL_ENTRIES]; -test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; -test_entry_t large_entries[NUM_LARGE_ENTRIES]; -test_entry_t huge_entries[NUM_HUGE_ENTRIES]; -test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; -test_entry_t variable_entries[NUM_VARIABLE_ENTRIES]; + +static test_entry_t pico_entries[NUM_PICO_ENTRIES]; +static test_entry_t nano_entries[NUM_NANO_ENTRIES]; +static test_entry_t micro_entries[NUM_MICRO_ENTRIES]; +static test_entry_t tiny_entries[NUM_TINY_ENTRIES]; +static test_entry_t small_entries[NUM_SMALL_ENTRIES]; +static test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; +static test_entry_t large_entries[NUM_LARGE_ENTRIES]; +static test_entry_t huge_entries[NUM_HUGE_ENTRIES]; +static test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; +static test_entry_t variable_entries[NUM_VARIABLE_ENTRIES]; static herr_t pico_get_load_size(const void *udata_ptr, size_t *image_len_ptr); static herr_t nano_get_load_size(const void *udata_ptr, size_t *image_len_ptr); @@ -271,7 +269,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = PICO_ENTRY_TYPE, "pico_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)pico_get_load_size, (H5C_deserialize_func_t)pico_deserialize, (H5C_image_len_func_t)pico_image_len, @@ -282,7 +280,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = NANO_ENTRY_TYPE, "nano_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)nano_get_load_size, (H5C_deserialize_func_t)nano_deserialize, (H5C_image_len_func_t)nano_image_len, @@ -293,7 +291,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = MICRO_ENTRY_TYPE, "micro_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)micro_get_load_size, (H5C_deserialize_func_t)micro_deserialize, (H5C_image_len_func_t)micro_image_len, @@ -304,7 +302,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = TINY_ENTRY_TYPE, "tiny_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)tiny_get_load_size, (H5C_deserialize_func_t)tiny_deserialize, (H5C_image_len_func_t)tiny_image_len, @@ -315,7 +313,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = SMALL_ENTRY_TYPE, "small_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)small_get_load_size, (H5C_deserialize_func_t)small_deserialize, (H5C_image_len_func_t)small_image_len, @@ -326,7 +324,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = MEDIUM_ENTRY_TYPE, "medium_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)medium_get_load_size, (H5C_deserialize_func_t)medium_deserialize, (H5C_image_len_func_t)medium_image_len, @@ -337,7 +335,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = LARGE_ENTRY_TYPE, "large_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)large_get_load_size, (H5C_deserialize_func_t)large_deserialize, (H5C_image_len_func_t)large_image_len, @@ -348,7 +346,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = HUGE_ENTRY_TYPE, "huge_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)huge_get_load_size, (H5C_deserialize_func_t)huge_deserialize, (H5C_image_len_func_t)huge_image_len, @@ -359,7 +357,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = MONSTER_ENTRY_TYPE, "monster_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)monster_get_load_size, (H5C_deserialize_func_t)monster_deserialize, (H5C_image_len_func_t)monster_image_len, @@ -370,7 +368,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = VARIABLE_ENTRY_TYPE, "variable_entry", H5FD_MEM_DEFAULT, - H5AC__CLASS_NO_FLAGS_SET, + H5C__CLASS_NO_FLAGS_SET, (H5C_get_load_size_func_t)variable_get_load_size, (H5C_deserialize_func_t)variable_deserialize, (H5C_image_len_func_t)variable_image_len, @@ -379,7 +377,8 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = } }; -/* address translation funtions: */ + +/* address translation functions: */ /*------------------------------------------------------------------------- @@ -1715,7 +1714,7 @@ recommend_core_file_driver(void) /*------------------------------------------------------------------------- * Function: reset_entries * - * Purpose: reset the contents of the entries arrays to know values. + * Purpose: reset the contents of the entries arrays to known values. * * Return: void * @@ -2039,7 +2038,7 @@ verify_entry_status(H5C_t * cache_ptr, pass = FALSE; sprintf(msg, - "%d entry (%d, %d) size actualexpected = %ld/%ld.\n", + "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag, (int)expected[i].entry_type, (int)expected[i].entry_index, @@ -2598,12 +2597,6 @@ takedown_cache(H5F_t * file_ptr, saved_cache = NULL; } - if ( H5F_addr_defined(saved_actual_base_addr) ) { - - H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, - (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); - saved_actual_base_addr = HADDR_UNDEF; - } } if ( saved_fapl_id != H5P_DEFAULT ) { @@ -2614,6 +2607,18 @@ takedown_cache(H5F_t * file_ptr, if ( saved_fid != -1 ) { + if ( H5F_addr_defined(saved_actual_base_addr) ) { + + if ( NULL == file_ptr ) { + file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE); + HDassert ( file_ptr ); + } + + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, + (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); + saved_actual_base_addr = HADDR_UNDEF; + } + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; @@ -2730,38 +2735,31 @@ flush_cache(H5F_t * file_ptr, hbool_t dump_stats, hbool_t dump_detailed_stats) { - H5C_t * cache_ptr; - herr_t result = 0; - verify_unprotected(); - if ( pass ) { + if(pass) { + H5C_t * cache_ptr; + herr_t result = 0; HDassert(file_ptr); cache_ptr = file_ptr->shared->cache; - if ( destroy_entries ) { - + if(destroy_entries) result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); - } else { - + else result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); - } - } - - if ( dump_stats ) { - H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - } - - if ( result < 0 ) { + if(dump_stats) + H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - pass = FALSE; - failure_mssg = "error in H5C_flush_cache()."; + if(result < 0) { + pass = FALSE; + failure_mssg = "error in H5C_flush_cache()."; + } } return; @@ -2812,7 +2810,7 @@ insert_entry(H5F_t * file_ptr, HDassert( entry_ptr == entry_ptr->self ); HDassert( !(entry_ptr->is_protected) ); - insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0 ); + insert_pinned = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0 ); entry_ptr->is_dirty = TRUE; @@ -2844,24 +2842,19 @@ insert_entry(H5F_t * file_ptr, (int)(entry_ptr->addr != entry_ptr->header.addr)); #endif } - HDassert( entry_ptr->cache_ptr == NULL ); + HDassert(entry_ptr->cache_ptr == NULL); entry_ptr->file_ptr = file_ptr; entry_ptr->cache_ptr = cache_ptr; - if ( insert_pinned ) { - - HDassert( entry_ptr->header.is_pinned ); - entry_ptr->is_pinned = TRUE; + if(insert_pinned) + HDassert(entry_ptr->header.is_pinned); + else + HDassert(!(entry_ptr->header.is_pinned)); + entry_ptr->is_pinned = insert_pinned; - } else { - - HDassert( ! ( entry_ptr->header.is_pinned ) ); - entry_ptr->is_pinned = FALSE; - - } - HDassert( entry_ptr->header.is_dirty ); - HDassert( ((entry_ptr->header).type)->id == type ); + HDassert(entry_ptr->header.is_dirty); + HDassert(((entry_ptr->header).type)->id == type); } return; @@ -3364,8 +3357,8 @@ unprotect_entry(H5F_t * file_ptr, HDassert( entry_ptr->header.is_protected ); HDassert( entry_ptr->is_protected ); - pin_flag_set = ((flags & H5C__PIN_ENTRY_FLAG) != 0 ); - unpin_flag_set = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0 ); + pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0); HDassert ( ! ( pin_flag_set && unpin_flag_set ) ); HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) ); @@ -3409,12 +3402,12 @@ unprotect_entry(H5F_t * file_ptr, if ( pin_flag_set ) { - HDassert ( entry_ptr->header.is_pinned ); + HDassert(entry_ptr->header.is_pinned); entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( ! ( entry_ptr->header.is_pinned ) ); + HDassert(!(entry_ptr->header.is_pinned)); entry_ptr->is_pinned = FALSE; } @@ -5027,6 +5020,62 @@ check_and_validate_cache_size(hid_t file_id, } /* check_and_validate_cache_size() */ +hbool_t +resize_configs_are_equal(const H5C_auto_size_ctl_t *a, + const H5C_auto_size_ctl_t *b, + hbool_t compare_init) +{ + if(a->version != b->version) + return(FALSE); + else if(a->rpt_fcn != b->rpt_fcn) + return(FALSE); + else if(compare_init && (a->set_initial_size != b->set_initial_size)) + return(FALSE); + else if(compare_init && (a->initial_size != b->initial_size)) + return(FALSE); + else if(HDfabs(a->min_clean_fraction - b->min_clean_fraction) > FP_EPSILON) + return(FALSE); + else if(a->max_size != b->max_size) + return(FALSE); + else if(a->min_size != b->min_size) + return(FALSE); + else if(a->epoch_length != b->epoch_length) + return(FALSE); + else if(a->incr_mode != b->incr_mode) + return(FALSE); + else if(HDfabs(a->lower_hr_threshold - b->lower_hr_threshold) > FP_EPSILON) + return(FALSE); + else if(HDfabs(a->increment - b->increment) > FP_EPSILON) + return(FALSE); + else if(a->apply_max_increment != b->apply_max_increment) + return(FALSE); + else if(a->max_increment != b->max_increment) + return(FALSE); + else if(a->flash_incr_mode != b->flash_incr_mode) + return(FALSE); + else if(HDfabs(a->flash_multiple - b->flash_multiple) > FP_EPSILON) + return(FALSE); + else if(HDfabs(a->flash_threshold - b->flash_threshold) > FP_EPSILON) + return(FALSE); + else if(a->decr_mode != b->decr_mode) + return(FALSE); + else if(HDfabs(a->upper_hr_threshold - b->upper_hr_threshold) > FP_EPSILON) + return(FALSE); + else if(HDfabs(a->decrement - b->decrement) > FP_EPSILON) + return(FALSE); + else if(a->apply_max_decrement != b->apply_max_decrement) + return(FALSE); + else if(a->max_decrement != b->max_decrement) + return(FALSE); + else if(a->epochs_before_eviction != b->epochs_before_eviction) + return(FALSE); + else if(a->apply_empty_reserve != b->apply_empty_reserve) + return(FALSE); + else if(HDfabs(a->empty_reserve - b->empty_reserve) > FP_EPSILON) + return(FALSE); + return(TRUE); +} + /*------------------------------------------------------------------------- * Function: validate_mdc_config() @@ -5095,7 +5144,7 @@ validate_mdc_config(hid_t file_id, /* compare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! RESIZE_CONFIGS_ARE_EQUAL(int_config, cache_ptr->resize_ctl, + if ( ! resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl, compare_init) ) { pass = FALSE; diff --git a/test/cache_common.h b/test/cache_common.h index 4a1a529..95ab0a9 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -19,17 +19,20 @@ * This file contains common #defines, type definitions, and * externs for tests of the cache implemented in H5C.c */ -#include "h5test.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" +#ifndef _CACHE_COMMON_H +#define _CACHE_COMMON_H #define H5C_PACKAGE /*suppress error about including H5Cpkg */ - -#include "H5Cpkg.h" - #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +/* Include library header files */ +#include "H5ACprivate.h" +#include "H5Cpkg.h" #include "H5Fpkg.h" +#include "H5Iprivate.h" + +/* Include test header files */ +#include "h5test.h" #define NO_CHANGE -1 @@ -357,12 +360,12 @@ if ( ( (cache_ptr) == NULL ) || \ } -#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ +#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \ { \ int k; \ int depth = 0; \ - H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ - k = H5C__HASH_FCN(Addr); \ + H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \ + k = H5C__HASH_FCN(Addr); \ entry_ptr = ((cache_ptr)->index)[k]; \ while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \ { \ @@ -371,7 +374,7 @@ if ( ( (cache_ptr) == NULL ) || \ } \ if ( entry_ptr ) \ { \ - H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ + H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \ if ( entry_ptr != ((cache_ptr)->index)[k] ) \ { \ if ( (entry_ptr)->ht_next ) \ @@ -391,67 +394,38 @@ if ( ( (cache_ptr) == NULL ) || \ /* Macros used in H5AC level tests */ -#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ -( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \ - ( (a).open_trace_file == (b).open_trace_file ) && \ - ( (a).close_trace_file == (b).close_trace_file ) && \ - ( ( (a).open_trace_file == FALSE ) || \ - ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \ - ( (a).evictions_enabled == (b).evictions_enabled ) && \ - ( ( ! cmp_set_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! cmp_init_size ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) - - -#define RESIZE_CONFIGS_ARE_EQUAL(a, b, compare_init) \ -( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn == (b).rpt_fcn ) && \ - ( ( ! compare_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! compare_init ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ - ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) +#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ + ( ( (a).version == (b).version ) && \ + ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \ + ( (a).open_trace_file == (b).open_trace_file ) && \ + ( (a).close_trace_file == (b).close_trace_file ) && \ + ( ( (a).open_trace_file == FALSE ) || \ + ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \ + ( (a).evictions_enabled == (b).evictions_enabled ) && \ + ( ( ! cmp_set_init ) || \ + ( (a).set_initial_size == (b).set_initial_size ) ) && \ + ( ( ! cmp_init_size ) || \ + ( (a).initial_size == (b).initial_size ) ) && \ + ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ + ( (a).max_size == (b).max_size ) && \ + ( (a).min_size == (b).min_size ) && \ + ( (a).epoch_length == (b).epoch_length ) && \ + ( (a).incr_mode == (b).incr_mode ) && \ + ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ + ( (a).apply_max_increment == (b).apply_max_increment ) && \ + ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ + ( (a).decr_mode == (b).decr_mode ) && \ + ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ + ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ + ( (a).max_decrement == (b).max_decrement ) && \ + ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ + ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ + ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) ) #define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \ @@ -517,18 +491,6 @@ extern hbool_t run_full_test; extern hbool_t try_core_file_driver; extern hbool_t core_file_driver_failed; extern const char *failure_mssg; -extern int express_test; -extern int failures; - -extern test_entry_t pico_entries[NUM_PICO_ENTRIES]; -extern test_entry_t nano_entries[NUM_NANO_ENTRIES]; -extern test_entry_t micro_entries[NUM_MICRO_ENTRIES]; -extern test_entry_t tiny_entries[NUM_TINY_ENTRIES]; -extern test_entry_t small_entries[NUM_SMALL_ENTRIES]; -extern test_entry_t medium_entries[NUM_MEDIUM_ENTRIES]; -extern test_entry_t large_entries[NUM_LARGE_ENTRIES]; -extern test_entry_t huge_entries[NUM_HUGE_ENTRIES]; -extern test_entry_t monster_entries[NUM_MONSTER_ENTRIES]; extern test_entry_t * entries[NUMBER_OF_ENTRY_TYPES]; extern const int32_t max_indices[NUMBER_OF_ENTRY_TYPES]; @@ -743,6 +705,9 @@ void verify_unprotected(void); /*** H5AC level utility functions ***/ +hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a, + const H5C_auto_size_ctl_t *b, hbool_t compare_init); + void check_and_validate_cache_hit_rate(hid_t file_id, double * hit_rate_ptr, hbool_t dump_data, @@ -761,3 +726,5 @@ void validate_mdc_config(hid_t file_id, hbool_t compare_init, int test_num); +#endif /* _CACHE_COMMON_H */ + diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 97d11a2..68a56d5 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -206,6 +206,9 @@ int virt_num_data_entries = NUM_DATA_ENTRIES; int data_index[NUM_DATA_ENTRIES]; +#define DO_WRITE_REQ_ACK FALSE +#define DO_SYNC_AFTER_WRITE TRUE + /***************************************************************************** * struct mssg @@ -232,9 +235,6 @@ int data_index[NUM_DATA_ENTRIES]; * *****************************************************************************/ -#define DO_WRITE_REQ_ACK FALSE -#define DO_SYNC_AFTER_WRITE TRUE - #define WRITE_REQ_CODE 0 #define WRITE_REQ_ACK_CODE 1 #define READ_REQ_CODE 2 @@ -253,7 +253,7 @@ struct mssg_t int dest; long int mssg_num; haddr_t base_addr; - int len; + unsigned len; int ver; unsigned magic; }; @@ -267,41 +267,40 @@ MPI_Datatype mpi_mssg_t; /* for MPI derived type created from mssg */ /* stats functions */ -void print_stats(void); -void reset_stats(void); +static void reset_stats(void); /* MPI setup functions */ -hbool_t set_up_file_communicator(void); +static hbool_t set_up_file_communicator(void); /* data array manipulation functions */ -int addr_to_datum_index(haddr_t base_addr); -void init_data(void); +static int addr_to_datum_index(haddr_t base_addr); +static void init_data(void); /* test coodination related functions */ -int do_express_test(void); -void do_sync(void); -int get_max_nerrors(void); +static int do_express_test(void); +static void do_sync(void); +static int get_max_nerrors(void); /* mssg xfer related functions */ -hbool_t recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset); -hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag); -hbool_t setup_derived_types(void); -hbool_t takedown_derived_types(void); +static hbool_t recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset); +static hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag); +static hbool_t setup_derived_types(void); +static hbool_t takedown_derived_types(void); /* server functions */ -hbool_t server_main(void); -hbool_t serve_read_request(struct mssg_t * mssg_ptr); -hbool_t serve_sync_request(struct mssg_t * mssg_ptr); -hbool_t serve_write_request(struct mssg_t * mssg_ptr); +static hbool_t server_main(void); +static hbool_t serve_read_request(struct mssg_t * mssg_ptr); +static hbool_t serve_sync_request(struct mssg_t * mssg_ptr); +static hbool_t serve_write_request(struct mssg_t * mssg_ptr); /* call back functions & related data structures */ @@ -352,44 +351,44 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = /* test utility functions */ -void expunge_entry(H5F_t * file_ptr, int32_t idx); -void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, +static void expunge_entry(H5F_t * file_ptr, int32_t idx); +static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, unsigned int flags); -void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, +static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, int min_count, int max_count); -void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx); -void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect); -int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, +static void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx); +static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect); +static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, hbool_t via_unprotect); -void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, +static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, int min_count, int max_count); -void lock_and_unlock_random_entry(H5F_t * file_ptr, +static void lock_and_unlock_random_entry(H5F_t * file_ptr, int min_idx, int max_idx); -void lock_entry(H5F_t * file_ptr, int32_t idx); -void mark_entry_dirty(int32_t idx); -void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); -void pin_protected_entry(int32_t idx, hbool_t global); -void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx); -void resize_entry(int32_t idx, size_t new_size); -hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, +static void lock_entry(H5F_t * file_ptr, int32_t idx); +static void mark_entry_dirty(int32_t idx); +static void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); +static void pin_protected_entry(int32_t idx, hbool_t global); +static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx); +static void resize_entry(int32_t idx, size_t new_size); +static hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr); -void setup_rand(void); -hbool_t take_down_cache(hid_t fid); -void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags); -void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, +static void setup_rand(void); +static hbool_t take_down_cache(hid_t fid); +static void unlock_entry(H5F_t * file_ptr, int32_t type, unsigned int flags); +static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty, hbool_t via_unprotect); /* test functions */ -hbool_t server_smoke_check(void); -hbool_t smoke_check_1(void); -hbool_t smoke_check_2(void); -hbool_t smoke_check_3(void); -hbool_t smoke_check_4(void); -hbool_t smoke_check_5(void); -hbool_t trace_file_check(void); +static hbool_t server_smoke_check(void); +static hbool_t smoke_check_1(void); +static hbool_t smoke_check_2(void); +static hbool_t smoke_check_3(void); +static hbool_t smoke_check_4(void); +static hbool_t smoke_check_5(void); +static hbool_t trace_file_check(void); /*****************************************************************************/ @@ -398,44 +397,6 @@ hbool_t trace_file_check(void); /***************************************************************************** * - * Function: print_stats() - * - * Purpose: Print the rudementary stats maintained by t_cache. - * - * This is a debugging function, which will not normally - * be run as part of t_cache. - * - * Return: void - * - * Programmer: JRM -- 4/17/06 - * - * Modifications: - * - * None. - * - *****************************************************************************/ - -void -print_stats(void) -{ - HDfprintf(stdout, - "%d: destroys = %ld\n", - world_mpi_rank, datum_destroys ); - HDfprintf(stdout, - "%d: datum flushes / pinned flushes / loads = %ld / %ld / %ld\n", - world_mpi_rank, datum_flushes, datum_pinned_flushes, - datum_loads ); - HDfprintf(stdout, - "%d: pins: global / global dirty / local = %ld / %ld / %ld\n", - world_mpi_rank, global_pins, global_dirty_pins, local_pins); - HDfflush(stdout); - - return; - -} /* print_stats() */ - -/***************************************************************************** - * * Function: reset_stats() * * Purpose: Reset the rudementary stats maintained by t_cache. @@ -450,7 +411,7 @@ print_stats(void) * *****************************************************************************/ -void +static void reset_stats(void) { datum_destroys = 0; @@ -489,7 +450,7 @@ reset_stats(void) * *****************************************************************************/ -hbool_t +static hbool_t set_up_file_communicator(void) { const char * fcn_name = "set_up_file_communicator()"; @@ -636,13 +597,8 @@ set_up_file_communicator(void) * * Programmer: JRM -- 12/20/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -int +static int addr_to_datum_index(haddr_t base_addr) { /* const char * fcn_name = "addr_to_datum_index()"; */ @@ -689,14 +645,8 @@ addr_to_datum_index(haddr_t base_addr) * * Programmer: JRM -- 12/20/05 * - * Modifications: - * - * JRM -- 7/11/06 - * Added support for the local_len field. - * *****************************************************************************/ - -void +static void init_data(void) { /* const char * fcn_name = "init_data()"; */ @@ -772,13 +722,8 @@ init_data(void) * * Programmer: JRM -- 4/25/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -int +static int do_express_test(void) { const char * fcn_name = "do_express_test()"; @@ -826,13 +771,8 @@ do_express_test(void) * * Programmer: JRM -- 5/10/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -void +static void do_sync(void) { const char * fcn_name = "do_sync()"; @@ -902,13 +842,8 @@ do_sync(void) * * Programmer: JRM -- 1/3/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -int +static int get_max_nerrors(void) { const char * fcn_name = "get_max_nerrors()"; @@ -963,7 +898,7 @@ get_max_nerrors(void) #define CACHE_TEST_TAG 99 /* different from any used by the library */ -hbool_t +static hbool_t recv_mssg(struct mssg_t *mssg_ptr, int mssg_tag_offset) { @@ -1047,8 +982,7 @@ recv_mssg(struct mssg_t *mssg_ptr, * Added the add_req_to_tag parameter and supporting code. * *****************************************************************************/ - -hbool_t +static hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag) { @@ -1102,7 +1036,7 @@ send_mssg(struct mssg_t *mssg_ptr, } /* send_mssg() */ - + /***************************************************************************** * * Function: setup_derived_types() @@ -1116,13 +1050,8 @@ send_mssg(struct mssg_t *mssg_ptr, * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t setup_derived_types(void) { const char * fcn_name = "setup_derived_types()"; @@ -1196,7 +1125,7 @@ setup_derived_types(void) } /* setup_derived_types */ - + /***************************************************************************** * * Function: takedown_derived_types() @@ -1210,13 +1139,8 @@ setup_derived_types(void) * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t takedown_derived_types(void) { const char * fcn_name = "takedown_derived_types()"; @@ -1244,6 +1168,7 @@ takedown_derived_types(void) /***************************** server functions ******************************/ /*****************************************************************************/ + /***************************************************************************** * * Function: server_main() @@ -1267,8 +1192,7 @@ takedown_derived_types(void) * Updated for sync message. * *****************************************************************************/ - -hbool_t +static hbool_t server_main(void) { const char * fcn_name = "server_main()"; @@ -1302,7 +1226,8 @@ server_main(void) case WRITE_REQ_ACK_CODE: success = FALSE; - HDfprintf(stdout, "%s: Received write ack?!?.\n", fcn_name); + if(verbose) + HDfprintf(stdout, "%s: Received write ack?!?.\n", fcn_name); break; case READ_REQ_CODE: @@ -1311,8 +1236,8 @@ server_main(void) case READ_REQ_REPLY_CODE: success = FALSE; - HDfprintf(stdout, "%s: Received read req reply?!?.\n", - fcn_name); + if(verbose) + HDfprintf(stdout, "%s: Received read req reply?!?.\n", fcn_name); break; case SYNC_REQ_CODE: @@ -1321,27 +1246,21 @@ server_main(void) case SYNC_ACK_CODE: success = FALSE; - HDfprintf(stdout, "%s: Received sync ack?!?.\n", - fcn_name); + if(verbose) + HDfprintf(stdout, "%s: Received sync ack?!?.\n", fcn_name); break; case DONE_REQ_CODE: done_count++; - /* HDfprintf(stdout, "%d:%s: done_count = %d.\n", - world_mpi_rank, fcn_name, done_count); */ - if ( done_count >= file_mpi_size ) { - + if(done_count >= file_mpi_size) done = TRUE; - } break; default: nerrors++; success = FALSE; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: Unknown request code.\n", - world_mpi_rank, fcn_name); - } + if(verbose) + HDfprintf(stdout, "%d:%s: Unknown request code.\n", world_mpi_rank, fcn_name); break; } } @@ -1351,7 +1270,7 @@ server_main(void) } /* server_main() */ - + /***************************************************************************** * * Function: serve_read_request() @@ -1369,13 +1288,8 @@ server_main(void) * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t serve_read_request(struct mssg_t * mssg_ptr) { const char * fcn_name = "serve_read_request()"; @@ -1454,7 +1368,7 @@ serve_read_request(struct mssg_t * mssg_ptr) } /* serve_read_request() */ - + /***************************************************************************** * * Function: serve_sync_request() @@ -1475,13 +1389,8 @@ serve_read_request(struct mssg_t * mssg_ptr) * * Programmer: JRM -- 5/10/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t serve_sync_request(struct mssg_t * mssg_ptr) { const char * fcn_name = "serve_sync_request()"; @@ -1522,7 +1431,7 @@ serve_sync_request(struct mssg_t * mssg_ptr) } /* serve_sync_request() */ - + /***************************************************************************** * * Function: serve_write_request() @@ -1548,8 +1457,7 @@ serve_sync_request(struct mssg_t * mssg_ptr) * doesn't work, it will help narrow down the possibilities. * *****************************************************************************/ - -hbool_t +static hbool_t serve_write_request(struct mssg_t * mssg_ptr) { const char * fcn_name = "serve_write_request()"; @@ -1711,14 +1619,9 @@ datum_get_load_size(const void * udata_ptr, * Programmer: John Mainzer * 9/20/07 * - * Modifications: - * - * None - * *------------------------------------------------------------------------- */ - -void * +static void * datum_deserialize(const void * image_ptr, UNUSED size_t len, void * udata_ptr, @@ -1789,13 +1692,13 @@ datum_deserialize(const void * image_ptr, if ( success ) { - if ( ( mssg.req != READ_REQ_REPLY_CODE ) || - ( mssg.src != world_server_mpi_rank ) || - ( mssg.dest != world_mpi_rank ) || - ( mssg.base_addr != entry_ptr->base_addr ) || - ( mssg.len != entry_ptr->len ) || - ( mssg.ver < entry_ptr->ver ) || - ( mssg.magic != MSSG_MAGIC ) ) { + if ( ( mssg.req != READ_REQ_REPLY_CODE ) || + ( mssg.src != world_server_mpi_rank ) || + ( mssg.dest != world_mpi_rank ) || + ( mssg.base_addr != entry_ptr->base_addr ) || + ( mssg.len != entry_ptr->len ) || + ( mssg.ver < entry_ptr->ver ) || + ( mssg.magic != MSSG_MAGIC ) ) { nerrors++; success = FALSE; @@ -1804,56 +1707,56 @@ datum_deserialize(const void * image_ptr, world_mpi_rank, fcn_name); } #if 0 /* This has been useful debugging code -- keep it for now. */ - if ( mssg.req != READ_REQ_REPLY_CODE ) { + if ( mssg.req != READ_REQ_REPLY_CODE ) { - HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", - world_mpi_rank, fcn_name, (int)(mssg.req)); - } + HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", + world_mpi_rank, fcn_name, (int)(mssg.req)); + } - if ( mssg.src != world_server_mpi_rank ) { + if ( mssg.src != world_server_mpi_rank ) { - HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.dest != world_mpi_rank ) { + if ( mssg.dest != world_mpi_rank ) { - HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.base_addr != entry_ptr->base_addr ) { + if ( mssg.base_addr != entry_ptr->base_addr ) { - HDfprintf(stdout, - "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", - world_mpi_rank, fcn_name, mssg.base_addr); - HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n", - world_mpi_rank, fcn_name, entry_ptr->base_addr); - } + HDfprintf(stdout, + "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", + world_mpi_rank, fcn_name, mssg.base_addr); + HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n", + world_mpi_rank, fcn_name, entry_ptr->base_addr); + } - if ( mssg.len != entry_ptr->len ) { + if ( mssg.len != entry_ptr->len ) { - HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", - world_mpi_rank, fcn_name, mssg.len); - } + HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", + world_mpi_rank, fcn_name, mssg.len); + } - if ( mssg.ver < entry_ptr->ver ) { + if ( mssg.ver < entry_ptr->ver ) { - HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.magic != MSSG_MAGIC ) { + if ( mssg.magic != MSSG_MAGIC ) { - HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", + world_mpi_rank, fcn_name); + } #endif /* JRM */ } else { @@ -1891,8 +1794,7 @@ datum_deserialize(const void * image_ptr, * *------------------------------------------------------------------------- */ - -herr_t +static herr_t datum_image_len(void *thing, size_t *image_len) { int idx; @@ -1938,14 +1840,9 @@ datum_image_len(void *thing, size_t *image_len) * Programmer: John Mainzer * 10/30/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - -herr_t +static herr_t datum_serialize(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, @@ -1957,8 +1854,8 @@ datum_serialize(const H5F_t UNUSED *f, size_t * new_len_ptr, void ** new_image_ptr_ptr) { - const char * fcn_name = "datum_serialize()"; + hbool_t was_dirty = FALSE; herr_t ret_value = SUCCEED; int idx; struct datum * entry_ptr; @@ -2005,65 +1902,67 @@ datum_serialize(const H5F_t UNUSED *f, world_mpi_rank, fcn_name); } - if ( ret_value == SUCCEED ) { + if ( ret_value == SUCCEED ) { - if ( entry_ptr->header.is_dirty ) { + if ( entry_ptr->header.is_dirty ) { - /* compose the message */ - mssg.req = WRITE_REQ_CODE; - mssg.src = world_mpi_rank; - mssg.dest = world_server_mpi_rank; - mssg.mssg_num = -1; /* set by send function */ - mssg.base_addr = entry_ptr->base_addr; - mssg.len = entry_ptr->len; - mssg.ver = entry_ptr->ver; - mssg.magic = MSSG_MAGIC; + was_dirty = TRUE; /* so we will receive the ack if requested */ - if ( ! send_mssg(&mssg, FALSE) ) { + /* compose the message */ + mssg.req = WRITE_REQ_CODE; + mssg.src = world_mpi_rank; + mssg.dest = world_server_mpi_rank; + mssg.mssg_num = -1; /* set by send function */ + mssg.base_addr = entry_ptr->base_addr; + mssg.len = entry_ptr->len; + mssg.ver = entry_ptr->ver; + mssg.magic = MSSG_MAGIC; - nerrors++; - ret_value = FAIL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", - world_mpi_rank, fcn_name); - } - } - else - { - entry_ptr->header.is_dirty = FALSE; - entry_ptr->dirty = FALSE; + if ( ! send_mssg(&mssg, FALSE) ) { + + nerrors++; + ret_value = FAIL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: send_mssg() failed.\n", + world_mpi_rank, fcn_name); } } + else + { + entry_ptr->header.is_dirty = FALSE; + entry_ptr->dirty = FALSE; + } } + } #if DO_WRITE_REQ_ACK - if ( ( ret_value == SUCCEED ) && ( entry_ptr->header.is_dirty ) ) { + if ( ( ret_value == SUCCEED ) && ( was_dirty ) ) { - if ( ! recv_mssg(&mssg, WRITE_REQ_ACK_CODE) ) { + if ( ! recv_mssg(&mssg, WRITE_REQ_ACK_CODE) ) { - nerrors++; - ret_value = FAIL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", - world_mpi_rank, fcn_name); - } - } else if ( ( mssg.req != WRITE_REQ_ACK_CODE ) || - ( mssg.src != world_server_mpi_rank ) || - ( mssg.dest != world_mpi_rank ) || - ( mssg.base_addr != entry_ptr->base_addr ) || - ( mssg.len != entry_ptr->len ) || - ( mssg.ver != entry_ptr->ver ) || - ( mssg.magic != MSSG_MAGIC ) ) { + nerrors++; + ret_value = FAIL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: recv_mssg() failed.\n", + world_mpi_rank, fcn_name); + } + } else if ( ( mssg.req != WRITE_REQ_ACK_CODE ) || + ( mssg.src != world_server_mpi_rank ) || + ( mssg.dest != world_mpi_rank ) || + ( mssg.base_addr != entry_ptr->base_addr ) || + ( mssg.len != entry_ptr->len ) || + ( mssg.ver != entry_ptr->ver ) || + ( mssg.magic != MSSG_MAGIC ) ) { - nerrors++; - ret_value = FAIL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", - world_mpi_rank, fcn_name); - } + nerrors++; + ret_value = FAIL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Bad data in write req ack.\n", + world_mpi_rank, fcn_name); } } + } #endif /* DO_WRITE_REQ_ACK */ @@ -2094,14 +1993,9 @@ datum_serialize(const H5F_t UNUSED *f, * Programmer: John Mainzer * 9/19/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - -herr_t +static herr_t datum_free_icr(void * thing) { int idx; @@ -2138,7 +2032,6 @@ datum_free_icr(void * thing) datum_destroys++; return(SUCCEED); - } /* datum_free_icr() */ @@ -2146,6 +2039,7 @@ datum_free_icr(void * thing) /************************** test utility functions ***************************/ /*****************************************************************************/ + /***************************************************************************** * Function: expunge_entry() * @@ -2159,13 +2053,8 @@ datum_free_icr(void * thing) * Programmer: John Mainzer * 07/11/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -void +static void expunge_entry(H5F_t * file_ptr, int32_t idx) { @@ -2227,7 +2116,7 @@ expunge_entry(H5F_t * file_ptr, } /* expunge_entry() */ - + /***************************************************************************** * Function: insert_entry() * @@ -2249,8 +2138,7 @@ expunge_entry(H5F_t * file_ptr, * any pins must be global pins. * *****************************************************************************/ - -void +static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, @@ -2338,7 +2226,7 @@ insert_entry(H5C_t * cache_ptr, } /* insert_entry() */ - + /***************************************************************************** * Function: local_pin_and_unpin_random_entries() * @@ -2352,11 +2240,8 @@ insert_entry(H5C_t * cache_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, @@ -2410,7 +2295,7 @@ local_pin_and_unpin_random_entries(H5F_t * file_ptr, } /* local_pin_and_unpin_random_entries() */ - + /***************************************************************************** * Function: local_pin_random_entry() * @@ -2426,11 +2311,8 @@ local_pin_and_unpin_random_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void local_pin_random_entry(H5F_t * file_ptr, int min_idx, int max_idx) @@ -2461,7 +2343,7 @@ local_pin_random_entry(H5F_t * file_ptr, } /* local_pin_random_entry() */ - + /***************************************************************************** * Function: local_unpin_all_entries() * @@ -2474,11 +2356,8 @@ local_pin_random_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect) { @@ -2503,7 +2382,7 @@ local_unpin_all_entries(H5F_t * file_ptr, } /* local_unpin_all_entries() */ - + /***************************************************************************** * Function: local_unpin_next_pinned_entry() * @@ -2519,11 +2398,8 @@ local_unpin_all_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - -int +static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, hbool_t via_unprotect) @@ -2565,7 +2441,7 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr, } /* local_unpin_next_pinned_entry() */ - + /***************************************************************************** * Function: lock_and_unlock_random_entries() * @@ -2580,11 +2456,8 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 1/12/06 * - * Modifications: - * *****************************************************************************/ - -void +static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, int max_idx, @@ -2616,7 +2489,7 @@ lock_and_unlock_random_entries(H5F_t * file_ptr, } /* lock_and_unlock_random_entries() */ - + /***************************************************************************** * Function: lock_and_unlock_random_entry() * @@ -2630,11 +2503,8 @@ lock_and_unlock_random_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 1/4/06 * - * Modifications: - * *****************************************************************************/ - -void +static void lock_and_unlock_random_entry(H5F_t * file_ptr, int min_idx, int max_idx) @@ -2663,7 +2533,7 @@ lock_and_unlock_random_entry(H5F_t * file_ptr, } /* lock_and_unlock_random_entry() */ - + /***************************************************************************** * Function: lock_entry() * @@ -2683,8 +2553,7 @@ lock_and_unlock_random_entry(H5F_t * file_ptr, * datum. * *****************************************************************************/ - -void +static void lock_entry(H5F_t * file_ptr, int32_t idx) { @@ -2743,8 +2612,7 @@ lock_entry(H5F_t * file_ptr, * 4/14/06 * *****************************************************************************/ - -void +static void mark_entry_dirty(int32_t idx) { const char * fcn_name = "mark_entry_dirty()"; @@ -2785,7 +2653,7 @@ mark_entry_dirty(int32_t idx) } /* mark_entry_dirty() */ - + /***************************************************************************** * Function: pin_entry() * @@ -2798,10 +2666,7 @@ mark_entry_dirty(int32_t idx) * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * *****************************************************************************/ - void pin_entry(H5F_t * file_ptr, int32_t idx, @@ -2855,7 +2720,7 @@ pin_entry(H5F_t * file_ptr, } /* pin_entry() */ - + /***************************************************************************** * Function: pin_protected_entry() * @@ -2869,13 +2734,8 @@ pin_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 01/04/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -void +static void pin_protected_entry(int32_t idx, hbool_t global) { @@ -2930,7 +2790,7 @@ pin_protected_entry(int32_t idx, } /* pin_protected_entry() */ - + /***************************************************************************** * Function: move_entry() * @@ -2946,14 +2806,8 @@ pin_protected_entry(int32_t idx, * Programmer: John Mainzer * 1/10/06 * - * Modifications: - * - * 7/11/06 -- JRM - * Added support for the phony_len field in datum. - * *****************************************************************************/ - -void +static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx) @@ -2986,7 +2840,35 @@ move_entry(H5F_t * file_ptr, old_addr = old_entry_ptr->base_addr; new_addr = new_entry_ptr->base_addr; - result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr); + /* Moving will mark the entry dirty if it is not already */ + old_entry_ptr->dirty = TRUE; + + /* touch up versions, base_addrs, and data_index. Do this + * now as it is possible that the rename will trigger a + * sync point. + */ + if(old_entry_ptr->ver < new_entry_ptr->ver) + old_entry_ptr->ver = new_entry_ptr->ver; + else + (old_entry_ptr->ver)++; + + old_entry_ptr->base_addr = new_addr; + new_entry_ptr->base_addr = old_addr; + + data_index[old_entry_ptr->index] = new_idx; + data_index[new_entry_ptr->index] = old_idx; + + tmp = old_entry_ptr->index; + old_entry_ptr->index = new_entry_ptr->index; + new_entry_ptr->index = tmp; + + if(old_entry_ptr->local_len != new_entry_ptr->local_len) { + tmp_len = old_entry_ptr->local_len; + old_entry_ptr->local_len = new_entry_ptr->local_len; + new_entry_ptr->local_len = tmp_len; + } /* end if */ + + result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr); if ( ( result < 0 ) || ( old_entry_ptr->header.addr != new_addr ) ) { @@ -3000,44 +2882,13 @@ move_entry(H5F_t * file_ptr, HDassert( ((old_entry_ptr->header).type)->id == DATUM_ENTRY_TYPE ); HDassert( old_entry_ptr->header.is_dirty ); - old_entry_ptr->dirty = TRUE; - - /* touch up versions, base_addrs, and data_index */ - - if ( old_entry_ptr->ver < new_entry_ptr->ver ) { - old_entry_ptr->ver = new_entry_ptr->ver; - - } else { - - (old_entry_ptr->ver)++; - - } - - old_entry_ptr->base_addr = new_addr; - new_entry_ptr->base_addr = old_addr; - - data_index[old_entry_ptr->index] = new_idx; - data_index[new_entry_ptr->index] = old_idx; - - tmp = old_entry_ptr->index; - old_entry_ptr->index = new_entry_ptr->index; - new_entry_ptr->index = tmp; - - if ( old_entry_ptr->local_len != new_entry_ptr->local_len ) { - - tmp_len = old_entry_ptr->local_len; - old_entry_ptr->local_len = new_entry_ptr->local_len; - new_entry_ptr->local_len = tmp_len; - } } } - return; - } /* move_entry() */ - + /***************************************************************************** * Function: resize_entry() * @@ -3052,13 +2903,8 @@ move_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 7/11/06 * - * Modifications: - * - * None - * *****************************************************************************/ - -void +static void resize_entry(int32_t idx, size_t new_size) { @@ -3111,7 +2957,7 @@ resize_entry(int32_t idx, } /* resize_entry() */ - + /***************************************************************************** * * Function: setup_cache_for_test() @@ -3130,13 +2976,8 @@ resize_entry(int32_t idx, * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t setup_cache_for_test(hid_t * fid_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr) @@ -3283,7 +3124,7 @@ setup_cache_for_test(hid_t * fid_ptr, } /* setup_cache_for_test() */ - + /***************************************************************************** * * Function: setup_rand() @@ -3303,8 +3144,7 @@ setup_cache_for_test(hid_t * fid_ptr, * Modified function to facilitate setting predefined seeds. * *****************************************************************************/ - -void +static void setup_rand(void) { const char * fcn_name = "setup_rand()"; @@ -3351,7 +3191,7 @@ setup_rand(void) } /* setup_rand() */ - + /***************************************************************************** * * Function: take_down_cache() @@ -3367,13 +3207,8 @@ setup_rand(void) * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t take_down_cache(hid_t fid) { const char * fcn_name = "take_down_cache()"; @@ -3410,7 +3245,7 @@ take_down_cache(hid_t fid) } /* take_down_cache() */ - + /***************************************************************************** * Function: unlock_entry() * @@ -3429,8 +3264,7 @@ take_down_cache(hid_t fid) * Updated for the new local_len field in datum. * *****************************************************************************/ - -void +static void unlock_entry(H5F_t * file_ptr, int32_t idx, unsigned int flags) @@ -3492,7 +3326,7 @@ unlock_entry(H5F_t * file_ptr, } /* unlock_entry() */ - + /***************************************************************************** * Function: unpin_entry() * @@ -3511,8 +3345,7 @@ unlock_entry(H5F_t * file_ptr, * Added assertion that entry is pinned on entry. * *****************************************************************************/ - -void +static void unpin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, @@ -3591,6 +3424,7 @@ unpin_entry(H5F_t * file_ptr, /****************************** test functions *******************************/ /*****************************************************************************/ + /***************************************************************************** * * Function: server_smoke_check() @@ -3617,8 +3451,7 @@ unpin_entry(H5F_t * file_ptr, * write request ack message. * *****************************************************************************/ - -hbool_t +static hbool_t server_smoke_check(void) { const char * fcn_name = "server_smoke_check()"; @@ -3814,6 +3647,7 @@ server_smoke_check(void) } /* server_smoke_check() */ + /***************************************************************************** * * Function: smoke_check_1() @@ -3826,13 +3660,8 @@ server_smoke_check(void) * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_1(void) { const char * fcn_name = "smoke_check_1()"; @@ -3968,7 +3797,7 @@ smoke_check_1(void) } /* smoke_check_1() */ - + /***************************************************************************** * * Function: smoke_check_2() @@ -3993,8 +3822,7 @@ smoke_check_1(void) * Modified test to move pinned entries. * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_2(void) { const char * fcn_name = "smoke_check_2()"; @@ -4177,7 +4005,7 @@ smoke_check_2(void) } /* smoke_check_2() */ - + /***************************************************************************** * * Function: smoke_check_3() @@ -4205,8 +4033,7 @@ smoke_check_2(void) * Added pinned entry tests. JRM - 4/14/06 * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_3(void) { const char * fcn_name = "smoke_check_3()"; @@ -4488,7 +4315,7 @@ smoke_check_3(void) } /* smoke_check_3() */ - + /***************************************************************************** * * Function: smoke_check_4() @@ -4518,8 +4345,7 @@ smoke_check_3(void) * JRM - 8/15/06 * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_4(void) { const char * fcn_name = "smoke_check_4()"; @@ -4794,7 +4620,7 @@ smoke_check_4(void) } /* smoke_check_4() */ - + /***************************************************************************** * * Function: smoke_check_5() @@ -4815,8 +4641,7 @@ smoke_check_4(void) * H5AC_resize_entry(). * *****************************************************************************/ - -hbool_t +static hbool_t smoke_check_5(void) { const char * fcn_name = "smoke_check_5()"; @@ -4986,7 +4811,7 @@ smoke_check_5(void) } /* smoke_check_5() */ - + /***************************************************************************** * * Function: trace_file_check() @@ -5008,7 +4833,7 @@ smoke_check_5(void) * - H5AC_flush() * - H5AC_insert_entry() * - H5AC_mark_entry_dirty() - * H5AC_move_entry() + * - H5AC_move_entry() * - H5AC_pin_protected_entry() * - H5AC_protect() * - H5AC_unpin_entry() @@ -5036,8 +4861,7 @@ smoke_check_5(void) * to support the new flash cache size increment code. * *****************************************************************************/ - -hbool_t +static hbool_t trace_file_check(void) { hbool_t success = TRUE; @@ -5361,7 +5185,7 @@ trace_file_check(void) } /* trace_file_check() */ - + /***************************************************************************** * * Function: main() @@ -5374,12 +5198,7 @@ trace_file_check(void) * * Programmer: JRM -- 12/23/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - int main(int argc, char **argv) { @@ -5567,6 +5386,8 @@ finish: printf("===================================\n"); } + takedown_derived_types(); + /* close HDF5 library */ H5close(); -- cgit v0.12