summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
authorNeil Fortner <fortnern@gmail.com>2024-02-23 17:06:06 (GMT)
committerGitHub <noreply@github.com>2024-02-23 17:06:06 (GMT)
commit560e80c0ad8494a2e070aafde9cbcff11de99219 (patch)
tree5ddb917d293eb80471e66fb98fe88a159b0419e5 /src/H5C.c
parent3fd1e90df69462a0d55b5d830e8eee663fcb44bb (diff)
downloadhdf5-560e80c0ad8494a2e070aafde9cbcff11de99219.zip
hdf5-560e80c0ad8494a2e070aafde9cbcff11de99219.tar.gz
hdf5-560e80c0ad8494a2e070aafde9cbcff11de99219.tar.bz2
Improve performance of flushing single objects (#4017)
Improve performance of flushing a single object, and remove metadata cache flush markers
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c79
1 files changed, 30 insertions, 49 deletions
diff --git a/src/H5C.c b/src/H5C.c
index eb6e49e..1713e83 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -493,7 +493,7 @@ H5C_dest(H5F_t *f)
#endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */
/* Enable the slist, as it is needed in the flush */
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed");
/* Flush and invalidate all cache entries */
@@ -567,7 +567,7 @@ H5C_evict(H5F_t *f)
assert(f);
/* Enable the slist, as it is needed in the flush */
- if (H5C_set_slist_enabled(f->shared->cache, true, false) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, true, true) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed");
/* Flush and invalidate all cache entries except the pinned entries */
@@ -575,7 +575,7 @@ H5C_evict(H5F_t *f)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache");
/* Disable the slist */
- if (H5C_set_slist_enabled(f->shared->cache, false, true) < 0)
+ if (H5C_set_slist_enabled(f->shared->cache, false, false) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed");
done:
@@ -1042,41 +1042,32 @@ done:
*
* 1) Verifies that the slist is empty.
*
- * 2) Scans the index list, and inserts all dirty entries
- * into the slist.
+ * 2) If the populate_slist parameter is true, scans the
+ * index list, and inserts all dirty entries into the
+ * slist.
*
* 3) Sets cache_ptr->slist_enabled = true.
*
- * Note that the clear_slist parameter is ignored if
- * the slist_enabed parameter is true.
- *
*
* If the slist_enabled_parameter is false, the function
- * shuts down the slist.
- *
- * Normally the slist will be empty at this point, however
- * that need not be the case if H5C_flush_cache() has been
- * called with the H5C__FLUSH_MARKED_ENTRIES_FLAG.
- *
- * Thus shutdown proceeds as follows:
+ * shuts down the slist:
*
* 1) Test to see if the slist is empty. If it is, proceed
* to step 3.
*
- * 2) Test to see if the clear_slist parameter is true.
- *
- * If it is, remove all entries from the slist.
- *
- * If it isn't, throw an error.
+ * 2) Remove all entries from the slist.
*
* 3) set cache_ptr->slist_enabled = false.
*
+ * Note that the populate_slist parameter is ignored if
+ * the slist_enabed parameter is false.
+ *
* Return: SUCCEED on success, and FAIL on failure.
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist)
+H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool populate_slist)
{
H5C_cache_entry_t *entry_ptr;
herr_t ret_value = SUCCEED; /* Return value */
@@ -1097,40 +1088,30 @@ H5C_set_slist_enabled(H5C_t *cache_ptr, bool slist_enabled, bool clear_slist)
*/
cache_ptr->slist_enabled = true;
- /* scan the index list and insert all dirty entries in the slist */
- entry_ptr = cache_ptr->il_head;
- while (entry_ptr != NULL) {
- if (entry_ptr->is_dirty)
- H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
- entry_ptr = entry_ptr->il_next;
- }
+ if (populate_slist) {
+ /* scan the index list and insert all dirty entries in the slist */
+ entry_ptr = cache_ptr->il_head;
+ while (entry_ptr != NULL) {
+ if (entry_ptr->is_dirty)
+ H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL);
+ entry_ptr = entry_ptr->il_next;
+ }
- /* we don't maintain a dirty index len, so we can't do a cross
- * check against it. Note that there is no point in cross checking
- * against the dirty LRU size, as the dirty LRU may not be maintained,
- * and in any case, there is no requirement that all dirty entries
- * will reside on the dirty LRU.
- */
- assert(cache_ptr->dirty_index_size == cache_ptr->slist_size);
+ /* we don't maintain a dirty index len, so we can't do a cross
+ * check against it. Note that there is no point in cross checking
+ * against the dirty LRU size, as the dirty LRU may not be maintained,
+ * and in any case, there is no requirement that all dirty entries
+ * will reside on the dirty LRU.
+ */
+ assert(cache_ptr->dirty_index_size == cache_ptr->slist_size);
+ }
}
else { /* take down the skip list */
if (!cache_ptr->slist_enabled)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?");
- if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) {
- if (clear_slist) {
- H5SL_node_t *node_ptr;
-
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- while (node_ptr != NULL) {
- entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, false, FAIL);
- node_ptr = H5SL_first(cache_ptr->slist_ptr);
- }
- }
- else
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?");
- }
+ if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0))
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?");
cache_ptr->slist_enabled = false;