From 1a5c36ce7ec09d48c4be4337c12e480809ec0700 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 29 Jun 2015 17:17:24 -0500 Subject: [svn-r27298] Description: Separate H5AC layer from using package-scoped pieces of the H5C layer, moving from including H5Cpkg.h to H5Cprivate.h. Tested on: MacOSX/64 10.10.3 (amazon) w/serial, parallel & production Linux/32 2.6.x (jam) w/serial & parallel --- src/H5AC.c | 88 ++++++++++++++++++++++++++++-------------------- src/H5ACmpio.c | 75 +++++++++++++++-------------------------- src/H5C.c | 28 ++++++++++++++++ src/H5Cpkg.h | 2 -- src/H5Cprivate.h | 100 +++++++++++++++++++++++++++++-------------------------- 5 files changed, 159 insertions(+), 134 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index ff0ef51..a94a727 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -32,7 +32,6 @@ /****************/ #define H5AC_PACKAGE /*suppress error about including H5ACpkg */ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Interface initialization */ @@ -43,7 +42,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACpkg.h" /* Metadata cache */ -#include "H5Cpkg.h" /* Cache */ +#include "H5Cprivate.h" /* Cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5FDprivate.h" /* File drivers */ @@ -488,7 +487,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL - aux_ptr = (struct H5AC_aux_t *)(f->shared->cache->aux_ptr); + aux_ptr = H5C_get_aux_ptr(f->shared->cache); if(aux_ptr) /* Sanity check */ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -776,7 +775,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add { H5AC_aux_t *aux_ptr; - if(NULL != (aux_ptr = (H5AC_aux_t *)f->shared->cache->aux_ptr)) { + if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) { /* Log the new entry */ if(H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed") @@ -840,12 +839,11 @@ H5AC_mark_entry_dirty(void *thing) { H5AC_info_t *entry_ptr = (H5AC_info_t *)thing; H5C_t *cache_ptr = entry_ptr->cache_ptr; + H5AC_aux_t *aux_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - + aux_ptr = H5C_get_aux_ptr(cache_ptr); if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && - (entry_ptr->is_pinned) && (NULL != cache_ptr->aux_ptr)) + (entry_ptr->is_pinned) && (NULL != aux_ptr)) if(H5AC__log_dirtied_entry(entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") } @@ -912,7 +910,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL /* Log moving the entry */ - if(NULL != (aux_ptr = (H5AC_aux_t *)f->shared->cache->aux_ptr)) + if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) if(H5AC__log_moved_entry(f, old_addr, new_addr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry") #endif /* H5_HAVE_PARALLEL */ @@ -1172,11 +1170,10 @@ H5AC_resize_entry(void *thing, size_t new_size) { H5AC_info_t * entry_ptr = (H5AC_info_t *)thing; H5C_t *cache_ptr = entry_ptr->cache_ptr; + H5AC_aux_t *aux_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) + aux_ptr = H5C_get_aux_ptr(cache_ptr); + if((!entry_ptr->is_dirty) && (NULL != aux_ptr)) if(H5AC__log_dirtied_entry(entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") } @@ -1384,7 +1381,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } /* end if */ #ifdef H5_HAVE_PARALLEL - if(NULL != (aux_ptr = (H5AC_aux_t *)f->shared->cache->aux_ptr)) { + if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) { if(dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE) if(H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") @@ -1502,14 +1499,18 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, FUNC_ENTER_NOAPI(FAIL) /* Check args */ - if((cache_ptr == NULL) || + if((cache_ptr == NULL) || (config_ptr == NULL) || + (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry.") #ifdef H5_HAVE_PARALLEL - ((cache_ptr->aux_ptr != NULL) && - (((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic != H5AC__H5AC_AUX_T_MAGIC)) - || +{ + H5AC_aux_t *aux_ptr; + + aux_ptr = H5C_get_aux_ptr(cache_ptr); + if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry.") +} #endif /* H5_HAVE_PARALLEL */ - (config_ptr == NULL) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry.") /* Retrieve the configuration */ if(H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config) < 0) @@ -1549,9 +1550,12 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, config_ptr->apply_empty_reserve = internal_config.apply_empty_reserve; config_ptr->empty_reserve = internal_config.empty_reserve; #ifdef H5_HAVE_PARALLEL - if(cache_ptr->aux_ptr != NULL) { - config_ptr->dirty_bytes_threshold = ((H5AC_aux_t *)(cache_ptr->aux_ptr))->dirty_bytes_threshold; - config_ptr->metadata_write_strategy = ((H5AC_aux_t *)(cache_ptr->aux_ptr))->metadata_write_strategy; +{ + H5AC_aux_t *aux_ptr; + + if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) { + config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold; + config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy; } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ @@ -1559,6 +1563,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY; #ifdef H5_HAVE_PARALLEL } /* end else */ +} #endif /* H5_HAVE_PARALLEL */ done: @@ -1684,13 +1689,17 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config trace_config = *config_ptr; #endif /* H5AC__TRACE_FILE_ENABLED */ - if((cache_ptr == NULL) + if(cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") #ifdef H5_HAVE_PARALLEL - || ((cache_ptr->aux_ptr != NULL) && - (((H5AC_aux_t *)(cache_ptr->aux_ptr))->magic != H5AC__H5AC_AUX_T_MAGIC)) +{ + H5AC_aux_t *aux_ptr; + + aux_ptr = H5C_get_aux_ptr(cache_ptr); + if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry.") +} #endif /* H5_HAVE_PARALLEL */ - ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") /* Validate external configuration */ if(H5AC_validate_config(config_ptr) != SUCCEED) @@ -1725,12 +1734,16 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.") #ifdef H5_HAVE_PARALLEL +{ + H5AC_aux_t *aux_ptr; + /* Set parallel configuration values */ /* (Which are only held in the H5AC layer -QAK) */ - if(cache_ptr->aux_ptr != NULL) { - ((H5AC_aux_t *)(cache_ptr->aux_ptr))->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold; - ((H5AC_aux_t *)(cache_ptr->aux_ptr))->metadata_write_strategy = config_ptr->metadata_write_strategy; + if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) { + aux_ptr->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold; + aux_ptr->metadata_write_strategy = config_ptr->metadata_write_strategy; } /* end if */ +} #endif /* H5_HAVE_PARALLEL */ done: @@ -1921,9 +1934,6 @@ H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name) { char file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 2]; FILE * file_ptr = NULL; -#ifdef H5_HAVE_PARALLEL - H5AC_aux_t * aux_ptr = NULL; -#endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1941,8 +1951,11 @@ H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name) HGOTO_ERROR(H5E_CACHE, H5E_FILEOPEN, FAIL, "trace file already open.") #ifdef H5_HAVE_PARALLEL - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); - if(cache_ptr->aux_ptr == NULL) +{ + H5AC_aux_t * aux_ptr; + + aux_ptr = H5C_get_aux_ptr(cache_ptr); + if(aux_ptr == NULL) sprintf(file_name, "%s", trace_file_name); else { if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC) @@ -1953,6 +1966,7 @@ H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name) if(HDstrlen(file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cooked trace file name too long.") +} #else /* H5_HAVE_PARALLEL */ HDsnprintf(file_name, (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1), "%s", trace_file_name); @@ -2121,7 +2135,7 @@ H5_ATTR_UNUSED HDassert(f != NULL); HDassert(f->shared != NULL); HDassert(f->shared->cache != NULL); - aux_ptr = (H5AC_aux_t *)(f->shared->cache->aux_ptr); + aux_ptr = H5C_get_aux_ptr(f->shared->cache); if(aux_ptr != NULL) { HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 64c27ab..6c2b924 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -30,7 +30,6 @@ /****************/ #define H5AC_PACKAGE /*suppress error about including H5ACpkg */ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Interface initialization */ @@ -41,7 +40,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACpkg.h" /* Metadata cache */ -#include "H5Cpkg.h" /* Cache */ +#include "H5Cprivate.h" /* Cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5MMprivate.h" /* Memory management */ @@ -188,8 +187,8 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(cache_ptr && (cache_ptr->magic == H5C__H5C_T_MAGIC)); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + HDassert(cache_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -221,10 +220,10 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(cache_ptr && (cache_ptr->magic == H5C__H5C_T_MAGIC)); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); - HDassert( aux_ptr != NULL ); - HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); + HDassert(cache_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); + HDassert(aux_ptr != NULL); + HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); aux_ptr->write_done = write_done; @@ -261,8 +260,7 @@ H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr) /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -326,8 +324,7 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -459,8 +456,7 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr; + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -542,7 +538,6 @@ H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -658,8 +653,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, int *num_entries_pt /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -735,8 +729,7 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) addr = entry_ptr->addr; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -792,8 +785,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) HDassert(entry_ptr->is_dirty == FALSE); cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -876,8 +868,7 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, /* Sanity check */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -945,8 +936,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) HDassert(entry_ptr); cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -1049,8 +1039,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) HDassert(f->shared); cache_ptr = (H5AC_t *)f->shared->cache; HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -1228,8 +1217,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1393,8 +1381,7 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -1519,8 +1506,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); @@ -1580,8 +1566,7 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, int *num_entries_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); @@ -1665,8 +1650,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1806,8 +1790,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1882,8 +1865,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -1985,8 +1967,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -2095,8 +2076,7 @@ H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || @@ -2220,8 +2200,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, /* Sanity checks */ HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); + aux_ptr = H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -2284,7 +2263,7 @@ H5AC__flush_entries(H5F_t *f, hid_t dxpl_id) HDassert(f->shared->cache); /* Check if we have >1 ranks */ - if(f->shared->cache->aux_ptr) + if(H5C_get_aux_ptr(f->shared->cache)) if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") diff --git a/src/H5C.c b/src/H5C.c index a60e519..c478173 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1924,6 +1924,34 @@ done: /*------------------------------------------------------------------------- + * Function: H5C_get_aux_ptr + * + * Purpose: Get the aux_ptr field from the cache. + * + * This field will either be NULL (when accessing a file serially) + * or contains a pointer to the auxiliary info for parallel I/O. + * + * Return: NULL/non-NULL (can't fail) + * + * Programmer: Quincey Koziol + * 6/29/15 + * + *------------------------------------------------------------------------- + */ +void * +H5C_get_aux_ptr(const H5C_t *cache_ptr) +{ + FUNC_ENTER_NOAPI_NOERR + + /* Check arguments */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + + FUNC_LEAVE_NOAPI(cache_ptr->aux_ptr) +} /* H5C_get_aux_ptr() */ + + +/*------------------------------------------------------------------------- * Function: H5C_get_trace_file_ptr * * Purpose: Get the trace_file_ptr field from the cache. diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 814387b..7d9d0f9 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -60,8 +60,6 @@ /* Cache configuration settings */ #define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */ #define H5C__H5C_T_MAGIC 0x005CAC0E -#define H5C__MAX_NUM_TYPE_IDS 28 -#define H5C__PREFIX_LEN 32 /**************************************************************************** * diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5b152c8..3cd74c1 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -40,30 +40,9 @@ /* Library Private Macros */ /**************************/ -#ifndef NDEBUG -#define H5C_DO_SANITY_CHECKS 1 -#define H5C_DO_SLIST_SANITY_CHECKS 0 -#define H5C_DO_TAGGING_SANITY_CHECKS 1 -#define H5C_DO_EXTREME_SANITY_CHECKS 0 -#else /* NDEBUG */ -/* With rare execptions, the following defines should be set - * to 0 if NDEBUG is defined - */ -#define H5C_DO_SANITY_CHECKS 0 -#define H5C_DO_SLIST_SANITY_CHECKS 0 -#define H5C_DO_TAGGING_SANITY_CHECKS 0 -#define H5C_DO_EXTREME_SANITY_CHECKS 0 -#endif /* NDEBUG */ - -/* Note: The memory sanity checks aren't going to work until I/O filters are - * changed to call a particular alloc/free routine for their buffers, - * because the H5AC__SERIALIZE_RESIZED_FLAG set by the fractal heap - * direct block serialize callback calls H5Z_pipeline(). When the I/O - * filters are changed, then we should implement "cache image alloc/free" - * routines that the fractal heap direct block (and global heap) serialize - * calls can use when resizing (and re-allocating) their image in the - * cache. -QAK */ -#define H5C_DO_MEMORY_SANITY_CHECKS 0 +/* Cache configuration settings */ +#define H5C__MAX_NUM_TYPE_IDS 28 +#define H5C__PREFIX_LEN 32 /* This sanity checking constant was picked out of the air. Increase * or decrease it if appropriate. Its purposes is to detect corrupt @@ -73,29 +52,6 @@ */ #define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024)) -/* H5C_COLLECT_CACHE_STATS controls overall collection of statistics - * on cache activity. In general, this #define should be set to 1 in - * debug mode, and 0 in production mode.. - */ - -#ifndef NDEBUG -#define H5C_COLLECT_CACHE_STATS 1 -#else /* NDEBUG */ -#define H5C_COLLECT_CACHE_STATS 0 -#endif /* NDEBUG */ - -/* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics - * in individual cache entries. - * - * H5C_COLLECT_CACHE_ENTRY_STATS should only be defined to true if - * H5C_COLLECT_CACHE_STATS is also defined to true. - */ -#if H5C_COLLECT_CACHE_STATS -#define H5C_COLLECT_CACHE_ENTRY_STATS 1 -#else -#define H5C_COLLECT_CACHE_ENTRY_STATS 0 -#endif /* H5C_COLLECT_CACHE_STATS */ - #ifdef H5_HAVE_PARALLEL /* we must maintain the clean and dirty LRU lists when we are compiled * with parallel support. @@ -255,6 +211,55 @@ #define H5C__FLUSH_COLLECTIVELY_FLAG 0x4000 #define H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG 0x8000 +/* Debugging/sanity checking/statistics settings */ +#ifndef NDEBUG +#define H5C_DO_SANITY_CHECKS 1 +#define H5C_DO_SLIST_SANITY_CHECKS 0 +#define H5C_DO_TAGGING_SANITY_CHECKS 1 +#define H5C_DO_EXTREME_SANITY_CHECKS 0 +#else /* NDEBUG */ +/* With rare execptions, the following defines should be set + * to 0 if NDEBUG is defined + */ +#define H5C_DO_SANITY_CHECKS 0 +#define H5C_DO_SLIST_SANITY_CHECKS 0 +#define H5C_DO_TAGGING_SANITY_CHECKS 0 +#define H5C_DO_EXTREME_SANITY_CHECKS 0 +#endif /* NDEBUG */ + +/* Note: The memory sanity checks aren't going to work until I/O filters are + * changed to call a particular alloc/free routine for their buffers, + * because the H5AC__SERIALIZE_RESIZED_FLAG set by the fractal heap + * direct block serialize callback calls H5Z_pipeline(). When the I/O + * filters are changed, then we should implement "cache image alloc/free" + * routines that the fractal heap direct block (and global heap) serialize + * calls can use when resizing (and re-allocating) their image in the + * cache. -QAK */ +#define H5C_DO_MEMORY_SANITY_CHECKS 0 + +/* H5C_COLLECT_CACHE_STATS controls overall collection of statistics + * on cache activity. In general, this #define should be set to 1 in + * debug mode, and 0 in production mode.. + */ + +#ifndef NDEBUG +#define H5C_COLLECT_CACHE_STATS 1 +#else /* NDEBUG */ +#define H5C_COLLECT_CACHE_STATS 0 +#endif /* NDEBUG */ + +/* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics + * in individual cache entries. + * + * H5C_COLLECT_CACHE_ENTRY_STATS should only be defined to true if + * H5C_COLLECT_CACHE_STATS is also defined to true. + */ +#if H5C_COLLECT_CACHE_STATS +#define H5C_COLLECT_CACHE_ENTRY_STATS 1 +#else +#define H5C_COLLECT_CACHE_ENTRY_STATS 0 +#endif /* H5C_COLLECT_CACHE_STATS */ + /****************************/ /* Library Private Typedefs */ @@ -1881,6 +1886,7 @@ H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, hbool_t *is_protected_ptr, hbool_t *is_pinned_ptr, hbool_t *is_flush_dep_parent_ptr, hbool_t *is_flush_dep_child_ptr); H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr); +H5_DLL void * H5C_get_aux_ptr(const H5C_t *cache_ptr); H5_DLL FILE *H5C_get_trace_file_ptr(const H5C_t *cache_ptr); H5_DLL FILE *H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr); H5_DLL herr_t H5C_insert_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, -- cgit v0.12