summaryrefslogtreecommitdiffstats
path: root/src/H5AC.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-10-05 04:22:10 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-10-05 04:22:10 (GMT)
commit06e02a2a81090d518846e29f22f35f9fc2bfc961 (patch)
tree3a6046f503de763ae4800ff8f503dd1f364f2565 /src/H5AC.c
parent37c2195cfc2616f1bedb056eefbba12fabf35949 (diff)
downloadhdf5-06e02a2a81090d518846e29f22f35f9fc2bfc961.zip
hdf5-06e02a2a81090d518846e29f22f35f9fc2bfc961.tar.gz
hdf5-06e02a2a81090d518846e29f22f35f9fc2bfc961.tar.bz2
[svn-r27951] Merge of r27298 from the trunk
Description: Separate H5AC layer from using package-scoped pieces of the H5C layer, moving from including H5Cpkg.h to H5Cprivate.h. NOTE: H5AC still includes H5Cpkg.h since other code needs it. Tested on: Ubuntu 15.04 (Linux 3.19 x86_64), gcc 4.9.2, MPICH 3.1.4 parallel w/ fortran serial w/ fortran and C++
Diffstat (limited to 'src/H5AC.c')
-rw-r--r--src/H5AC.c95
1 files changed, 59 insertions, 36 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);