diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-12-29 15:43:39 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-12-29 15:43:39 (GMT) |
commit | 5e26cd2d824ea05e5ae5ca3aebaa439a9b80e7fc (patch) | |
tree | 2ed2abb8653e179ae03d54d17b265b328e9bfcdd /src | |
parent | 890e1f3263c450fe6ed4f65f7bbdb46f456a8098 (diff) | |
parent | da2f1610d1f2cba40770aee6d0d6fbc8196645ae (diff) | |
download | hdf5-5e26cd2d824ea05e5ae5ca3aebaa439a9b80e7fc.zip hdf5-5e26cd2d824ea05e5ae5ca3aebaa439a9b80e7fc.tar.gz hdf5-5e26cd2d824ea05e5ae5ca3aebaa439a9b80e7fc.tar.bz2 |
Merge pull request #223 in HDFFV/hdf5 from develop_merge_cache_image_02 to develop
Merged normalizations w/ cache_image branch.
* commit 'da2f1610d1f2cba40770aee6d0d6fbc8196645ae':
More normalizations against incoming cache image branch.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 7 | ||||
-rw-r--r-- | src/H5ACprivate.h | 5 | ||||
-rw-r--r-- | src/H5C.c | 11 | ||||
-rw-r--r-- | src/H5Cdbg.c | 43 | ||||
-rw-r--r-- | src/H5Cepoch.c | 13 | ||||
-rw-r--r-- | src/H5Cpkg.h | 9 | ||||
-rw-r--r-- | src/H5Cprivate.h | 53 | ||||
-rw-r--r-- | src/H5FD.c | 3 | ||||
-rw-r--r-- | src/H5FDmulti.c | 46 | ||||
-rw-r--r-- | src/H5FDspace.c | 2 | ||||
-rw-r--r-- | src/H5FS.c | 2 | ||||
-rw-r--r-- | src/H5FScache.c | 1 | ||||
-rw-r--r-- | src/H5FSpkg.h | 1 | ||||
-rw-r--r-- | src/H5FSsection.c | 12 | ||||
-rw-r--r-- | src/H5Fint.c | 3 | ||||
-rw-r--r-- | src/H5Fprivate.h | 1 | ||||
-rw-r--r-- | src/H5Fsuper.c | 1 | ||||
-rw-r--r-- | src/H5Fsuper_cache.c | 2 | ||||
-rw-r--r-- | src/H5HFcache.c | 14 | ||||
-rw-r--r-- | src/H5HLcache.c | 2 | ||||
-rw-r--r-- | src/H5MF.c | 4 | ||||
-rw-r--r-- | src/H5MFaggr.c | 36 | ||||
-rw-r--r-- | src/H5MFdbg.c | 13 | ||||
-rw-r--r-- | src/H5MFprivate.h | 2 | ||||
-rw-r--r-- | src/H5Ofsinfo.c | 2 | ||||
-rw-r--r-- | src/H5Omessage.c | 3 | ||||
-rw-r--r-- | src/H5Oprivate.h | 12 |
27 files changed, 133 insertions, 170 deletions
@@ -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; @@ -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 */ @@ -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 <koziol@hdfgroup.org> * - * Purpose: Space allocation routines for the file. + * Purpose: Space allocation routines for the file driver code. * *------------------------------------------------------------------------- */ @@ -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 @@ -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<none>\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) |