summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5AC.c95
-rw-r--r--src/H5ACmpio.c83
-rw-r--r--src/H5C.c28
-rw-r--r--src/H5Cpkg.h2
-rw-r--r--src/H5Cprivate.h101
5 files changed, 172 insertions, 137 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 41ec720..7b500fa 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -32,7 +32,7 @@
/****************/
#define H5AC_PACKAGE /*suppress error about including H5ACpkg */
-#define H5C_PACKAGE /*suppress error about including H5Cpkg */
+#define H5C_PACKAGE /*suppress error about including H5Cpkg */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
/* Interface initialization */
@@ -43,7 +43,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cpkg.h" /* Cache */
+#include "H5Cpkg.h" /* Cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files */
#include "H5FDprivate.h" /* File drivers */
@@ -505,7 +505,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
}
#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);
@@ -885,7 +885,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")
@@ -957,19 +957,20 @@ H5AC_mark_entry_dirty(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
-
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
-
/* Check if log messages are being emitted */
if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_aux_t *aux_ptr;
+
+ 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")
+}
#endif /* H5_HAVE_PARALLEL */
if(H5C_mark_entry_dirty(thing) < 0)
@@ -1045,7 +1046,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 */
@@ -1392,9 +1393,14 @@ H5AC_resize_entry(void *thing, size_t new_size)
HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry")
#ifdef H5_HAVE_PARALLEL
- if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr))
+{
+ H5AC_aux_t *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")
+}
#endif /* H5_HAVE_PARALLEL */
done:
@@ -1651,7 +1657,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")
@@ -1775,14 +1781,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)
@@ -1822,16 +1832,20 @@ 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 */
config_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD;
- config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
+ config_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY;
#ifdef H5_HAVE_PARALLEL
} /* end else */
+}
#endif /* H5_HAVE_PARALLEL */
done:
@@ -1963,13 +1977,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)
@@ -2004,12 +2022,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:
@@ -2208,9 +2230,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)
@@ -2228,8 +2247,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)
@@ -2240,6 +2262,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);
@@ -2408,7 +2431,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 367d6ef..6912f33 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 */
@@ -39,11 +38,11 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cpkg.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Cprivate.h" /* Cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
#include "H5MMprivate.h" /* Memory management */
#ifdef H5_HAVE_PARALLEL
@@ -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 2b3dbc3..3dcb008 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1988,6 +1988,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 9c979f7..0a27275 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -48,8 +48,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 29
-#define H5C__PREFIX_LEN 32
/* Initial allocated size of the "flush_dep_parent" array */
#define H5C_FLUSH_DEP_PARENT_INIT 8
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index ab44d96..10ea344 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 29
+#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.
@@ -254,11 +210,61 @@
#define H5C_TAG_SIZE sizeof(H5C_tag_t)
#define H5C_TAG_DEF {(haddr_t)0, H5C_GLOBALITY_NONE}
+/* 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 */
+
/* Cork actions: cork/uncork/get cork status of an object */
#define H5C__SET_CORK 0x1
#define H5C__UNCORK 0x2
#define H5C__GET_CORKED 0x4
+/* 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 */
/****************************/
@@ -1998,6 +2004,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_corked_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,