summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-10-12 04:39:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-10-12 04:39:55 (GMT)
commit040d7358870e72d18f6083053f200c211d6b6e34 (patch)
tree2a7e1e68f51f32b00a88da33869eb56733f72698
parent4b3730011f553513fa93c3269171863cf825fd8c (diff)
downloadhdf5-040d7358870e72d18f6083053f200c211d6b6e34.zip
hdf5-040d7358870e72d18f6083053f200c211d6b6e34.tar.gz
hdf5-040d7358870e72d18f6083053f200c211d6b6e34.tar.bz2
[svn-r28034] Description:
Merge r27710 from trunk to branch. (And some other minor cleanups) Tested on: MacOSX/64 10.10.5 (amazon) w/serial (h5committest not required on this branch)
-rw-r--r--src/H5AC.c114
-rw-r--r--src/H5ACprivate.h25
-rw-r--r--src/H5C.c2335
-rw-r--r--src/H5Cpkg.h455
-rw-r--r--src/H5Cprivate.h78
-rw-r--r--src/H5FScache.c16
-rw-r--r--src/H5Fsuper.c74
-rw-r--r--src/H5Fsuper_cache.c10
-rw-r--r--src/H5MF.c80
-rw-r--r--src/H5Pdxpl.c12
-rw-r--r--src/H5SM.c25
-rw-r--r--test/Makefile.am2
-rw-r--r--test/cache_common.c4
-rw-r--r--test/cache_logging.c2
-rw-r--r--testpar/t_cache.c2
15 files changed, 2072 insertions, 1162 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 7b500fa..0b24c12 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -2667,12 +2667,11 @@ H5AC_flush_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hid_t dxpl_id)
HDassert(f->shared);
/* Call cache level function to flush metadata entries with specified tag */
- if(H5C_flush_tagged_entries(f, dxpl_id, metadata_tag)<0)
+ if(H5C_flush_tagged_entries(f, dxpl_id, metadata_tag) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot flush metadata")
done:
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_flush_tagged_metadata */
@@ -2842,3 +2841,114 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_verify_tag */
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5AC_get_entry_ring
+ *
+ * Purpose: Given a file address, retrieve the ring for an entry at that
+ * address.
+ *
+ * On error, the value of *ring is not modified.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 9/8/15
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(ring);
+
+ /* Retrieve the ring value for the entry at address */
+ if(H5C_get_entry_ring(f, addr, ring) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "Can't retrieve ring for entry")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5AC_get_entry_ring() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5AC_set_ring
+ *
+ * Purpose: Routine to set the ring on a DXPL (for passing through
+ * to the metadata cache).
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, September 8, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dxpl,
+ H5AC_ring_t *orig_ring)
+{
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(dxpl);
+ HDassert(orig_ring);
+
+ /* Set the ring type in the DXPL */
+ if(NULL == ((*dxpl) = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ if((H5P_get((*dxpl), H5AC_RING_NAME, orig_ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get original ring value")
+ if((H5P_set((*dxpl), H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set ring value")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5AC_set_ring() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5AC_reset_ring
+ *
+ * Purpose: Routine to reset the original ring on a DXPL (after passing
+ * through to the metadata cache).
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, September 8, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring)
+{
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Reset the ring in the DXPL, if it's been changed */
+ if(orig_ring) {
+ /* Sanity check */
+ HDassert(dxpl);
+
+ if((H5P_set(dxpl, H5AC_RING_NAME, &orig_ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5AC_reset_ring() */
+
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 18794a0..1c81976 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -139,12 +139,20 @@ typedef enum {
#define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG
#define H5AC__SERIALIZE_COMPRESSED_FLAG H5C__SERIALIZE_COMPRESSED_FLAG
-
/* Cork actions: cork/uncork/get cork status of an object */
#define H5AC__SET_CORK H5C__SET_CORK
#define H5AC__UNCORK H5C__UNCORK
#define H5AC__GET_CORKED H5C__GET_CORKED
+/* Aliases for the "ring" type and values */
+typedef H5C_ring_t H5AC_ring_t;
+#define H5AC_RING_INV H5C_RING_UNDEFINED
+#define H5AC_RING_US H5C_RING_USER
+#define H5AC_RING_FSM H5C_RING_FSM
+#define H5AC_RING_SBE H5C_RING_SBE
+#define H5AC_RING_SB H5C_RING_SB
+#define H5AC_RING_NTYPES H5C_RING_NTYPES
+
/* Aliases for 'notify action' type & values */
typedef H5C_notify_action_t H5AC_notify_action_t;
#define H5AC_NOTIFY_ACTION_AFTER_INSERT H5C_NOTIFY_ACTION_AFTER_INSERT
@@ -196,6 +204,8 @@ typedef H5C_t H5AC_t;
#define H5AC_COLLECTIVE_META_WRITE_DEF 0
#endif /* H5_HAVE_PARALLEL */
+#define H5AC_RING_NAME "H5AC_ring_type"
+
/* Dataset transfer property list for flush calls */
/* (Collective set, "block before metadata write" set and "library internal" set) */
/* (Global variable declaration, definition is in H5AC.c) */
@@ -364,15 +374,18 @@ H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_close_trace_file(H5AC_t *cache_ptr);
H5_DLL herr_t H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name);
-H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag);
-H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag);
-H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f);
+/* Tag & Ring routines */
+H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag);
H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hid_t dxpl_id);
-
H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hid_t dxpl_id);
-
+H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag);
+H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f);
H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked);
+H5_DLL herr_t H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring);
+H5_DLL herr_t H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dxpl,
+ H5AC_ring_t *orig_ring);
+H5_DLL herr_t H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr);
diff --git a/src/H5C.c b/src/H5C.c
index 991db94..ee4affa 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -74,7 +74,6 @@
/* Module Setup */
/****************/
-#define H5AC_PACKAGE /*suppress error about including H5ACpkg */
#define H5C_PACKAGE /*suppress error about including H5Cpkg */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
@@ -84,7 +83,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_PARALLEL
-#include "H5ACpkg.h" /* Metadata cache */
+#include "H5ACprivate.h" /* Metadata cache */
#endif /* H5_HAVE_PARALLEL */
#include "H5Cpkg.h" /* Cache */
#include "H5Eprivate.h" /* Error handling */
@@ -117,10 +116,6 @@
/* Local Prototypes */
/********************/
-/*
- * Private file-scope function declarations:
- */
-
static herr_t H5C__auto_adjust_cache_size(H5F_t * f,
hid_t dxpl_id,
hbool_t write_permitted);
@@ -152,6 +147,12 @@ static herr_t H5C_flush_invalidate_cache(const H5F_t * f,
hid_t dxpl_id,
unsigned flags);
+static herr_t H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id,
+ H5C_ring_t ring, unsigned flags);
+
+static herr_t H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring,
+ unsigned flags);
+
static void * H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
@@ -188,6 +189,10 @@ static herr_t H5C_verify_len_eoa (H5F_t *f,
size_t *len,
htri_t actual);
+#if H5C_DO_TAGGING_SANITY_CHECKS
+static herr_t H5C_verify_tag(int id, haddr_t tag);
+#endif
+
#if H5C_DO_SLIST_SANITY_CHECKS
static hbool_t H5C_entry_in_skip_list(H5C_t * cache_ptr,
H5C_cache_entry_t *target_ptr);
@@ -204,6 +209,11 @@ static void H5C__assert_flush_dep_nocycle(H5C_cache_entry_t * entry,
H5C_cache_entry_t * base_entry);
#endif /* NDEBUG */
+#if 0 /* debugging routines */
+herr_t H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name);
+herr_t H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn);
+#endif /* debugging routines */
+
/*********************/
/* Package Variables */
/*********************/
@@ -246,7 +256,7 @@ H5FL_DEFINE_STATIC(haddr_t);
#define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS
static herr_t H5C__epoch_marker_get_load_size(const void *image_ptr,
- const void *udata_ptr,
+ void *udata_ptr,
size_t *image_len_ptr,
size_t *actual_len,
hbool_t *compressed_ptr,
@@ -313,7 +323,7 @@ const H5C_class_t epoch_marker_class =
*
***************************************************************************/
static herr_t
-H5C__epoch_marker_get_load_size(const void H5_ATTR_UNUSED *image_ptr, const void H5_ATTR_UNUSED *udata_ptr,
+H5C__epoch_marker_get_load_size(const void H5_ATTR_UNUSED *image_ptr, void H5_ATTR_UNUSED *udata_ptr,
size_t H5_ATTR_UNUSED *image_len_ptr, size_t H5_ATTR_UNUSED *actual_len,
hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
@@ -521,6 +531,8 @@ H5C_create(size_t max_cache_size,
cache_ptr->log_file_ptr = NULL;
+ cache_ptr->trace_file_ptr = NULL;
+
cache_ptr->aux_ptr = aux_ptr;
cache_ptr->max_type_id = max_type_id;
@@ -542,6 +554,16 @@ H5C_create(size_t max_cache_size,
cache_ptr->clean_index_size = (size_t)0;
cache_ptr->dirty_index_size = (size_t)0;
+ for(i = 0; i < H5C_RING_NTYPES; i++) {
+ cache_ptr->index_ring_len[i] = 0;
+ cache_ptr->index_ring_size[i] = (size_t)0;
+ cache_ptr->clean_index_ring_size[i] = (size_t)0;
+ cache_ptr->dirty_index_ring_size[i] = (size_t)0;
+
+ cache_ptr->slist_ring_len[i] = 0;
+ cache_ptr->slist_ring_size[i] = (size_t)0;
+ } /* end for */
+
/* Tagging Field Initializations */
cache_ptr->ignore_tags = FALSE;
@@ -556,10 +578,8 @@ H5C_create(size_t max_cache_size,
cache_ptr->slist_size_increase = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ )
- {
+ for(i = 0; i < H5C__HASH_TABLE_LEN; i++)
(cache_ptr->index)[i] = NULL;
- }
cache_ptr->entries_removed_counter = 0;
cache_ptr->last_entry_removed_ptr = NULL;
@@ -1129,53 +1149,84 @@ done:
* Programmer: John Mainzer
* 6/2/04
*
- * Changes: Modified function to test for slist chamges in
- * pre_serialize and serialize callbacks, and re-start
- * scans through the slist when such changes occur.
+ * Changes: Modified function to test for slist chamges in
+ * pre_serialize and serialize callbacks, and re-start
+ * scans through the slist when such changes occur.
*
- * This has been a potential problem for some time,
- * and there has been code in this function to deal
- * with elements of this issue. However the shift
- * to the V3 cache in combination with the activities
- * of some of the cache clients (in particular the
- * free space manager and the fractal heap) have
- * made this re-work necessary.
+ * This has been a potential problem for some time,
+ * and there has been code in this function to deal
+ * with elements of this issue. However the shift
+ * to the V3 cache in combination with the activities
+ * of some of the cache clients (in particular the
+ * free space manager and the fractal heap) have
+ * made this re-work necessary.
*
- * JRM -- 12/13/14
+ * JRM -- 12/13/14
+ *
+ * Modified function to support rings. Basic idea is that
+ * every entry in the cache is assigned to a ring. Entries
+ * in the outermost ring are flushed first, followed by
+ * those in the next outermost ring, and so on until the
+ * innermost ring is flushed. See header comment on
+ * H5C_ring_t in H5Cprivate.h for a more detailed
+ * discussion.
+ *
+ * JRM -- 8/30/15
*
*-------------------------------------------------------------------------
*/
herr_t
H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags)
{
- H5C_t * cache_ptr = f->shared->cache;
- herr_t ret_value = SUCCEED;
- hbool_t destroy;
- hbool_t flushed_entries_last_pass;
- hbool_t flush_marked_entries;
- hbool_t ignore_protected;
- hbool_t tried_to_flush_protected_entry = FALSE;
- hbool_t restart_slist_scan;
- int32_t protected_entries = 0;
- H5SL_node_t * node_ptr = NULL;
- H5C_cache_entry_t * entry_ptr = NULL;
- H5C_cache_entry_t * next_entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
- int64_t flushed_entries_count = 0;
- int64_t flushed_entries_size = 0;
- int64_t initial_slist_len = 0;
- size_t initial_slist_size = 0;
- int64_t entry_size_change;
- int64_t * entry_size_change_ptr = &entry_size_change;
-#else /* H5C_DO_SANITY_CHECKS */
- int64_t * entry_size_change_ptr = NULL;
+ int i;
+ int32_t index_len = 0;
+ size_t index_size = (size_t)0;
+ size_t clean_index_size = (size_t)0;
+ size_t dirty_index_size = (size_t)0;
+ size_t slist_size = (size_t)0;
+ int32_t slist_len = 0;
#endif /* H5C_DO_SANITY_CHECKS */
+ H5C_ring_t ring;
+ H5C_t * cache_ptr;
+ hbool_t destroy;
+ hbool_t ignore_protected;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( cache_ptr->slist_ptr );
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_ptr);
+
+#if H5C_DO_SANITY_CHECKS
+ HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+
+ for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
+ index_len += cache_ptr->index_ring_len[i];
+ index_size += cache_ptr->index_ring_size[i];
+ clean_index_size += cache_ptr->clean_index_ring_size[i];
+ dirty_index_size += cache_ptr->dirty_index_ring_size[i];
+
+ slist_len += cache_ptr->slist_ring_len[i];
+ slist_size += cache_ptr->slist_ring_size[i];
+ } /* end for */
+
+ HDassert(cache_ptr->index_len == index_len);
+ HDassert(cache_ptr->index_size == index_size);
+ HDassert(cache_ptr->clean_index_size == clean_index_size);
+ HDassert(cache_ptr->dirty_index_size == dirty_index_size);
+ HDassert(cache_ptr->slist_len == slist_len);
+ HDassert(cache_ptr->slist_size == slist_size);
+#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_DO_EXTREME_SANITY_CHECKS
if((H5C_validate_protected_entry_list(cache_ptr) < 0) ||
@@ -1186,13 +1237,6 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags)
ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 );
destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 );
-
- /* note that flush_marked_entries is set to FALSE if destroy is TRUE */
- flush_marked_entries = ( ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 )
- &&
- ( ! destroy )
- );
-
HDassert( ! ( destroy && ignore_protected ) );
HDassert( ! ( cache_ptr->flush_in_progress ) );
@@ -1200,283 +1244,19 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags)
if(destroy) {
if(H5C_flush_invalidate_cache(f, dxpl_id, flags) < 0)
- /* This shouldn't happen -- if it does, we are toast so
- * just scream and die.
- */
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed.")
- } else {
- /* When we are only flushing marked entries, the slist will usually
- * still contain entries when we have flushed everything we should.
- * Thus we track whether we have flushed any entries in the last
- * pass, and terminate if we haven't.
- */
-
- flushed_entries_last_pass = TRUE;
-
- /* set the cache_ptr->slist_change_in_pre_serialize and
- * cache_ptr->slist_change_in_serialize to false.
- *
- * These flags are set to TRUE by H5C__flush_single_entry if the
- * slist is modified by a pre_serialize or serialize call respectively.
- * H5C_flush_cache uses these flags to detect any modifications
- * to the slist that might corrupt the scan of the slist -- and
- * restart the scan in this event.
+ } /* end if */
+ else {
+ /* flush each ring, starting from the outermost ring and
+ * working inward.
*/
- cache_ptr->slist_change_in_pre_serialize = FALSE;
- cache_ptr->slist_change_in_serialize = FALSE;
-
- while ( ( cache_ptr->slist_len != 0 ) &&
- ( protected_entries == 0 ) &&
- ( flushed_entries_last_pass ) )
- {
- flushed_entries_last_pass = FALSE;
-
-#if H5C_DO_SANITY_CHECKS
- /* For sanity checking, try to verify that the skip list has
- * the expected size and number of entries at the end of each
- * internal while loop (see below).
- *
- * Doing this get a bit tricky, as depending on flags, we may
- * or may not flush all the entries in the slist.
- *
- * To make things more entertaining, with the advent of the
- * fractal heap, the entry serialize callback can cause entries
- * to be dirtied, resized, and/or moved. Also, the
- * pre_serialize callback can result in an entry being
- * removed from the cache via the take ownership flag.
- *
- * To deal with this, we first make note of the initial
- * skip list length and size:
- */
- initial_slist_len = cache_ptr->slist_len;
- initial_slist_size = cache_ptr->slist_size;
-
- /* We then zero counters that we use to track the number
- * and total size of entries flushed:
- */
- flushed_entries_count = 0;
- flushed_entries_size = 0;
-
- /* As mentioned above, there is the possibility that
- * entries will be dirtied, resized, flushed, or removed
- * from the cache via the take ownership flag during
- * our pass through the skip list. To capture the number
- * of entries added, and the skip list size delta,
- * zero the slist_len_increase and slist_size_increase of
- * the cache's instance of H5C_t. These fields will be
- * updated elsewhere to account for slist insertions and/or
- * dirty entry size changes.
- */
- cache_ptr->slist_len_increase = 0;
- cache_ptr->slist_size_increase = 0;
-
- /* at the end of the loop, use these values to compute the
- * expected slist length and size and compare this with the
- * value recorded in the cache's instance of H5C_t.
- */
-#endif /* H5C_DO_SANITY_CHECKS */
-
- restart_slist_scan = TRUE;
-
- while ( ( restart_slist_scan ) || ( node_ptr != NULL ) )
- {
- if ( restart_slist_scan )
- {
- restart_slist_scan = FALSE;
-
- /* Start at beginning of skip list */
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
-
- if ( node_ptr == NULL )
- {
- /* the slist is empty -- break out of inner loop */
- break;
- }
- HDassert( node_ptr != NULL );
-
- /* Get cache entry for this node */
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
-
- if(NULL == next_entry_ptr)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
-
- HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
- HDassert( next_entry_ptr->is_dirty );
- HDassert( next_entry_ptr->in_slist );
- }
-
- entry_ptr = next_entry_ptr;
-
- /* With the advent of the fractal heap, the free space
- * manager, and the version 3 cache, it is possible
- * that the pre-serialize or serialize callback will
- * dirty, resize, or take ownership of other entries
- * in the cache.
- *
- * To deal with this, I have inserted code to detect any
- * change in the skip list not directly under the control
- * of this function. If such modifications are detected,
- * we must re-start the scan of the skip list to avoid
- * the possibility that the target of the next_entry_ptr
- * may have been flushed or deleted from the cache.
- *
- * To verify that all such possibilities have been dealt
- * with, we do a bit of extra sanity checking on
- * entry_ptr.
- */
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert(entry_ptr->in_slist);
- HDassert(entry_ptr->is_dirty);
-
- /* increment node pointer now, before we delete its target
- * from the slist.
- */
- node_ptr = H5SL_next(node_ptr);
-
- if ( node_ptr != NULL ) {
- next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- if ( NULL == next_entry_ptr )
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
- HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
- HDassert( next_entry_ptr->is_dirty );
- HDassert( next_entry_ptr->in_slist );
- HDassert( entry_ptr != next_entry_ptr );
- } else {
- next_entry_ptr = NULL;
- }
-
- HDassert( entry_ptr != NULL );
- HDassert( entry_ptr->in_slist );
-
- if ( ( ( ! flush_marked_entries ) ||
- ( entry_ptr->flush_marker ) ) &&
- ( ( ! entry_ptr->flush_me_last ) ||
- ( cache_ptr->num_last_entries >=
- cache_ptr->slist_len ) ||
- ( flush_marked_entries &&
- ( entry_ptr->flush_marker ) ) ) &&
- ( ( entry_ptr->flush_dep_nchildren == 0 ) ||
- ( ( ! destroy ) &&
- ( entry_ptr->flush_dep_ndirty_children == 0 ) ) ) ) {
-
- if ( entry_ptr->is_protected ) {
- /* we probably have major problems -- but lets
- * flush everything we can before we decide
- * whether to flag an error.
- */
- tried_to_flush_protected_entry = TRUE;
- protected_entries++;
-
- } else if ( entry_ptr->is_pinned ) {
-#if H5C_DO_SANITY_CHECKS
- flushed_entries_count++;
- flushed_entries_size += (int64_t)entry_ptr->size;
- entry_size_change = 0;
-#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0 )
- /* This shouldn't happen -- if it does, we are toast
- * so just scream and die.
- */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.")
-
-#if H5C_DO_SANITY_CHECKS
- /* it is possible that the entry size changed
- * during flush -- update flushed_entries_size
- * to account for this.
- */
- flushed_entries_size += entry_size_change;
-#endif /* H5C_DO_SANITY_CHECKS */
-
- if ((cache_ptr->slist_change_in_serialize) ||
- (cache_ptr->slist_change_in_pre_serialize))
- {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_change_in_pre_serialize = FALSE;
- cache_ptr->slist_change_in_serialize = FALSE;
-
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
- }
-
- flushed_entries_last_pass = TRUE;
- } /* end if */
- else {
-#if H5C_DO_SANITY_CHECKS
- flushed_entries_count++;
- flushed_entries_size += (int64_t)entry_ptr->size;
- entry_size_change = 0;
-#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0)
- /* This shouldn't happen -- if it does, we are
- * toast so just scream and die.
- */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.")
-#if H5C_DO_SANITY_CHECKS
- /* it is possible that the entry size changed
- * during flush -- update flushed_entries_size
- * to account for this.
- */
- flushed_entries_size += entry_size_change;
-#endif /* H5C_DO_SANITY_CHECKS */
- if ((cache_ptr->slist_change_in_serialize) ||
- (cache_ptr->slist_change_in_pre_serialize))
- {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_change_in_pre_serialize = FALSE;
- cache_ptr->slist_change_in_serialize = FALSE;
-
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
- }
-
- flushed_entries_last_pass = TRUE;
- } /* end else */
- } /* end if */
- } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */
-
-#if H5C_DO_SANITY_CHECKS
- /* Verify that the slist size and length are as expected. */
-
- HDassert( (initial_slist_len + cache_ptr->slist_len_increase -
- flushed_entries_count) == cache_ptr->slist_len );
- HDassert( (size_t)((int64_t)initial_slist_size +
- cache_ptr->slist_size_increase -
- flushed_entries_size) == cache_ptr->slist_size );
-#endif /* H5C_DO_SANITY_CHECKS */
-
- } /* while */
-
- HDassert( protected_entries <= cache_ptr->pl_len );
-
- if ( ( ( cache_ptr->pl_len > 0 ) && ( !ignore_protected ) )
- ||
- ( tried_to_flush_protected_entry ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "cache has protected items")
- }
-
-#if H5C_DO_SANITY_CHECKS
- if ( ! flush_marked_entries ) {
-
- HDassert( cache_ptr->slist_len == 0 );
- HDassert( cache_ptr->slist_size == 0 );
- }
-#endif /* H5C_DO_SANITY_CHECKS */
-
- }
+ ring = H5C_RING_USER;
+ while(ring < H5C_RING_NTYPES) {
+ if(H5C_flush_ring(f, dxpl_id, ring, flags) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed.")
+ ring++;
+ } /* end while */
+ } /* end else */
done:
cache_ptr->flush_in_progress = FALSE;
@@ -2057,6 +1837,7 @@ H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr)
FUNC_LEAVE_NOAPI(H5C_get_trace_file_ptr(entry_ptr->cache_ptr))
} /* H5C_get_trace_file_ptr_from_entry() */
+
/*-------------------------------------------------------------------------
* Function: H5C_set_up_logging
@@ -2086,7 +1867,7 @@ H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[],
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t *aux_ptr = NULL;
#endif /*H5_HAVE_PARALLEL*/
- char *file_name;
+ char *file_name = NULL;
size_t n_chars;
herr_t ret_value = SUCCEED; /* Return value */
@@ -2151,8 +1932,8 @@ H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[],
cache_ptr->currently_logging = start_immediately;
done:
-
- HDfree(file_name);
+ if(file_name)
+ HDfree(file_name);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_set_up_logging() */
@@ -2410,7 +2191,8 @@ H5C_insert_entry(H5F_t * f,
unsigned int flags)
{
H5C_t * cache_ptr;
- herr_t result;
+ H5P_genplist_t *dxpl;
+ H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t insert_pinned;
hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
@@ -2456,6 +2238,14 @@ H5C_insert_entry(H5F_t * f,
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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get the ring type from the DXPL */
+ if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to query ring value")
+
entry_ptr = (H5C_cache_entry_t *)thing;
/* verify that the new entry isn't already in the hash table -- scream
@@ -2481,7 +2271,7 @@ H5C_insert_entry(H5F_t * f,
/* Apply tag to newly inserted entry */
if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry")
/* Set the entry's cork status */
if(H5C_cork(cache_ptr, entry_ptr->tag, H5C__GET_CORKED, &entry_ptr->is_corked) < 0)
@@ -2537,6 +2327,8 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->flush_in_progress = FALSE;
entry_ptr->destroy_in_progress = FALSE;
+ entry_ptr->ring = ring;
+
/* Initialize flush dependency height fields */
entry_ptr->flush_dep_parent = NULL;
entry_ptr->flush_dep_nparents = 0;
@@ -2558,13 +2350,8 @@ H5C_insert_entry(H5F_t * f,
if ( ( cache_ptr->flash_size_increase_possible ) &&
( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) {
- result = H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
- "H5C__flash_increase_cache_size failed.")
- }
+ if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed.")
}
if(cache_ptr->index_size >= cache_ptr->max_cache_size)
@@ -2581,33 +2368,20 @@ H5C_insert_entry(H5F_t * f,
size_t space_needed;
- if ( empty_space <= entry_ptr->size ) {
-
+ if(empty_space <= entry_ptr->size)
cache_ptr->cache_full = TRUE;
- }
-
- if ( cache_ptr->check_write_permitted != NULL ) {
-
- result = (cache_ptr->check_write_permitted)(f, &write_permitted);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
- "Can't get write_permitted")
- }
- } else {
+ if(cache_ptr->check_write_permitted != NULL) {
+ if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "Can't get write_permitted")
+ } /* end if */
+ else
write_permitted = cache_ptr->write_permitted;
- }
-
- HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE );
+ HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE);
space_needed = entry_ptr->size;
-
- if ( space_needed > cache_ptr->max_cache_size ) {
-
+ if(space_needed > cache_ptr->max_cache_size)
space_needed = cache_ptr->max_cache_size;
- }
/* Note that space_needed is just the amount of space that
* needed to insert the new entry without exceeding the cache
@@ -2634,16 +2408,8 @@ H5C_insert_entry(H5F_t * f,
* no point in worrying about the third.
*/
- result = H5C_make_space_in_cache(f,
- dxpl_id,
- space_needed,
- write_permitted);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
- "H5C_make_space_in_cache failed.")
- }
+ if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_make_space_in_cache failed.")
}
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
@@ -2744,15 +2510,15 @@ H5C_mark_entry_dirty(void *thing)
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
if ( entry_ptr->is_protected ) {
- HDassert( ! ((entry_ptr)->is_read_only) );
+ HDassert( ! ((entry_ptr)->is_read_only) );
/* set the dirtied flag */
entry_ptr->dirtied = TRUE;
} else if ( entry_ptr->is_pinned ) {
- hbool_t was_pinned_unprotected_and_clean;
+ hbool_t was_pinned_unprotected_and_clean;
- was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty );
+ was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty );
/* mark the entry as dirty if it isn't already */
entry_ptr->is_dirty = TRUE;
@@ -2760,20 +2526,13 @@ H5C_mark_entry_dirty(void *thing)
/* Propagate the dirty flag up the flush dependency chain if appropriate
*/
- if ( was_pinned_unprotected_and_clean ) {
-
+ if(was_pinned_unprotected_and_clean) {
H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr);
- if ( ( entry_ptr->flush_dep_ndirty_children == 0) &&
- ( entry_ptr->flush_dep_nparents > 0 ) ) {
-
- if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
- }
- }
- }
+ if((entry_ptr->flush_dep_ndirty_children == 0) && (entry_ptr->flush_dep_nparents > 0))
+ if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
+ } /* end if */
if ( ! (entry_ptr->in_slist) ) {
@@ -2813,9 +2572,9 @@ H5C_move_entry(H5C_t * cache_ptr,
haddr_t old_addr,
haddr_t new_addr)
{
- hbool_t was_dirty;
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * test_entry_ptr = NULL;
+ hbool_t was_dirty;
#if H5C_DO_SANITY_CHECKS
hbool_t removed_entry_from_slist = FALSE;
#endif /* H5C_DO_SANITY_CHECKS */
@@ -2927,31 +2686,28 @@ H5C_move_entry(H5C_t * cache_ptr,
if ( ( entry_ptr->flush_dep_ndirty_children == 0) &&
( entry_ptr->flush_dep_nparents > 0 ) ) {
- if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
- }
+ if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
}
}
}
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
#if H5C_DO_SANITY_CHECKS
- if ( removed_entry_from_slist ) {
+ if ( removed_entry_from_slist ) {
- /* we just removed the entry from the slist. Thus we
- * must touch up cache_ptr->slist_len_increase and
- * cache_ptr->slist_size_increase to keep from skewing
- * the sanity checks.
- */
+ /* we just removed the entry from the slist. Thus we
+ * must touch up cache_ptr->slist_len_increase and
+ * cache_ptr->slist_size_increase to keep from skewing
+ * the sanity checks.
+ */
cache_ptr->slist_len_increase -= 1;
cache_ptr->slist_size_increase -= (int64_t)(entry_ptr->size);
- }
+ }
#endif /* H5C_DO_SANITY_CHECKS */
@@ -3050,11 +2806,8 @@ H5C_resize_entry(void *thing, size_t new_size)
if ( ( entry_ptr->flush_dep_ndirty_children == 0) &&
( entry_ptr->flush_dep_nparents > 0 ) ) {
- if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
- }
+ if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
}
}
@@ -3306,6 +3059,8 @@ 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;
@@ -3314,7 +3069,6 @@ H5C_protect(H5F_t * f,
hbool_t flush_collectively;
#endif /* H5_HAVE_PARALLEL */
hbool_t write_permitted;
- herr_t result;
size_t empty_space;
void * thing;
H5C_cache_entry_t * entry_ptr;
@@ -3349,15 +3103,48 @@ H5C_protect(H5F_t * f,
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)))
+ HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "not a property list")
+
+ /* Get the ring type from the DXPL */
+ if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "unable to query ring value")
+
/* first check to see if the target is in cache */
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL)
if ( entry_ptr != NULL ) {
+ if(entry_ptr->ring != ring)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry\n");
/* Check for trying to load the wrong type of entry from an address */
if(entry_ptr->type != type)
HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type")
+#if H5C_DO_TAGGING_SANITY_CHECKS
+{
+ H5C_tag_t tag; /* Tag structure */
+
+ /* The entry is already in the cache, but make sure that the tag value
+ being passed in via dxpl is still legal. This will ensure that had
+ the entry NOT been in the cache, tagging was still set up correctly
+ and it would have received a legal tag value after getting loaded
+ from disk. */
+
+ /* Get the tag from the DXPL */
+ if((H5P_get(dxpl, "H5C_tag", &tag)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value");
+
+ /* Verify tag value */
+ if(cache_ptr->ignore_tags != TRUE) {
+ /* Verify legal tag value */
+ if((H5C_verify_tag(entry_ptr->type->id, tag.value)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed");
+ } /* end if */
+}
+#endif
+
hit = TRUE;
thing = (void *)entry_ptr;
@@ -3372,13 +3159,15 @@ H5C_protect(H5F_t * f,
if ( thing == NULL ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry")
- }
+ }
entry_ptr = (H5C_cache_entry_t *)thing;
+ entry_ptr->ring = ring;
+
/* Apply tag to newly protected entry */
if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag entry")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry")
/* Set the entry's cork status */
if(H5C_cork(cache_ptr, entry_ptr->tag, H5C__GET_CORKED, &entry_ptr->is_corked) < 0)
@@ -3390,14 +3179,8 @@ H5C_protect(H5F_t * f,
if ( ( cache_ptr->flash_size_increase_possible ) &&
( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) {
- result = H5C__flash_increase_cache_size(cache_ptr, 0,
- entry_ptr->size);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
- "H5C__flash_increase_cache_size failed.")
- }
+ if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed.")
}
if(cache_ptr->index_size >= cache_ptr->max_cache_size)
@@ -3423,20 +3206,11 @@ H5C_protect(H5F_t * f,
if(empty_space <= entry_ptr->size)
cache_ptr->cache_full = TRUE;
- if ( cache_ptr->check_write_permitted != NULL ) {
-
- result = (cache_ptr->check_write_permitted)(f, &write_permitted);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
- "Can't get write_permitted 1")
-
- } else {
-
+ if(cache_ptr->check_write_permitted != NULL) {
+ if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1")
+ else
have_write_permitted = TRUE;
-
- }
} else {
write_permitted = cache_ptr->write_permitted;
@@ -3483,16 +3257,8 @@ H5C_protect(H5F_t * f,
* see no point in worrying about the fourth.
*/
- result = H5C_make_space_in_cache(f,
- dxpl_id,
- space_needed,
- write_permitted);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
- "H5C_make_space_in_cache failed 1.")
- }
+ if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 1.")
}
/* Insert the entry in the hash table. It can't be dirty yet, so
@@ -3586,19 +3352,10 @@ H5C_protect(H5F_t * f,
if ( ! have_write_permitted ) {
if ( cache_ptr->check_write_permitted != NULL ) {
-
- result = (cache_ptr->check_write_permitted)(f, &write_permitted);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
- "Can't get write_permitted 2")
-
- } else {
-
+ if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 2")
+ else
have_write_permitted = TRUE;
-
- }
} else {
write_permitted = cache_ptr->write_permitted;
@@ -3612,14 +3369,8 @@ H5C_protect(H5F_t * f,
( cache_ptr->cache_accesses >=
(cache_ptr->resize_ctl).epoch_length ) ) {
- result = H5C__auto_adjust_cache_size(f,
- dxpl_id,
- write_permitted);
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
- "Cache auto-resize failed.")
- }
+ if(H5C__auto_adjust_cache_size(f, dxpl_id, write_permitted) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed.")
}
if ( cache_ptr->size_decreased ) {
@@ -3648,16 +3399,8 @@ H5C_protect(H5F_t * f,
if(cache_ptr->index_size > cache_ptr->max_cache_size)
cache_ptr->cache_full = TRUE;
- result = H5C_make_space_in_cache(f,
- dxpl_id,
- (size_t)0,
- write_permitted);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
- "H5C_make_space_in_cache failed 2.")
- }
+ if(H5C_make_space_in_cache(f, dxpl_id, (size_t)0, write_permitted) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 2.")
}
}
}
@@ -4119,7 +3862,7 @@ herr_t
H5C_set_trace_file_ptr(H5C_t * cache_ptr,
FILE * trace_file_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -4140,46 +3883,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5C_set_log_file_ptr
- *
- * Purpose: Set the log_file_ptr field for the cache.
- *
- * This field must either be NULL (which turns of metadata
- * cache logging), or be a pointer to an open file to which
- * log entries are to be written.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 1/20/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_set_log_file_ptr(H5C_t * cache_ptr,
- FILE * log_file_ptr)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* This would normally be an assert, but we need to use an HGOTO_ERROR
- * call to shut up the compiler.
- */
- if ( ( ! cache_ptr ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
- }
-
- cache_ptr->log_file_ptr = log_file_ptr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* H5C_set_log_file_ptr() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5C_stats
*
* Purpose: Prints statistics about the cache.
@@ -5318,11 +5021,8 @@ H5C_unprotect(H5F_t * f,
if ( ( entry_ptr->flush_dep_ndirty_children == 0) &&
( entry_ptr->flush_dep_nparents > 0 ) ) {
- if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
- }
+ if ( H5C__mark_flush_dep_dirty(entry_ptr) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
}
H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr)
@@ -5333,11 +5033,8 @@ H5C_unprotect(H5F_t * f,
if ( ( entry_ptr->flush_dep_ndirty_children == 0) &&
( entry_ptr->flush_dep_nparents > 0 ) ) {
- if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Can't propagate flush dep dirty flag")
- }
+ if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag")
}
}
@@ -6650,9 +6347,9 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
}
/* dirty corked entry is skipped */
- if(entry_ptr->is_corked && entry_ptr->is_dirty) {
+ if(entry_ptr->is_corked && entry_ptr->is_dirty)
corked = TRUE;
- } else if ( entry_ptr->is_dirty ) {
+ else if ( entry_ptr->is_dirty ) {
/* reset entries_removed_counter and
* last_entry_removed_ptr prior to the call to
@@ -6683,10 +6380,10 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
if ( prev_ptr != NULL ) {
- if(corked) { /* dirty corked entry is skipped */
+ if(corked) /* dirty corked entry is skipped */
entry_ptr = prev_ptr;
- } else if ( ( restart_scan )
+ else if ( ( restart_scan )
||
( prev_ptr->is_dirty != prev_is_dirty )
||
@@ -7233,58 +6930,153 @@ done:
* Programmer: John Mainzer
* 3/24/065
*
- * Changes: Modified function to test for slist chamges in
- * pre_serialize and serialize callbacks, and re-start
- * scans through the slist when such changes occur.
- *
- * This has been a potential problem for some time,
- * and there has been code in this function to deal
- * with elements of this issue. However the shift
- * to the V3 cache in combination with the activities
- * of some of the cache clients (in particular the
- * free space manager and the fractal heap) have
- * made this re-work necessary in H5C_flush_cache.
- *
- * At present, this issue doesn't seem to be causing problems
- * in H5C_flush_invalidate_cache(). However, it seems
- * prudent to port the H5C_flush_cache changes to this
- * function as well.
- *
- * JRM -- 12/14/14
- *
- * Added code to track entry size change during flush single
- * entry. This didn't used to be a problem, as the entry
- * was largely removed from the cache data structures before
- * the flush proper. However, re-entrant calls to the cache
- * in the parallel case required a re-factoring of the
- * H5C__flush_single_entry() function to keep entries fully
- * in the cache until after the pre-serialize and serialize
- * calls.
- * JRM -- 12/25/14
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
{
H5C_t * cache_ptr;
+ H5C_ring_t ring;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_ptr);
+
+#if H5C_DO_SANITY_CHECKS
+{
+ int32_t i;
+ int32_t index_len = 0;
+ int32_t slist_len = 0;
+ size_t index_size = (size_t)0;
+ size_t clean_index_size = (size_t)0;
+ size_t dirty_index_size = (size_t)0;
+ size_t slist_size = (size_t)0;
+
+ HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+ HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0);
+ HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0);
+
+ for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) {
+ index_len += cache_ptr->index_ring_len[i];
+ index_size += cache_ptr->index_ring_size[i];
+ clean_index_size += cache_ptr->clean_index_ring_size[i];
+ dirty_index_size += cache_ptr->dirty_index_ring_size[i];
+
+ slist_len += cache_ptr->slist_ring_len[i];
+ slist_size += cache_ptr->slist_ring_size[i];
+ } /* end for */
+
+ HDassert(cache_ptr->index_len == index_len);
+ HDassert(cache_ptr->index_size == index_size);
+ HDassert(cache_ptr->clean_index_size == clean_index_size);
+ HDassert(cache_ptr->dirty_index_size == dirty_index_size);
+ HDassert(cache_ptr->slist_len == slist_len);
+ HDassert(cache_ptr->slist_size == slist_size);
+}
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ /* remove ageout markers if present */
+ if(cache_ptr->epoch_markers_active > 0)
+ if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.")
+
+ /* flush invalidate each ring, starting from the outermost ring and
+ * working inward.
+ */
+ ring = H5C_RING_USER;
+ while(ring < H5C_RING_NTYPES) {
+ if(H5C_flush_invalidate_ring(f, dxpl_id, ring, flags) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed.")
+ ring++;
+ } /* end while */
+
+ /* Invariants, after destroying all entries in the hash table */
+ if(!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) {
+ HDassert(cache_ptr->index_size == 0);
+ HDassert(cache_ptr->clean_index_size == 0);
+ HDassert(cache_ptr->dirty_index_size == 0);
+ HDassert(cache_ptr->slist_len == 0);
+ HDassert(cache_ptr->slist_size == 0);
+ HDassert(cache_ptr->pel_len == 0);
+ HDassert(cache_ptr->pel_size == 0);
+ HDassert(cache_ptr->pl_len == 0);
+ HDassert(cache_ptr->pl_size == 0);
+ HDassert(cache_ptr->LRU_list_len == 0);
+ HDassert(cache_ptr->LRU_list_size == 0);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_flush_invalidate_cache() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_flush_invalidate_ring
+ *
+ * Purpose: Flush and destroy the entries contained in the target
+ * cache and ring.
+ *
+ * If the ring contains protected entries, the function will
+ * fail, as protected entries cannot be either flushed or
+ * destroyed. However all unprotected entries should be
+ * flushed and destroyed before the function returns failure.
+ *
+ * While pinned entries can usually be flushed, they cannot
+ * be destroyed. However, they should be unpinned when all
+ * the entries that reference them have been destroyed (thus
+ * reduding the pinned entry's reference count to 0, allowing
+ * it to be unpinned).
+ *
+ * If pinned entries are present, the function makes repeated
+ * passes through the cache, flushing all dirty entries
+ * (including the pinned dirty entries where permitted) and
+ * destroying all unpinned entries. This process is repeated
+ * until either the cache is empty, or the number of pinned
+ * entries stops decreasing on each pass.
+ *
+ * If flush dependencies appear in the target ring, the
+ * function makes repeated passes through the cache flushing
+ * entries in flush dependency order.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 9/1/15
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
+ unsigned flags)
+{
+ H5C_t * cache_ptr;
hbool_t restart_slist_scan;
int32_t protected_entries = 0;
int32_t i;
- int32_t cur_pel_len;
- int32_t old_pel_len;
+ int32_t cur_ring_pel_len;
+ int32_t old_ring_pel_len;
unsigned cooked_flags;
unsigned evict_flags;
H5SL_node_t * node_ptr = NULL;
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * next_entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
- int64_t flushed_slist_len = 0;
+ int64_t flushed_slist_len = 0;
int64_t initial_slist_len = 0;
int64_t flushed_slist_size = 0;
size_t initial_slist_size = 0;
- int64_t entry_size_change;
- int64_t * entry_size_change_ptr = &entry_size_change;
+ int64_t entry_size_change;
+ int64_t * entry_size_change_ptr = &entry_size_change;
#else /* H5C_DO_SANITY_CHECKS */
int64_t * entry_size_change_ptr = NULL;
#endif /* H5C_DO_SANITY_CHECKS */
@@ -7298,24 +7090,22 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(cache_ptr->slist_ptr);
+ HDassert(ring > H5C_RING_UNDEFINED);
+ HDassert(ring < H5C_RING_NTYPES);
+
+ HDassert(cache_ptr->epoch_markers_active == 0);
/* Filter out the flags that are not relevant to the flush/invalidate.
- * At present, only the H5C__FLUSH_CLEAR_ONLY_FLAG is kept.
*/
cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG;
evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG;
- /* remove ageout markers if present */
- if(cache_ptr->epoch_markers_active > 0)
- if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.")
-
/* The flush proceedure here is a bit strange.
*
* In the outer while loop we make at least one pass through the
- * cache, and then repeat until either all the pinned entries
- * unpin themselves, or until the number of pinned entries stops
- * declining. In this later case, we scream and die.
+ * cache, and then repeat until either all the pinned entries in
+ * the ring unpin themselves, or until the number of pinned entries
+ * in the ring stops declining. In this later case, we scream and die.
*
* Since the fractal heap can dirty, resize, and/or move entries
* in is flush callback, it is possible that the cache will still
@@ -7339,13 +7129,20 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
* to increasing address order, but there are no guarantees.
*/
- cur_pel_len = cache_ptr->pel_len;
- old_pel_len = cache_ptr->pel_len;
-
- while ( cache_ptr->index_len > 0 )
- {
- protected_entries = 0;
-
+ /* compute the number of pinned entries in this ring */
+ entry_ptr = cache_ptr->pel_head_ptr;
+ cur_ring_pel_len = 0;
+ while(entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
+ if(entry_ptr->ring == ring)
+ cur_ring_pel_len++;
+
+ entry_ptr = entry_ptr->next;
+ } /* end while */
+
+ old_ring_pel_len = cur_ring_pel_len;
+ while(cache_ptr->index_ring_len[ring] > 0) {
/* first, try to flush-destroy any dirty entries. Do this by
* making a scan through the slist. Note that new dirty entries
* may be created by the flush call backs. Thus it is possible
@@ -7353,35 +7150,37 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
*/
#if H5C_DO_SANITY_CHECKS
- /* Depending on circumstances, H5C__flush_single_entry() will
- * remove dirty entries from the slist as it flushes them.
+ /* Depending on circumstances, H5C__flush_single_entry() will
+ * remove dirty entries from the slist as it flushes them.
* Thus for sanity checks we must make note of the initial
* slist length and size before we do any flushes.
*/
initial_slist_len = cache_ptr->slist_len;
- initial_slist_size = cache_ptr->slist_size;
+ initial_slist_size = cache_ptr->slist_size;
/* There is also the possibility that entries will be
- * dirtied, resized, and/or moved as the result of
- * calls to the flush callbacks. We use the slist_len_increase
- * and slist_size_increase increase fields in struct H5C_t
- * to track these changes for purpose of sanity checking.
+ * dirtied, resized, moved, and/or removed from the cache
+ * as the result of calls to the flush callbacks. We use
+ * the slist_len_increase and slist_size_increase increase
+ * fields in struct H5C_t to track these changes for purpose
+ * of sanity checking.
+ *
* To this end, we must zero these fields before we start
* the pass through the slist.
*/
cache_ptr->slist_len_increase = 0;
cache_ptr->slist_size_increase = 0;
- /* Finally, reset the flushed_slist_len and flushed_slist_size
+ /* Finally, reset the flushed_slist_len and flushed_slist_size
* fields to zero, as these fields are used to accumulate
* the slist lenght and size that we see as we scan through
* the slist.
*/
- flushed_slist_len = 0;
- flushed_slist_size = 0;
+ flushed_slist_len = 0;
+ flushed_slist_size = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- /* set the cache_ptr->slist_change_in_pre_serialize and
+ /* set the cache_ptr->slist_change_in_pre_serialize and
* cache_ptr->slist_change_in_serialize to false.
*
* These flags are set to TRUE by H5C__flush_single_entry if the
@@ -7393,18 +7192,16 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
* the slist -- and restart the scan in this event.
*/
cache_ptr->slist_change_in_pre_serialize = FALSE;
- cache_ptr->slist_change_in_serialize = FALSE;
-
- /* this done, start the scan of the slist */
- restart_slist_scan = TRUE;
+ cache_ptr->slist_change_in_serialize = FALSE;
+ /* this done, start the scan of the slist */
+ restart_slist_scan = TRUE;
while(restart_slist_scan || (node_ptr != NULL)) {
if(restart_slist_scan) {
restart_slist_scan = FALSE;
/* Start at beginning of skip list */
node_ptr = H5SL_first(cache_ptr->slist_ptr);
-
if(node_ptr == NULL)
/* the slist is empty -- break out of inner loop */
break;
@@ -7417,24 +7214,26 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(next_entry_ptr->is_dirty);
HDassert(next_entry_ptr->in_slist);
+ HDassert(next_entry_ptr->ring >= ring);
} /* end if */
- entry_ptr = next_entry_ptr;
+ entry_ptr = next_entry_ptr;
- /* It is possible that entries will be dirtied, resized,
- * flushed, or removed from the cache via the take ownership
- * flag as the result of pre_serialize or serialized callbacks.
- *
+ /* It is possible that entries will be dirtied, resized,
+ * flushed, or removed from the cache via the take ownership
+ * flag as the result of pre_serialize or serialized callbacks.
+ *
* This in turn can corrupt the scan through the slist.
*
- * We test for slist modifications in the pre_serialize
- * and serialize callbacks, and restart the scan of the
+ * We test for slist modifications in the pre_serialize
+ * and serialize callbacks, and restart the scan of the
* slist if we find them. However, best we do some extra
- * sanity checking just in case.
- */
+ * sanity checking just in case.
+ */
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(entry_ptr->in_slist);
HDassert(entry_ptr->is_dirty);
+ HDassert(entry_ptr->ring >= ring);
/* increment node pointer now, before we delete its target
* from the slist.
@@ -7447,6 +7246,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(next_entry_ptr->is_dirty);
HDassert(next_entry_ptr->in_slist);
+ HDassert(next_entry_ptr->ring >= ring);
HDassert(entry_ptr != next_entry_ptr);
} /* end if */
else
@@ -7465,11 +7265,11 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
HDassert(entry_ptr != NULL);
HDassert(entry_ptr->in_slist);
- if ( ( ( ! entry_ptr->flush_me_last ) ||
- ( ( entry_ptr->flush_me_last ) &&
- ( cache_ptr->num_last_entries >=
- cache_ptr->slist_len ) ) ) &&
- ( entry_ptr->flush_dep_nchildren == 0 ) ) {
+ if(((!entry_ptr->flush_me_last) ||
+ ((entry_ptr->flush_me_last) &&
+ (cache_ptr->num_last_entries >= cache_ptr->slist_len))) &&
+ (entry_ptr->flush_dep_nchildren == 0) &&
+ (entry_ptr->ring == ring)) {
if(entry_ptr->is_protected) {
/* we have major problems -- but lets flush
* everything we can before we flag an error.
@@ -7478,87 +7278,83 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
} else if(entry_ptr->is_pinned) {
#if H5C_DO_SANITY_CHECKS
- /* update flushed_slist_len & flushed_slist_size
- * before the flush. Note that the entry will
- * be removed from the slist after the flush,
- * and thus may be resized by the flush callback.
- * This is OK, as we will catch the size delta in
- * cache_ptr->slist_size_increase.
- *
- */
- flushed_slist_len++;
- flushed_slist_size += (int64_t)entry_ptr->size;
- entry_size_change = 0;
+ /* update flushed_slist_len & flushed_slist_size
+ * before the flush. Note that the entry will
+ * be removed from the slist after the flush,
+ * and thus may be resized by the flush callback.
+ * This is OK, as we will catch the size delta in
+ * cache_ptr->slist_size_increase.
+ *
+ */
+ flushed_slist_len++;
+ flushed_slist_size += (int64_t)entry_ptr->size;
+ entry_size_change = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr) < 0)
- /* This shouldn't happen -- if it does, we are toast
- * so just scream and die.
- */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.")
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.")
#if H5C_DO_SANITY_CHECKS
- /* entry size may have changed during the flush.
- * Update flushed_slist_size to account for this.
+ /* entry size may have changed during the flush.
+ * Update flushed_slist_size to account for this.
*/
- flushed_slist_size += entry_size_change;
+ flushed_slist_size += entry_size_change;
#endif /* H5C_DO_SANITY_CHECKS */
- if ( ( cache_ptr->slist_change_in_serialize ) ||
- ( cache_ptr->slist_change_in_pre_serialize ) )
- {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
- * This has the potential to corrupt the
- * scan through the slist, so restart it.
- */
- restart_slist_scan = TRUE;
- cache_ptr->slist_change_in_pre_serialize = FALSE;
- cache_ptr->slist_change_in_serialize = FALSE;
- H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr);
- }
+ if((cache_ptr->slist_change_in_serialize) ||
+ (cache_ptr->slist_change_in_pre_serialize)) {
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_change_in_pre_serialize = FALSE;
+ cache_ptr->slist_change_in_serialize = FALSE;
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr);
+ } /* end if */
} /* end if */
else {
#if H5C_DO_SANITY_CHECKS
- /* update flushed_slist_len & flushed_slist_size
- * before the flush. Note that the entry will
- * be removed from the slist after the flush,
- * and thus may be resized by the flush callback.
- * This is OK, as we will catch the size delta in
- * cache_ptr->slist_size_increase.
- *
- */
- flushed_slist_len++;
- flushed_slist_size += (int64_t)entry_ptr->size;
- entry_size_change = 0;
+ /* update flushed_slist_len & flushed_slist_size
+ * before the flush. Note that the entry will
+ * be removed from the slist after the flush,
+ * and thus may be resized by the flush callback.
+ * This is OK, as we will catch the size delta in
+ * cache_ptr->slist_size_increase.
+ *
+ */
+ flushed_slist_len++;
+ flushed_slist_size += (int64_t)entry_ptr->size;
+ entry_size_change = 0;
#endif /* H5C_DO_SANITY_CHECKS */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), entry_size_change_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.")
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr,
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG),
+ entry_size_change_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.")
#if H5C_DO_SANITY_CHECKS
- /* entry size may have changed during the flush.
- * Update flushed_slist_size to account for this.
- */
- flushed_slist_size += entry_size_change;
+ /* entry size may have changed during the flush.
+ * Update flushed_slist_size to account for this.
+ */
+ flushed_slist_size += entry_size_change;
#endif /* H5C_DO_SANITY_CHECKS */
- if ((cache_ptr->slist_change_in_serialize) ||
- (cache_ptr->slist_change_in_pre_serialize))
- {
- /* The slist has been modified by something
- * other than the simple removal of the
- * of the flushed entry after the flush.
- *
+ if((cache_ptr->slist_change_in_serialize) ||
+ (cache_ptr->slist_change_in_pre_serialize)) {
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
* This has the potential to corrupt the
* scan through the slist, so restart it.
*/
- restart_slist_scan = TRUE;
- cache_ptr->slist_change_in_pre_serialize = FALSE;
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_change_in_pre_serialize = FALSE;
cache_ptr->slist_change_in_serialize = FALSE;
H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
- }
-
+ } /* end if */
} /* end else */
} /* end if */
} /* end while loop scanning skip list */
@@ -7597,42 +7393,44 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
while(next_entry_ptr != NULL) {
entry_ptr = next_entry_ptr;
- HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
next_entry_ptr = entry_ptr->ht_next;
HDassert((next_entry_ptr == NULL) ||
(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC));
- if ( ( ( ! entry_ptr->flush_me_last ) ||
- ( ( entry_ptr->flush_me_last ) &&
- ( cache_ptr->num_last_entries >=
- cache_ptr->slist_len ) ) ) &&
- ( entry_ptr->flush_dep_nchildren == 0 ) ) {
+ if(((!entry_ptr->flush_me_last) ||
+ ((entry_ptr->flush_me_last) &&
+ (cache_ptr->num_last_entries >= cache_ptr->slist_len))) &&
+ (entry_ptr->flush_dep_nchildren == 0) &&
+ (entry_ptr->ring == ring)) {
if(entry_ptr->is_protected) {
- /* we have major problems -- but lets flush and destroy
- * everything we can before we flag an error.
+ /* we have major problems -- but lets flush and
+ * destroy everything we can before we flag an
+ * error.
*/
protected_entries++;
-
if(!entry_ptr->in_slist)
HDassert(!(entry_ptr->is_dirty));
} else if(!(entry_ptr->is_pinned)) {
- /* if *entry_ptr is dirty, it is possible
- * that one or more other entries may be
- * either removed from the cache, loaded
+
+ /* if *entry_ptr is dirty, it is possible
+ * that one or more other entries may be
+ * either removed from the cache, loaded
* into the cache, or moved to a new location
* in the file as a side effect of the flush.
*
- * If this happens, and one of the target
- * entries happens to be the next entry in
- * the hash bucket, we could find ourselves
- * either find ourselves either scanning a
- * non-existant entry, scanning through a
+ * If this happens, and one of the target
+ * entries happens to be the next entry in
+ * the hash bucket, we could find ourselves
+ * either find ourselves either scanning a
+ * non-existant entry, scanning through a
* different bucket, or skipping an entry.
*
- * Neither of these are good, so restart the
- * the scan at the head of the hash bucket
+ * Neither of these are good, so restart the
+ * the scan at the head of the hash bucket
* after the flush if *entry_ptr was dirty,
* on the off chance that the next entry was
* a target.
@@ -7643,10 +7441,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
*/
hbool_t entry_was_dirty;
- entry_was_dirty = entry_ptr->is_dirty;
+ entry_was_dirty = entry_ptr->is_dirty;
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.")
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr,
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG),
+ NULL) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.")
if(entry_was_dirty) {
/* update stats for hash bucket scan
@@ -7658,6 +7458,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
} /* end if */
} /* end if */
} /* end if */
+
/* We can't do anything if the entry is pinned. The
* hope is that the entry will be unpinned as the
* result of destroys of entries that reference it.
@@ -7666,7 +7467,7 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
* of pinned entries from pass to pass. If it stops
* shrinking before it hits zero, we scream and die.
*/
- /* if the serialize function on the entry we last evicted
+ /* if the serialize function on the entry we last evicted
* loaded an entry into cache (as Quincey has promised me
* it never will), and if the cache was full, it is
* possible that *next_entry_ptr was flushed or evicted.
@@ -7675,9 +7476,9 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
* test is triggred, we are accessing a deallocated piece
* of dynamically allocated memory, so we just scream and
* die.
- *
- * Update: The code to restart the scan after flushes
- * of dirty entries should make it impossible
+ *
+ * Update: The code to restart the scan after flushes
+ * of dirty entries should make it impossible
* to satisfy the following test. Leave it in
* in case I am wrong.
* -- JRM
@@ -7690,61 +7491,393 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
} /* end while loop scanning hash table bin */
} /* end for loop scanning hash table */
- old_pel_len = cur_pel_len;
- cur_pel_len = cache_ptr->pel_len;
-
- if ( ( cur_pel_len > 0 ) && ( cur_pel_len >= old_pel_len ) ) {
+ old_ring_pel_len = cur_ring_pel_len;
+ entry_ptr = cache_ptr->pel_head_ptr;
+ cur_ring_pel_len = 0;
+ while(entry_ptr != NULL) {
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->ring >= ring);
- if(evict_flags) HGOTO_DONE(TRUE)
+ if(entry_ptr->ring == ring)
+ cur_ring_pel_len++;
- /* The number of pinned entries is positive, and it is not
- * declining. Scream and die.
- */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entry count not decreasing, cur_pel_len = %d, old_pel_len = %d", (int)cur_pel_len, (int)old_pel_len)
- }
- HDassert( protected_entries == cache_ptr->pl_len );
- if ( ( protected_entries > 0 ) &&
- ( protected_entries == cache_ptr->index_len ) ) {
+ entry_ptr = entry_ptr->next;
+ } /* end while */
- /* Only protected entries are left in the cache. Scream and die.
- */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Only protected entries left in cache, protected_entries = %d", (int)protected_entries)
+ if((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) {
+ /* Don't error if allowed to have pinned entries remaining */
+ if(evict_flags)
+ HGOTO_DONE(TRUE)
- }
+ /* The number of pinned entries in the ring is positive, and
+ * it is not declining. Scream and die.
+ */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring)
+ } /* end if */
+ HDassert(protected_entries == cache_ptr->pl_len);
+ if((protected_entries > 0) && (protected_entries == cache_ptr->index_len))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Only protected entries left in cache, protected_entries = %d", (int)protected_entries)
} /* main while loop */
- /* Invariants, after destroying all entries in the hash table */
- HDassert(cache_ptr->index_size == 0);
- HDassert(cache_ptr->clean_index_size == 0);
- HDassert(cache_ptr->dirty_index_size == 0);
- HDassert(cache_ptr->slist_len == 0);
- HDassert(cache_ptr->slist_size == 0);
- HDassert(cache_ptr->pel_len == 0);
- HDassert(cache_ptr->pel_size == 0);
- HDassert(cache_ptr->pl_len == 0);
- HDassert(cache_ptr->pl_size == 0);
- HDassert(cache_ptr->LRU_list_len == 0);
- HDassert(cache_ptr->LRU_list_size == 0);
+ /* Invariants, after destroying all entries in the ring */
+ for(i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) {
+ HDassert(cache_ptr->index_ring_len[i] == 0);
+ HDassert(cache_ptr->index_ring_size[i] == (size_t)0);
+ HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0);
+ HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0);
+ HDassert(cache_ptr->slist_ring_len[i] == 0);
+ HDassert(cache_ptr->slist_ring_size[i] == (size_t)0);
+ } /* end for */
HDassert(protected_entries <= cache_ptr->pl_len);
if(protected_entries > 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries.")
+ else if(cur_ring_pel_len > 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring.")
- else if(cur_pel_len > 0) {
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_flush_invalidate_ring() */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries.")
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_flush_ring
+ *
+ * Purpose: Flush the entries contained in the specified cache and
+ * ring. All entries in rings outside the specified ring
+ * must have been flushed on entry.
+ *
+ * If the cache contains protected entries in the specified
+ * ring, the function will fail, as protected entries cannot
+ * be flushed. However all unprotected entries in the target
+ * ring should be flushed before the function returns failure.
+ *
+ * If flush dependencies appear in the target ring, the
+ * function makes repeated passes through the slist flushing
+ * entries in flush dependency order.
+ *
+ * Return: Non-negative on success/Negative on failure or if there was
+ * a request to flush all items and something was protected.
+ *
+ * Programmer: John Mainzer
+ * 9/1/15
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags)
+{
+ H5C_t * cache_ptr = f->shared->cache;
+ hbool_t destroy;
+ hbool_t flushed_entries_last_pass;
+ hbool_t flush_marked_entries;
+ hbool_t ignore_protected;
+ hbool_t tried_to_flush_protected_entry = FALSE;
+ hbool_t restart_slist_scan;
+ int32_t protected_entries = 0;
+ H5SL_node_t * node_ptr = NULL;
+ H5C_cache_entry_t * entry_ptr = NULL;
+ H5C_cache_entry_t * next_entry_ptr = NULL;
+#if H5C_DO_SANITY_CHECKS
+ int64_t flushed_entries_count = 0;
+ int64_t flushed_entries_size = 0;
+ int64_t initial_slist_len = 0;
+ size_t initial_slist_size = 0;
+ int64_t entry_size_change;
+ int64_t * entry_size_change_ptr = &entry_size_change;
+#else /* H5C_DO_SANITY_CHECKS */
+ int64_t * entry_size_change_ptr = NULL;
+#endif /* H5C_DO_SANITY_CHECKS */
+ int i;
+ herr_t ret_value = SUCCEED;
- }
+ FUNC_ENTER_NOAPI(FAIL)
-done:
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr->slist_ptr);
+ HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0);
+ HDassert(ring > H5C_RING_UNDEFINED);
+ HDassert(ring < H5C_RING_NTYPES);
- FUNC_LEAVE_NOAPI(ret_value)
+#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 entry.\n");
+#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
-} /* H5C_flush_invalidate_cache() */
+ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 );
+ destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 );
+ flush_marked_entries = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 );
+
+ if(!flush_marked_entries)
+ for(i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++)
+ HDassert(cache_ptr->slist_ring_len[i] == 0);
+
+ HDassert(cache_ptr->flush_in_progress);
+
+ /* When we are only flushing marked entries, the slist will usually
+ * still contain entries when we have flushed everything we should.
+ * Thus we track whether we have flushed any entries in the last
+ * pass, and terminate if we haven't.
+ */
+ flushed_entries_last_pass = TRUE;
+
+ /* set the cache_ptr->slist_change_in_pre_serialize and
+ * cache_ptr->slist_change_in_serialize to false.
+ *
+ * These flags are set to TRUE by H5C__flush_single_entry if the
+ * slist is modified by a pre_serialize or serialize call respectively.
+ * H5C_flush_cache uses these flags to detect any modifications
+ * to the slist that might corrupt the scan of the slist -- and
+ * restart the scan in this event.
+ */
+ cache_ptr->slist_change_in_pre_serialize = FALSE;
+ cache_ptr->slist_change_in_serialize = FALSE;
+
+ while((cache_ptr->slist_ring_len[ring] > 0) &&
+ (protected_entries == 0) &&
+ (flushed_entries_last_pass)) {
+ flushed_entries_last_pass = FALSE;
+
+#if H5C_DO_SANITY_CHECKS
+ /* For sanity checking, try to verify that the skip list has
+ * the expected size and number of entries at the end of each
+ * internal while loop (see below).
+ *
+ * Doing this get a bit tricky, as depending on flags, we may
+ * or may not flush all the entries in the slist.
+ *
+ * To make things more entertaining, with the advent of the
+ * fractal heap, the entry serialize callback can cause entries
+ * to be dirtied, resized, and/or moved. Also, the
+ * pre_serialize callback can result in an entry being
+ * removed from the cache via the take ownership flag.
+ *
+ * To deal with this, we first make note of the initial
+ * skip list length and size:
+ */
+ initial_slist_len = cache_ptr->slist_len;
+ initial_slist_size = cache_ptr->slist_size;
+
+ /* We then zero counters that we use to track the number
+ * and total size of entries flushed:
+ */
+ flushed_entries_count = 0;
+ flushed_entries_size = 0;
+
+ /* As mentioned above, there is the possibility that
+ * entries will be dirtied, resized, flushed, or removed
+ * from the cache via the take ownership flag during
+ * our pass through the skip list. To capture the number
+ * of entries added, and the skip list size delta,
+ * zero the slist_len_increase and slist_size_increase of
+ * the cache's instance of H5C_t. These fields will be
+ * updated elsewhere to account for slist insertions and/or
+ * dirty entry size changes.
+ */
+ cache_ptr->slist_len_increase = 0;
+ cache_ptr->slist_size_increase = 0;
+
+ /* at the end of the loop, use these values to compute the
+ * expected slist length and size and compare this with the
+ * value recorded in the cache's instance of H5C_t.
+ */
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ restart_slist_scan = TRUE;
+
+ while((restart_slist_scan ) || (node_ptr != NULL)) {
+ if(restart_slist_scan) {
+ restart_slist_scan = FALSE;
+
+ /* Start at beginning of skip list */
+ node_ptr = H5SL_first(cache_ptr->slist_ptr);
+
+ if(node_ptr == NULL)
+ /* the slist is empty -- break out of inner loop */
+ break;
+
+ /* Get cache entry for this node */
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+
+ if(NULL == next_entry_ptr)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
+
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
+ } /* end if */
+
+ entry_ptr = next_entry_ptr;
+
+ /* With the advent of the fractal heap, the free space
+ * manager, and the version 3 cache, it is possible
+ * that the pre-serialize or serialize callback will
+ * dirty, resize, or take ownership of other entries
+ * in the cache.
+ *
+ * To deal with this, I have inserted code to detect any
+ * change in the skip list not directly under the control
+ * of this function. If such modifications are detected,
+ * we must re-start the scan of the skip list to avoid
+ * the possibility that the target of the next_entry_ptr
+ * may have been flushed or deleted from the cache.
+ *
+ * To verify that all such possibilities have been dealt
+ * with, we do a bit of extra sanity checking on
+ * entry_ptr.
+ */
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(entry_ptr->in_slist);
+ HDassert(entry_ptr->is_dirty);
+ if(!flush_marked_entries || entry_ptr->flush_marker)
+ HDassert(entry_ptr->ring >= ring);
+
+ /* increment node pointer now, before we delete its target
+ * from the slist.
+ */
+ node_ptr = H5SL_next(node_ptr);
+ if(node_ptr != NULL) {
+ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ if(NULL == next_entry_ptr)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
+
+ HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert(next_entry_ptr->is_dirty);
+ HDassert(next_entry_ptr->in_slist);
+ if(!flush_marked_entries || next_entry_ptr->flush_marker)
+ HDassert(next_entry_ptr->ring >= ring);
+
+ HDassert(entry_ptr != next_entry_ptr);
+ } /* end if */
+ else
+ next_entry_ptr = NULL;
+
+ HDassert(entry_ptr != NULL);
+ HDassert(entry_ptr->in_slist);
+
+ if(((!flush_marked_entries) || (entry_ptr->flush_marker)) &&
+ ((!entry_ptr->flush_me_last) ||
+ (entry_ptr->flush_me_last &&
+ ((cache_ptr->num_last_entries >= cache_ptr->slist_len) ||
+ (flush_marked_entries && entry_ptr->flush_marker)))) &&
+ ( ( entry_ptr->flush_dep_nchildren == 0 ) ||
+ ( ( ! destroy ) &&
+ ( entry_ptr->flush_dep_ndirty_children == 0 ) ) ) &&
+ (entry_ptr->ring == ring)) {
+ if(entry_ptr->is_protected) {
+ /* we probably have major problems -- but lets
+ * flush everything we can before we decide
+ * whether to flag an error.
+ */
+ tried_to_flush_protected_entry = TRUE;
+ protected_entries++;
+ } /* end if */
+ else if(entry_ptr->is_pinned) {
+
+#if H5C_DO_SANITY_CHECKS
+ flushed_entries_count++;
+ flushed_entries_size += (int64_t)entry_ptr->size;
+ entry_size_change = 0;
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.")
+
+#if H5C_DO_SANITY_CHECKS
+ /* it is possible that the entry size changed
+ * during flush -- update flushed_entries_size
+ * to account for this.
+ */
+ flushed_entries_size += entry_size_change;
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ if((cache_ptr->slist_change_in_serialize) ||
+ (cache_ptr->slist_change_in_pre_serialize)) {
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_change_in_pre_serialize = FALSE;
+ cache_ptr->slist_change_in_serialize = FALSE;
+
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
+ } /* end if */
+
+ flushed_entries_last_pass = TRUE;
+ } /* end else-if */
+ else {
+#if H5C_DO_SANITY_CHECKS
+ flushed_entries_count++;
+ flushed_entries_size += (int64_t)entry_ptr->size;
+ entry_size_change = 0;
+#endif /* H5C_DO_SANITY_CHECKS */
+ if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.")
+
+#if H5C_DO_SANITY_CHECKS
+ /* it is possible that the entry size changed
+ * during flush -- update flushed_entries_size
+ * to account for this.
+ */
+ flushed_entries_size += entry_size_change;
+#endif /* H5C_DO_SANITY_CHECKS */
+
+ if((cache_ptr->slist_change_in_serialize) ||
+ (cache_ptr->slist_change_in_pre_serialize)) {
+ /* The slist has been modified by something
+ * other than the simple removal of the
+ * of the flushed entry after the flush.
+ *
+ * This has the potential to corrupt the
+ * scan through the slist, so restart it.
+ */
+ restart_slist_scan = TRUE;
+ cache_ptr->slist_change_in_pre_serialize = FALSE;
+ cache_ptr->slist_change_in_serialize = FALSE;
+
+ H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
+ } /* end if */
+
+ flushed_entries_last_pass = TRUE;
+ } /* end else */
+ } /* end if */
+ } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */
+
+#if H5C_DO_SANITY_CHECKS
+ /* Verify that the slist size and length are as expected. */
+ HDassert((initial_slist_len + cache_ptr->slist_len_increase -
+ flushed_entries_count) == cache_ptr->slist_len);
+ HDassert((size_t)((int64_t)initial_slist_size +
+ cache_ptr->slist_size_increase -
+ flushed_entries_size) == cache_ptr->slist_size);
+#endif /* H5C_DO_SANITY_CHECKS */
+ } /* while */
+
+ HDassert(protected_entries <= cache_ptr->pl_len);
+
+ if(((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items")
+
+#if H5C_DO_SANITY_CHECKS
+ if(!flush_marked_entries) {
+ HDassert(cache_ptr->slist_ring_len[ring] == 0);
+ HDassert(cache_ptr->slist_ring_size[ring] == 0);
+ } /* end if */
+#endif /* H5C_DO_SANITY_CHECKS */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_flush_ring() */
/*-------------------------------------------------------------------------
@@ -7760,7 +7893,7 @@ done:
* error.
*
* If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will
- * be cleared and not flushed, and the call can't be part of a
+ * be cleared and not flushed, and the call can't be part of a
* sequence of flushes.
*
* If the caller knows the address of the skip list node at
@@ -7778,33 +7911,33 @@ done:
*
* Programmer: John Mainzer, 5/5/04
*
- * Changes: Refactored function to remove the type_ptr parameter.
+ * Changes: Refactored function to remove the type_ptr parameter.
*
- * JRM -- 8/7/14
+ * JRM -- 8/7/14
*
* Added code to check for slist changes in pre_serialize and
- * serialize calls, and set
- * cache_ptr->slist_change_in_pre_serialize and
- * cache_ptr->slist_change_in_serialize as appropriate.
+ * serialize calls, and set
+ * cache_ptr->slist_change_in_pre_serialize and
+ * cache_ptr->slist_change_in_serialize as appropriate.
*
* JRM -- 12/13/14
*
- * Refactored function to delay all modifications of the
- * metadata cache data structures until after any calls
- * to the pre-serialize or serialize callbacks.
+ * Refactored function to delay all modifications of the
+ * metadata cache data structures until after any calls
+ * to the pre-serialize or serialize callbacks.
*
- * Need to do this, as some pre-serialize or serialize
- * calls result in calls to the metadata cache and
- * modifications to its data structures. Thus, at the
- * time of any such call, the target entry flags and
- * the metadata cache must all be consistant.
+ * Need to do this, as some pre-serialize or serialize
+ * calls result in calls to the metadata cache and
+ * modifications to its data structures. Thus, at the
+ * time of any such call, the target entry flags and
+ * the metadata cache must all be consistant.
*
- * Also added the entry_size_change_ptr parameter, which
- * allows the function to report back any change in the size
- * of the entry during the flush. Such size changes may
- * occur during the pre-serialize callback.
+ * Also added the entry_size_change_ptr parameter, which
+ * allows the function to report back any change in the size
+ * of the entry during the flush. Such size changes may
+ * occur during the pre-serialize callback.
*
- * JRM -- 12/24/14
+ * JRM -- 12/24/14
*
*-------------------------------------------------------------------------
*/
@@ -7815,16 +7948,16 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
H5C_t * cache_ptr; /* Cache for file */
hbool_t destroy; /* external flag */
hbool_t clear_only; /* external flag */
- hbool_t free_file_space; /* external flag */
+ hbool_t free_file_space; /* external flag */
hbool_t take_ownership; /* external flag */
hbool_t del_from_slist_on_destroy; /* external flag */
- hbool_t write_entry; /* internal flag */
- hbool_t destroy_entry; /* internal flag */
+ hbool_t write_entry; /* internal flag */
+ hbool_t destroy_entry; /* internal flag */
hbool_t was_dirty;
- haddr_t new_addr = HADDR_UNDEF;
- haddr_t old_addr = HADDR_UNDEF;
- size_t new_len = 0;
- size_t new_compressed_len = 0;
+ haddr_t new_addr = HADDR_UNDEF;
+ haddr_t old_addr = HADDR_UNDEF;
+ size_t new_len = 0;
+ size_t new_compressed_len = 0;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -7834,6 +7967,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(entry_ptr);
+ HDassert(entry_ptr->ring != H5C_RING_UNDEFINED);
/* If defined, initialize *entry_size_change_ptr to 0 */
if(entry_size_change_ptr != NULL)
@@ -8237,7 +8371,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
/* only log a clear if the entry was dirty */
if(was_dirty) {
H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
- } /* end if */
+ } /* end if */
} else if(write_entry) {
HDassert(was_dirty);
@@ -8279,34 +8413,30 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr)
- if(entry_ptr->in_slist && del_from_slist_on_destroy)
+ if(entry_ptr->in_slist && del_from_slist_on_destroy)
H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr)
- H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
+ H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL)
/* Destroy parent flush dependencies and free flush dependency parent
* array, if necessary */
- HDassert( entry_ptr->flush_dep_nchildren == 0 );
- if ( entry_ptr->flush_dep_parent_nalloc > 0 ) {
-
- while ( entry_ptr->flush_dep_nparents > 0 ) {
-
+ HDassert(entry_ptr->flush_dep_nchildren == 0);
+ if(entry_ptr->flush_dep_parent_nalloc > 0) {
+ while(entry_ptr->flush_dep_nparents > 0) {
/* Since the flush_dep_parent array willbe resized every
* a flush dependency is destroyed, we do not have to
* iterate over all indices. Instead, always destroy the
* last dependency so we can skip the memmove() in
* H5C_destroy_flush_dependency(). */
- if ( H5C_destroy_flush_dependency(entry_ptr->flush_dep_parent[entry_ptr->flush_dep_nparents - 1],
- entry_ptr) < 0 ) {
+ if(H5C_destroy_flush_dependency(entry_ptr->flush_dep_parent[entry_ptr->flush_dep_nparents - 1], entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Can't remove flush dependency")
- }
- }
+ } /* end while */
/* H5C_destroy_flush_dependency should have freed the parent
* array when it became empty */
- HDassert( ! (entry_ptr->flush_dep_parent) );
- HDassert( entry_ptr->flush_dep_parent_nalloc == 0 );
- }
+ HDassert(!(entry_ptr->flush_dep_parent));
+ HDassert(entry_ptr->flush_dep_parent_nalloc == 0);
+ } /* end if */
}
else {
HDassert(clear_only || write_entry);
@@ -8339,18 +8469,13 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
/* Propagate the clean flag up the flush dependency chain if
* appropriate */
- if ( was_dirty ) {
-
- HDassert( entry_ptr->flush_dep_ndirty_children == 0 );
-
- if ( entry_ptr->flush_dep_nparents > 0 ) {
-
- if ( H5C__mark_flush_dep_clean(entry_ptr) < 0 ) {
+ if(was_dirty) {
+ HDassert(entry_ptr->flush_dep_ndirty_children == 0);
+ if(entry_ptr->flush_dep_nparents > 0)
+ if(H5C__mark_flush_dep_clean(entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep clean flag")
- }
- }
- }
+ } /* end if */
}
@@ -8500,7 +8625,8 @@ done:
*
* Return: FAIL if error is detected, SUCCEED otherwise.
*
- * Programmer:
+ * Programmer: Vailin Choi
+ * 9/6/15
*
*-------------------------------------------------------------------------
*/
@@ -8581,14 +8707,14 @@ H5C_load_entry(H5F_t * f,
haddr_t addr,
void * udata)
{
- hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
- hbool_t compressed = FALSE; /* flag indicating whether thing */
- /* will be run through filters on */
+ hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
+ hbool_t compressed = FALSE; /* flag indicating whether thing */
+ /* will be run through filters on */
/* on read and write. Usually FALSE */
- /* set to true if appropriate. */
- size_t compressed_size = 0; /* entry compressed size if */
+ /* set to true if appropriate. */
+ size_t compressed_size = 0; /* entry compressed size if */
/* known -- otherwise uncompressed. */
- /* Zero indicates compression not */
+ /* Zero indicates compression not */
/* enabled. */
uint8_t * image = NULL; /* Buffer for disk image */
void * thing = NULL; /* Pointer to thing loaded */
@@ -8697,10 +8823,8 @@ H5C_load_entry(H5F_t * f,
#endif /* modified code */ /* JRM */
}
/* Allocate the buffer for reading the on-disk entry image */
- if(NULL == (image = H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \
- "memory allocation failed for on disk image buffer.")
+ if(NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer.")
#if H5C_DO_MEMORY_SANITY_CHECKS
HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
@@ -8731,7 +8855,7 @@ H5C_load_entry(H5F_t * f,
if(actual_len != len) {
if(NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
- image = new_image;
+ image = (uint8_t *)new_image;
}
if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0)
@@ -8774,7 +8898,7 @@ H5C_load_entry(H5F_t * f,
if(NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
- image = new_image;
+ image = (uint8_t *)new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
HDmemcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
@@ -8788,8 +8912,7 @@ H5C_load_entry(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image")
}
} else { /* throw an error */
- HGOTO_ERROR(H5E_CACHE, H5E_UNSUPPORTED, NULL,
- "size of non-speculative, non-compressed object changed")
+ HGOTO_ERROR(H5E_CACHE, H5E_UNSUPPORTED, NULL, "size of non-speculative, non-compressed object changed")
}
} /* end if (actual_len != len) */
@@ -8811,7 +8934,7 @@ H5C_load_entry(H5F_t * f,
if(retries) { /* Does not track 0 retry */
if(H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries)
- }
+ } /* end if */
len = actual_len;
} /* end if !H5C__CLASS_SKIP_READS */
@@ -8830,7 +8953,7 @@ H5C_load_entry(H5F_t * f,
*
* In the following assert:
*
- * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
+ * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
*
* note that type ids 5 & 6 are associated with object headers in the
* metadata cache.
@@ -8847,12 +8970,12 @@ H5C_load_entry(H5F_t * f,
entry->addr = addr;
entry->size = len;
HDassert(entry->size < H5C_MAX_ENTRY_SIZE);
- entry->compressed = compressed;
- entry->compressed_size = compressed_size;
+ entry->compressed = compressed;
+ entry->compressed_size = compressed_size;
entry->image_ptr = image;
entry->image_up_to_date = TRUE;
entry->type = type;
- entry->is_dirty = dirty;
+ entry->is_dirty = dirty;
entry->dirtied = FALSE;
entry->is_protected = FALSE;
entry->is_read_only = FALSE;
@@ -8867,6 +8990,8 @@ H5C_load_entry(H5F_t * f,
entry->flush_in_progress = FALSE;
entry->destroy_in_progress = FALSE;
+ entry->ring = H5C_RING_UNDEFINED;
+
/* Initialize flush dependency height fields */
entry->flush_dep_parent = NULL;
entry->flush_dep_nparents = 0;
@@ -8887,7 +9012,7 @@ H5C_load_entry(H5F_t * f,
ret_value = thing;
done:
- /* Cleanup on error */
+ /* Cleanup on error */
if(NULL == ret_value) {
/* Release resources */
@@ -8897,7 +9022,7 @@ done:
"free_icr callback failed")
if(image)
- image = H5MM_xfree(image);
+ image = (uint8_t *)H5MM_xfree(image);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -8937,45 +9062,45 @@ done:
*
* Programmer: John Mainzer, 5/14/04
*
- * Changes: Modified function to skip over entries with the
- * flush_in_progress flag set. If this is not done,
- * an infinite recursion is possible if the cache is
- * full, and the pre-serialize or serialize routine
- * attempts to load another entry.
+ * Changes: Modified function to skip over entries with the
+ * flush_in_progress flag set. If this is not done,
+ * an infinite recursion is possible if the cache is
+ * full, and the pre-serialize or serialize routine
+ * attempts to load another entry.
*
* This error was exposed by a re-factor of the
* H5C__flush_single_entry() routine. However, it was
* a potential bug from the moment that entries were
* allowed to load other entries on flush.
*
- * In passing, note that the primary and secondary dxpls
- * mentioned in the comment above have been replaced by
- * a single dxpl at some point, and thus the discussion
- * above is somewhat obsolete. Date of this change is
- * unkown.
+ * In passing, note that the primary and secondary dxpls
+ * mentioned in the comment above have been replaced by
+ * a single dxpl at some point, and thus the discussion
+ * above is somewhat obsolete. Date of this change is
+ * unkown.
*
- * JRM -- 12/26/14
+ * JRM -- 12/26/14
*
- * Modified function to detect deletions of entries
- * during a scan of the LRU, and where appropriate,
- * restart the scan to avoid proceeding with a next
- * entry that is no longer in the cache.
+ * Modified function to detect deletions of entries
+ * during a scan of the LRU, and where appropriate,
+ * restart the scan to avoid proceeding with a next
+ * entry that is no longer in the cache.
*
- * Note the absence of checks after flushes of clean
- * entries. As a second entry can only be removed by
- * by a call to the pre_serialize or serialize callback
- * of the first, and as these callbacks will not be called
- * on clean entries, no checks are needed.
+ * Note the absence of checks after flushes of clean
+ * entries. As a second entry can only be removed by
+ * by a call to the pre_serialize or serialize callback
+ * of the first, and as these callbacks will not be called
+ * on clean entries, no checks are needed.
*
- * JRM -- 4/6/15
+ * JRM -- 4/6/15
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5C_make_space_in_cache(H5F_t * f,
- hid_t dxpl_id,
- size_t space_needed,
- hbool_t write_permitted)
+H5C_make_space_in_cache(H5F_t * f,
+ hid_t dxpl_id,
+ size_t space_needed,
+ hbool_t write_permitted)
{
H5C_t * cache_ptr = f->shared->cache;
#if H5C_COLLECT_CACHE_STATS
@@ -8987,7 +9112,7 @@ H5C_make_space_in_cache(H5F_t * f,
size_t empty_space;
hbool_t prev_is_dirty = FALSE;
hbool_t didnt_flush_entry = FALSE;
- hbool_t restart_scan;
+ hbool_t restart_scan;
H5C_cache_entry_t * entry_ptr;
H5C_cache_entry_t * prev_ptr;
H5C_cache_entry_t * next_ptr;
@@ -9004,7 +9129,7 @@ H5C_make_space_in_cache(H5F_t * f,
if ( write_permitted ) {
- restart_scan = FALSE;
+ restart_scan = FALSE;
initial_list_len = cache_ptr->LRU_list_len;
entry_ptr = cache_ptr->LRU_tail_ptr;
@@ -9018,7 +9143,7 @@ H5C_make_space_in_cache(H5F_t * f,
}
- while ( ( ( (cache_ptr->index_size + space_needed)
+ while ( ( ( (cache_ptr->index_size + space_needed)
>
cache_ptr->max_cache_size
)
@@ -9110,13 +9235,13 @@ H5C_make_space_in_cache(H5F_t * f,
total_entries_scanned++;
#endif /* H5C_COLLECT_CACHE_STATS */
- } else {
+ } else {
- /* Skip epoch markers and entries that are in the process
+ /* Skip epoch markers and entries that are in the process
* of being flushed.
*/
didnt_flush_entry = TRUE;
- }
+ }
if ( prev_ptr != NULL ) {
@@ -9127,7 +9252,7 @@ H5C_make_space_in_cache(H5F_t * f,
* Hence no need for sanity checks, as we haven't
* flushed anything. Thus just set entry_ptr to prev_ptr
* and go on.
- */
+ */
entry_ptr = prev_ptr;
} else if ( ( restart_scan )
@@ -9143,7 +9268,7 @@ H5C_make_space_in_cache(H5F_t * f,
/* something has happened to the LRU -- start over
* from the tail.
*/
- restart_scan = FALSE;
+ restart_scan = FALSE;
entry_ptr = cache_ptr->LRU_tail_ptr;
H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
@@ -9238,14 +9363,14 @@ H5C_make_space_in_cache(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
/* we are scanning the clean LRU, so the serialize function
- * will not be called on any entry -- thus there is no
- * concern about the list being modified out from under
- * this function.
- */
+ * will not be called on any entry -- thus there is no
+ * concern about the list being modified out from under
+ * this function.
+ */
entry_ptr = prev_ptr;
entries_examined++;
- }
+ }
}
done:
@@ -9292,90 +9417,90 @@ H5C_validate_lru_list(H5C_t * cache_ptr)
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
if ( ( ( cache_ptr->LRU_head_ptr == NULL )
- ||
- ( cache_ptr->LRU_tail_ptr == NULL )
- )
- &&
- ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr )
+ ||
+ ( cache_ptr->LRU_tail_ptr == NULL )
+ )
+ &&
+ ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
}
if ( ( cache_ptr->LRU_list_len < 0 ) || ( cache_ptr->LRU_list_size < 0 ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
}
if ( ( cache_ptr->LRU_list_len == 1 )
- &&
- ( ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr )
- ||
- ( cache_ptr->LRU_head_ptr == NULL )
- ||
- ( cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size )
- )
+ &&
+ ( ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr )
+ ||
+ ( cache_ptr->LRU_head_ptr == NULL )
+ ||
+ ( cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size )
+ )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
}
if ( ( cache_ptr->LRU_list_len >= 1 )
- &&
- ( ( cache_ptr->LRU_head_ptr == NULL )
- ||
- ( cache_ptr->LRU_head_ptr->prev != NULL )
- ||
- ( cache_ptr->LRU_tail_ptr == NULL )
- ||
- ( cache_ptr->LRU_tail_ptr->next != NULL )
- )
+ &&
+ ( ( cache_ptr->LRU_head_ptr == NULL )
+ ||
+ ( cache_ptr->LRU_head_ptr->prev != NULL )
+ ||
+ ( cache_ptr->LRU_tail_ptr == NULL )
+ ||
+ ( cache_ptr->LRU_tail_ptr->next != NULL )
+ )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
}
entry_ptr = cache_ptr->LRU_head_ptr;
while ( entry_ptr != NULL )
{
- if ( ( entry_ptr != cache_ptr->LRU_head_ptr ) &&
- ( ( entry_ptr->prev == NULL ) ||
- ( entry_ptr->prev->next != entry_ptr ) ) ) {
+ if ( ( entry_ptr != cache_ptr->LRU_head_ptr ) &&
+ ( ( entry_ptr->prev == NULL ) ||
+ ( entry_ptr->prev->next != entry_ptr ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
+ }
- if ( ( entry_ptr != cache_ptr->LRU_tail_ptr ) &&
- ( ( entry_ptr->next == NULL ) ||
- ( entry_ptr->next->prev != entry_ptr ) ) ) {
+ if ( ( entry_ptr != cache_ptr->LRU_tail_ptr ) &&
+ ( ( entry_ptr->next == NULL ) ||
+ ( entry_ptr->next->prev != entry_ptr ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
+ }
- if ( ( entry_ptr->is_pinned ) ||
- ( entry_ptr->pinned_from_client ) ||
- ( entry_ptr->pinned_from_cache ) ) {
+ if ( ( entry_ptr->is_pinned ) ||
+ ( entry_ptr->pinned_from_client ) ||
+ ( entry_ptr->pinned_from_cache ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
+ }
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
}
if ( ( cache_ptr->LRU_list_len != len ) ||
- ( cache_ptr->LRU_list_size != size ) ) {
+ ( cache_ptr->LRU_list_size != size ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
}
done:
if ( ret_value != SUCCEED ) {
- HDassert(0);
+ HDassert(0);
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -9422,94 +9547,94 @@ H5C_validate_pinned_entry_list(H5C_t * cache_ptr)
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
if ( ( ( cache_ptr->pel_head_ptr == NULL )
- ||
- ( cache_ptr->pel_tail_ptr == NULL )
- )
- &&
- ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr )
+ ||
+ ( cache_ptr->pel_tail_ptr == NULL )
+ )
+ &&
+ ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
}
if ( ( cache_ptr->pel_len < 0 ) || ( cache_ptr->pel_size < 0 ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
}
if ( ( cache_ptr->pel_len == 1 )
- &&
- ( ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr )
- ||
- ( cache_ptr->pel_head_ptr == NULL )
- ||
- ( cache_ptr->pel_head_ptr->size != cache_ptr->pel_size )
- )
+ &&
+ ( ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr )
+ ||
+ ( cache_ptr->pel_head_ptr == NULL )
+ ||
+ ( cache_ptr->pel_head_ptr->size != cache_ptr->pel_size )
+ )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
}
if ( ( cache_ptr->pel_len >= 1 )
- &&
- ( ( cache_ptr->pel_head_ptr == NULL )
- ||
- ( cache_ptr->pel_head_ptr->prev != NULL )
- ||
- ( cache_ptr->pel_tail_ptr == NULL )
- ||
- ( cache_ptr->pel_tail_ptr->next != NULL )
- )
+ &&
+ ( ( cache_ptr->pel_head_ptr == NULL )
+ ||
+ ( cache_ptr->pel_head_ptr->prev != NULL )
+ ||
+ ( cache_ptr->pel_tail_ptr == NULL )
+ ||
+ ( cache_ptr->pel_tail_ptr->next != NULL )
+ )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
}
entry_ptr = cache_ptr->pel_head_ptr;
while ( entry_ptr != NULL )
{
- if ( ( entry_ptr != cache_ptr->pel_head_ptr ) &&
- ( ( entry_ptr->prev == NULL ) ||
- ( entry_ptr->prev->next != entry_ptr ) ) ) {
+ if ( ( entry_ptr != cache_ptr->pel_head_ptr ) &&
+ ( ( entry_ptr->prev == NULL ) ||
+ ( entry_ptr->prev->next != entry_ptr ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
+ }
- if ( ( entry_ptr != cache_ptr->pel_tail_ptr ) &&
- ( ( entry_ptr->next == NULL ) ||
- ( entry_ptr->next->prev != entry_ptr ) ) ) {
+ if ( ( entry_ptr != cache_ptr->pel_tail_ptr ) &&
+ ( ( entry_ptr->next == NULL ) ||
+ ( entry_ptr->next->prev != entry_ptr ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
+ }
- if ( ! entry_ptr->is_pinned ) {
+ if ( ! entry_ptr->is_pinned ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
+ }
- if ( ! ( ( entry_ptr->pinned_from_client ) ||
- ( entry_ptr->pinned_from_cache ) ) ) {
+ if ( ! ( ( entry_ptr->pinned_from_client ) ||
+ ( entry_ptr->pinned_from_cache ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
+ }
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
}
if ( ( cache_ptr->pel_len != len ) ||
- ( cache_ptr->pel_size != size ) ) {
+ ( cache_ptr->pel_size != size ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
}
done:
if ( ret_value != SUCCEED ) {
- HDassert(0);
+ HDassert(0);
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -9556,94 +9681,94 @@ H5C_validate_protected_entry_list(H5C_t * cache_ptr)
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
if ( ( ( cache_ptr->pl_head_ptr == NULL )
- ||
- ( cache_ptr->pl_tail_ptr == NULL )
- )
- &&
- ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr )
+ ||
+ ( cache_ptr->pl_tail_ptr == NULL )
+ )
+ &&
+ ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
}
if ( ( cache_ptr->pl_len < 0 ) || ( cache_ptr->pl_size < 0 ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
}
if ( ( cache_ptr->pl_len == 1 )
- &&
- ( ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr )
- ||
- ( cache_ptr->pl_head_ptr == NULL )
- ||
- ( cache_ptr->pl_head_ptr->size != cache_ptr->pl_size )
- )
+ &&
+ ( ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr )
+ ||
+ ( cache_ptr->pl_head_ptr == NULL )
+ ||
+ ( cache_ptr->pl_head_ptr->size != cache_ptr->pl_size )
+ )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed")
}
if ( ( cache_ptr->pl_len >= 1 )
- &&
- ( ( cache_ptr->pl_head_ptr == NULL )
- ||
- ( cache_ptr->pl_head_ptr->prev != NULL )
- ||
- ( cache_ptr->pl_tail_ptr == NULL )
- ||
- ( cache_ptr->pl_tail_ptr->next != NULL )
- )
+ &&
+ ( ( cache_ptr->pl_head_ptr == NULL )
+ ||
+ ( cache_ptr->pl_head_ptr->prev != NULL )
+ ||
+ ( cache_ptr->pl_tail_ptr == NULL )
+ ||
+ ( cache_ptr->pl_tail_ptr->next != NULL )
+ )
) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed")
}
entry_ptr = cache_ptr->pl_head_ptr;
while ( entry_ptr != NULL )
{
- if ( ( entry_ptr != cache_ptr->pl_head_ptr ) &&
- ( ( entry_ptr->prev == NULL ) ||
- ( entry_ptr->prev->next != entry_ptr ) ) ) {
+ if ( ( entry_ptr != cache_ptr->pl_head_ptr ) &&
+ ( ( entry_ptr->prev == NULL ) ||
+ ( entry_ptr->prev->next != entry_ptr ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed")
+ }
- if ( ( entry_ptr != cache_ptr->pl_tail_ptr ) &&
- ( ( entry_ptr->next == NULL ) ||
- ( entry_ptr->next->prev != entry_ptr ) ) ) {
+ if ( ( entry_ptr != cache_ptr->pl_tail_ptr ) &&
+ ( ( entry_ptr->next == NULL ) ||
+ ( entry_ptr->next->prev != entry_ptr ) ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed")
+ }
- if ( ! entry_ptr->is_protected ) {
+ if ( ! entry_ptr->is_protected ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed")
+ }
- if ( ( entry_ptr->is_read_only ) &&
- ( entry_ptr->ro_ref_count <= 0 ) ) {
+ if ( ( entry_ptr->is_read_only ) &&
+ ( entry_ptr->ro_ref_count <= 0 ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
- }
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed")
+ }
- len++;
- size += entry_ptr->size;
- entry_ptr = entry_ptr->next;
+ len++;
+ size += entry_ptr->size;
+ entry_ptr = entry_ptr->next;
}
if ( ( cache_ptr->pl_len != len ) ||
- ( cache_ptr->pl_size != size ) ) {
+ ( cache_ptr->pl_size != size ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed")
}
done:
if ( ret_value != SUCCEED ) {
- HDassert(0);
+ HDassert(0);
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -9689,14 +9814,14 @@ H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr)
while ( ( node_ptr != NULL ) && ( ! in_slist ) )
{
- entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
+ entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
HDassert( entry_ptr );
HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
- HDassert( entry_ptr->is_dirty );
- HDassert( entry_ptr->in_slist );
+ HDassert( entry_ptr->is_dirty );
+ HDassert( entry_ptr->in_slist );
- if ( entry_ptr == target_ptr ) {
+ if ( entry_ptr == target_ptr ) {
in_slist = TRUE;
@@ -9756,7 +9881,7 @@ H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr)
#ifndef NDEBUG
herr_t
H5C_get_entry_ptr_from_addr(const H5F_t *f,
- haddr_t addr,
+ haddr_t addr,
void ** entry_ptr_ptr)
{
H5C_t * cache_ptr;
@@ -9780,21 +9905,21 @@ H5C_get_entry_ptr_from_addr(const H5F_t *f,
*/
if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
}
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
if ( entry_ptr == NULL ) {
- /* the entry doesn't exist in the cache -- report this
- * and quit.
- */
- *entry_ptr_ptr = NULL;
+ /* the entry doesn't exist in the cache -- report this
+ * and quit.
+ */
+ *entry_ptr_ptr = NULL;
} else {
- *entry_ptr_ptr = entry_ptr;
+ *entry_ptr_ptr = entry_ptr;
/* increment call counter */
(cache_ptr->get_entry_ptr_from_addr_counter)++;
@@ -9841,10 +9966,10 @@ done:
#ifndef NDEBUG
herr_t
H5C_verify_entry_type(const H5F_t *f,
- haddr_t addr,
- const H5C_class_t * expected_type,
- hbool_t * in_cache_ptr,
- hbool_t * type_ok_ptr)
+ haddr_t addr,
+ const H5C_class_t * expected_type,
+ hbool_t * in_cache_ptr,
+ hbool_t * type_ok_ptr)
{
H5C_t * cache_ptr;
H5C_cache_entry_t * entry_ptr = NULL;
@@ -9868,21 +9993,21 @@ H5C_verify_entry_type(const H5F_t *f,
*/
if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
}
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
if ( entry_ptr == NULL ) {
- /* the entry doesn't exist in the cache -- report this
- * and quit.
- */
- *in_cache_ptr = FALSE;
+ /* the entry doesn't exist in the cache -- report this
+ * and quit.
+ */
+ *in_cache_ptr = FALSE;
} else {
- *in_cache_ptr = TRUE;
+ *in_cache_ptr = TRUE;
*type_ok_ptr = (expected_type == entry_ptr->type);
}
@@ -9908,7 +10033,7 @@ done:
* before coming into the cache, any external functions that
* use the internal library functions (i.e., tests) should
* use this function if they don't plan on setting up proper
- * tags.
+ * metadata tags.
*
* Return: FAIL if error is detected, SUCCEED otherwise.
*
@@ -9967,12 +10092,32 @@ H5C_tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Get the tag from the DXPL */
if((H5P_get(dxpl, "H5C_tag", &tag)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query property value")
+ if(cache_ptr->ignore_tags != TRUE) {
+#if H5C_DO_TAGGING_SANITY_CHECKS
+ /* Perform some sanity checks to ensure that a correct tag is being applied */
+ if(H5C_verify_tag(entry_ptr->type->id, tag.value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed")
+#endif
+ } else {
+ /* if we're ignoring tags, it's because we're running
+ tests on internal functions and may not have inserted a tag
+ value into a given dxpl_id before creating some metadata. Thus,
+ in this case only, if a tag value has not been set, we can
+ arbitrarily set it to something for the sake of passing the tests.
+ If the tag value is set, then we'll just let it get assigned without
+ additional checking for correctness. */
+ if(!tag.value) {
+ tag.value = H5AC__IGNORE_TAG;
+ tag.globality = H5C_GLOBALITY_NONE;
+ } /* end if */
+ } /* end if */
+
/* Apply the tag to the entry */
entry_ptr->tag = tag.value;
@@ -9983,6 +10128,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_tag_entry */
+
/*-------------------------------------------------------------------------
*
* Function: H5C_evict_tagged_entries
@@ -10000,13 +10146,12 @@ herr_t
H5C_evict_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag)
{
/* Variable Declarations */
- herr_t status;
+ H5C_t *cache_ptr = NULL;
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * next_entry_ptr = NULL;
- int i;
hbool_t evicted_entries_last_pass;
hbool_t pinned_entries_need_evicted;
- H5C_t *cache_ptr = NULL;
+ int i;
herr_t ret_value = SUCCEED;
/* Function Enter Macro */
@@ -10078,7 +10223,7 @@ H5C_evict_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag)
} /* end for */
/* Keep doing this until we have stopped evicted entries */
- } while ((evicted_entries_last_pass == TRUE));
+ } while (evicted_entries_last_pass == TRUE);
/* If we stop evicting entries and pinned entries still need evicted,
then we have a problem. */
@@ -10177,12 +10322,89 @@ H5C_flush_marked_entries(H5F_t * f, hid_t dxpl_id)
/* Flush all marked entries */
if(H5C_flush_cache(f, dxpl_id, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_flush_marked_entries */
+#if H5C_DO_TAGGING_SANITY_CHECKS
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C_verify_tag
+ *
+ * Purpose: Performs sanity checking on an entrytype/tag pair.
+ *
+ * Return: SUCCEED or FAIL.
+ *
+ * Programmer: Mike McGreevy
+ * January 14, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C_verify_tag(int id, haddr_t tag)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Perform some sanity checks on tag value. Certain entry
+ * types require certain tag values, so check that these
+ * constraints are met. */
+ if(tag == H5AC__IGNORE_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification.")
+ else if(tag == H5AC__INVALID_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided")
+ else {
+
+ /* Perform some sanity checks on tag value. Certain entry
+ * types require certain tag values, so check that these
+ * constraints are met. */
+
+ /* Superblock */
+ if((id == H5AC_SUPERBLOCK_ID) || (id == H5AC_DRVRINFO_ID)) {
+ if(tag != H5AC__SUPERBLOCK_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG")
+ }
+ else {
+ if(tag == H5AC__SUPERBLOCK_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__SUPERBLOCK_TAG applied to non-superblock entry")
+ }
+
+ /* Free Space Manager */
+ if((id == H5AC_FSPACE_HDR_ID) || (id == H5AC_FSPACE_SINFO_ID)) {
+ if(tag != H5AC__FREESPACE_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "freespace entry not tagged with H5AC__FREESPACE_TAG")
+ }
+ else {
+ if(tag == H5AC__FREESPACE_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry")
+ }
+
+ /* SOHM */
+ if((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID)) {
+ if(tag != H5AC__SOHM_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG")
+ }
+
+ /* Global Heap */
+ if(id == H5AC_GHEAP_ID) {
+ if(tag != H5AC__GLOBALHEAP_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG")
+ }
+ else {
+ if(tag == H5AC__GLOBALHEAP_TAG)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry")
+ }
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_verify_tag */
+#endif
+
/*-------------------------------------------------------------------------
*
@@ -10214,7 +10436,7 @@ H5C_flush_tagged_entries(H5F_t * f, hid_t dxpl_id, haddr_t tag)
cache_ptr = f->shared->cache;
/* Mark all entries with specified tag */
- if(H5C_mark_tagged_entries(cache_ptr, tag, FALSE) < 0 )
+ if(H5C_mark_tagged_entries(cache_ptr, tag, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries")
/* Flush all marked entries */
@@ -10266,6 +10488,50 @@ H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag)
/*-------------------------------------------------------------------------
+ * Function: H5C_get_entry_ring
+ *
+ * Purpose: Given a file address, retrieve the ring for an entry at that
+ * address.
+ *
+ * On error, the value of *ring is not modified.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 9/8/15
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring)
+{
+ H5C_t *cache_ptr; /* Pointer to cache */
+ H5C_cache_entry_t *entry_ptr; /* Pointer to cache entry at address */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ cache_ptr = f->shared->cache;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(H5F_addr_defined(addr));
+
+ /* Locate the entry at the address */
+ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
+ HDassert(entry_ptr);
+
+ /* Return the ring value */
+ *ring = entry_ptr->ring;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_get_entry_ring() */
+
+
+/*-------------------------------------------------------------------------
*
* Function: H5C_cork
*
@@ -10291,8 +10557,6 @@ herr_t
H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
{
haddr_t *ptr; /* Points to an address */
- haddr_t *addr_ptr = NULL; /* Points to an address */
- hbool_t is_corked; /* Cork status for an entry */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -10305,8 +10569,23 @@ H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Search the list of corked object addresses in the cache */
ptr = (haddr_t *)H5SL_search(cache_ptr->cork_list_ptr, &obj_addr);
- switch(action) {
- case H5C__SET_CORK:
+ if(H5C__GET_CORKED == action) {
+ HDassert(corked);
+ if(ptr != NULL && *ptr == obj_addr)
+ *corked = TRUE;
+ else
+ *corked = FALSE;
+ } /* end if */
+ else {
+ hbool_t is_corked; /* Cork status for an entry */
+
+ /* Sanity check */
+ HDassert(H5C__SET_CORK == action || H5C__UNCORK == action);
+
+ /* Perform appropriate action */
+ if(H5C__SET_CORK == action) {
+ haddr_t *addr_ptr = NULL; /* Points to an address */
+
if(ptr != NULL && *ptr == obj_addr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't cork an already corked object")
@@ -10316,15 +10595,15 @@ H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Insert into the list */
*addr_ptr = obj_addr;
- if(H5SL_insert(cache_ptr->cork_list_ptr, addr_ptr, addr_ptr) < 0)
+ if(H5SL_insert(cache_ptr->cork_list_ptr, addr_ptr, addr_ptr) < 0) {
+ addr_ptr = H5FL_FREE(haddr_t, addr_ptr);
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't insert address into cork list")
+ } /* end if */
/* Set the entry's cork status */
is_corked = TRUE;
-
- break;
-
- case H5C__UNCORK:
+ } /* end if */
+ else {
if(ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't uncork an object that is not corked ")
@@ -10338,25 +10617,12 @@ H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the entry's cork status */
is_corked = FALSE;
- break;
-
- case H5C__GET_CORKED:
- HDassert(corked);
- if(ptr != NULL && *ptr == obj_addr)
- *corked = TRUE;
- else
- *corked = FALSE;
- break;
-
- default: /* should be unreachable */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cork action")
- break;
- } /* end switch */
+ } /* end else */
- if(action != H5C__GET_CORKED)
/* Mark existing cache entries with tag (obj_addr) to the cork status */
if(H5C_mark_tagged_entries_cork(cache_ptr, obj_addr, is_corked) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cork action")
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't mark cork status on entry")
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -10544,3 +10810,4 @@ H5C__assert_flush_dep_nocycle(H5C_cache_entry_t * entry,
FUNC_LEAVE_NOAPI_VOID
} /* H5C__assert_flush_dep_nocycle() */
#endif /* NDEBUG */
+
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index f77b069..22cc9c0 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -815,6 +815,12 @@ if ( ( (entry_ptr) == NULL ) || \
*
* JRM -- 11/5/08
*
+ * - Updated existing index macros and sanity check macros to maintain
+ * the index_ring_len, index_ring_size, clean_index_ring_size, and
+ * dirty_index_ring_size fields of H5C_t.
+ *
+ * JRM -- 9/1/15
+ *
***********************************************************************/
/* H5C__HASH_TABLE_LEN is defined in H5Cpkg.h. It mut be a power of two. */
@@ -839,7 +845,17 @@ if ( ( (cache_ptr) == NULL ) || \
((cache_ptr)->clean_index_size + \
(cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \
"Pre HT insert SC failed") \
}
@@ -851,7 +867,16 @@ if ( ( (cache_ptr) == NULL ) || \
((cache_ptr)->clean_index_size + \
(cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \
"Post HT insert SC failed") \
}
@@ -878,7 +903,20 @@ if ( ( (cache_ptr) == NULL ) || \
((cache_ptr)->clean_index_size + \
(cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] < \
+ (entry_ptr)->size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \
}
@@ -894,7 +932,15 @@ if ( ( (cache_ptr) == NULL ) || \
((cache_ptr)->clean_index_size + \
(cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Post HT remove SC failed") \
}
@@ -962,7 +1008,18 @@ if ( ( (cache_ptr) == NULL ) || \
( (cache_ptr)->clean_index_size < (old_size) ) ) && \
( ( (was_clean) ) || \
( (cache_ptr)->dirty_index_size < (old_size) ) ) ) || \
- ( (entry_ptr) == NULL ) ) { \
+ ( (entry_ptr) == NULL ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Pre HT entry size change SC failed") \
}
@@ -983,7 +1040,15 @@ if ( ( (cache_ptr) == NULL ) || \
( ( ((entry_ptr)->is_dirty) ) || \
( (cache_ptr)->clean_index_size < (new_size) ) ) ) || \
( ( (cache_ptr)->index_len == 1 ) && \
- ( (cache_ptr)->index_size != (new_size) ) ) ) { \
+ ( (cache_ptr)->index_size != (new_size) ) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Post HT entry size change SC failed") \
}
@@ -1000,7 +1065,18 @@ if ( \
( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Pre HT update for entry clean SC failed") \
}
@@ -1017,7 +1093,18 @@ if ( \
( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \
+ ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Pre HT update for entry dirty SC failed") \
}
@@ -1026,7 +1113,15 @@ if ( \
if ( ( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Post HT update for entry clean SC failed") \
}
@@ -1035,7 +1130,15 @@ if ( ( (cache_ptr)->index_size != \
if ( ( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \
- ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \
+ ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \
+ ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \
+ (cache_ptr)->index_len ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \
+ (cache_ptr)->index_size ) || \
+ ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \
+ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \
+ (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \
+ HDassert(FALSE); \
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Post HT update for entry dirty SC failed") \
}
@@ -1061,30 +1164,38 @@ if ( ( (cache_ptr)->index_size != \
#endif /* H5C_DO_SANITY_CHECKS */
-#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \
-{ \
- int k; \
- H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
- k = H5C__HASH_FCN((entry_ptr)->addr); \
- if ( ((cache_ptr)->index)[k] == NULL ) \
- ((cache_ptr)->index)[k] = (entry_ptr); \
- else { \
- (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
- (entry_ptr)->ht_next->ht_prev = (entry_ptr); \
- ((cache_ptr)->index)[k] = (entry_ptr); \
- } \
- (cache_ptr)->index_len++; \
- (cache_ptr)->index_size += (entry_ptr)->size; \
- if ( (entry_ptr)->is_dirty ) \
- (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
- else \
- (cache_ptr)->clean_index_size += (entry_ptr)->size; \
- if ((entry_ptr)->flush_me_last) { \
- (cache_ptr)->num_last_entries++; \
- HDassert((cache_ptr)->num_last_entries <= 2); \
- } \
- H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
- H5C__POST_HT_INSERT_SC(cache_ptr, fail_val) \
+#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \
+{ \
+ int k; \
+ H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
+ k = H5C__HASH_FCN((entry_ptr)->addr); \
+ if ( ((cache_ptr)->index)[k] == NULL ) \
+ ((cache_ptr)->index)[k] = (entry_ptr); \
+ else { \
+ (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
+ (entry_ptr)->ht_next->ht_prev = (entry_ptr); \
+ ((cache_ptr)->index)[k] = (entry_ptr); \
+ } \
+ (cache_ptr)->index_len++; \
+ (cache_ptr)->index_size += (entry_ptr)->size; \
+ ((cache_ptr)->index_ring_len[entry_ptr->ring])++; \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ if ( (entry_ptr)->is_dirty ) { \
+ (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ } else { \
+ (cache_ptr)->clean_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
+ } \
+ if ((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries++; \
+ HDassert((cache_ptr)->num_last_entries <= 2); \
+ } \
+ H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
+ H5C__POST_HT_INSERT_SC(cache_ptr, fail_val) \
}
#define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) \
@@ -1102,10 +1213,18 @@ if ( ( (cache_ptr)->index_size != \
(entry_ptr)->ht_prev = NULL; \
(cache_ptr)->index_len--; \
(cache_ptr)->index_size -= (entry_ptr)->size; \
- if ( (entry_ptr)->is_dirty ) \
+ ((cache_ptr)->index_ring_len[entry_ptr->ring])--; \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ if ( (entry_ptr)->is_dirty ) { \
(cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
- else \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ } else { \
(cache_ptr)->clean_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
+ } \
if ((entry_ptr)->flush_me_last) { \
(cache_ptr)->num_last_entries--; \
HDassert((cache_ptr)->num_last_entries <= 1); \
@@ -1173,7 +1292,11 @@ if ( ( (cache_ptr)->index_size != \
{ \
H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
(cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
(cache_ptr)->clean_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
}
@@ -1181,27 +1304,39 @@ if ( ( (cache_ptr)->index_size != \
{ \
H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
(cache_ptr)->clean_index_size -= (entry_ptr)->size; \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
+ -= (entry_ptr)->size; \
(cache_ptr)->dirty_index_size += (entry_ptr)->size; \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+ += (entry_ptr)->size; \
H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
}
-#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \
- entry_ptr, was_clean) \
-{ \
- H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
- entry_ptr, was_clean) \
- (cache_ptr)->index_size -= (old_size); \
- (cache_ptr)->index_size += (new_size); \
- if ( was_clean ) \
- (cache_ptr)->clean_index_size -= (old_size); \
- else \
- (cache_ptr)->dirty_index_size -= (old_size); \
- if ( (entry_ptr)->is_dirty ) \
- (cache_ptr)->dirty_index_size += (new_size); \
- else \
- (cache_ptr)->clean_index_size += (new_size); \
- H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
- entry_ptr) \
+#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \
+ entry_ptr, was_clean) \
+{ \
+ H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr, was_clean) \
+ (cache_ptr)->index_size -= (old_size); \
+ (cache_ptr)->index_size += (new_size); \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (old_size); \
+ ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (new_size); \
+ if ( was_clean ) { \
+ (cache_ptr)->clean_index_size -= (old_size); \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])-= (old_size); \
+ } else { \
+ (cache_ptr)->dirty_index_size -= (old_size); \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])-= (old_size); \
+ } \
+ if ( (entry_ptr)->is_dirty ) { \
+ (cache_ptr)->dirty_index_size += (new_size); \
+ ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])+= (new_size); \
+ } else { \
+ (cache_ptr)->clean_index_size += (new_size); \
+ ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])+= (new_size); \
+ } \
+ H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
+ entry_ptr) \
}
@@ -1266,6 +1401,10 @@ if ( ( (cache_ptr)->index_size != \
* Added code to set cache_ptr->slist_changed to TRUE
* when an entry is inserted in the slist.
*
+ * JRM -- 9/1/15
+ * Added code to maintain the cache_ptr->slist_ring_len
+ * and cache_ptr->slist_ring_size arrays.
+ *
*-------------------------------------------------------------------------
*/
@@ -1287,6 +1426,12 @@ if ( ( (cache_ptr)->index_size != \
HDassert( H5F_addr_defined((entry_ptr)->addr) ); \
HDassert( !((entry_ptr)->in_slist) ); \
HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \
+ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \
+ HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \
+ HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_len ); \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_size ); \
\
if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \
@@ -1296,6 +1441,8 @@ if ( ( (cache_ptr)->index_size != \
(cache_ptr)->slist_changed = TRUE; \
(cache_ptr)->slist_len++; \
(cache_ptr)->slist_size += (entry_ptr)->size; \
+ ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \
(cache_ptr)->slist_len_increase++; \
(cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \
\
@@ -1315,6 +1462,12 @@ if ( ( (cache_ptr)->index_size != \
HDassert( H5F_addr_defined((entry_ptr)->addr) ); \
HDassert( !((entry_ptr)->in_slist) ); \
HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \
+ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \
+ HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \
+ HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_len ); \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_size ); \
\
if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \
@@ -1324,6 +1477,8 @@ if ( ( (cache_ptr)->index_size != \
(cache_ptr)->slist_changed = TRUE; \
(cache_ptr)->slist_len++; \
(cache_ptr)->slist_size += (entry_ptr)->size; \
+ ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \
\
HDassert( (cache_ptr)->slist_len > 0 ); \
HDassert( (cache_ptr)->slist_size > 0 ); \
@@ -1366,32 +1521,46 @@ if ( ( (cache_ptr)->index_size != \
* Added code to set cache_ptr->slist_changed to TRUE
* when an entry is removed from the slist.
*
+ * JRM -- 9/1/15
+ * Added code to maintain the cache_ptr->slist_ring_len
+ * and cache_ptr->slist_ring_size arrays.
+ *
*-------------------------------------------------------------------------
*/
-#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \
-{ \
- HDassert( (cache_ptr) ); \
- HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
- HDassert( (entry_ptr) ); \
- HDassert( !((entry_ptr)->is_protected) ); \
- HDassert( !((entry_ptr)->is_read_only) ); \
- HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
- HDassert( (entry_ptr)->size > 0 ); \
- HDassert( (entry_ptr)->in_slist ); \
- HDassert( (cache_ptr)->slist_ptr ); \
- \
- if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \
- != (entry_ptr) ) \
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \
- "Can't delete entry from skip list.") \
- \
- HDassert( (cache_ptr)->slist_len > 0 ); \
- (cache_ptr)->slist_changed = TRUE; \
- (cache_ptr)->slist_len--; \
- HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \
- (cache_ptr)->slist_size -= (entry_ptr)->size; \
- (entry_ptr)->in_slist = FALSE; \
+#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (entry_ptr) ); \
+ HDassert( !((entry_ptr)->is_protected) ); \
+ HDassert( !((entry_ptr)->is_read_only) ); \
+ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
+ HDassert( (entry_ptr)->size > 0 ); \
+ HDassert( (entry_ptr)->in_slist ); \
+ HDassert( (cache_ptr)->slist_ptr ); \
+ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \
+ HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \
+ HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_len ); \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_size ); \
+ \
+ if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \
+ != (entry_ptr) ) \
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \
+ "Can't delete entry from skip list.") \
+ \
+ HDassert( (cache_ptr)->slist_len > 0 ); \
+ (cache_ptr)->slist_changed = TRUE; \
+ (cache_ptr)->slist_len--; \
+ HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \
+ (cache_ptr)->slist_size -= (entry_ptr)->size; \
+ ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \
+ (entry_ptr)->size ); \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size; \
+ (entry_ptr)->in_slist = FALSE; \
} /* H5C__REMOVE_ENTRY_FROM_SLIST */
@@ -1423,52 +1592,76 @@ if ( ( (cache_ptr)->index_size != \
* in this case, as the structure of the slist is not
* modified.
*
+ * JRM -- 9/1/15
+ * Added code to maintain the cache_ptr->slist_ring_len
+ * and cache_ptr->slist_ring_size arrays.
+ *
*-------------------------------------------------------------------------
*/
#if H5C_DO_SANITY_CHECKS
-#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
-{ \
- HDassert( (cache_ptr) ); \
- HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
- HDassert( (old_size) > 0 ); \
- HDassert( (new_size) > 0 ); \
- HDassert( (old_size) <= (cache_ptr)->slist_size ); \
- HDassert( (cache_ptr)->slist_len > 0 ); \
- HDassert( ((cache_ptr)->slist_len > 1) || \
- ( (cache_ptr)->slist_size == (old_size) ) ); \
- \
- (cache_ptr)->slist_size -= (old_size); \
- (cache_ptr)->slist_size += (new_size); \
- \
- (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \
- (cache_ptr)->slist_size_increase += (int64_t)(new_size); \
- \
- HDassert( (new_size) <= (cache_ptr)->slist_size ); \
- HDassert( ( (cache_ptr)->slist_len > 1 ) || \
- ( (cache_ptr)->slist_size == (new_size) ) ); \
+#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (old_size) > 0 ); \
+ HDassert( (new_size) > 0 ); \
+ HDassert( (old_size) <= (cache_ptr)->slist_size ); \
+ HDassert( (cache_ptr)->slist_len > 0 ); \
+ HDassert( ((cache_ptr)->slist_len > 1) || \
+ ( (cache_ptr)->slist_size == (old_size) ) ); \
+ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \
+ HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \
+ HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_len ); \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_size ); \
+ \
+ (cache_ptr)->slist_size -= (old_size); \
+ (cache_ptr)->slist_size += (new_size); \
+ \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \
+ \
+ (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \
+ (cache_ptr)->slist_size_increase += (int64_t)(new_size); \
+ \
+ HDassert( (new_size) <= (cache_ptr)->slist_size ); \
+ HDassert( ( (cache_ptr)->slist_len > 1 ) || \
+ ( (cache_ptr)->slist_size == (new_size) ) ); \
} /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */
#else /* H5C_DO_SANITY_CHECKS */
-#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
-{ \
- HDassert( (cache_ptr) ); \
- HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
- HDassert( (old_size) > 0 ); \
- HDassert( (new_size) > 0 ); \
- HDassert( (old_size) <= (cache_ptr)->slist_size ); \
- HDassert( (cache_ptr)->slist_len > 0 ); \
- HDassert( ((cache_ptr)->slist_len > 1) || \
- ( (cache_ptr)->slist_size == (old_size) ) ); \
- \
- (cache_ptr)->slist_size -= (old_size); \
- (cache_ptr)->slist_size += (new_size); \
- \
- HDassert( (new_size) <= (cache_ptr)->slist_size ); \
- HDassert( ( (cache_ptr)->slist_len > 1 ) || \
- ( (cache_ptr)->slist_size == (new_size) ) ); \
+#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
+{ \
+ HDassert( (cache_ptr) ); \
+ HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
+ HDassert( (old_size) > 0 ); \
+ HDassert( (new_size) > 0 ); \
+ HDassert( (old_size) <= (cache_ptr)->slist_size ); \
+ HDassert( (cache_ptr)->slist_len > 0 ); \
+ HDassert( ((cache_ptr)->slist_len > 1) || \
+ ( (cache_ptr)->slist_size == (old_size) ) ); \
+ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \
+ HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \
+ HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_len ); \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \
+ (cache_ptr)->slist_size ); \
+ \
+ (cache_ptr)->slist_size -= (old_size); \
+ (cache_ptr)->slist_size += (new_size); \
+ \
+ HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \
+ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \
+ \
+ HDassert( (new_size) <= (cache_ptr)->slist_size ); \
+ HDassert( ( (cache_ptr)->slist_len > 1 ) || \
+ ( (cache_ptr)->slist_size == (new_size) ) ); \
} /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */
#endif /* H5C_DO_SANITY_CHECKS */
@@ -2868,6 +3061,16 @@ if ( ( (cache_ptr)->index_size != \
* index_size by three should yield a conservative estimate
* of the cache's memory footprint.
*
+ * index_ring_len: Array of integer of length H5C_RING_NTYPES used to
+ * maintain a count of entries in the index by ring. Note
+ * that the sum of all the cells in this array must equal
+ * the value stored in index_len above.
+ *
+ * index_ring_size: Array of size_t of length H5C_RING_NTYPES used to
+ * maintain the sum of the sizes of all entries in the index
+ * by ring. Note that the sum of all cells in this array must
+ * equal the value stored in index_size above.
+ *
* clean_index_size: Number of bytes of clean entries currently stored in
* the hash table. Note that the index_size field (above)
* is also the sum of the sizes of all entries in the cache.
@@ -2882,12 +3085,22 @@ if ( ( (cache_ptr)->index_size != \
* clean_index_size plus the amount of empty space (if any)
* in the cache.
*
+ * clean_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to
+ * maintain the sum of the sizes of all clean entries in the
+ * index by ring. Note that the sum of all cells in this array
+ * must equal the value stored in clean_index_size above.
+ *
* dirty_index_size: Number of bytes of dirty entries currently stored in
* the hash table. Note that the index_size field (above)
* is also the sum of the sizes of all entries in the cache.
* Thus we should have the invariant that clean_index_size +
* dirty_index_size == index_size.
*
+ * dirty_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to
+ * maintain the sum of the sizes of all dirty entries in the
+ * index by ring. Note that the sum of all cells in this array
+ * must equal the value stored in dirty_index_size above.
+ *
* index: Array of pointer to H5C_cache_entry_t of size
* H5C__HASH_TABLE_LEN. At present, this value is a power
* of two, not the usual prime number.
@@ -2976,6 +3189,16 @@ if ( ( (cache_ptr)->index_size != \
* skip list used to maintain a sorted list of
* dirty entries in the cache.
*
+ * slist_ring_len: Array of integer of length H5C_RING_NTYPES used to
+ * maintain a count of entries in the slist by ring. Note
+ * that the sum of all the cells in this array must equal
+ * the value stored in slist_len above.
+ *
+ * slist_ring_size: Array of size_t of length H5C_RING_NTYPES used to
+ * maintain the sum of the sizes of all entries in the
+ * slist by ring. Note that the sum of all cells in this
+ * array must equal the value stored in slist_size above.
+ *
* slist_ptr: pointer to the instance of H5SL_t used maintain a sorted
* list of dirty entries in the cache. This sorted list has
* two uses:
@@ -3624,8 +3847,12 @@ struct H5C_t {
/* Fields for maintaining [hash table] index of entries */
int32_t index_len;
size_t index_size;
+ int32_t index_ring_len[H5C_RING_NTYPES];
+ size_t index_ring_size[H5C_RING_NTYPES];
size_t clean_index_size;
+ size_t clean_index_ring_size[H5C_RING_NTYPES];
size_t dirty_index_size;
+ size_t dirty_index_ring_size[H5C_RING_NTYPES];
H5C_cache_entry_t * (index[H5C__HASH_TABLE_LEN]);
/* Fields to detect entries removed during scans */
@@ -3641,6 +3868,8 @@ struct H5C_t {
hbool_t slist_change_in_serialize;
int32_t slist_len;
size_t slist_size;
+ int32_t slist_ring_len[H5C_RING_NTYPES];
+ size_t slist_ring_size[H5C_RING_NTYPES];
H5SL_t * slist_ptr;
int32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 10ea344..489a2d1 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -1218,6 +1218,60 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr,
/****************************************************************************
*
+ * H5C_ring_t & associated #defines
+ *
+ * The metadata cache uses the concept of rings to order the flushes of
+ * classes of entries. In this arrangement, each entry in the cache is
+ * assigned to a ring, and on flush, the members of the outermost ring
+ * are flushed first, followed by the next outermost, and so on with the
+ * members of the innermost ring being flushed last.
+ *
+ * Note that flush dependencies are used to order flushes within rings.
+ *
+ * Note also that at the conceptual level, rings are argueably superfluous,
+ * as a similar effect could be obtained via the flush dependency mechanism.
+ * However, this would require all entries in the cache to participate in a
+ * flush dependency -- with the implied setup and takedown overhead and
+ * added complexity. Further, the flush ordering between rings need only
+ * be enforced on flush operations, and thus the use of flush dependencies
+ * instead would apply unecessary constraints on flushes under normal
+ * operating circumstances.
+ *
+ * As of this writing, all metadata entries pretaining to data sets and
+ * groups must be flushed first, and are thus assigned to the outermost
+ * ring.
+ *
+ * Free space managers managing file space must be flushed next,
+ * and are assigned to the second outermost ring.
+ *
+ * The object header and associated chunks used to implement superblock
+ * extension messages must be flushed next, and are thus assigned to
+ * the third outermost ring.
+ *
+ * The superblock proper must be flushed last, and is thus assigned to
+ * the innermost ring.
+ *
+ * The H5C_ring_t and the associated #defines below are used to define
+ * the rings. Each entry must be assigned to the appropriate ring on
+ * insertion or protect.
+ *
+ * Note that H5C_ring_t was originally an enumerated type. It was
+ * converted to an integer and a set of #defines for convenience in
+ * debugging.
+ */
+
+#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */
+#define H5C_RING_USER 1 /* outermost ring */
+#define H5C_RING_FSM 2
+#define H5C_RING_SBE 4 /* temporarily merged with H5C_RING_SB */
+#define H5C_RING_SB 4 /* innermost ring */
+#define H5C_RING_NTYPES 5
+
+typedef int H5C_ring_t;
+
+
+/****************************************************************************
+ *
* structure H5C_cache_entry_t
*
* Instances of the H5C_cache_entry_t structure are used to store cache
@@ -1482,6 +1536,25 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr,
* is in the process of being flushed and destroyed.
*
*
+ * Fields supporting rings for flush ordering:
+ *
+ * All entries in the metadata cache are assigned to a ring. On cache
+ * flush, all entries in the outermost ring are flushed first, followed
+ * by all members of the next outermost ring, and so on until the
+ * innermost ring is flushed. Note that this ordering is ONLY applied
+ * in flush and serialize calls. Rings are ignored during normal operations
+ * in which entries are flushed as directed by the replacement policy.
+ *
+ * See the header comment on H5C_ring_t above for further details.
+ *
+ * Note that flush dependencies (see below) are used to order flushes
+ * within rings. Unlike rings, flush dependencies are applied to ALL
+ * writes, not just those triggered by flush or serialize calls.
+ *
+ * ring: Instance of H5C_ring_t indicating the ring to which this
+ * entry is assigned.
+ *
+ *
* Fields supporting the 'flush dependency' feature:
*
* Entries in the cache may have a 'flush dependencies' on other entries in the
@@ -1647,6 +1720,9 @@ typedef struct H5C_cache_entry_t {
hbool_t flush_in_progress;
hbool_t destroy_in_progress;
+ /* fields supporting rings for purposes of flush ordering */
+ H5C_ring_t ring;
+
/* fields supporting the 'flush dependency' feature: */
struct H5C_cache_entry_t ** flush_dep_parent;
unsigned flush_dep_nparents;
@@ -2021,7 +2097,6 @@ H5_DLL herr_t H5C_resize_entry(void *thing, size_t new_size);
H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr);
H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled);
H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix);
-H5_DLL herr_t H5C_set_log_file_ptr(H5C_t * cache_ptr, FILE * log_file_ptr);
H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t *cache_ptr, FILE *trace_file_ptr);
H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name,
hbool_t display_detailed_stats);
@@ -2036,6 +2111,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr,
H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr);
H5_DLL void H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag);
H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
+H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id,
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 5af26b2..923f3fb 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -424,6 +424,8 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
unsigned *flags)
{
H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL)
@@ -439,6 +441,16 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
HDassert(flags);
if(fspace->sinfo) {
+ H5AC_ring_t ring;
+
+ /* Retrieve the ring type for the header */
+ if(H5AC_get_entry_ring(f, addr, &ring) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to get property value");
+
+ /* Set the ring type for the section info in the DXPL */
+ if(H5AC_set_ring(dxpl_id, ring, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* This implies that the header "owns" the section info.
*
* Unfortunately, the comments in the code are not clear as to
@@ -644,6 +656,10 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
*flags = 0;
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5FS__cache_hdr_pre_serialize() */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index df01c7f..d7d45e0 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -206,6 +206,8 @@ herr_t
H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
hbool_t was_created)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -216,6 +218,10 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
/* Check if extension was created */
if(was_created) {
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Increment link count on superblock extension's object header */
if(H5O_link(ext_ptr, 1, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LINKCOUNT, FAIL, "unable to increment hard link count")
@@ -232,6 +238,10 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
f->nopen_objs--;
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_super_ext_close() */
@@ -256,7 +266,8 @@ done:
herr_t
H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read)
{
- H5P_genplist_t *dxpl; /* DXPL object */
+ H5P_genplist_t *dxpl = NULL; /* DXPL object */
+ H5AC_ring_t ring, orig_ring = H5AC_RING_INV;
H5F_super_t * sblock = NULL; /* Superblock structure */
H5F_superblock_cache_ud_t udata; /* User data for cache callbacks */
H5P_genplist_t *c_plist; /* File creation property list */
@@ -276,6 +287,8 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read)
/* Get the DXPL plist object for DXPL ID */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+ if((H5P_get(dxpl, H5AC_RING_NAME, &orig_ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get property value");
/* Find the superblock */
if(H5FD_locate_signature(f->shared->lf, dxpl, &super_addr) < 0)
@@ -320,6 +333,11 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read)
udata.stored_eof = HADDR_UNDEF;
udata.drvrinfo_removed = FALSE;
+ /* Set the ring type in the DXPL */
+ ring = H5AC_RING_SB;
+ if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value");
+
/* Look up the superblock */
if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags)))
HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock")
@@ -435,6 +453,11 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read)
* allocated so that it knows how to allocate additional memory.
*/
+ /* Set the ring type in the DXPL */
+ ring = H5AC_RING_SBE;
+ if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value");
+
/* Decode the optional driver information block */
if(H5F_addr_defined(sblock->driver_addr)) {
H5O_drvinfo_t *drvinfo; /* Driver info */
@@ -663,6 +686,10 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read)
f->shared->sblock = sblock;
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Release the superblock */
if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock")
@@ -721,6 +748,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
H5O_drvinfo_t *drvinfo = NULL; /* Driver info */
hbool_t drvinfo_in_cache = FALSE; /* Whether the driver info block has been inserted into the metadata cache */
H5P_genplist_t *plist; /* File creation property list */
+ H5P_genplist_t *dxpl = NULL;
+ H5AC_ring_t ring, orig_ring = H5AC_RING_INV;
hsize_t userblock_size; /* Size of userblock, in bytes */
hsize_t superblock_size; /* Size of superblock, in bytes */
size_t driver_size; /* Size of driver info block (bytes) */
@@ -846,6 +875,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
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")
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_SB, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Insert superblock into cache, pinned */
if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache")
@@ -891,6 +924,11 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
else
need_ext = FALSE;
+ /* Set the ring type in the DXPL */
+ ring = H5AC_RING_SBE;
+ if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Create the superblock extension for "extra" superblock data, if necessary. */
if(need_ext) {
/* The superblock extension isn't actually a group, but the
@@ -992,6 +1030,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
} /* end if */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Close superblock extension, if it was created */
if(ext_created && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension")
@@ -1130,6 +1172,8 @@ H5F__super_free(H5F_super_t *sblock)
herr_t
H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1154,6 +1198,10 @@ H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext
ext_loc.file = f;
ext_loc.addr = f->shared->sblock->ext_addr;
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Get object header info for superblock extension */
if(H5O_get_hdr_info(&ext_loc, dxpl_id, &hdr_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
@@ -1167,6 +1215,10 @@ H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext
} /* end if */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__super_size() */
@@ -1185,6 +1237,8 @@ done:
herr_t
H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
hbool_t ext_created = FALSE; /* Whether superblock extension was created */
hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
@@ -1198,6 +1252,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_
HDassert(f->shared);
HDassert(f->shared->sblock);
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Open/create the superblock extension object header */
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
@@ -1235,6 +1293,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_
} /* end else */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Close the superblock extension, if it was opened */
if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension")
@@ -1261,6 +1323,8 @@ done:
herr_t
H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
hbool_t ext_opened = FALSE; /* Whether the superblock extension was opened */
int null_count = 0; /* # of null messages */
@@ -1272,6 +1336,10 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id)
/* Make sure that the superblock extension object header exists */
HDassert(H5F_addr_defined(f->shared->sblock->ext_addr));
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Open superblock extension object header */
if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension")
@@ -1305,6 +1373,10 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id)
} /* end if */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Close superblock extension object header, if opened */
if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension")
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index 0311f85..af253bc 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -617,6 +617,8 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id,
size_t H5_ATTR_UNUSED *new_len, size_t H5_ATTR_UNUSED *new_compressed_len,
unsigned H5_ATTR_UNUSED *flags)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the super block */
herr_t ret_value = SUCCEED; /* Return value */
@@ -664,6 +666,10 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id,
if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Write driver info information to the superblock extension */
drvinfo.len = driver_size;
drvinfo.buf = dbuf;
@@ -679,6 +685,10 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id,
} /* end if */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FS_cache_superblock_pre_serialize() */
diff --git a/src/H5MF.c b/src/H5MF.c
index 0c98654..8a227d7 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -237,6 +237,8 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
{
const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */
H5MF_FSPACE_SECT_CLS_SIMPLE};
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -250,6 +252,10 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
HDassert(H5F_addr_defined(f->shared->fs_addr[type]));
HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED);
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Open an existing free space structure for the file */
if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type],
NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold)))
@@ -260,6 +266,10 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
f->shared->fs_state[type] = H5F_FS_STATE_OPEN;
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_alloc_open() */
@@ -423,6 +433,8 @@ done:
haddr_t
H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */
haddr_t ret_value; /* Return value */
@@ -440,6 +452,10 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
/* Get free space type from allocation type */
fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type);
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, HADDR_UNDEF, "unable to set ring value")
+
/* Check if we are using the free space manager for this file */
if(H5F_HAVE_FREE_SPACE_MANAGER(f)) {
/* Check if the free space manager for the file has been initialized */
@@ -512,6 +528,10 @@ HDfprintf(stderr, "%s: Check 2.0\n", FUNC);
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd")
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, HADDR_UNDEF, "unable to set property value")
+
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size);
#endif /* H5MF_ALLOC_DEBUG */
@@ -604,6 +624,8 @@ H5MF_xfree(const H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr,
H5F_io_info_t fio_info; /* I/O info for operation */
H5MF_free_section_t *node = NULL; /* Free space section pointer */
H5MF_sect_ud_t udata; /* User data for callback */
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */
herr_t ret_value = SUCCEED; /* Return value */
@@ -622,6 +644,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
if(H5F_addr_le(f->shared->tmp_addr, addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space")
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Set up I/O info for operation */
fio_info.f = f;
if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
@@ -729,6 +755,10 @@ HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC);
} /* end else */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Release section node, if allocated and not added to section list or merged */
if(node)
if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
@@ -762,6 +792,8 @@ htri_t
H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, haddr_t addr,
hsize_t size, hsize_t extra_requested)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
haddr_t end; /* End of block to extend */
H5FD_mem_t map_type; /* Mapped type */
htri_t ret_value; /* Return value */
@@ -781,6 +813,10 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r
/* Compute end of block to extend */
end = addr + size;
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Check if the block is exactly at the end of the file */
if((ret_value = H5FD_try_extend(f->shared->lf, map_type, f, end, extra_requested)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file")
@@ -810,6 +846,10 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r
} /* end if */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG */
@@ -842,6 +882,8 @@ H5MF_sects_dump(f, dxpl_id, stderr);
herr_t
H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
haddr_t eoa; /* End of allocated space in the file */
haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */
hsize_t ma_size = 0; /* Size of "metadata aggregator" */
@@ -865,6 +907,10 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Retrieve metadata aggregator info, if available */
if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
@@ -953,6 +999,10 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
*meta_size = tot_meta_size;
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_get_freespace() */
@@ -977,6 +1027,8 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr,
{
H5MF_free_section_t *node = NULL; /* Free space section pointer */
H5MF_sect_ud_t udata; /* User data for callback */
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -991,6 +1043,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
HDassert(H5F_addr_defined(addr));
HDassert(size > 0);
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Create free space section for block */
if(NULL == (node = H5MF_sect_simple_new(addr, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section")
@@ -1012,6 +1068,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
} /* end if */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Free section node allocated */
if(node && H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
@@ -1104,6 +1164,8 @@ done:
herr_t
H5MF_close(H5F_t *f, hid_t dxpl_id)
{
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5FD_mem_t type; /* Memory type for iteration */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1118,6 +1180,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
HDassert(f->shared->lf);
HDassert(f->shared->sblock);
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Free the space in aggregators */
/* (for space not at EOF, it may be put into free space managers) */
if(H5MF_free_aggrs(f, dxpl_id) < 0)
@@ -1280,6 +1346,10 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC);
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa")
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG */
@@ -1337,6 +1407,8 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects,
{
size_t total_sects = 0; /* total number of sections */
H5MF_sect_iter_ud_t sect_udata; /* User data for callback */
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5FD_mem_t start_type, end_type; /* Memory types to iterate over */
H5FD_mem_t ty; /* Memory type for iteration */
ssize_t ret_value; /* Return value */
@@ -1363,6 +1435,10 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects,
sect_udata.sect_count = nsects;
sect_udata.sect_idx = 0;
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Iterate over memory types, retrieving the number of sections of each type */
for(ty = start_type; ty < end_type; H5_INC_ENUM(H5FD_mem_t, ty)) {
hbool_t fs_started = FALSE;
@@ -1406,6 +1482,10 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects,
ret_value = (ssize_t)total_sects;
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF_get_free_sections() */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 5da0e84..b079eea 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -167,6 +167,11 @@
#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL
#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t)
#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0
+/* Ring type - private property */
+#define H5AC_XFER_RING_SIZE sizeof(unsigned)
+#define H5AC_XFER_RING_DEF H5AC_RING_US
+#define H5AC_XFER_RING_ENC H5P__encode_unsigned
+#define H5AC_XFER_RING_DEC H5P__decode_unsigned
/******************/
/* Local Typedefs */
@@ -270,6 +275,7 @@ static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_F
static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */
static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */
static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */
+static const H5AC_ring_t H5D_ring_g = H5AC_XFER_RING_DEF; /* Default value for the cache entry ring type */
/*-------------------------------------------------------------------------
@@ -463,6 +469,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the data transform property */
+ if(H5P_register_real(pclass, H5AC_RING_NAME, H5AC_XFER_RING_SIZE, &H5D_ring_g,
+ NULL, NULL, NULL, H5AC_XFER_RING_ENC, H5AC_XFER_RING_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dxfr_reg_prop() */
diff --git a/src/H5SM.c b/src/H5SM.c
index 730f4b1..52133c9 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -122,6 +122,8 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
{
H5O_shmesg_table_t sohm_table; /* SOHM message for superblock extension */
H5SM_master_table_t *table = NULL; /* SOHM master table for file */
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t ring, orig_ring = H5AC_RING_INV; /* Original ring value */
haddr_t table_addr = HADDR_UNDEF; /* Address of SOHM master table in file */
unsigned list_max, btree_min; /* Phase change limits for SOHM indices */
unsigned index_type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Messages types stored in each index */
@@ -136,6 +138,10 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
/* File should not already have a SOHM table */
HDassert(!H5F_addr_defined(H5F_SOHM_ADDR(f)));
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_US, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Initialize master table */
if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table")
@@ -220,6 +226,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
if(type_flags_used & H5O_SHMESG_ATTR_FLAG)
H5F_SET_STORE_MSG_CRT_IDX(f, TRUE);
+ /* Set the ring type to superblock extension */
+ ring = H5AC_RING_SBE;
+ if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Write shared message information to the superblock extension */
sohm_table.addr = H5F_SOHM_ADDR(f);
sohm_table.version = H5F_SOHM_VERS(f);
@@ -228,6 +239,10 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to update SOHM header message")
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value")
+
if(ret_value < 0) {
if(table_addr != HADDR_UNDEF)
H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)table->table_size);
@@ -1929,6 +1944,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
H5F_t *f = ext_loc->file; /* File pointer (convenience variable) */
H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */
H5SM_master_table_t *table = NULL; /* SOHM master table */
+ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */
+ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
unsigned tmp_sohm_nindexes; /* Number of shared messages indexes in the table */
htri_t status; /* Status for message existing */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1969,6 +1986,10 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
/* Set up user data for callback */
cache_udata.f = f;
+ /* Set the ring type in the DXPL */
+ if(H5AC_set_ring(dxpl_id, H5AC_RING_US, &dxpl, &orig_ring) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value")
+
/* Read the rest of the SOHM table information from the cache */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
@@ -2020,6 +2041,10 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
} /* end else */
done:
+ /* Reset the ring in the DXPL */
+ if(H5AC_reset_ring(dxpl, orig_ring) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value")
+
/* Release the master SOHM table if we took it out of the cache */
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
diff --git a/test/Makefile.am b/test/Makefile.am
index d07837d..dedb4a1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -151,7 +151,7 @@ flush2.chkexe_: flush1.chkexe_
# prefix or low-level driver with environment variables will influence
# the temporary file name in ways that the makefile is not aware of.
CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 \
- dset_offset.h5 chunk_fixed.h5 cache_logging.log \
+ dset_offset.h5 chunk_fixed.h5 cache_logging.out \
max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \
chunk_expand.h5 layout_extend.h5 swmr_fail.h5 partial_chunks.h5 \
diff --git a/test/cache_common.c b/test/cache_common.c
index 9936e47..c8444b0 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -3209,7 +3209,7 @@ setup_cache(size_t max_cache_size,
if ( pass ) { /* allocate space for test entries */
- actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT,
+ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT,
(hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
if ( actual_base_addr == HADDR_UNDEF ) {
@@ -3319,7 +3319,7 @@ takedown_cache(H5F_t * file_ptr,
HDassert ( file_ptr );
}
- H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr,
+ H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, saved_actual_base_addr,
(hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
saved_actual_base_addr = HADDR_UNDEF;
}
diff --git a/test/cache_logging.c b/test/cache_logging.c
index fa2a752..682ff6d 100644
--- a/test/cache_logging.c
+++ b/test/cache_logging.c
@@ -17,7 +17,7 @@
#include "h5test.h"
-#define LOG_LOCATION "cache_logging.log"
+#define LOG_LOCATION "cache_logging.out"
#define FILE_NAME "cache_logging"
#define N_GROUPS 100
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index b438725..4a894b9 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -4205,7 +4205,7 @@ setup_cache_for_test(hid_t * fid_ptr,
*/
if ( success ) { /* allocate space for test entries */
- actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT,
+ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT,
(hsize_t)(max_addr + BASE_ADDR));
if ( actual_base_addr == HADDR_UNDEF ) {