summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c201
1 files changed, 47 insertions, 154 deletions
diff --git a/src/H5C.c b/src/H5C.c
index 5c3d9ef..622e34a 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -498,8 +498,6 @@ H5C_create(size_t max_cache_size,
HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS );
HDassert( type_name_table_ptr );
- HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) );
-
for ( i = 0; i <= max_type_id; i++ ) {
HDassert( (type_name_table_ptr)[i] );
@@ -2195,19 +2193,16 @@ H5C_insert_entry(H5F_t * f,
void * thing,
unsigned int flags)
{
- H5C_t * cache_ptr;
+ H5C_t *cache_ptr;
H5P_genplist_t *dxpl;
H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t insert_pinned;
hbool_t flush_last;
-#ifdef H5_HAVE_PARALLEL
- hbool_t flush_collectively;
-#endif /* H5_HAVE_PARALLEL */
hbool_t set_flush_marker;
hbool_t write_permitted = TRUE;
size_t empty_space;
- H5C_cache_entry_t * entry_ptr;
- H5C_cache_entry_t * test_entry_ptr;
+ H5C_cache_entry_t *entry_ptr;
+ H5C_cache_entry_t *test_entry_ptr;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2239,9 +2234,6 @@ H5C_insert_entry(H5F_t * f,
set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
-#ifdef H5_HAVE_PARALLEL
- flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 );
-#endif /* H5_HAVE_PARALLEL */
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
@@ -2290,9 +2282,6 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->pinned_from_client = insert_pinned;
entry_ptr->pinned_from_cache = FALSE;
entry_ptr->flush_me_last = flush_last;
-#ifdef H5_HAVE_PARALLEL
- entry_ptr->flush_me_collectively = flush_collectively;
-#endif
/* newly inserted entries are assumed to be dirty */
entry_ptr->is_dirty = TRUE;
@@ -2438,11 +2427,8 @@ H5C_insert_entry(H5F_t * f,
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "an extreme sanity check failed just before done.\n");
- }
+ ( H5C_validate_lru_list(cache_ptr) < 0 ) )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
/* If the entry's type has a 'notify' callback send a 'after insertion'
@@ -2455,19 +2441,14 @@ H5C_insert_entry(H5F_t * f,
H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)
done:
-
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "an extreme sanity check failed on exit.\n");
- }
+ ( H5C_validate_lru_list(cache_ptr) < 0 ) )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_insert_entry() */
@@ -3048,10 +3029,10 @@ done:
* This allows H5C_protect to accept flags other than
* H5C__READ_ONLY_FLAG.
*
- * Added support for the H5C__FLUSH_LAST_FLAG and
- * H5C__FLUSH_COLLECTIVELY_FLAG flags. At present, these
- * flags are only applied if the entry is not in cache, and
- * is loaded into the cache as a result of this call.
+ * Added support for the H5C__FLUSH_LAST_FLAG.
+ * At present, this flag is only applied if the entry is
+ * not in cache, and is loaded into the cache as a result of
+ * this call.
*
*-------------------------------------------------------------------------
*/
@@ -3064,19 +3045,16 @@ H5C_protect(H5F_t * f,
unsigned flags)
{
H5C_t * cache_ptr;
- H5P_genplist_t *dxpl;
H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t hit;
hbool_t have_write_permitted = FALSE;
hbool_t read_only = FALSE;
hbool_t flush_last;
-#ifdef H5_HAVE_PARALLEL
- hbool_t flush_collectively;
-#endif /* H5_HAVE_PARALLEL */
hbool_t write_permitted;
size_t empty_space;
void * thing;
H5C_cache_entry_t * entry_ptr;
+ H5P_genplist_t * dxpl; /* dataset transfer property list */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -3104,9 +3082,6 @@ H5C_protect(H5F_t * f,
read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 );
flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
-#ifdef H5_HAVE_PARALLEL
- flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 );
-#endif /* H5_HAVE_PARALLEL */
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
@@ -3167,7 +3142,6 @@ H5C_protect(H5F_t * f,
}
entry_ptr = (H5C_cache_entry_t *)thing;
-
entry_ptr->ring = ring;
/* Apply tag to newly protected entry */
@@ -3274,20 +3248,16 @@ H5C_protect(H5F_t * f,
*
* *******************************************
*
- * Set the flush_last (and possibly flush_collectively) fields
+ * Set the flush_last field
* of the newly loaded entry before inserting it into the
* index. Must do this, as the index tracked the number of
* entries with the flush_last field set, but assumes that
* the field will not change after insertion into the index.
*
- * Note that this means that the H5C__FLUSH_LAST_FLAG and
- * H5C__FLUSH_COLLECTIVELY_FLAG flags are ignored if the
- * entry is already in cache.
+ * Note that this means that the H5C__FLUSH_LAST_FLAG flag
+ * is ignored if the entry is already in cache.
*/
entry_ptr->flush_me_last = flush_last;
-#ifdef H5_HAVE_PARALLEL
- entry_ptr->flush_me_collectively = flush_collectively;
-#endif
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL)
@@ -3426,11 +3396,8 @@ done:
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
- ( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \
- "an extreme sanity check failed on exit.\n");
- }
+ ( H5C_validate_lru_list(cache_ptr) < 0 ) )
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3769,23 +3736,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_evictions_enabled(H5C_t *cache_ptr,
- hbool_t evictions_enabled)
+H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled)
{
herr_t ret_value = SUCCEED; /* Return value */
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 ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Bad evictions_enabled on entry.")
- }
/* There is no fundamental reason why we should not permit
* evictions to be disabled while automatic resize is enabled.
@@ -3793,20 +3751,15 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr,
* want to, and allowing it would greatly complicate testing
* the feature. Hence the following:
*/
- if ( ( evictions_enabled != TRUE ) &&
- ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) ||
- ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "Can't disable evictions when auto resize enabled.")
- }
+ if((evictions_enabled != TRUE) &&
+ ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) ||
+ (cache_ptr->resize_ctl.decr_mode != H5C_decr__off)))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.")
cache_ptr->evictions_enabled = evictions_enabled;
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_set_evictions_enabled() */
@@ -5192,27 +5145,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) {
- if ( ( config_ptr->set_initial_size != TRUE ) &&
- ( config_ptr->set_initial_size != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "set_initial_size must be either TRUE or FALSE");
- }
-
- if ( config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big");
- }
-
- if ( config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small");
- }
+ if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big")
- if ( config_ptr->min_size > config_ptr->max_size ) {
+ if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size");
- }
+ if(config_ptr->min_size > config_ptr->max_size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size")
if ( ( config_ptr->set_initial_size ) &&
( ( config_ptr->initial_size < config_ptr->min_size ) ||
@@ -5251,25 +5191,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
if ( config_ptr->incr_mode == H5C_incr__threshold ) {
- if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) ||
- ( config_ptr->lower_hr_threshold > (double)1.0f ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "lower_hr_threshold must be in the range [0.0, 1.0]");
- }
-
- if ( config_ptr->increment < (double)1.0f ) {
+ if((config_ptr->lower_hr_threshold < (double)0.0f) ||
+ (config_ptr->lower_hr_threshold > (double)1.0f))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "increment must be greater than or equal to 1.0");
- }
-
- if ( ( config_ptr->apply_max_increment != TRUE ) &&
- ( config_ptr->apply_max_increment != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "apply_max_increment must be either TRUE or FALSE");
- }
+ if(config_ptr->increment < (double)1.0f)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0")
/* no need to check max_increment, as it is a size_t,
* and thus must be non-negative.
@@ -5347,26 +5274,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
"epochs_before_eviction must be positive");
}
- if ( config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS ) {
+ if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big")
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "epochs_before_eviction too big");
- }
-
- if ( ( config_ptr->apply_empty_reserve != TRUE ) &&
- ( config_ptr->apply_empty_reserve != FALSE ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "apply_empty_reserve must be either TRUE or FALSE");
- }
-
- if ( ( config_ptr->apply_empty_reserve ) &&
- ( ( config_ptr->empty_reserve > (double)1.0f ) ||
- ( config_ptr->empty_reserve < (double)0.0f ) ) ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "empty_reserve must be in the interval [0.0, 1.0]");
- }
+ if((config_ptr->apply_empty_reserve) &&
+ ((config_ptr->empty_reserve > (double)1.0f) ||
+ (config_ptr->empty_reserve < (double)0.0f)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]")
/* no need to check max_decrement as it is a size_t
* and thus must be non-negative.
@@ -6462,7 +6376,6 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
prev_ptr = entry_ptr->prev;
if ( ! (entry_ptr->is_dirty) ) {
-
if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry")
}
@@ -7961,6 +7874,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
hbool_t was_dirty;
haddr_t new_addr = HADDR_UNDEF;
haddr_t old_addr = HADDR_UNDEF;
+ haddr_t entry_addr = HADDR_UNDEF;
size_t new_len = 0;
size_t new_compressed_len = 0;
herr_t ret_value = SUCCEED; /* Return value */
@@ -8041,31 +7955,6 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
entry_ptr->flush_in_progress = TRUE;
entry_ptr->flush_marker = FALSE;
-#ifdef H5_HAVE_PARALLEL
-#ifndef NDEBUG
- /* If MPI based VFD is used, do special parallel I/O sanity checks.
- * Note that we only do these sanity checks when the clear_only flag
- * is not set, and the entry to be flushed is dirty. Don't bother
- * otherwise as no file I/O can result.
- */
- if(!clear_only && entry_ptr->is_dirty && H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- H5P_genplist_t *dxpl; /* Dataset transfer property list */
- unsigned coll_meta; /* Collective metadata write flag */
-
- /* Get the dataset transfer property list */
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- /* Get the collective metadata write property */
- if(H5P_get(dxpl, H5AC_COLLECTIVE_META_WRITE_NAME, &coll_meta) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve xfer mode")
-
- /* Sanity check collective metadata write flag */
- HDassert(coll_meta);
- } /* end if */
-#endif /* NDEBUG */
-#endif /* H5_HAVE_PARALLEL */
-
/* serialize the entry if necessary, and then write it to disk. */
if(write_entry) {
unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET;
@@ -8494,6 +8383,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
/* reset the flush_in progress flag */
entry_ptr->flush_in_progress = FALSE;
+ /* capture the cache entry address for the log_flush call at the
+ end before the entry_ptr gets freed */
+ entry_addr = entry_ptr->addr;
+
/* Internal cache data structures should now be up to date, and
* consistant with the status of the entry.
*
@@ -8605,7 +8498,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
} /* if (destroy) */
if(cache_ptr->log_flush)
- if((cache_ptr->log_flush)(cache_ptr, entry_ptr->addr, was_dirty, flags) < 0)
+ if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed.")
done:
@@ -8843,7 +8736,7 @@ H5C_load_entry(H5F_t * f,
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Get the on-disk entry image */
- if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) {
+ if(0 == (type->flags & H5C__CLASS_SKIP_READS)) {
unsigned tries, max_tries; /* The # of read attempts */
unsigned retries; /* The # of retries */
htri_t chk_ret; /* return from verify_chksum callback */