summaryrefslogtreecommitdiffstats
path: root/src/H5Ctag.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-03-23 13:48:05 (GMT)
committerGitHub <noreply@github.com>2022-03-23 13:48:05 (GMT)
commitfbb532cd633e216f47ce846493b38af02cfbb43a (patch)
tree1ef7bc9f25ec0832f8b25bb8ea4be34d53bd144d /src/H5Ctag.c
parent78375882485a99a81caa933928ed08d7a38ef88b (diff)
downloadhdf5-fbb532cd633e216f47ce846493b38af02cfbb43a.zip
hdf5-fbb532cd633e216f47ce846493b38af02cfbb43a.tar.gz
hdf5-fbb532cd633e216f47ce846493b38af02cfbb43a.tar.bz2
VFD SWMR: Normalization with develop (#1506)
* Brought over plugin and test script changes * Removes remaining register keywords (#1481) * Fixed warnings in the aux process code * Minor fixes from develop * Minor changes from develop, fixed format warnings * Formatted source * Added HD prefix to timespec_get * Cleanup in new files * Removes the MANIFEST file and unused release files (#1497) * Removes the MANIFEST file and unused release files * Updated tar command * checkposix corrections * More checkposix fixes * Ripped out unused instrumentation functionality * Brought over cache tagging changes from develop * Changes to tagged metadata expulsion iteration * Fixed typo * Brought over H5O__free() changes from develop * Brings (unused) parallel page buffer test in line with develop * Moved the functionality in supervise.subr to test_vfd_swmr.sh * Tools VFD parameter updates * Committing clang-format changes * H5F VFD SWMR refactoring * Committing clang-format changes * Misc changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Ctag.c')
-rw-r--r--src/H5Ctag.c88
1 files changed, 81 insertions, 7 deletions
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index a3f04e8..2095cf8 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -72,7 +72,6 @@ typedef struct {
H5F_t * f; /* File pointer for evicting entry */
int type_id; /* Cache entry type to expunge */
unsigned flags; /* Flags for expunging entry */
- hbool_t type_match;
} H5C_tag_iter_ettm_ctx_t;
/* Typedef for tagged entry iterator callback context - mark corked */
@@ -818,7 +817,7 @@ H5C__expunge_tag_type_metadata_cb(H5C_cache_entry_t *entry, void *_ctx)
HDassert(ctx);
/* Found one with the same tag and type id */
- if (entry->type->id == ctx->type_id || !ctx->type_match)
+ if (entry->type->id == ctx->type_id)
if (H5C_expunge_entry(ctx->f, entry->type, entry->addr, ctx->flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, H5_ITER_ERROR, "can't expunge entry")
@@ -841,7 +840,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags, hbool_t type_match)
+H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags)
{
H5C_t * cache; /* Pointer to cache structure */
H5C_tag_iter_ettm_ctx_t ctx; /* Context for iterator callback */
@@ -858,10 +857,9 @@ H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags
HDassert(cache->magic == H5C__H5C_T_MAGIC);
/* Construct context for iterator callbacks */
- ctx.f = f;
- ctx.type_id = type_id;
- ctx.flags = flags;
- ctx.type_match = type_match;
+ ctx.f = f;
+ ctx.type_id = type_id;
+ ctx.flags = flags;
/* Iterate through hash table entries, expunge those with specified tag and type id */
if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__expunge_tag_type_metadata_cb, &ctx) < 0)
@@ -873,6 +871,82 @@ done:
/*-------------------------------------------------------------------------
*
+ * Function: H5C__expunge_all_tagged_metadata_cb
+ *
+ * Purpose: Callback for expunging all tagged cache entries
+ *
+ * Return: H5_ITER_ERROR if error is detected, H5_ITER_CONT otherwise.
+ *
+ * Programmer: Dana Robinson
+ * Spring 2022
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5C__expunge_all_tagged_metadata_cb(H5C_cache_entry_t *entry, void *_ctx)
+{
+ H5C_tag_iter_ettm_ctx_t *ctx = (H5C_tag_iter_ettm_ctx_t *)_ctx; /* Get pointer to iterator context */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ /* Function enter macro */
+ FUNC_ENTER_STATIC
+
+ /* Santify checks */
+ HDassert(entry);
+ HDassert(ctx);
+
+ if (H5C_expunge_entry(ctx->f, entry->type, entry->addr, ctx->flags) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, H5_ITER_ERROR, "can't expunge entry")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__expunge_all_tagged_metadata_cb() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5C_expunge_all_tagged_metadata
+ *
+ * Purpose: Expunge all cache entries
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Spring 2022
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_expunge_all_tagged_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags)
+{
+ H5C_t * cache; /* Pointer to cache structure */
+ H5C_tag_iter_ettm_ctx_t ctx; /* Context for iterator callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Function enter macro */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+ cache = f->shared->cache; /* Get cache pointer */
+ HDassert(cache != NULL);
+ HDassert(cache->magic == H5C__H5C_T_MAGIC);
+
+ /* Construct context for iterator callbacks */
+ ctx.f = f;
+ ctx.type_id = type_id;
+ ctx.flags = flags;
+
+ /* Iterate through all tagged entries, expunging them */
+ if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__expunge_all_tagged_metadata_cb, &ctx) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iterated expunging of tagged entries failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_expunge_all_tagged_metadata() */
+
+/*-------------------------------------------------------------------------
+ *
* Function: H5C_get_tag()
*
* Purpose: Get the tag for a metadata cache entry.