diff options
-rw-r--r-- | src/H5AC.c | 42 | ||||
-rw-r--r-- | src/H5ACpkg.h | 49 | ||||
-rw-r--r-- | src/H5ACprivate.h | 4 | ||||
-rw-r--r-- | src/H5ACpublic.h | 2 | ||||
-rw-r--r-- | src/H5B2hdr.c | 2 | ||||
-rw-r--r-- | src/H5B2pkg.h | 20 | ||||
-rw-r--r-- | src/H5C.c | 35 | ||||
-rw-r--r-- | src/H5Cpkg.h | 612 | ||||
-rw-r--r-- | src/H5EAcache.c | 4 | ||||
-rw-r--r-- | src/H5EAdblkpage.c | 2 | ||||
-rw-r--r-- | src/H5EAhdr.c | 2 | ||||
-rw-r--r-- | src/H5EApkg.h | 30 | ||||
-rw-r--r-- | src/H5F.c | 1 | ||||
-rw-r--r-- | src/H5FAcache.c | 4 | ||||
-rw-r--r-- | src/H5FAdblkpage.c | 2 | ||||
-rw-r--r-- | src/H5FAhdr.c | 2 | ||||
-rw-r--r-- | src/H5FApkg.h | 20 | ||||
-rw-r--r-- | src/H5FS.c | 2 | ||||
-rw-r--r-- | src/H5Fint.c | 63 | ||||
-rw-r--r-- | src/H5Fpkg.h | 44 | ||||
-rw-r--r-- | src/H5Fprivate.h | 4 | ||||
-rw-r--r-- | src/H5Fsuper.c | 8 | ||||
-rw-r--r-- | src/H5Gent.c | 4 | ||||
-rw-r--r-- | src/H5Gpkg.h | 2 | ||||
-rw-r--r-- | src/H5Gprivate.h | 8 | ||||
-rw-r--r-- | src/H5HFcache.c | 16 | ||||
-rw-r--r-- | src/H5HGcache.c | 10 | ||||
-rw-r--r-- | src/H5MF.c | 6 | ||||
-rw-r--r-- | src/H5MFdbg.c | 4 | ||||
-rw-r--r-- | src/H5MFprivate.h | 2 | ||||
-rw-r--r-- | src/H5MFsection.c | 2 | ||||
-rw-r--r-- | src/H5Oprivate.h | 1 | ||||
-rw-r--r-- | src/H5Pfapl.c | 8 | ||||
-rw-r--r-- | src/H5SMcache.c | 72 | ||||
-rw-r--r-- | test/cache.c | 36 | ||||
-rw-r--r-- | test/cache_common.c | 6 | ||||
-rw-r--r-- | testpar/t_cache.c | 5 |
37 files changed, 635 insertions, 501 deletions
@@ -1002,7 +1002,7 @@ H5AC_mark_entry_dirty(void *thing) * is really necessary in the trace file. Write the result to catch * occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((const H5C_cache_entry_t *) thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); @@ -1150,7 +1150,7 @@ H5AC_pin_protected_entry(void *thing) /* For the pin protected entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((const H5C_cache_entry_t *)thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); @@ -1198,7 +1198,7 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing) HDassert(child_thing); #if H5AC__TRACE_FILE_ENABLED - if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)parent_thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s %lx %lx", FUNC, @@ -1309,10 +1309,8 @@ H5AC_protect(H5F_t *f, } #endif /* H5AC__TRACE_FILE_ENABLED */ - if ( rw == H5AC_READ ) { - + if ( rw == H5AC_READ ) protect_flags |= H5C__READ_ONLY_FLAG; - } thing = H5C_protect(f, dxpl_id, @@ -1385,7 +1383,7 @@ H5AC_resize_entry(void *thing, size_t new_size) * really necessary in the trace file. Write the result to catch * occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr), @@ -1451,7 +1449,7 @@ H5AC_unpin_entry(void *thing) /* For the unpin entry call, only the addr is really necessary * in the trace file. Also write the result to catch occult errors. */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)thing, &trace_file_ptr) >= 0) && (NULL != trace_file_ptr)) sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); @@ -1498,8 +1496,8 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) HDassert(child_thing); #if H5AC__TRACE_FILE_ENABLED - if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) && - (NULL != trace_file_ptr)) + if((H5C_get_trace_file_ptr_from_entry((H5C_cache_entry_t *)parent_thing, &trace_file_ptr) >= 0) && + (NULL != trace_file_ptr)) sprintf(trace, "%s %llx %llx", FUNC, (unsigned long long)(((H5C_cache_entry_t *)parent_thing)->addr), @@ -1648,7 +1646,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, done: #if H5AC__TRACE_FILE_ENABLED if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %x %d\n", + HDfprintf(trace_file_ptr, "%s 0x%x %d\n", trace, (unsigned)flags, (int)ret_value); #endif /* H5AC__TRACE_FILE_ENABLED */ @@ -2154,7 +2152,7 @@ done: ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d %d\n", + "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n", "H5AC_set_cache_auto_resize_config", trace_config.version, (int)(trace_config.rpt_fcn_enabled), @@ -2450,7 +2448,7 @@ H5AC_open_trace_file(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "trace file open failed.") } - HDfprintf(file_ptr, "### HDF5 metadata cache trace file ###\n"); + HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 1 ###\n"); if ( H5C_set_trace_file_ptr(cache_ptr, file_ptr) < 0 ) { @@ -5002,15 +5000,15 @@ H5AC_run_sync_point(H5F_t *f, #if H5AC_DEBUG_DIRTY_BYTES_CREATION HDfprintf(stdout, - "%d:H5AC_propagate...:%d: (u/uu/i/iu/r/ru) = %d/%d/%d/%d/%d/%d\n", - (int)(aux_ptr->mpi_rank), - (int)(aux_ptr->dirty_bytes_propagations), - (int)(aux_ptr->unprotect_dirty_bytes), - (int)(aux_ptr->unprotect_dirty_bytes_updates), - (int)(aux_ptr->insert_dirty_bytes), - (int)(aux_ptr->insert_dirty_bytes_updates), - (int)(aux_ptr->rename_dirty_bytes), - (int)(aux_ptr->rename_dirty_bytes_updates)); + "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", + aux_ptr->mpi_rank, + aux_ptr->dirty_bytes_propagations, + aux_ptr->unprotect_dirty_bytes, + aux_ptr->unprotect_dirty_bytes_updates, + aux_ptr->insert_dirty_bytes, + aux_ptr->insert_dirty_bytes_updates, + aux_ptr->rename_dirty_bytes, + aux_ptr->rename_dirty_bytes_updates); #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ switch(aux_ptr->metadata_write_strategy) { diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index ad768ef..5b8ac86 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -64,10 +64,10 @@ *------------------------------------------------------------------------- */ -#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (int32_t) \ +#define H5AC__MIN_DIRTY_BYTES_THRESHOLD (size_t) \ (H5C__MIN_MAX_CACHE_SIZE / 2) #define H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD (256 * 1024) -#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (int32_t) \ +#define H5AC__MAX_DIRTY_BYTES_THRESHOLD (size_t) \ (H5C__MAX_MAX_CACHE_SIZE / 4) @@ -142,6 +142,29 @@ * * JRM - 6/27/05 * + * Update: When the above was written, I planned to allow the process + * 0 metadata cache to write dirty metadata between sync points. + * However, testing indicated that this allowed occasional + * messages from the future to reach the caches on other processes. + * + * To resolve this, the code was altered to require that all metadata + * writes take place during sync points -- which solved the problem. + * Initially all writes were performed by the process 0 cache. This + * approach was later replaced with a distributed write approach + * in which each process writes a subset of the metadata to be + * written. + * + * After thinking on the matter for a while, I arrived at the + * conclusion that the process 0 cache could be allowed to write + * dirty metadata between sync points if it restricted itself to + * entries that had been dirty at the time of the previous sync point. + * + * To date, there has been no attempt to implement this optimization. + * However, should it be attempted, much of the supporting code + * should still be around. + * + * JRM -- 1/6/15 + * * magic: Unsigned 32 bit integer always set to * H5AC__H5AC_AUX_T_MAGIC. This field is used to validate * pointers to instances of H5AC_aux_t. @@ -180,6 +203,10 @@ * field exists to facilitate experiments with other * strategies. * + * At present, this field must be set to either + * H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY or + * H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED. + * * dirty_bytes_propagations: This field only exists when the * H5AC_DEBUG_DIRTY_BYTES_CREATION #define is TRUE. * @@ -344,24 +371,24 @@ typedef struct H5AC_aux_t hbool_t write_permitted; - int32_t dirty_bytes_threshold; + size_t dirty_bytes_threshold; - int32_t dirty_bytes; + size_t dirty_bytes; int32_t metadata_write_strategy; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - int32_t dirty_bytes_propagations; + unsigned dirty_bytes_propagations; - int32_t unprotect_dirty_bytes; - int32_t unprotect_dirty_bytes_updates; + size_t unprotect_dirty_bytes; + unsigned unprotect_dirty_bytes_updates; - int32_t insert_dirty_bytes; - int32_t insert_dirty_bytes_updates; + size_t insert_dirty_bytes; + unsigned insert_dirty_bytes_updates; - int32_t move_dirty_bytes; - int32_t move_dirty_bytes_updates; + size_t move_dirty_bytes; + unsigned move_dirty_bytes_updates; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index cf4c122..e259a24 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -255,7 +255,7 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ /* double empty_reserve = */ 0.1f, \ - /* int dirty_bytes_threshold = */ (256 * 1024), \ + /* size_t dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ } @@ -291,7 +291,7 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ /* double empty_reserve = */ 0.1f, \ - /* int dirty_bytes_threshold = */ (256 * 1024), \ + /* size_t dirty_bytes_threshold = */ (256 * 1024), \ /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ } diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 639179c..598197f 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -496,7 +496,7 @@ typedef struct H5AC_cache_config_t /* parallel configuration fields: */ - int dirty_bytes_threshold; + size_t dirty_bytes_threshold; int metadata_write_strategy; } H5AC_cache_config_t; diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 97b979e..d873cf6 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -256,7 +256,7 @@ H5B2__hdr_alloc(H5F_t *f) hdr->f = f; hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); hdr->sizeof_size = H5F_SIZEOF_SIZE(f); - hdr->hdr_size = H5B2_HEADER_SIZE(hdr); + hdr->hdr_size = H5B2_HEADER_SIZE_HDR(hdr); hdr->root.addr = HADDR_UNDEF; /* Set return value */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 72476eb..a2d32e6 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -45,10 +45,10 @@ /* Size of a "tree pointer" (on disk) */ /* (essentially, the largest internal pointer allowed) */ -#define H5B2_TREE_POINTER_SIZE(h) ( \ - (h)->sizeof_addr + \ +#define H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) ( \ + (sizeof_addr) + \ H5B2_SIZEOF_RECORDS_PER_NODE + \ - (h)->sizeof_size \ + (sizeof_size) \ ) /* Size of a internal node pointer (on disk) */ @@ -70,7 +70,7 @@ ) /* Size of the v2 B-tree header on disk */ -#define H5B2_HEADER_SIZE(h) ( \ +#define H5B2_HEADER_SIZE(sizeof_addr, sizeof_size) ( \ /* General metadata fields */ \ H5B2_METADATA_PREFIX_SIZE \ \ @@ -80,7 +80,17 @@ + (unsigned)2 /* Depth of tree */ \ + (unsigned)1 /* Split % of full (as integer, ie. "98" means 98%) */ \ + (unsigned)1 /* Merge % of full (as integer, ie. "98" means 98%) */ \ - + H5B2_TREE_POINTER_SIZE(h) /* Node pointer to root node in tree */ \ + + H5B2_TREE_POINTER_SIZE(sizeof_addr, sizeof_size) /* Node pointer to root node in tree */ \ + ) + +/* Size of the v2 B-tree header on disk (via file pointer) */ +#define H5B2_HEADER_SIZE_FILE(f) ( \ + H5B2_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \ + ) + +/* Size of the v2 B-tree header on disk (via v2 B-tree header) */ +#define H5B2_HEADER_SIZE_HDR(h) ( \ + H5B2_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \ ) /* Size of the v2 B-tree internal node prefix */ @@ -621,7 +621,7 @@ H5C_apply_candidate_list(H5F_t * f, (int)(cache_ptr->LRU_list_len)); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - /* ====================================================================== * + /* ===================================================================== * * Now scan the LRU and PEL lists, flushing or clearing entries as * needed. * @@ -632,7 +632,7 @@ H5C_apply_candidate_list(H5F_t * f, * to account for this one case where they come into play. If these flags * are ever expanded upon, this function and the following flushing steps * should be reworked to account for additional cases. - * ====================================================================== */ + * ===================================================================== */ entries_examined = 0; initial_list_len = cache_ptr->LRU_list_len; @@ -1612,9 +1612,7 @@ H5C_expunge_entry(H5F_t * f, HDassert(f); HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(type); @@ -2394,7 +2392,7 @@ H5C_get_cache_hit_rate(H5C_t * cache_ptr, double * hit_rate_ptr) FUNC_ENTER_NOAPI(FAIL) - if((cache_ptr == NULL ) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") if(hit_rate_ptr == NULL) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry.") @@ -2733,7 +2731,7 @@ H5C_insert_entry(H5F_t * f, entry_ptr->cache_ptr = cache_ptr; entry_ptr->addr = addr; entry_ptr->type = type; - + /* Apply tag to newly inserted entry */ if(H5C_tag_entry(cache_ptr, entry_ptr, primary_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry") @@ -3469,7 +3467,7 @@ H5C_move_entry(H5C_t * cache_ptr, #endif /* H5C_DO_SANITY_CHECKS */ H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL) - } + } } H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) @@ -4729,11 +4727,9 @@ H5C_stats(H5C_t * cache_ptr, total_clears += cache_ptr->clears[i]; total_flushes += cache_ptr->flushes[i]; total_evictions += cache_ptr->evictions[i]; - total_moves += cache_ptr->moves[i]; - total_entry_flush_moves - += cache_ptr->entry_flush_moves[i]; - total_cache_flush_moves - += cache_ptr->cache_flush_moves[i]; + total_moves += cache_ptr->moves[i]; + total_entry_flush_moves += cache_ptr->entry_flush_moves[i]; + total_cache_flush_moves += cache_ptr->cache_flush_moves[i]; total_size_increases += cache_ptr->size_increases[i]; total_size_decreases += cache_ptr->size_decreases[i]; total_entry_flush_size_changes @@ -4889,14 +4885,14 @@ H5C_stats(H5C_t * cache_ptr, (long)total_evictions); HDfprintf(stdout, - "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", + "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, (long)total_insertions, (long)total_pinned_insertions, (long)total_moves); HDfprintf(stdout, - "%s Total entry / cache flush moves = %ld / %ld\n", + "%s Total entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, (long)total_entry_flush_moves, (long)total_cache_flush_moves); @@ -5018,14 +5014,14 @@ H5C_stats(H5C_t * cache_ptr, (long)(cache_ptr->evictions[i])); HDfprintf(stdout, - "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", + "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, (long)(cache_ptr->insertions[i]), (long)(cache_ptr->pinned_insertions[i]), (long)(cache_ptr->moves[i])); HDfprintf(stdout, - "%s entry / cache flush moves = %ld / %ld\n", + "%s entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, (long)(cache_ptr->entry_flush_moves[i]), (long)(cache_ptr->cache_flush_moves[i])); @@ -5050,7 +5046,7 @@ H5C_stats(H5C_t * cache_ptr, (long)(cache_ptr->unpins[i])); HDfprintf(stdout, - "%s entry dirty pins/pin'd flushes = %ld / %ld\n", + "%s entry dirty pins/pin'd flushes = %ld / %ld\n", cache_ptr->prefix, (long)(cache_ptr->dirty_pins[i]), (long)(cache_ptr->pinned_flushes[i])); @@ -5144,8 +5140,8 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) cache_ptr->flushes[i] = 0; cache_ptr->evictions[i] = 0; cache_ptr->moves[i] = 0; - cache_ptr->entry_flush_moves[i] = 0; - cache_ptr->cache_flush_moves[i] = 0; + cache_ptr->entry_flush_moves[i] = 0; + cache_ptr->cache_flush_moves[i] = 0; cache_ptr->pins[i] = 0; cache_ptr->unpins[i] = 0; cache_ptr->dirty_pins[i] = 0; @@ -8943,7 +8939,6 @@ H5C_make_space_in_cache(H5F_t * f, total_entries_scanned++; #endif /* H5C_COLLECT_CACHE_STATS */ - } else { /* Skip epoch markers. Set result to SUCCEED to avoid diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index ae6bdad..7c278e8 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -530,7 +530,7 @@ * * cache_full: Boolean flag used to keep track of whether the cache is * full, so we can refrain from increasing the size of a - * cache which hasn't used up the space alotted to it. + * cache which hasn't used up the space allotted to it. * * The field is initialized to FALSE, and then set to TRUE * whenever we attempt to make space in the cache. @@ -542,7 +542,7 @@ * resize_enabled = size_increase_possible || * size_decrease_possible; * - * size_decreased: Boolean flag set to TRUE whenever the maximun cache + * size_decreased: Boolean flag set to TRUE whenever the maximum cache * size is decreased. The flag triggers a call to * H5C_make_space_in_cache() on the next call to H5C_protect(). * @@ -667,7 +667,7 @@ * pinned into the cache in the current epoch. * * clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type + * are used to record the number of times a dirty entry with type * id equal to the array index has been cleared in the current * epoch. * @@ -1217,78 +1217,78 @@ if ( ( (new_size) > (dll_size) ) || \ #define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ - H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->next = (entry_ptr); \ - (entry_ptr)->prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += (entry_ptr)->size; +{ \ + H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (tail_ptr)->next = (entry_ptr); \ + (entry_ptr)->prev = (tail_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += (entry_ptr)->size; \ +} /* H5C__DLL_APPEND() */ #define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ - H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->prev = (entry_ptr); \ - (entry_ptr)->next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; +{ \ + H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (head_ptr)->prev = (entry_ptr); \ + (entry_ptr)->next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__DLL_PREPEND() */ #define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ - H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->next; \ - if ( (head_ptr) != NULL ) \ - { \ - (head_ptr)->prev = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->prev->next = (entry_ptr)->next; \ - } \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->prev; \ - if ( (tail_ptr) != NULL ) \ - { \ - (tail_ptr)->next = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->next->prev = (entry_ptr)->prev; \ - } \ - entry_ptr->next = NULL; \ - entry_ptr->prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } +{ \ + H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + { \ + if ( (head_ptr) == (entry_ptr) ) \ + { \ + (head_ptr) = (entry_ptr)->next; \ + if ( (head_ptr) != NULL ) \ + (head_ptr)->prev = NULL; \ + } \ + else \ + (entry_ptr)->prev->next = (entry_ptr)->next; \ + if ( (tail_ptr) == (entry_ptr) ) \ + { \ + (tail_ptr) = (entry_ptr)->prev; \ + if ( (tail_ptr) != NULL ) \ + (tail_ptr)->next = NULL; \ + } \ + else \ + (entry_ptr)->next->prev = (entry_ptr)->prev; \ + entry_ptr->next = NULL; \ + entry_ptr->prev = NULL; \ + (len)--; \ + (Size) -= entry_ptr->size; \ + } \ +} /* H5C__DLL_REMOVE() */ #define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \ - H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ - (dll_size) -= (old_size); \ - (dll_size) += (new_size); \ - H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) +{ \ + H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ + (dll_size) -= (old_size); \ + (dll_size) += (new_size); \ + H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ +} /* H5C__DLL_UPDATE_FOR_SIZE_CHANGE() */ #if H5C_DO_SANITY_CHECKS @@ -1365,72 +1365,68 @@ if ( ( (entry_ptr) == NULL ) || \ #define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\ - H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->aux_next = (entry_ptr); \ - (entry_ptr)->aux_prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; +{ \ + H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (tail_ptr)->aux_next = (entry_ptr); \ + (entry_ptr)->aux_prev = (tail_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__AUX_DLL_APPEND() */ #define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fv) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->aux_prev = (entry_ptr); \ - (entry_ptr)->aux_next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; +{ \ + H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (head_ptr)->aux_prev = (entry_ptr); \ + (entry_ptr)->aux_next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__AUX_DLL_PREPEND() */ #define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fv) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->aux_next; \ - if ( (head_ptr) != NULL ) \ - { \ - (head_ptr)->aux_prev = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \ - } \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->aux_prev; \ - if ( (tail_ptr) != NULL ) \ - { \ - (tail_ptr)->aux_next = NULL; \ - } \ - } \ - else \ - { \ - (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \ - } \ - entry_ptr->aux_next = NULL; \ - entry_ptr->aux_prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } +{ \ + H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ + { \ + if ( (head_ptr) == (entry_ptr) ) \ + { \ + (head_ptr) = (entry_ptr)->aux_next; \ + if ( (head_ptr) != NULL ) \ + (head_ptr)->aux_prev = NULL; \ + } \ + else \ + (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \ + if ( (tail_ptr) == (entry_ptr) ) \ + { \ + (tail_ptr) = (entry_ptr)->aux_prev; \ + if ( (tail_ptr) != NULL ) \ + (tail_ptr)->aux_next = NULL; \ + } \ + else \ + (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \ + entry_ptr->aux_next = NULL; \ + entry_ptr->aux_prev = NULL; \ + (len)--; \ + (Size) -= entry_ptr->size; \ + } \ +} /* H5C__AUX_DLL_REMOVE() */ /*********************************************************************** @@ -1544,185 +1540,195 @@ if ( ( (entry_ptr) == NULL ) || \ #if H5C_COLLECT_CACHE_ENTRY_STATS #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ - (entry_ptr)->accesses = 0; \ - (entry_ptr)->clears = 0; \ - (entry_ptr)->flushes = 0; \ - (entry_ptr)->pins = 0; - -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ - (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ - } \ - ((entry_ptr)->clears)++; - -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ - (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ - } \ - ((entry_ptr)->flushes)++; - -#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->accesses > \ - ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] \ - = (entry_ptr)->accesses; \ - } \ - if ( (entry_ptr)->accesses < \ - ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] \ - = (entry_ptr)->accesses; \ - } \ - if ( (entry_ptr)->clears > \ - ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \ - = (entry_ptr)->clears; \ - } \ - if ( (entry_ptr)->flushes > \ - ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \ - = (entry_ptr)->flushes; \ - } \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - } \ - if ( (entry_ptr)->pins > \ - ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \ - = (entry_ptr)->pins; \ - } - -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - (entry_ptr)->pins++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - } - -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ - if ( hit ) \ - ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ - else \ - ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ - if ( ! ((entry_ptr)->is_read_only) ) { \ - ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ - } else { \ - ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ - if ( ((entry_ptr)->ro_ref_count) > \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ - ((entry_ptr)->ro_ref_count); \ - } \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ - (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - } \ - ((entry_ptr)->accesses)++; - -#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - (entry_ptr)->pins++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; +{ \ + (entry_ptr)->accesses = 0; \ + (entry_ptr)->clears = 0; \ + (entry_ptr)->flushes = 0; \ + (entry_ptr)->pins = 0; \ +} + +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ + ((entry_ptr)->clears)++; \ +} + +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ + ((entry_ptr)->flushes)++; \ +} + +#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->accesses > \ + ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] = \ + (entry_ptr)->accesses; \ + if ( (entry_ptr)->accesses < \ + ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] = \ + (entry_ptr)->accesses; \ + if ( (entry_ptr)->clears > \ + ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \ + = (entry_ptr)->clears; \ + if ( (entry_ptr)->flushes > \ + ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \ + = (entry_ptr)->flushes; \ + if ( (entry_ptr)->size > \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ + = (entry_ptr)->size; \ + if ( (entry_ptr)->pins > \ + ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \ + = (entry_ptr)->pins; \ +} + +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) { \ + (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + (entry_ptr)->pins++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ + if ( (entry_ptr)->size > \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ + = (entry_ptr)->size; \ + } \ +} + +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ +{ \ + if ( hit ) \ + ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ + else \ + ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ + if ( ! ((entry_ptr)->is_read_only) ) { \ + ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ + } else { \ + ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ + if ( ((entry_ptr)->ro_ref_count) > \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ + ((entry_ptr)->ro_ref_count); \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ + (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ + if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ + if ( (entry_ptr)->size > \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \ + ((entry_ptr)->accesses)++; \ +} + +#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ +{ \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + (entry_ptr)->pins++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ +} #else /* H5C_COLLECT_CACHE_ENTRY_STATS */ #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ - } \ - (((cache_ptr)->clears)[(entry_ptr)->type->id])++; +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ +{ \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ + (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ +} -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ - (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ - } +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) \ + (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ +} -#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; - -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ - (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; - -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ - if ( hit ) \ - ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ - else \ - ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ - if ( ! ((entry_ptr)->is_read_only) ) { \ - ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ - } else { \ - ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ - if ( ((entry_ptr)->ro_ref_count) > \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ - ((entry_ptr)->ro_ref_count); \ - } \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ - (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; - -#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; +#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ + (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; + +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ +{ \ + (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ + if ( (entry_ptr)->is_pinned ) { \ + (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ +} + +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ +{ \ + if ( hit ) \ + ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ + else \ + ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ + if ( ! ((entry_ptr)->is_read_only) ) \ + ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ + else { \ + ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ + if ( ((entry_ptr)->ro_ref_count) > \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \ + ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ + ((entry_ptr)->ro_ref_count); \ + } \ + if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ + (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ + if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ +} + +#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ +{ \ + ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ + if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ +} #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index b9acc49..70686fb 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -227,7 +227,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the 'base' size of the extensible array header on disk */ - size = H5EA_HEADER_SIZE(hdr); + size = H5EA_HEADER_SIZE_HDR(hdr); /* Get a pointer to a buffer that's large enough for serialized header */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) @@ -1789,7 +1789,7 @@ H5EA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the size of the extensible array data block page on disk */ - size = H5EA_DBLK_PAGE_SIZE(dblk_page); + size = H5EA_DBLK_PAGE_SIZE(udata->hdr); /* Get a pointer to a buffer that's large enough for serialized info */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 3c2da7c..37fd68b 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -169,7 +169,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Set info about data block page on disk */ dblk_page->addr = addr; - dblk_page->size = H5EA_DBLK_PAGE_SIZE(dblk_page); + dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr); #ifdef QAK HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); #endif /* QAK */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 136cf1e..76ea6d8 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -230,7 +230,7 @@ HDfprintf(stderr, "%s: hdr->sblk_info[%Zu] = {%Zu, %Zu, %Hu, %Hu}\n", FUNC, u, h } /* end for */ /* Set size of header on disk (locally and in statistics) */ - hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr); + hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr); /* Create the callback context, if there's one */ if(hdr->cparam.cls->crt_context) { diff --git a/src/H5EApkg.h b/src/H5EApkg.h index d89a35e..5382eac 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -66,7 +66,7 @@ ) /* Size of the extensible array header on disk */ -#define H5EA_HEADER_SIZE(h) ( \ +#define H5EA_HEADER_SIZE(sizeof_addr, sizeof_size) ( \ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ @@ -79,15 +79,25 @@ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ /* Extensible Array statistics fields */ \ - + (h)->sizeof_size /* Number of super blocks created */ \ - + (h)->sizeof_size /* Size of super blocks created */ \ - + (h)->sizeof_size /* Number of data blocks created */ \ - + (h)->sizeof_size /* Size of data blocks created */ \ - + (h)->sizeof_size /* Max. index set */ \ - + (h)->sizeof_size /* Number of elements 'realized' */ \ + + (sizeof_size) /* Number of super blocks created */ \ + + (sizeof_size) /* Size of super blocks created */ \ + + (sizeof_size) /* Number of data blocks created */ \ + + (sizeof_size) /* Size of data blocks created */ \ + + (sizeof_size) /* Max. index set */ \ + + (sizeof_size) /* Number of elements 'realized' */ \ \ /* Extensible Array Header specific fields */ \ - + (h)->sizeof_addr /* File address of index block */ \ + + (sizeof_addr) /* File address of index block */ \ + ) + +/* Size of the extensible array header on disk (via file pointer) */ +#define H5EA_HEADER_SIZE_FILE(f) ( \ + H5EA_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \ + ) + +/* Size of the extensible array header on disk (via extensible array header) */ +#define H5EA_HEADER_SIZE_HDR(h) ( \ + H5EA_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \ ) /* Size of the extensible array index block on disk */ @@ -139,8 +149,8 @@ ) /* Size of the extensible array data block page on disk */ -#define H5EA_DBLK_PAGE_SIZE(p) ( \ - + ((p)->hdr->dblk_page_nelmts * (size_t)(p)->hdr->cparam.raw_elmt_size) /* Elements in data block page */ \ +#define H5EA_DBLK_PAGE_SIZE(h) ( \ + + ((h)->dblk_page_nelmts * (size_t)(h)->cparam.raw_elmt_size) /* Elements in data block page */ \ + H5EA_SIZEOF_CHKSUM /* Checksum for each page */ \ ) @@ -1477,3 +1477,4 @@ H5Fclear_elink_file_cache(hid_t file_id) done: FUNC_LEAVE_API(ret_value) } /* end H5Fclear_elink_file_cache() */ + diff --git a/src/H5FAcache.c b/src/H5FAcache.c index a26aee6..9a1fc57 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -189,7 +189,7 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the 'base' size of the fixed array header on disk */ - size = H5FA_HEADER_SIZE(hdr); + size = H5FA_HEADER_SIZE_HDR(hdr); /* Get a pointer to a buffer that's large enough for serialized header */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) @@ -883,7 +883,7 @@ H5FA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the size of the fixed array data block page on disk */ - size = H5FA_DBLK_PAGE_SIZE(dblk_page, udata->nelmts); + size = H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts); /* Get a pointer to a buffer that's large enough for serialized info */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index b5ef82c..1f6b706 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -167,7 +167,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Set info about data block page on disk */ dblk_page->addr = addr; - dblk_page->size = H5FA_DBLK_PAGE_SIZE(dblk_page, nelmts); + dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); #endif /* H5FA_DEBUG */ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 5970ff0..23c20bc 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -148,7 +148,7 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)) HDassert(hdr); /* Set size of header on disk (locally and in statistics) */ - hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE(hdr); + hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE_HDR(hdr); /* Set number of elements for Fixed Array in statistics */ hdr->stats.nelmts = hdr->cparam.nelmts; diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 7101f0b..e7993a6 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -70,7 +70,7 @@ ) /* Size of the Fixed Array header on disk */ -#define H5FA_HEADER_SIZE(h) ( \ +#define H5FA_HEADER_SIZE(sizeof_addr, sizeof_size) ( \ /* General metadata fields */ \ H5FA_METADATA_PREFIX_SIZE(TRUE) \ \ @@ -79,10 +79,20 @@ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ /* Fixed Array statistics fields */ \ - + (h)->sizeof_size /* # of elements in the fixed array */ \ + + (sizeof_size) /* # of elements in the fixed array */ \ \ /* Fixed Array Header specific fields */ \ - + (h)->sizeof_addr /* File address of Fixed Array data block */ \ + + (sizeof_addr) /* File address of Fixed Array data block */ \ + ) + +/* Size of the fixed array header on disk (via file pointer) */ +#define H5FA_HEADER_SIZE_FILE(f) ( \ + H5FA_HEADER_SIZE(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) \ + ) + +/* Size of the fixed array header on disk (via fixed array header) */ +#define H5FA_HEADER_SIZE_HDR(h) ( \ + H5FA_HEADER_SIZE((h)->sizeof_addr, (h)->sizeof_size) \ ) /* Size of the Fixed Array data block prefix on disk */ @@ -108,9 +118,9 @@ ) /* Size of the Fixed Array data block page on disk */ -#define H5FA_DBLK_PAGE_SIZE(d, nelmts) ( \ +#define H5FA_DBLK_PAGE_SIZE(h, nelmts) ( \ /* Fixed Array Data Block Page */ \ - + (nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block page */ \ + + (nelmts * (size_t)(h)->cparam.raw_elmt_size) /* Elements in data block page */ \ + H5FA_SIZEOF_CHKSUM /* Checksum for each page */ \ ) @@ -605,7 +605,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Set immutable free list parameters */ - fspace->nclasses = nclasses; + H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t); if(nclasses > 0) { if(NULL == (fspace->sect_cls = H5FL_SEQ_MALLOC(H5FS_section_class_t, nclasses))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section class array") diff --git a/src/H5Fint.c b/src/H5Fint.c index 775c91f..e012ba6 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2049,3 +2049,66 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_get_file_image() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__set_base_addr + * + * Purpose: Quick and dirty routine to set the file's 'base_addr' value + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * July 19, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_base_addr(const H5F_t *f, haddr_t addr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + HDassert(f); + HDassert(f->shared); + + /* Dispatch to driver */ + if(H5FD_set_base_addr(f->shared->lf, addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_base_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5F__set_eoa + * + * Purpose: Quick and dirty routine to set the file's 'eoa' value + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * July 19, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + HDassert(f); + HDassert(f->shared); + + /* Dispatch to driver */ + if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_eoa() */ + diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index a645fd3..9f70e12 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -89,34 +89,34 @@ + 1 /* reserved */ \ + 4 /* group leaf k, group internal k */ \ + 4) /* consistency flags */ -#define H5F_SUPERBLOCK_VARLEN_SIZE_V0(f) \ +#define H5F_SUPERBLOCK_VARLEN_SIZE_V0(sizeof_addr, sizeof_size) \ ( H5F_SUPERBLOCK_VARLEN_SIZE_COMMON /* Common variable-length info */ \ - + H5F_SIZEOF_ADDR(f) /* base address */ \ - + H5F_SIZEOF_ADDR(f) /* <unused> */ \ - + H5F_SIZEOF_ADDR(f) /* EOF address */ \ - + H5F_SIZEOF_ADDR(f) /* driver block address */ \ - + H5G_SIZEOF_ENTRY(f)) /* root group ptr */ -#define H5F_SUPERBLOCK_VARLEN_SIZE_V1(f) \ + + (sizeof_addr) /* base address */ \ + + (sizeof_addr) /* <unused> */ \ + + (sizeof_addr) /* EOF address */ \ + + (sizeof_addr) /* driver block address */ \ + + H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size)) /* root group ptr */ +#define H5F_SUPERBLOCK_VARLEN_SIZE_V1(sizeof_addr, sizeof_size) \ ( H5F_SUPERBLOCK_VARLEN_SIZE_COMMON /* Common variable-length info */ \ + 2 /* indexed B-tree internal k */ \ + 2 /* reserved */ \ - + H5F_SIZEOF_ADDR(f) /* base address */ \ - + H5F_SIZEOF_ADDR(f) /* <unused> */ \ - + H5F_SIZEOF_ADDR(f) /* EOF address */ \ - + H5F_SIZEOF_ADDR(f) /* driver block address */ \ - + H5G_SIZEOF_ENTRY(f)) /* root group ptr */ -#define H5F_SUPERBLOCK_VARLEN_SIZE_V2(f) \ + + (sizeof_addr) /* base address */ \ + + (sizeof_addr) /* <unused> */ \ + + (sizeof_addr) /* EOF address */ \ + + (sizeof_addr) /* driver block address */ \ + + H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size)) /* root group ptr */ +#define H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr) \ ( 2 /* size of address, size of lengths */ \ + 1 /* consistency flags */ \ - + H5F_SIZEOF_ADDR(f) /* base address */ \ - + H5F_SIZEOF_ADDR(f) /* superblock extension address */ \ - + H5F_SIZEOF_ADDR(f) /* EOF address */ \ - + H5F_SIZEOF_ADDR(f) /* root group object header address */ \ + + (sizeof_addr) /* base address */ \ + + (sizeof_addr) /* superblock extension address */ \ + + (sizeof_addr) /* EOF address */ \ + + (sizeof_addr) /* root group object header address */ \ + H5F_SIZEOF_CHKSUM) /* superblock checksum (keep this last) */ #define H5F_SUPERBLOCK_VARLEN_SIZE(v, f) ( \ - (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(f) : 0) \ - + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(f) : 0) \ - + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(f) : 0)) + (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) : 0) \ + + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) : 0) \ + + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(H5F_SIZEOF_ADDR(f)) : 0)) /* Total size of superblock, depends on superblock version */ #define H5F_SUPERBLOCK_SIZE(v, f) ( H5F_SUPERBLOCK_FIXED_SIZE \ @@ -340,6 +340,10 @@ H5_DLL herr_t H5F_efc_release(H5F_efc_t *efc); H5_DLL herr_t H5F_efc_destroy(H5F_efc_t *efc); H5_DLL herr_t H5F_efc_try_close(H5F_t *f); +/* Functions that get/retrieve values from VFD layer */ +H5_DLL herr_t H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr); +H5_DLL herr_t H5F__set_base_addr(const H5F_t *f, haddr_t addr); + /* Testing functions */ #ifdef H5F_TESTING H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 9a5bfb3..36d7429 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -394,13 +394,13 @@ */ #if (H5_SIZEOF_SIZE_T >= H5_SIZEOF_OFF_T) # define H5F_OVERFLOW_SIZET2OFFT(X) \ - ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(off_t)-1))) + ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_SIZET2OFFT(X) 0 #endif #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T) # define H5F_OVERFLOW_HSIZET2OFFT(X) \ - ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(off_t)-1))) + ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(HDoff_t)-1))) #else # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 #endif diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 6db631e..166247a 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -279,7 +279,7 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) /* Check for userblock present */ if(H5F_addr_gt(super_addr, 0)) { /* Set the base address for the file in the VFD now */ - if(H5FD_set_base_addr(f->shared->lf, super_addr) < 0) + if(H5F__set_base_addr(f, super_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver") } /* end if */ @@ -418,13 +418,13 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) sblock->status_flags = 0; /* Reserve space for the userblock */ - if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, userblock_size) < 0) + if(H5F__set_eoa(f, H5FD_MEM_SUPER, userblock_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for userblock") /* Set the base address for the file in the VFD now, after allocating * space for userblock. */ - if(H5FD_set_base_addr(f->shared->lf, sblock->base_addr) < 0) + if(H5F__set_base_addr(f, sblock->base_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set base address for file driver") /* Save a local copy of the superblock version number */ @@ -455,7 +455,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) superblock_size += driver_size; /* Reserve space in the file for the superblock, instead of allocating it */ - if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, superblock_size) < 0) + if(H5F__set_eoa(f, H5FD_MEM_SUPER, superblock_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock") /* Insert superblock into cache, pinned */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 2cef9f7..3f243de 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -173,7 +173,7 @@ H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") } /* end switch */ - *pp = p_ret + H5G_SIZEOF_ENTRY(f); + *pp = p_ret + H5G_SIZEOF_ENTRY_FILE(f); done: FUNC_LEAVE_NOAPI(ret_value) @@ -240,7 +240,7 @@ done: herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) { - uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f); + uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY_FILE(f); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b194adb..7346b41 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -55,7 +55,7 @@ + 2 /* Number of symbols */ \ \ /* Entries */ \ - + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)) \ + + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY_FILE(f)) \ ) diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 50f8bda..130c742 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -47,12 +47,14 @@ * The disk size for a symbol table entry... */ #define H5G_SIZEOF_SCRATCH 16 -#define H5G_SIZEOF_ENTRY(F) \ - (H5F_SIZEOF_SIZE(F) + /*offset of name into heap */ \ - H5F_SIZEOF_ADDR(F) + /*address of object header */ \ +#define H5G_SIZEOF_ENTRY(sizeof_addr, sizeof_size) \ + ((sizeof_size) + /*offset of name into heap */ \ + (sizeof_addr) + /*address of object header */ \ 4 + /*entry type */ \ 4 + /*reserved */ \ H5G_SIZEOF_SCRATCH) /*scratch pad space */ +#define H5G_SIZEOF_ENTRY_FILE(F) \ + H5G_SIZEOF_ENTRY(H5F_SIZEOF_ADDR(F), H5F_SIZEOF_SIZE(F)) /* ========= Group Creation properties ============ */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 9f8dfd9..07e5b36 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -262,6 +262,10 @@ H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__dtable_encode() */ +/**************************************************/ +/* metadata cache callback definitions for header */ +/**************************************************/ + /*------------------------------------------------------------------------- * Function: H5HF_cache_hdr_load @@ -379,8 +383,8 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Compute the size of the extra filter information */ filter_info_size = (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */ - + (unsigned)4 /* Size of filter mask for filtered root direct block */ - + hdr->filter_len); /* Size of encoded I/O filter info */ + + (unsigned)4 /* Size of filter mask for filtered root direct block */ + + hdr->filter_len); /* Size of encoded I/O filter info */ /* Compute the heap header's size */ hdr->heap_size = size + filter_info_size; @@ -724,6 +728,10 @@ H5HF_cache_hdr_size(const H5F_t H5_ATTR_UNUSED *f, const H5HF_hdr_t *hdr, size_t FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_cache_hdr_size() */ +/***********************************************************/ +/* metadata cache callback definitions for indirect blocks */ +/***********************************************************/ + /*------------------------------------------------------------------------- * Function: H5HF_cache_iblock_load @@ -1366,6 +1374,10 @@ H5HF_cache_iblock_size(const H5F_t H5_ATTR_UNUSED *f, const H5HF_indirect_t *ibl FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_cache_iblock_size() */ +/*********************************************************/ +/* metadata cache callback definitions for direct blocks */ +/*********************************************************/ + /*------------------------------------------------------------------------- * Function: H5HF_cache_dblock_load diff --git a/src/H5HGcache.c b/src/H5HGcache.c index f1b5fc6..aac73ed 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -129,10 +129,10 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) /* Read the initial 4k page */ if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, (size_t)H5HG_MINSIZE))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(H5F_block_read(f, H5FD_MEM_GHEAP, addr, (size_t)H5HG_MINSIZE, dxpl_id, heap->chunk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection") p = heap->chunk; @@ -260,7 +260,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) done: if(!ret_value && heap) if(H5HG_free(heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG_load() */ @@ -367,11 +367,11 @@ done: static herr_t H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - /* Check arguments */ + /* Sanity checks */ HDassert(heap); /* Mark heap as clean */ @@ -565,7 +565,7 @@ HDfprintf(stderr, "%s: size = %Hu\n", FUNC, size); HDassert(size > 0); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed") /* Compute value to return */ @@ -598,7 +598,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, +H5MF_xfree(const H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, hsize_t size) { H5F_io_info_t fio_info; /* I/O info for operation */ @@ -862,7 +862,7 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si HDassert(f->shared->lf); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* Retrieve metadata aggregator info, if available */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index d6fc5ce..3a664ef 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -238,7 +238,7 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); HDassert(stream); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); @@ -265,7 +265,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[type] || type == f->shared->fs_type_map[type]) { /* Retrieve the 'eoa' for this file memory type */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, 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:", diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index ad5e385..024cc91 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -67,7 +67,7 @@ H5_DLL herr_t H5MF_close(H5F_t *f, hid_t dxpl_id); /* File space allocation routines */ 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(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +H5_DLL herr_t H5MF_xfree(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, 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); diff --git a/src/H5MFsection.c b/src/H5MFsection.c index bc147ed..20b9984 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -310,7 +310,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) HDassert(udata->f); /* Retrieve the end of the file's address space */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type))) + if(HADDR_UNDEF == (eoa = H5F_get_eoa(udata->f, udata->alloc_type))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* Compute address of end of section to check */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 3707367..cc262a0 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -35,6 +35,7 @@ #include "H5Spublic.h" /* Dataspace functions */ /* Private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ #include "H5SLprivate.h" /* Skip lists */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 79726e1..6b3d4ac 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2698,8 +2698,8 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_DOUBLE(*pp, config->empty_reserve); - /* int */ - INT32ENCODE(*pp, (int32_t)config->dirty_bytes_threshold); + /* unsigned */ + UINT32ENCODE(*pp, (uint32_t)config->dirty_bytes_threshold); /* int */ INT32ENCODE(*pp, (int32_t)config->metadata_write_strategy); @@ -2850,8 +2850,8 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) H5_DECODE_DOUBLE(*pp, config->empty_reserve); - /* int */ - INT32DECODE(*pp, config->dirty_bytes_threshold); + /* unsigned */ + UINT32DECODE(*pp, config->dirty_bytes_threshold); /* int */ INT32DECODE(*pp, config->metadata_write_strategy); diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 98b5213..eaeb889 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -130,13 +130,13 @@ static H5SM_master_table_t * H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void H5_ATTR_UNUSED *udata) { H5SM_master_table_t *table = NULL; - H5WB_t *wb = NULL; /* Wrapped buffer for table data */ + H5WB_t *wb = NULL; /* Wrapped buffer for table data */ uint8_t tbl_buf[H5SM_TBL_BUF_SIZE]; /* Buffer for table */ - uint8_t *buf; /* Reading buffer */ - const uint8_t *p; /* Pointer into input buffer */ - uint32_t stored_chksum; /* Stored metadata checksum value */ - uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t x; /* Counter variable for index headers */ + uint8_t *buf; /* Reading buffer */ + const uint8_t *p; /* Pointer into input buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + size_t u; /* Counter variable for index headers */ H5SM_master_table_t *ret_value; FUNC_ENTER_NOAPI_NOINIT @@ -187,37 +187,37 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void H5_ATTR_UNUSED *udat HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes") /* Read in the index headers */ - for(x = 0; x < table->num_indexes; ++x) { + for(u = 0; u < table->num_indexes; ++u) { /* Verify correct version of index list */ if(H5SM_LIST_VERSION != *p++) HGOTO_ERROR(H5E_SOHM, H5E_VERSION, NULL, "bad shared message list version number") /* Type of the index (list or B-tree) */ - table->indexes[x].index_type= (H5SM_index_type_t)*p++; + table->indexes[u].index_type= (H5SM_index_type_t)*p++; /* Type of messages in the index */ - UINT16DECODE(p, table->indexes[x].mesg_types); + UINT16DECODE(p, table->indexes[u].mesg_types); /* Minimum size of message to share */ - UINT32DECODE(p, table->indexes[x].min_mesg_size); + UINT32DECODE(p, table->indexes[u].min_mesg_size); /* List cutoff; fewer than this number and index becomes a list */ - UINT16DECODE(p, table->indexes[x].list_max); + UINT16DECODE(p, table->indexes[u].list_max); /* B-tree cutoff; more than this number and index becomes a B-tree */ - UINT16DECODE(p, table->indexes[x].btree_min); + UINT16DECODE(p, table->indexes[u].btree_min); /* Number of messages shared */ - UINT16DECODE(p, table->indexes[x].num_messages); + UINT16DECODE(p, table->indexes[u].num_messages); /* Address of the actual index */ - H5F_addr_decode(f, &p, &(table->indexes[x].index_addr)); + H5F_addr_decode(f, &p, &(table->indexes[u].index_addr)); /* Address of the index's heap */ - H5F_addr_decode(f, &p, &(table->indexes[x].heap_addr)); + H5F_addr_decode(f, &p, &(table->indexes[u].heap_addr)); /* Compute the size of a list index for this SOHM index */ - table->indexes[x].list_size = H5SM_LIST_SIZE(f, table->indexes[x].list_max); + table->indexes[u].list_size = H5SM_LIST_SIZE(f, table->indexes[u].list_max); } /* end for */ /* Read in checksum */ @@ -279,7 +279,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma uint8_t *buf; /* Temporary buffer */ uint8_t *p; /* Pointer into raw data buffer */ uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t x; /* Counter variable */ + size_t u; /* Counter variable */ /* Verify that we're writing version 0 of the table; this is the only * version defined so far. @@ -302,33 +302,33 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma p += H5_SIZEOF_MAGIC; /* Encode each index header */ - for(x = 0; x < table->num_indexes; ++x) { - /* Version for this list. */ + for(u = 0; u < table->num_indexes; ++u) { + /* Version for this list */ *p++ = H5SM_LIST_VERSION; /* Is message index a list or a B-tree? */ - *p++ = table->indexes[x].index_type; + *p++ = table->indexes[u].index_type; /* Type of messages in the index */ - UINT16ENCODE(p, table->indexes[x].mesg_types); + UINT16ENCODE(p, table->indexes[u].mesg_types); /* Minimum size of message to share */ - UINT32ENCODE(p, table->indexes[x].min_mesg_size); + UINT32ENCODE(p, table->indexes[u].min_mesg_size); /* List cutoff; fewer than this number and index becomes a list */ - UINT16ENCODE(p, table->indexes[x].list_max); + UINT16ENCODE(p, table->indexes[u].list_max); /* B-tree cutoff; more than this number and index becomes a B-tree */ - UINT16ENCODE(p, table->indexes[x].btree_min); + UINT16ENCODE(p, table->indexes[u].btree_min); /* Number of messages shared */ - UINT16ENCODE(p, table->indexes[x].num_messages); + UINT16ENCODE(p, table->indexes[u].num_messages); /* Address of the actual index */ - H5F_addr_encode(f, &p, table->indexes[x].index_addr); + H5F_addr_encode(f, &p, table->indexes[u].index_addr); /* Address of the index's heap */ - H5F_addr_encode(f, &p, table->indexes[x].heap_addr); + H5F_addr_encode(f, &p, table->indexes[u].heap_addr); } /* end for */ /* Compute checksum on buffer */ @@ -477,7 +477,7 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) uint8_t *p; /* Pointer into input buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t x; /* Counter variable for messages in list */ + size_t u; /* Counter variable for messages in list */ H5SM_list_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -517,8 +517,8 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Read messages into the list array */ ctx.sizeof_addr = H5F_SIZEOF_ADDR(udata->f); - for(x = 0; x < udata->header->num_messages; x++) { - if(H5SM_message_decode(p, &(list->messages[x]), &ctx) < 0) + for(u = 0; u < udata->header->num_messages; u++) { + if(H5SM_message_decode(p, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message") p += H5SM_SOHM_ENTRY_SIZE(udata->f); } /* end for */ @@ -537,8 +537,8 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, NULL, "incorrect metadata checksum for shared message list") /* Initialize the rest of the array */ - for(x = udata->header->num_messages; x < udata->header->list_max; x++) - list->messages[x].location = H5SM_NO_LOC; + for(u = udata->header->num_messages; u < udata->header->list_max; u++) + list->messages[u].location = H5SM_NO_LOC; /* Set return value */ ret_value = list; @@ -590,7 +590,7 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis uint8_t *p; /* Pointer into raw data buffer */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t mesgs_written; /* Number of messages written to list */ - size_t x; /* Local index variable */ + size_t u; /* Local index variable */ /* Wrap the local buffer for serialized list index info */ if(NULL == (wb = H5WB_wrap(lst_buf, sizeof(lst_buf)))) @@ -610,9 +610,9 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis /* Write messages from the messages array to disk */ mesgs_written = 0; ctx.sizeof_addr = H5F_SIZEOF_ADDR(f); - for(x = 0; x < list->header->list_max && mesgs_written < list->header->num_messages; x++) { - if(list->messages[x].location != H5SM_NO_LOC) { - if(H5SM_message_encode(p, &(list->messages[x]), &ctx) < 0) + for(u = 0; u < list->header->list_max && mesgs_written < list->header->num_messages; u++) { + if(list->messages[u].location != H5SM_NO_LOC) { + if(H5SM_message_encode(p, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to write shared message to disk") p += H5SM_SOHM_ENTRY_SIZE(f); diff --git a/test/cache.c b/test/cache.c index 8d6076a..9bf225e 100644 --- a/test/cache.c +++ b/test/cache.c @@ -271,7 +271,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -289,7 +289,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* file_ptr */ file_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -307,7 +307,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -336,7 +336,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* file_ptr */ file_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -360,7 +360,7 @@ smoke_check_1(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* file_ptr */ file_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -456,7 +456,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -474,7 +474,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* file_ptr */ file_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -492,7 +492,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -521,7 +521,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* file_ptr */ file_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -545,7 +545,7 @@ smoke_check_2(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* file_ptr */ file_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -640,7 +640,7 @@ smoke_check_3(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -825,7 +825,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -843,7 +843,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_backward(/* file_ptr */ file_ptr, + row_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -861,7 +861,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - row_major_scan_forward(/* file_ptr */ file_ptr, + row_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -890,7 +890,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_forward(/* file_ptr */ file_ptr, + col_major_scan_forward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -914,7 +914,7 @@ smoke_check_4(void) HDfprintf(stdout, "%s() - %0d -- pass = %d\n", fcn_name, mile_stone++, (int)pass); - col_major_scan_backward(/* file_ptr */ file_ptr, + col_major_scan_backward(/* file_ptr */ file_ptr, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -13206,8 +13206,8 @@ check_expunge_entry(void) */ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, + &is_pinned, NULL, NULL); if ( result < 0 ) { diff --git a/test/cache_common.c b/test/cache_common.c index cce87a9..12001b2 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -19,7 +19,6 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ -#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */ #include "h5test.h" #include "H5Cprivate.h" #include "H5Iprivate.h" @@ -799,7 +798,6 @@ notify_dest(H5F_t * f, void * thing) * *------------------------------------------------------------------------- */ - herr_t flush(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, @@ -871,7 +869,6 @@ flush(H5F_t *f, } return(SUCCEED); - } /* flush() */ herr_t @@ -962,7 +959,6 @@ notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, return(flush(f, dxpl_id, dest, addr, thing, flags_ptr)); } - /*------------------------------------------------------------------------- * Function: load & friends @@ -1108,7 +1104,6 @@ notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) * *------------------------------------------------------------------------- */ - herr_t size(H5F_t H5_ATTR_UNUSED * f, void * thing, @@ -1134,7 +1129,6 @@ size(H5F_t H5_ATTR_UNUSED * f, *size_ptr = entry_ptr->size; return(SUCCEED); - } /* size() */ herr_t diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 91c1113..02792b1 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -31,6 +31,7 @@ #include "H5Iprivate.h" +#define BASE_ADDR (haddr_t)512 int nerrors = 0; @@ -767,7 +768,7 @@ init_data(void) 1974, 3194, 5168, 8362, 13539}; int i; int j = 0; - haddr_t addr = 512; + haddr_t addr = BASE_ADDR; /* this must hold so moves don't change entry size. */ HDassert( (NUM_DATA_ENTRIES / 2) % 20 == 0 ); @@ -4709,7 +4710,7 @@ verify_total_writes(int expected_total_writes) * Updated for the new local_len field in datum. * *****************************************************************************/ -void +static void unlock_entry(H5F_t * file_ptr, int32_t idx, unsigned int flags) |