From 9e6a5a5f2cd2b3a432f713d8af49c853debafef2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Dec 2016 11:36:32 -0800 Subject: Normalize against incoming cache image feature. --- src/H5ACprivate.h | 78 +++++++++++++++--------------- src/H5C.c | 142 +++++++++++++++++++++++++----------------------------- 2 files changed, 104 insertions(+), 116 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 48b7c6b..9a4ab55 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -59,36 +59,36 @@ /* Types of metadata objects cached */ typedef enum { - H5AC_BT_ID = 0, /* ( 0) B-tree nodes */ - H5AC_SNODE_ID, /* ( 1) symbol table nodes */ - H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */ - H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */ - H5AC_GHEAP_ID, /* ( 4) global heap */ - H5AC_OHDR_ID, /* ( 5) object header */ - H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */ - H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */ - H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */ - H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */ - H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */ - H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */ - H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */ - H5AC_FSPACE_HDR_ID, /* (13) free space header */ - H5AC_FSPACE_SINFO_ID, /* (14) free space sections */ - H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */ - H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */ - H5AC_EARRAY_HDR_ID, /* (17) extensible array header */ - H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */ - H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */ - H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */ - H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */ - H5AC_FARRAY_HDR_ID, /* (22) fixed array header */ - H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */ - 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_NTYPES /* Number of types, must be last */ + H5AC_BT_ID = 0, /* ( 0) B-tree nodes */ + H5AC_SNODE_ID, /* ( 1) symbol table nodes */ + H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */ + H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */ + H5AC_GHEAP_ID, /* ( 4) global heap */ + H5AC_OHDR_ID, /* ( 5) object header */ + H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */ + H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */ + H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */ + H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */ + H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */ + H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */ + H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */ + H5AC_FSPACE_HDR_ID, /* (13) free space header */ + H5AC_FSPACE_SINFO_ID, /* (14) free space sections */ + H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */ + H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */ + H5AC_EARRAY_HDR_ID, /* (17) extensible array header */ + H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */ + H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */ + H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */ + H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */ + H5AC_FARRAY_HDR_ID, /* (22) fixed array header */ + H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */ + 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_NTYPES /* Number of types, must be last */ } H5AC_type_t; /* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when @@ -173,8 +173,8 @@ typedef H5C_notify_action_t H5AC_notify_action_t; #define H5AC__CLASS_SPECULATIVE_LOAD_FLAG H5C__CLASS_SPECULATIVE_LOAD_FLAG /* The following flags should only appear in test code */ -#define H5AC__CLASS_SKIP_READS H5C__CLASS_SKIP_READS -#define H5AC__CLASS_SKIP_WRITES H5C__CLASS_SKIP_WRITES +#define H5AC__CLASS_SKIP_READS H5C__CLASS_SKIP_READS +#define H5AC__CLASS_SKIP_WRITES H5C__CLASS_SKIP_WRITES typedef H5C_get_initial_load_size_func_t H5AC_get_initial_load_size_func_t; typedef H5C_get_final_load_size_func_t H5AC_get_final_load_size_func_t; @@ -345,13 +345,13 @@ H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; * H5AC_get_entry_status() call. */ -#define H5AC_ES__IN_CACHE 0x0001 -#define H5AC_ES__IS_DIRTY 0x0002 -#define H5AC_ES__IS_PROTECTED 0x0004 -#define H5AC_ES__IS_PINNED 0x0008 -#define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010 -#define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020 -#define H5AC_ES__IS_CORKED 0x0040 +#define H5AC_ES__IN_CACHE 0x0001 +#define H5AC_ES__IS_DIRTY 0x0002 +#define H5AC_ES__IS_PROTECTED 0x0004 +#define H5AC_ES__IS_PINNED 0x0008 +#define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010 +#define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020 +#define H5AC_ES__IS_CORKED 0x0040 /* external function declarations: */ diff --git a/src/H5C.c b/src/H5C.c index faf99ff..1ce24a8 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -269,7 +269,7 @@ H5C_create(size_t max_cache_size, for ( i = 0; i <= max_type_id; i++ ) { HDassert( (type_name_table_ptr)[i] ); HDassert( HDstrlen(( type_name_table_ptr)[i]) > 0 ); - } + } /* end for */ if(NULL == (cache_ptr = H5FL_CALLOC(H5C_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -327,6 +327,9 @@ H5C_create(size_t max_cache_size, cache_ptr->slist_ring_size[i] = (size_t)0; } /* end for */ + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) + (cache_ptr->index)[i] = NULL; + /* Tagging Field Initializations */ cache_ptr->ignore_tags = FALSE; @@ -339,9 +342,6 @@ H5C_create(size_t max_cache_size, cache_ptr->slist_size_increase = 0; #endif /* H5C_DO_SANITY_CHECKS */ - for(i = 0; i < H5C__HASH_TABLE_LEN; i++) - (cache_ptr->index)[i] = NULL; - cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; cache_ptr->entry_watched_for_removal = NULL; @@ -809,7 +809,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, #if H5C_DO_EXTREME_SANITY_CHECKS if(H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry.\n"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* Look for entry in cache */ @@ -957,7 +957,7 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) if((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); @@ -1021,7 +1021,7 @@ H5C_flush_to_min_clean(H5F_t * f, H5C_t * cache_ptr; herr_t result; hbool_t write_permitted; -#if 0 /* modified code -- commented out for now */ +#if 0 /* modified code -- commented out for now */ /* JRM */ int i; int flushed_entries_count = 0; size_t flushed_entries_size = 0; @@ -1322,12 +1322,12 @@ H5C_insert_entry(H5F_t * f, entry_ptr->ring = ring; - /* Initialize flush dependency height fields */ - entry_ptr->flush_dep_parent = NULL; - entry_ptr->flush_dep_nparents = 0; - entry_ptr->flush_dep_parent_nalloc = 0; - entry_ptr->flush_dep_nchildren = 0; - entry_ptr->flush_dep_ndirty_children = 0; + /* Initialize flush dependency fields */ + entry_ptr->flush_dep_parent = NULL; + entry_ptr->flush_dep_nparents = 0; + entry_ptr->flush_dep_parent_nalloc = 0; + entry_ptr->flush_dep_nchildren = 0; + entry_ptr->flush_dep_ndirty_children = 0; entry_ptr->ht_next = NULL; entry_ptr->ht_prev = NULL; @@ -1436,7 +1436,7 @@ H5C_insert_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE); @@ -1738,7 +1738,6 @@ H5C_move_entry(H5C_t * cache_ptr, if(entry_ptr->in_slist) { HDassert(cache_ptr->slist_ptr); - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE) } /* end if */ } /* end if */ @@ -2159,8 +2158,7 @@ H5C_protect(H5F_t * f, ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ - "an extreme sanity check failed on entry.\n"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry.\n") } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2195,7 +2193,7 @@ H5C_protect(H5F_t * f, if ( entry_ptr != NULL ) { if(entry_ptr->ring != ring) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry\n"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry\n") /* Check for trying to load the wrong type of entry from an address */ if(entry_ptr->type != type) @@ -2263,7 +2261,7 @@ H5C_protect(H5F_t * f, /* Get the tag from the DXPL */ if((H5P_get(dxpl, H5AC_TAG_NAME, &tag)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value") if(H5C_verify_tag(entry_ptr->type->id, tag) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed") @@ -2336,22 +2334,16 @@ H5C_protect(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1") else have_write_permitted = TRUE; - } else { - + } /* end if */ + else { write_permitted = cache_ptr->write_permitted; - have_write_permitted = TRUE; + } /* end else */ - } - - HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE ); - + HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); space_needed = entry_ptr->size; - - if ( space_needed > cache_ptr->max_cache_size ) { - + if(space_needed > cache_ptr->max_cache_size) space_needed = cache_ptr->max_cache_size; - } /* Note that space_needed is just the amount of space that * needed to insert the new entry without exceeding the cache @@ -3077,7 +3069,6 @@ H5C_unprotect(H5F_t * f, if(H5C_unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") } /* end if */ - } else { if(entry_ptr->is_read_only) { /* Sanity check */ @@ -3205,7 +3196,7 @@ H5C_unprotect(H5F_t * f, * makes good use of existing code. * JRM - 5/19/04 */ - if ( deleted ) { + if(deleted) { unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_INVALIDATE_FLAG); @@ -3232,7 +3223,7 @@ H5C_unprotect(H5F_t * f, } #ifdef H5_HAVE_PARALLEL - else if ( clear_entry ) { + else if(clear_entry) { /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) @@ -3243,7 +3234,7 @@ H5C_unprotect(H5F_t * f, if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry") - } + } /* end else if */ #endif /* H5_HAVE_PARALLEL */ } @@ -3329,12 +3320,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small") } if ( config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big") } } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */ @@ -3344,7 +3335,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( ( config_ptr->incr_mode != H5C_incr__off ) && ( config_ptr->incr_mode != H5C_incr__threshold ) ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode") } if ( config_ptr->incr_mode == H5C_incr__threshold ) { @@ -3399,7 +3390,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, ( config_ptr->decr_mode != H5C_decr__age_out_with_threshold ) ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode") } if ( config_ptr->decr_mode == H5C_decr__threshold ) { @@ -4076,9 +4067,7 @@ H5C__auto_adjust_cache_size(H5F_t * f, } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__auto_adjust_cache_size() */ @@ -5602,7 +5591,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) if((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); @@ -6070,7 +6059,6 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ * Finally, if the destroy_entry flag is set, discard the * entry. */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) if(entry_ptr->in_slist && del_from_slist_on_destroy) @@ -6575,50 +6563,50 @@ H5C_load_entry(H5F_t * f, HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6) ); - entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - entry->cache_ptr = f->shared->cache; - entry->addr = addr; - entry->size = len; + entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; + 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; - entry->is_dirty = dirty; - entry->dirtied = FALSE; - entry->is_protected = FALSE; - entry->is_read_only = FALSE; - entry->ro_ref_count = 0; - entry->is_pinned = FALSE; - entry->in_slist = FALSE; - entry->flush_marker = FALSE; + entry->image_ptr = image; + entry->image_up_to_date = TRUE; + entry->type = type; + entry->is_dirty = dirty; + entry->dirtied = FALSE; + entry->is_protected = FALSE; + entry->is_read_only = FALSE; + entry->ro_ref_count = 0; + entry->is_pinned = FALSE; + entry->in_slist = FALSE; + entry->flush_marker = FALSE; #ifdef H5_HAVE_PARALLEL - entry->clear_on_unprotect = FALSE; - entry->flush_immediately = FALSE; - entry->coll_access = coll_access; + entry->clear_on_unprotect = FALSE; + entry->flush_immediately = FALSE; + entry->coll_access = coll_access; #endif /* H5_HAVE_PARALLEL */ - entry->flush_in_progress = FALSE; - entry->destroy_in_progress = FALSE; + entry->flush_in_progress = FALSE; + entry->destroy_in_progress = FALSE; - entry->ring = H5C_RING_UNDEFINED; + entry->ring = H5C_RING_UNDEFINED; - /* Initialize flush dependency height fields */ - entry->flush_dep_parent = NULL; - entry->flush_dep_nparents = 0; - entry->flush_dep_parent_nalloc = 0; - entry->flush_dep_nchildren = 0; - entry->flush_dep_ndirty_children = 0; - entry->ht_next = NULL; - entry->ht_prev = NULL; + /* Initialize flush dependency fields */ + entry->flush_dep_parent = NULL; + entry->flush_dep_nparents = 0; + entry->flush_dep_parent_nalloc = 0; + entry->flush_dep_nchildren = 0; + entry->flush_dep_ndirty_children = 0; + entry->ht_next = NULL; + entry->ht_prev = NULL; - entry->next = NULL; - entry->prev = NULL; + entry->next = NULL; + entry->prev = NULL; - entry->aux_next = NULL; - entry->aux_prev = NULL; + entry->aux_next = NULL; + entry->aux_prev = NULL; #ifdef H5_HAVE_PARALLEL - entry->coll_next = NULL; - entry->coll_prev = NULL; + entry->coll_next = NULL; + entry->coll_prev = NULL; #endif /* H5_HAVE_PARALLEL */ H5C__RESET_CACHE_ENTRY_STATS(entry); -- cgit v0.12