From da2f1610d1f2cba40770aee6d0d6fbc8196645ae Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 29 Dec 2016 02:40:26 -0800 Subject: More normalizations against incoming cache image branch. --- src/H5AC.c | 7 +- src/H5ACprivate.h | 5 +- src/H5C.c | 11 +- src/H5Cdbg.c | 43 ++------ src/H5Cepoch.c | 13 +-- src/H5Cpkg.h | 9 +- src/H5Cprivate.h | 53 +++++---- src/H5FD.c | 3 +- src/H5FDmulti.c | 46 ++++---- src/H5FDspace.c | 2 +- src/H5FS.c | 2 +- src/H5FScache.c | 1 - src/H5FSpkg.h | 1 - src/H5FSsection.c | 12 +-- src/H5Fint.c | 3 +- src/H5Fprivate.h | 1 + src/H5Fsuper.c | 1 - src/H5Fsuper_cache.c | 2 +- src/H5HFcache.c | 14 +-- src/H5HLcache.c | 2 +- src/H5MF.c | 4 +- src/H5MFaggr.c | 36 ++++--- src/H5MFdbg.c | 13 +-- src/H5MFprivate.h | 2 +- src/H5Ofsinfo.c | 2 +- src/H5Omessage.c | 3 +- src/H5Oprivate.h | 12 ++- test/cache.c | 296 ++++++++++++++++++--------------------------------- 28 files changed, 235 insertions(+), 364 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index f68c7a9..86e5ed7 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -102,6 +102,7 @@ hid_t H5AC_rawdata_dxpl_id = (-1); hbool_t H5_coll_api_sanity_check_g = false; #endif /* H5_HAVE_PARALLEL */ + /*******************/ /* Local Variables */ /*******************/ @@ -135,6 +136,7 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = "fixed array data block pages", "superblock", "driver info", + "epoch marker", /* internal to cache only */ "proxy entry", "test entry" /* for testing only -- not used for actual files */ }; @@ -2215,11 +2217,6 @@ done: } /* H5AC_validate_config() */ -/*************************************************************************/ -/**************************** Private Functions: *************************/ -/*************************************************************************/ - - /*------------------------------------------------------------------------- * * Function: H5AC__check_if_write_permitted diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 9a4ab55..afd7817 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -86,8 +86,9 @@ typedef enum { H5AC_FARRAY_DBLK_PAGE_ID, /* (24) fixed array data block page */ H5AC_SUPERBLOCK_ID, /* (25) file superblock */ H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock) */ - H5AC_PROXY_ENTRY_ID, /* (27) cache entry proxy */ - H5AC_TEST_ID, /* (28) test entry -- not used for actual files */ + H5AC_EPOCH_MARKER_ID, /* (27) epoch marker - always internal to cache */ + H5AC_PROXY_ENTRY_ID, /* (28) cache entry proxy */ + H5AC_TEST_ID, /* (29) test entry -- not used for actual files */ H5AC_NTYPES /* Number of types, must be last */ } H5AC_type_t; diff --git a/src/H5C.c b/src/H5C.c index 1ce24a8..677dba9 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -136,8 +136,7 @@ static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr); static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr); static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, - size_t old_entry_size, - size_t new_entry_size); + size_t old_entry_size, size_t new_entry_size); static herr_t H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, @@ -4391,7 +4390,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr = cache_ptr->LRU_tail_ptr; while ( ( entry_ptr != NULL ) && - ( (entry_ptr->type)->id != H5C__EPOCH_MARKER_TYPE ) && + ( (entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID ) && ( bytes_evicted < eviction_size_limit ) ) { hbool_t corked = FALSE; @@ -4509,7 +4508,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr = cache_ptr->LRU_tail_ptr; while ( ( entry_ptr != NULL ) && - ( (entry_ptr->type)->id != H5C__EPOCH_MARKER_TYPE ) && + ( (entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID ) && ( bytes_evicted < eviction_size_limit ) ) { HDassert( ! (entry_ptr->is_protected) ); @@ -5875,6 +5874,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); /* setup external flags from the flags parameter */ @@ -6776,7 +6776,7 @@ H5C_make_space_in_cache(H5F_t * f, ++num_corked_entries; didnt_flush_entry = TRUE; - } else if ( ( (entry_ptr->type)->id != H5C__EPOCH_MARKER_TYPE ) && + } else if ( ( (entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID ) && ( ! entry_ptr->flush_in_progress ) ) { didnt_flush_entry = FALSE; @@ -7433,7 +7433,6 @@ H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) return(in_slist); } /* H5C_entry_in_skip_list() */ - #endif /* H5C_DO_SLIST_SANITY_CHECKS */ diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 16077c8..e7ed443 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -34,9 +34,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Cpkg.h" /* Cache */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error Handling */ /****************/ @@ -342,19 +342,6 @@ done: * Programmer: John Mainzer * 6/2/04 * - * JRM -- 11/13/08 - * Added code displaying the max_clean_index_size and - * max_dirty_index_size. - * - * MAM -- 01/06/09 - * Added code displaying the calls_to_msic, - * total_entries_skipped_in_msic, total_entries_scanned_in_msic, - * and max_entries_skipped_in_msic fields. - * - * JRM -- 4/11/15 - * Added code displaying the new slist_scan_restarts, - * LRU_scan_restarts, and hash_bucket_scan_restarts fields; - * *------------------------------------------------------------------------- */ herr_t @@ -625,11 +612,10 @@ H5C_stats(H5C_t * cache_ptr, cache_ptr->prefix, (long long)(cache_ptr->calls_to_msic)); - if (cache_ptr->calls_to_msic > 0) { + if (cache_ptr->calls_to_msic > 0) average_entries_skipped_per_calls_to_msic = (((double)(cache_ptr->total_entries_skipped_in_msic)) / ((double)(cache_ptr->calls_to_msic))); - } HDfprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n", cache_ptr->prefix, @@ -804,20 +790,6 @@ done: * * Programmer: John Mainzer, 4/28/04 * - * JRM 11/13/08 - * Added initialization for the new max_clean_index_size and - * max_dirty_index_size fields. - * - * MAM -- 01/06/09 - * Added code to initalize the calls_to_msic, - * total_entries_skipped_in_msic, total_entries_scanned_in_msic, - * and max_entries_skipped_in_msic fields. - * - * JRM 4/11/15 - * Added code to initialize the new slist_scan_restarts, - * LRU_scan_restarts, hash_bucket_scan_restarts, and - * take_ownerships fields. - * *------------------------------------------------------------------------- */ void @@ -910,6 +882,7 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ #endif /* H5C_COLLECT_CACHE_STATS */ + return; } /* H5C_stats__reset() */ extern void @@ -948,7 +921,7 @@ H5C__dump_children_cb(H5C_cache_entry_t *entry_ptr, void *_ctx) } /* end if */ return(H5_ITER_CONT); -} +} /* end H5C__dump_children_cb() */ static void H5C__dump_children(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, @@ -964,7 +937,7 @@ H5C__dump_children(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, ctx.prefix = prefix; ctx.indent = indent; H5C__iter_tagged_entries(cache_ptr, entry_ptr->tag_info->tag, FALSE, H5C__dump_children_cb, &ctx); -} +} /* end H5C__dump_children() */ void H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, @@ -978,4 +951,4 @@ H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, H5C__dump_parents(cache_ptr, entry_ptr, "Parent", indent); if(entry_ptr->flush_dep_nchildren) H5C__dump_children(cache_ptr, entry_ptr, FALSE, "Child", indent); -} +} /* end H5C__dump_entry() */ diff --git a/src/H5Cepoch.c b/src/H5Cepoch.c index 3726aa1..f9c809b 100644 --- a/src/H5Cepoch.c +++ b/src/H5Cepoch.c @@ -25,18 +25,11 @@ */ -/****************/ -/* Module Setup */ -/****************/ - -#include "H5Cmodule.h" /* This source code file is part of the H5C module */ - - /***********/ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Cpkg.h" /* Cache */ +#include "H5ACprivate.h" /* Metadata cache */ /****************/ @@ -101,10 +94,10 @@ static herr_t H5C__epoch_marker_fsf_size(const void H5_ATTR_UNUSED * thing, const H5C_class_t H5C__epoch_marker_class = { - /* id = */ H5C__EPOCH_MARKER_TYPE, + /* id = */ H5AC_EPOCH_MARKER_ID, /* name = */ "epoch marker", /* mem_type = */ H5FD_MEM_DEFAULT, /* value doesn't matter */ - /* flags = */ H5C__CLASS_NO_FLAGS_SET, + /* flags = */ H5AC__CLASS_NO_FLAGS_SET, /* get_initial_load_size = */ H5C__epoch_marker_get_initial_load_size, /* get_final_load_size = */ H5C__epoch_marker_get_final_load_size, /* verify_chksum = */ H5C__epoch_marker_verify_chksum, diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index fae4d74..fd3f282 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -45,6 +45,9 @@ /* Package Private Macros */ /**************************/ +/* Number of epoch markers active */ +#define H5C__MAX_EPOCH_MARKERS 10 + /* Cache configuration settings */ #define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */ #define H5C__H5C_T_MAGIC 0x005CAC0E @@ -52,12 +55,6 @@ /* Initial allocated size of the "flush_dep_parent" array */ #define H5C_FLUSH_DEP_PARENT_INIT 8 -/* Cache client ID for epoch markers */ -/* Note that H5C__MAX_EPOCH_MARKERS is defined in H5Cprivate.h, not here because - * it is needed to dimension arrays in H5C_t. - */ -#define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS - /**************************************************************************** * * We maintain doubly linked lists of instances of H5C_cache_entry_t for a diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index ed75bec..77ebe8a 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -41,7 +41,7 @@ /**************************/ /* Cache configuration settings */ -#define H5C__MAX_NUM_TYPE_IDS 29 +#define H5C__MAX_NUM_TYPE_IDS 30 #define H5C__PREFIX_LEN 32 /* This sanity checking constant was picked out of the air. Increase @@ -66,11 +66,11 @@ #endif /* H5_HAVE_PARALLEL */ /* Flags for cache client class behavior */ -#define H5C__CLASS_NO_FLAGS_SET ((unsigned)0x0) -#define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1) +#define H5C__CLASS_NO_FLAGS_SET ((unsigned)0x0) +#define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1) /* The following flags may only appear in test code */ -#define H5C__CLASS_SKIP_READS ((unsigned)0x2) -#define H5C__CLASS_SKIP_WRITES ((unsigned)0x4) +#define H5C__CLASS_SKIP_READS ((unsigned)0x2) +#define H5C__CLASS_SKIP_WRITES ((unsigned)0x4) /* Flags for pre-serialize callback */ #define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0) @@ -115,9 +115,6 @@ #define H5C__CURR_AUTO_SIZE_CTL_VER 1 #define H5C__CURR_AUTO_RESIZE_RPT_FCN_VER 1 -/* Number of epoch markers active */ -#define H5C__MAX_EPOCH_MARKERS 10 - /* Default configuration settings */ #define H5C__DEF_AR_UPPER_THRESHHOLD 0.9999f #define H5C__DEF_AR_LOWER_THRESHHOLD 0.9f @@ -958,12 +955,12 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, * debugging. */ -#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */ -#define H5C_RING_USER 1 /* outermost ring */ -#define H5C_RING_FSM 2 -#define H5C_RING_SBE 4 /* temporarily merged with H5C_RING_SB */ -#define H5C_RING_SB 4 /* innermost ring */ -#define H5C_RING_NTYPES 5 +#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */ +#define H5C_RING_USER 1 /* outermost ring */ +#define H5C_RING_FSM 2 +#define H5C_RING_SBE 4 /* temporarily merged with H5C_RING_SB */ +#define H5C_RING_SB 4 /* innermost ring */ +#define H5C_RING_NTYPES 5 typedef int H5C_ring_t; @@ -1347,12 +1344,12 @@ typedef int H5C_ring_t; ****************************************************************************/ typedef struct H5C_cache_entry_t { uint32_t magic; - H5C_t * cache_ptr; + H5C_t *cache_ptr; haddr_t addr; size_t size; - void * image_ptr; + void *image_ptr; hbool_t image_up_to_date; - const H5C_class_t * type; + const H5C_class_t *type; hbool_t is_dirty; hbool_t dirtied; hbool_t is_protected; @@ -1383,23 +1380,23 @@ typedef struct H5C_cache_entry_t { hbool_t pinned_from_cache; /* fields supporting the hash table: */ - struct H5C_cache_entry_t * ht_next; - struct H5C_cache_entry_t * ht_prev; + struct H5C_cache_entry_t *ht_next; + struct H5C_cache_entry_t *ht_prev; /* fields supporting replacement policies: */ - struct H5C_cache_entry_t * next; - struct H5C_cache_entry_t * prev; - struct H5C_cache_entry_t * aux_next; - struct H5C_cache_entry_t * aux_prev; + struct H5C_cache_entry_t *next; + struct H5C_cache_entry_t *prev; + struct H5C_cache_entry_t *aux_next; + struct H5C_cache_entry_t *aux_prev; #ifdef H5_HAVE_PARALLEL - struct H5C_cache_entry_t * coll_next; - struct H5C_cache_entry_t * coll_prev; + struct H5C_cache_entry_t *coll_next; + struct H5C_cache_entry_t *coll_prev; #endif /* H5_HAVE_PARALLEL */ /* fields supporting tag lists */ - struct H5C_cache_entry_t * tl_next; - struct H5C_cache_entry_t * tl_prev; - struct H5C_tag_info_t * tag_info; + struct H5C_cache_entry_t *tl_next; + struct H5C_cache_entry_t *tl_prev; + struct H5C_tag_info_t *tag_info; #if H5C_COLLECT_CACHE_ENTRY_STATS /* cache entry stats fields */ diff --git a/src/H5FD.c b/src/H5FD.c index 99a9288..660f496 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -498,8 +498,7 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) FUNC_ENTER_NOAPI(FAIL) HDassert(file && file->cls); - if(file->cls->sb_encode && - (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0) + if(file->cls->sb_encode && (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") done: diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 5e27c53..befcaca 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -75,11 +75,11 @@ static hid_t H5FD_MULTI_g = 0; /* Driver-specific file access properties */ typedef struct H5FD_multi_fapl_t { - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /*memory usage map */ - hid_t memb_fapl[H5FD_MEM_NTYPES];/*member access properties */ - char *memb_name[H5FD_MEM_NTYPES];/*name generators */ - haddr_t memb_addr[H5FD_MEM_NTYPES];/*starting addr per member */ - hbool_t relax; /*less stringent error checking */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /*memory usage map */ + hid_t memb_fapl[H5FD_MEM_NTYPES]; /*member access properties */ + char *memb_name[H5FD_MEM_NTYPES]; /*name generators */ + haddr_t memb_addr[H5FD_MEM_NTYPES]; /*starting addr per member */ + hbool_t relax; /*less stringent error checking */ } H5FD_multi_fapl_t; /* @@ -89,17 +89,17 @@ typedef struct H5FD_multi_fapl_t { * copied into the parent file struct in H5F_open(). */ typedef struct H5FD_multi_t { - H5FD_t pub; /*public stuff, must be first */ - H5FD_multi_fapl_t fa; /*driver-specific file access properties*/ - haddr_t memb_next[H5FD_MEM_NTYPES];/*addr of next member */ - H5FD_t *memb[H5FD_MEM_NTYPES]; /*member pointers */ - haddr_t memb_eoa[H5FD_MEM_NTYPES]; /*EOA for individual files, - *end of allocated addresses. v1.6 library - *have the EOA for the entire file. But it's - *meaningless for MULTI file. We replaced it - *with the EOAs for individual files */ - unsigned flags; /*file open flags saved for debugging */ - char *name; /*name passed to H5Fopen or H5Fcreate */ + H5FD_t pub; /*public stuff, must be first */ + H5FD_multi_fapl_t fa; /*driver-specific file access properties */ + haddr_t memb_next[H5FD_MEM_NTYPES]; /*addr of next member */ + H5FD_t *memb[H5FD_MEM_NTYPES]; /*member pointers */ + haddr_t memb_eoa[H5FD_MEM_NTYPES]; /*EOA for individual files, + *end of allocated addresses. v1.6 library + *have the EOA for the entire file. But it's + *meaningless for MULTI file. We replaced it + *with the EOAs for individual files */ + unsigned flags; /*file open flags saved for debugging */ + char *name; /*name passed to H5Fopen or H5Fcreate */ } H5FD_multi_t; /* Driver specific data transfer properties */ @@ -233,9 +233,9 @@ H5FD_multi_init(void) /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - if (H5I_VFL!=H5Iget_type(H5FD_MULTI_g)) { - H5FD_MULTI_g = H5FDregister(&H5FD_multi_g); - } + if(H5I_VFL!=H5Iget_type(H5FD_MULTI_g)) + H5FD_MULTI_g = H5FDregister(&H5FD_multi_g); + return H5FD_MULTI_g; } @@ -285,7 +285,8 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char meta_name[H5FD_MULT_MAX_FILE_NAME_LEN], raw_name[H5FD_MULT_MAX_FILE_NAME_LEN]; + char meta_name[H5FD_MULT_MAX_FILE_NAME_LEN]; + char raw_name[H5FD_MULT_MAX_FILE_NAME_LEN]; haddr_t memb_addr[H5FD_MEM_NTYPES]; /*NO TRACE*/ @@ -1111,6 +1112,7 @@ H5FD_multi_close(H5FD_t *_file) if (file->fa.memb_fapl[mt]>=0) (void)H5Idec_ref(file->fa.memb_fapl[mt]); if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } END_MEMBERS; + free(file->name); free(file); return 0; @@ -1186,8 +1188,8 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) /* Set the VFL feature flags that this driver supports */ if(flags) { *flags = 0; - *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } /* end if */ return(0); diff --git a/src/H5FDspace.c b/src/H5FDspace.c index edc83e6..a7899ac 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -19,7 +19,7 @@ * Jan 3 2008 * Quincey Koziol * - * Purpose: Space allocation routines for the file. + * Purpose: Space allocation routines for the file driver code. * *------------------------------------------------------------------------- */ diff --git a/src/H5FS.c b/src/H5FS.c index 2193d84..af02e0f 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -365,7 +365,7 @@ HDfprintf(stderr, "%s: Expunging free space section info from cache\n", FUNC); if(H5AC_expunge_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, cache_flags) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove free space section info from cache") - } + } /* end block */ #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUNC); diff --git a/src/H5FScache.c b/src/H5FScache.c index 42eccff..400f07c 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -519,7 +519,6 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(fspace->sect_size > 0); if(!H5F_addr_defined(fspace->sect_addr)) { /* case 1 */ - haddr_t tag = HADDR_UNDEF; /* allocate file space for the section info, and insert it diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index b3b1548..f07ffad 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -190,7 +190,6 @@ struct H5FS_t { hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ - /* Memory data structures (not stored directly) */ H5FS_section_class_t *sect_cls; /* Array of section classes for this free list */ }; diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 766a823..efe0031 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -1725,10 +1725,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); HDassert(alignment); HDassert(cls); - if ((mis_align = curr_sect->addr % alignment)) + if((mis_align = curr_sect->addr % alignment)) frag_size = alignment - mis_align; - if ((curr_sect->size >= (request + frag_size)) && (cls->split)) { + if((curr_sect->size >= (request + frag_size)) && (cls->split)) { /* remove the section with aligned address */ if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") @@ -1745,17 +1745,17 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); * NODE's addr & size are updated to point to the remaining aligned section * split_sect is re-added to free-space */ - if (mis_align) { + if(mis_align) { split_sect = cls->split(*node, frag_size); if((H5FS_sect_link(fspace, split_sect, 0) < 0)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") /* sanity check */ HDassert(split_sect->addr < (*node)->addr); HDassert(request <= (*node)->size); - } + } /* end if */ /* Indicate that we found a node for the request */ HGOTO_DONE(TRUE) - } + } /* end if */ /* Get the next section node in the list */ curr_sect_node = H5SL_next(curr_sect_node); @@ -1831,7 +1831,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #ifdef QAK HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, (*node)->size, (*node)->addr, (*node)->type); #endif /* QAK */ - } + } /* end if */ } /* end if */ done: diff --git a/src/H5Fint.c b/src/H5Fint.c index fd79dc2..f1e9fb5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -858,9 +858,10 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) /* Clear status_flags */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_WRITE_ACCESS); f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS); + /* Mark superblock dirty in cache, so change will get encoded */ - /* Push error, but keep going*/ if(H5F_super_dirty(f) < 0) + /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") if(H5F_flush(f, dxpl_id, TRUE) < 0) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index a6d1c4a..c099d32 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -527,6 +527,7 @@ #define H5F_METADATA_READ_ATTEMPTS 1 /* Default # of read attempts for non-SWMR access */ #define H5F_SWMR_METADATA_READ_ATTEMPTS 100 /* Default # of read attempts for SWMR access */ + /* Macros to define signatures of all objects in the file */ /* Size of signature information (on disk) */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 2a82618..9e93394 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -653,7 +653,6 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read) HDassert(f->shared->sblock == NULL); f->shared->sblock = sblock; #endif /* JRM */ - if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 6cfd9c7..0dc504e 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -982,7 +982,7 @@ done: * * Purpose: Loads an object from the disk. * - * Return: Success: Pointer to a new B-tree. + * Return: Success: Pointer to a new driver info struct * Failure: NULL * * Programmer: Quincey Koziol diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 04f1459..f85b344 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -97,7 +97,7 @@ static herr_t H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, unsigned *flags); static herr_t H5HF__cache_iblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); -static herr_t H5HF__cache_iblock_notify(H5C_notify_action_t action, void *thing); +static herr_t H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *thing); static herr_t H5HF__cache_iblock_free_icr(void *thing); static herr_t H5HF__cache_dblock_get_initial_load_size(void *udata, size_t *image_len); @@ -110,7 +110,7 @@ static herr_t H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, unsigned *flags); static herr_t H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); -static herr_t H5HF__cache_dblock_notify(H5C_notify_action_t action, void *thing); +static herr_t H5HF__cache_dblock_notify(H5AC_notify_action_t action, void *thing); static herr_t H5HF__cache_dblock_free_icr(void *thing); /* Debugging Function Prototypes */ @@ -1253,7 +1253,7 @@ H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, } /* end if */ *new_addr = iblock_addr; - *flags = H5C__SERIALIZE_MOVED_FLAG; + *flags = H5AC__SERIALIZE_MOVED_FLAG; } /* end if */ else *flags = 0; @@ -1400,7 +1400,7 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len, *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_iblock_notify(H5C_notify_action_t action, void *_thing) +H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) { H5HF_indirect_t *iblock = (H5HF_indirect_t *)_thing; /* Indirect block info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2345,12 +2345,12 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, /* finally, pass data back to the metadata cache as appropriate */ if(!H5F_addr_eq(addr, dblock_addr)) { - dblock_flags |= H5C__SERIALIZE_MOVED_FLAG; + dblock_flags |= H5AC__SERIALIZE_MOVED_FLAG; *new_addr = dblock_addr; } /* end if */ if((hdr->filter_len > 0) && (len != write_size)) { - dblock_flags |= H5C__SERIALIZE_RESIZED_FLAG; + dblock_flags |= H5AC__SERIALIZE_RESIZED_FLAG; *new_len = write_size; } /* end if */ @@ -2444,7 +2444,7 @@ H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_dblock_notify(H5C_notify_action_t action, void *_thing) +H5HF__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) { H5HF_direct_t *dblock = (H5HF_direct_t *)_thing; /* Fractal heap direct block */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HLcache.c b/src/H5HLcache.c index c53292a..3db239e 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -309,7 +309,7 @@ H5HL__cache_prefix_get_final_load_size(const void *_image, size_t image_len, const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */ H5HL_t heap; /* Local heap */ - htri_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5MF.c b/src/H5MF.c index 024cf19..09341e6 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -693,7 +693,7 @@ HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC); HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size); #endif /* H5MF_ALLOC_DEBUG_MORE */ HGOTO_DONE(SUCCEED) - } + } /* end else-if */ } /* end if */ /* If we are deleting the free space manager, leave now, to avoid @@ -847,7 +847,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r if((ret_value = H5FS_sect_try_extend(f, dxpl_id, f->shared->fs_man[fs_type], addr, size, extra_requested)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending block in free space manager") } /* end if */ - } /* end if */ + } /* end else-if */ done: /* Reset the ring in the DXPL */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index c45b473..8faff0d 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -221,14 +221,15 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if ((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0) + if((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") - else if (was_extended) { + else if(was_extended) { /* aggr->size is unchanged */ ret_value = aggr->addr + aggr_frag_size; aggr->addr += ext_size; aggr->tot_size += ext_size; - } else { + } /* end else-if */ + else { /* Check for overlapping into file's temporary allocation space */ if(H5F_addr_gt((eoa + size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") @@ -237,10 +238,10 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz * has allocated more than one block and the unallocated space is greater than its * allocation block size. */ - if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && - (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { - if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") + if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { + if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ @@ -265,11 +266,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); if((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") - else if (was_extended) { + else if(was_extended) { aggr->addr += aggr_frag_size; aggr->size += (ext_size - aggr_frag_size); aggr->tot_size += ext_size; - } else { + } /* end else-if */ + else { haddr_t new_space; /* Address of new space allocated */ /* Check for overlapping into file's temporary allocation space */ @@ -281,9 +283,9 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); * allocation block size. */ if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && - (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { - if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") + (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { + if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ @@ -314,7 +316,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); aggr->addr = new_space; aggr->size = aggr->alloc_size; aggr->tot_size = aggr->alloc_size; - } + } /* end else */ } /* end else */ /* Allocate space out of the metadata block */ @@ -436,8 +438,8 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, /* Indicate success */ HGOTO_DONE(TRUE); - } - /* + } /* end if */ + /* * If extra_requested is above percentage threshold: * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested * 2) extend the block into the aggregator @@ -461,8 +463,8 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, */ aggr->size += extra; aggr->size -= extra_requested; - } /* end if */ - } /* end if */ + } /* end else-if */ + } /* end else */ } /* end if */ else { /* The aggreator is not at end of file */ /* Check if aggregator has enough internal space to satisfy the extension. */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 6d5d994..ef4f1bb 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -192,7 +192,7 @@ H5MF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, FILE *stream, int ind HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") } /* end if */ break; - } + } /* end if */ done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) @@ -267,9 +267,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, /* Retrieve the 'eoa' for this file memory type */ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), - "eoa:", - eoa); + HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa); /* Print header for sections */ HDfprintf(stream, "%*sSections:\n", indent + 3, ""); @@ -288,14 +286,13 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") } /* end if */ - else { + else /* No sections of this type */ HDfprintf(stream, "%*s\n", indent + 6, ""); - } /* end else */ } /* end if */ - else { + else HDfprintf(stream, "%*sMapped to type = %u\n", indent, "", (unsigned)f->shared->fs_type_map[type]); - } /* end else */ + } /* end for */ done: diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 22ed308..cb797b7 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -60,7 +60,7 @@ H5_DLL herr_t H5MF_try_close(H5F_t *f, hid_t dxpl_id); H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); H5_DLL herr_t H5MF_xfree(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - hsize_t size); + hsize_t size); H5_DLL herr_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested); H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 1712857..938d319 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -19,7 +19,7 @@ * Feb 2009 * Vailin Choi * - * Purpose: Free space manager info message. + * Purpose: File space info message. * *------------------------------------------------------------------------- */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index ee21e49..376c888 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1323,10 +1323,9 @@ done: * object header, the header will be condensed after each * message removal) */ - if(oh_modified & H5O_MODIFY_CONDENSE) { + if(oh_modified & H5O_MODIFY_CONDENSE) if(H5O_condense_header(f, oh, dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") - } /* Mark object header as changed */ if(H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0) diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index e430b1f..5851fe4 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -99,7 +99,7 @@ typedef struct H5O_t H5O_t; #define H5O_BOGUS_MSG_FLAGS_NAME "bogus msg flags" /* Flags for 'bogus' message */ #define H5O_BOGUS_MSG_FLAGS_SIZE sizeof(uint8_t) -/* bogus ID can be either (a) H5O_BOGUS_VALID_ID 0x0009 or (b) H5O_BOGUS_INVALID_ID 0x0019 */ +/* bogus ID can be either (a) H5O_BOGUS_VALID_ID or (b) H5O_BOGUS_INVALID_ID */ #define H5O_BOGUS_MSG_ID_NAME "bogus msg id" /* ID for 'bogus' message */ #define H5O_BOGUS_MSG_ID_SIZE sizeof(unsigned) @@ -206,6 +206,14 @@ typedef struct H5O_copy_t { #define H5O_FSINFO_ID 0x0017 /* Free-space manager info message. */ #define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */ /* (this should never exist in a file) */ +/* + * Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g + * in H5O.c when creating a new message type. Also bump the value of + * H5O_BOGUS_INVALID_ID, below, to be one greater than the value of + * H5O_UNKNOWN_ID. + * + * (this should never exist in a file) + */ #define H5O_BOGUS_INVALID_ID 0x0019 /* "Bogus invalid" Message. */ /* Shared object message types. @@ -775,7 +783,7 @@ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1 typedef unsigned H5O_unknown_t; /* Original message type ID */ /* - * Free space manager info Message. + * File space info Message. * Contains file space management info and * addresses of free space managers for file memory * (Data structure in memory) diff --git a/test/cache.c b/test/cache.c index 5c42dfd..0cd0c99 100644 --- a/test/cache.c +++ b/test/cache.c @@ -15888,7 +15888,6 @@ check_flush_protected_err(void) * *------------------------------------------------------------------------- */ - static unsigned check_destroy_pinned_err(void) { @@ -15917,43 +15916,35 @@ check_destroy_pinned_err(void) pass = FALSE; failure_mssg = "destroy succeeded on cache with pinned entry.\n"; - - } else { - + } /* end if */ + else { unpin_entry(0, 0); if(H5C_dest(file_ptr, H5AC_ind_read_dxpl_id) < 0) { - pass = FALSE; failure_mssg = "destroy failed after unpin.\n"; - - } else { + } /* end if */ + else { file_ptr->shared->cache = NULL; - } - } + } /* end else */ + } /* end else */ if(saved_cache != NULL) { - file_ptr->shared->cache = saved_cache; saved_cache = NULL; - - } + } /* end if */ /* call takedown_cache() with a NULL file_ptr parameter. * This causes the function to close and delete the file, * while skipping the call to H5C_dest(). */ takedown_cache(NULL, FALSE, FALSE); - - } + } /* end if */ if(pass) { PASSED(); } else { H5_FAILED(); } - if(!pass) { - - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - FUNC, failure_mssg); - } + if(!pass) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); return (unsigned)!pass; @@ -16000,45 +15991,36 @@ check_destroy_protected_err(void) protect_entry(file_ptr, 0, 0); if(H5C_dest(file_ptr, H5AC_ind_read_dxpl_id) >= 0) { - pass = FALSE; failure_mssg = "destroy succeeded on cache with protected entry.\n"; - - } else { - + } /* end if */ + else { unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); - if(H5C_dest(file_ptr, H5AC_ind_read_dxpl_id) < 0) { - pass = FALSE; failure_mssg = "destroy failed after unprotect.\n"; - - } else { + } /* end if */ + else { file_ptr->shared->cache = NULL; - } - } + } /* end else */ + } /* end else */ if(saved_cache != NULL) { - file_ptr->shared->cache = saved_cache; saved_cache = NULL; - - } + } /* end if */ /* call takedown_cache() with a NULL file_ptr parameter. * This causes the function to close and delete the file, * while skipping the call to H5C_dest(). */ takedown_cache(NULL, FALSE, FALSE); - } + } /* end if */ if(pass) { PASSED(); } else { H5_FAILED(); } - if(!pass) { - - HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", - FUNC, failure_mssg); - } + if(!pass) + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", FUNC, failure_mssg); return (unsigned)!pass; @@ -34532,8 +34514,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) /* If we are collecting stats, check to see if we get the expected * values. */ - if(pass) { - + if(pass) if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) || @@ -34555,31 +34536,23 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected huge size entry stats in cedds__expunge_dirty_entry_in_flush_test()."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->slist_scan_restarts != 1) || (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->hash_bucket_scan_restarts != 0)) { - pass = FALSE; failure_mssg = "unexpected scan restart stats in cedds__expunge_dirty_entry_in_flush_test()."; - } - } + } /* end if */ #endif /* H5C_COLLECT_CACHE_STATS */ - if(pass) { - - reset_entries(); - } - - if(pass) { + if(pass) + reset_entries(); - /* reset cache min clean size to its expected value */ + if(pass) + /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - } return; @@ -34920,8 +34893,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) } } - if(pass) { - + if(pass) if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || @@ -34943,31 +34915,25 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry stats in cedds__H5C_make_space_in_cache()."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 1) || (cache_ptr->hash_bucket_scan_restarts != 0)) { pass = FALSE; failure_mssg = "unexpected scan restart stats in cedds__H5C_make_space_in_cache()."; - } - } -#endif /* H5C_COLLECT_CACHE_STATS */ - - if(pass) { + } /* end if */ - reset_entries(); - } +#endif /* H5C_COLLECT_CACHE_STATS */ - if(pass) { + if(pass) + reset_entries(); - /* reset cache min clean size to its expected value */ + if(pass) + /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - } return; @@ -35337,8 +35303,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) * values. */ - if(pass) { - + if(pass) if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || @@ -35360,31 +35325,25 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry stats in cedds__H5C__autoadjust__ageout__evict_aged_out_entries()."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 1) || (cache_ptr->hash_bucket_scan_restarts != 0)) { pass = FALSE; failure_mssg = "unexpected scan restart stats in cedds__H5C__autoadjust__ageout__evict_aged_out_entries()."; - } - } -#endif /* H5C_COLLECT_CACHE_STATS */ - - if(pass) { + } /* end if */ - reset_entries(); - } +#endif /* H5C_COLLECT_CACHE_STATS */ - if(pass) { + if(pass) + reset_entries(); - /* reset cache min clean size to its expected value */ + if(pass) + /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - } return; @@ -35712,8 +35671,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) * values. */ - if(pass) { - + if(pass) if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || @@ -35735,31 +35693,24 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry stats in cedds__H5C_flush_invalidate_cache__bucket_scan()."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->hash_bucket_scan_restarts != 1)) { - pass = FALSE; failure_mssg = "unexpected scan restart stats in cedds__H5C_flush_invalidate_cache__bucket_scan()."; } - } -#endif /* H5C_COLLECT_CACHE_STATS */ - if(pass) { - - reset_entries(); - } +#endif /* H5C_COLLECT_CACHE_STATS */ - if(pass) { + if(pass) + reset_entries(); - /* reset cache min clean size to its expected value */ + if(pass) + /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - } return; @@ -35875,47 +35826,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr) int i; herr_t result; - if(pass) { - - if(cache_ptr == NULL) { + if(pass) + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "cache_ptr NULL on entry to check_stats__smoke_check_1()."; - } + } /* end if */ else if((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { pass = FALSE; failure_mssg = "cache not empty on entry to check_stats__smoke_check_1()."; - } + } /* end else-if */ else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { pass = FALSE; - failure_mssg = - "unexpected cache config at start of check_stats__smoke_check_1()."; + failure_mssg = "unexpected cache config at start of check_stats__smoke_check_1()."; - } else { + } /* end else-if */ + else { /* set min clean size to zero for this test as it simplifies * computing the expected cache size after each operation. */ - cache_ptr->min_clean_size = 0; - } - } - - if(pass) { + } /* end else */ + if(pass) /* first fill the cache with monster entryies via insertion */ - - for (i = 0; i < 32; i++) - + for(i = 0; i < 32; i++) insert_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); - } - - if(pass) { + if(pass) if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 0) || @@ -35942,11 +35885,9 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(1)."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->total_ht_insertions != 32) || (cache_ptr->total_ht_deletions != 0) || (cache_ptr->successful_ht_searches != 0) || @@ -35975,14 +35916,11 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(1)."; - } - } + } /* end if */ #if H5C_COLLECT_CACHE_ENTRY_STATS - if(pass) { - + if(pass) /* Note that most entry level stats are only updated on entry eviction */ - if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1000000) || /* initial value */ (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) || @@ -35992,26 +35930,20 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(1)."; - } - } + } /* end if */ #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ - if(pass) { - + if(pass) /* protect and unprotect each entry once. Note * that all entries are already dirty, as they * entered the cache via insertion */ - - for (i = 0; i < 32; i++) - { + for(i = 0; i < 32; i++) { protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); - } - } - - if(pass) { + } /* end for */ + if(pass) if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 32) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 32) || @@ -36038,11 +35970,9 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(2)."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->total_ht_insertions != 32) || (cache_ptr->total_ht_deletions != 0) || (cache_ptr->successful_ht_searches != 32) || @@ -36071,14 +36001,11 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(2)."; - } - } + } /* end if */ #if H5C_COLLECT_CACHE_ENTRY_STATS - if(pass) { - + if(pass) /* Note that most entry level stats are only updated on entry eviction */ - if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1000000) || /* initial value */ (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) || @@ -36088,12 +36015,10 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(2)."; - } - } + } /* end if */ #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ if(pass) { - /* protect and unprotect an entry that is not currently * in the cache. Since the cache is full and all entries * are dirty, this will force a flush of each entry, and @@ -36101,10 +36026,9 @@ check_stats__smoke_check_1(H5F_t * file_ptr) */ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 32); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 32, H5C__DIRTIED_FLAG); - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 32) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 1) || (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 33) || @@ -36131,11 +36055,9 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(3)."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->total_ht_insertions != 33) || (cache_ptr->total_ht_deletions != 1) || (cache_ptr->successful_ht_searches != 32) || @@ -36164,14 +36086,11 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(3)."; - } - } + } /* end if */ #if H5C_COLLECT_CACHE_ENTRY_STATS - if(pass) { - + if(pass) /* Note that most entry level stats are only updated on entry eviction */ - if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 1) || (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1) || (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) || @@ -36181,18 +36100,17 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(3)."; - } - } + } /* end if */ + #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ if(pass) { - /* protect and unprotect dirty (MET, 1), and then flush destroy * the cache. */ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); - } + } /* end if */ /* flush the cache to end the test and collect all entry stats */ @@ -36204,18 +36122,17 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Cache flush invalidate failed in check_stats__smoke_check_1()"; - } + } /* end if */ else if((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0)) { pass = FALSE; failure_mssg = "Unexpected cache len/size after check_stats__smoke_check_1()"; - } - } - - if(pass) { + } /* end else-if */ + } /* end if */ + if(pass) if((cache_ptr->hits[MONSTER_ENTRY_TYPE] != 33) || (cache_ptr->misses[MONSTER_ENTRY_TYPE] != 1) || (cache_ptr->write_protects[MONSTER_ENTRY_TYPE] != 34) || @@ -36242,11 +36159,9 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(4)."; - } - } - - if(pass) { + } /* end if */ + if(pass) if((cache_ptr->total_ht_insertions != 33) || (cache_ptr->total_ht_deletions != 33) || (cache_ptr->successful_ht_searches != 33) || @@ -36275,14 +36190,11 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(4)."; - } - } + } /* end if */ #if H5C_COLLECT_CACHE_ENTRY_STATS - if(pass) { - + if(pass) /* Note that most entry level stats are only updated on entry eviction */ - if((cache_ptr->max_accesses[MONSTER_ENTRY_TYPE] != 2) || (cache_ptr->min_accesses[MONSTER_ENTRY_TYPE] != 1) || (cache_ptr->max_clears[MONSTER_ENTRY_TYPE] != 0) || @@ -36292,20 +36204,16 @@ check_stats__smoke_check_1(H5F_t * file_ptr) pass = FALSE; failure_mssg = "Unexpected monster entry level stats in check_stats__smoke_check_1(4)."; - } - } -#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ - - if(pass) { + } /* end if */ - reset_entries(); - } +#endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ - if(pass) { + if(pass) + reset_entries(); - /* reset cache min clean size to its expected value */ + if(pass) + /* reset cache min clean size to its expected value */ cache_ptr->min_clean_size = (1 * 1024 * 1024); - } return; -- cgit v0.12