diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
commit | ec8ad09125032c9c232878d02e90aa86df162841 (patch) | |
tree | 5d63105d3a0db7d5bbee41c5b74b097649a2115e /src/H5Ctag.c | |
parent | 453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff) | |
download | hdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2 |
Source formatted
Diffstat (limited to 'src/H5Ctag.c')
-rw-r--r-- | src/H5Ctag.c | 269 |
1 files changed, 123 insertions, 146 deletions
diff --git a/src/H5Ctag.c b/src/H5Ctag.c index e92d0e4..a3eb173 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -27,68 +27,63 @@ /* Module Setup */ /****************/ -#include "H5Cmodule.h" /* This source code file is part of the H5C module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ - +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Cpkg.h" /* Cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ - +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Cpkg.h" /* Cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ /* Typedef for tagged entry iterator callback context - evict tagged entries */ typedef struct { - H5F_t *f; /* File pointer for evicting entry */ - hbool_t evicted_entries_last_pass; /* Flag to indicate that an entry - * was evicted when iterating over - * cache - */ - hbool_t pinned_entries_need_evicted;/* Flag to indicate that a pinned - * entry was attempted to be evicted - */ - hbool_t skipped_pf_dirty_entries; /* Flag indicating that one or more - * entries marked prefetched_dirty - * were encountered and not - * evicted. - */ + H5F_t * f; /* File pointer for evicting entry */ + hbool_t evicted_entries_last_pass; /* Flag to indicate that an entry + * was evicted when iterating over + * cache + */ + hbool_t pinned_entries_need_evicted; /* Flag to indicate that a pinned + * entry was attempted to be evicted + */ + hbool_t skipped_pf_dirty_entries; /* Flag indicating that one or more + * entries marked prefetched_dirty + * were encountered and not + * evicted. + */ } H5C_tag_iter_evict_ctx_t; /* Typedef for tagged entry iterator callback context - expunge tag type metadata */ typedef struct { - H5F_t *f; /* File pointer for evicting entry */ - int type_id; /* Cache entry type to expunge */ - unsigned flags; /* Flags for expunging entry */ + H5F_t * f; /* File pointer for evicting entry */ + int type_id; /* Cache entry type to expunge */ + unsigned flags; /* Flags for expunging entry */ } H5C_tag_iter_ettm_ctx_t; /* Typedef for tagged entry iterator callback context - mark corked */ typedef struct { - hbool_t cork_val; /* Corked value */ + hbool_t cork_val; /* Corked value */ } H5C_tag_iter_cork_ctx_t; - /********************/ /* Local Prototypes */ /********************/ static herr_t H5C__mark_tagged_entries(H5C_t *cache_ptr, haddr_t tag); - /*********************/ /* Package Variables */ /*********************/ @@ -96,18 +91,14 @@ static herr_t H5C__mark_tagged_entries(H5C_t *cache_ptr, haddr_t tag); /* Declare extern free list to manage the tag info struct */ H5FL_EXTERN(H5C_tag_info_t); - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - - /*------------------------------------------------------------------------- * * Function: H5C_ignore_tags @@ -131,7 +122,7 @@ H5FL_EXTERN(H5C_tag_info_t); *------------------------------------------------------------------------- */ herr_t -H5C_ignore_tags(H5C_t * cache_ptr) +H5C_ignore_tags(H5C_t *cache_ptr) { FUNC_ENTER_NOAPI_NOERR @@ -145,7 +136,6 @@ H5C_ignore_tags(H5C_t * cache_ptr) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5C_ignore_tags */ - /*------------------------------------------------------------------------- * * Function: H5C_get_ignore_tags @@ -172,7 +162,6 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr) FUNC_LEAVE_NOAPI(cache_ptr->ignore_tags) } /* H5C_get_ignore_tags */ - /*------------------------------------------------------------------------- * * Function: H5C_get_num_objs_corked @@ -198,7 +187,6 @@ H5C_get_num_objs_corked(const H5C_t *cache_ptr) FUNC_LEAVE_NOAPI(cache_ptr->num_objs_corked) } /* H5C_get_num_objs_corked */ - /*------------------------------------------------------------------------- * * Function: H5C__tag_entry @@ -218,9 +206,9 @@ H5C_get_num_objs_corked(const H5C_t *cache_ptr) herr_t H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) { - H5C_tag_info_t *tag_info; /* Points to a tag info struct */ - haddr_t tag; /* Tag value */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_tag_info_t *tag_info; /* Points to a tag info struct */ + haddr_t tag; /* Tag value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -232,7 +220,7 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) /* Get the tag */ tag = H5CX_get_tag(); - if(cache->ignore_tags) { + if (cache->ignore_tags) { /* 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 API context before creating some metadata. Thus, @@ -240,13 +228,13 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) 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(!H5F_addr_defined(tag)) + if (!H5F_addr_defined(tag)) tag = H5AC__IGNORE_TAG; } /* end if */ #if H5C_DO_TAGGING_SANITY_CHECKS else { /* Perform some sanity checks to ensure that a correct tag is being applied */ - if(H5C_verify_tag(entry->type->id, tag) < 0) + if (H5C_verify_tag(entry->type->id, tag) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed") } /* end else */ #endif @@ -255,16 +243,16 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) tag_info = (H5C_tag_info_t *)H5SL_search(cache->tag_list, &tag); /* Check if this is the first entry for this tagged object */ - if(NULL == tag_info) { + if (NULL == tag_info) { /* Allocate new tag info struct */ - if(NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) + if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry") /* Set the tag for all entries */ tag_info->tag = tag; /* Insert tag info into skip list */ - if(H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0 ) + if (H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list") } /* end if */ else @@ -276,9 +264,9 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) HDassert(entry->tag_info == NULL); /* Add the entry to the list for the tagged object */ - entry->tl_next = tag_info->head; + entry->tl_next = tag_info->head; entry->tag_info = tag_info; - if(tag_info->head) + if (tag_info->head) tag_info->head->tl_prev = entry; tag_info->head = entry; tag_info->entry_cnt++; @@ -287,7 +275,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__tag_entry */ - /*------------------------------------------------------------------------- * * Function: H5C__untag_entry @@ -305,8 +292,8 @@ done: herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry) { - H5C_tag_info_t *tag_info; /* Points to a tag info struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_tag_info_t *tag_info; /* Points to a tag info struct */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -316,27 +303,27 @@ H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry) HDassert(cache->magic == H5C__H5C_T_MAGIC); /* Get the entry's tag info struct */ - if(NULL != (tag_info = entry->tag_info)) { + if (NULL != (tag_info = entry->tag_info)) { /* Remove the entry from the list */ - if(entry->tl_next) + if (entry->tl_next) entry->tl_next->tl_prev = entry->tl_prev; - if(entry->tl_prev) + if (entry->tl_prev) entry->tl_prev->tl_next = entry->tl_next; - if(tag_info->head == entry) + if (tag_info->head == entry) tag_info->head = entry->tl_next; tag_info->entry_cnt--; /* Reset pointers, to avoid confusion */ - entry->tl_next = NULL; - entry->tl_prev = NULL; + entry->tl_next = NULL; + entry->tl_prev = NULL; entry->tag_info = NULL; /* Remove the tag info from the tag list, if there's no more entries with this tag */ - if(!tag_info->corked && 0 == tag_info->entry_cnt) { + if (!tag_info->corked && 0 == tag_info->entry_cnt) { /* Sanity check */ HDassert(NULL == tag_info->head); - if(H5SL_remove(cache->tag_list, &(tag_info->tag)) != tag_info) + if (H5SL_remove(cache->tag_list, &(tag_info->tag)) != tag_info) HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list") /* Release the tag info */ @@ -350,7 +337,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__untag_entry */ - /*------------------------------------------------------------------------- * * Function: H5C__iter_tagged_entries_real @@ -365,11 +351,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, - void *cb_ctx) +H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, void *cb_ctx) { - H5C_tag_info_t *tag_info; /* Points to a tag info struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_tag_info_t *tag_info; /* Points to a tag info struct */ + herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ FUNC_ENTER_STATIC @@ -382,9 +367,9 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, tag_info = (H5C_tag_info_t *)H5SL_search(cache->tag_list, &tag); /* If there's any entries for this tag, iterate over them */ - if(tag_info) { - H5C_cache_entry_t *entry; /* Pointer to current entry */ - H5C_cache_entry_t *next_entry; /* Pointer to next entry in hash bucket chain */ + if (tag_info) { + H5C_cache_entry_t *entry; /* Pointer to current entry */ + H5C_cache_entry_t *next_entry; /* Pointer to next entry in hash bucket chain */ /* Sanity check */ HDassert(tag_info->head); @@ -392,24 +377,23 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, /* Iterate over the entries for this tag */ entry = tag_info->head; - while(entry) { + while (entry) { /* Acquire pointer to next entry */ next_entry = entry->tl_next; /* Make callback for entry */ - if((cb)(entry, cb_ctx) != H5_ITER_CONT) + if ((cb)(entry, cb_ctx) != H5_ITER_CONT) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "tagged entry iteration callback failed") /* Advance to next entry */ entry = next_entry; } /* end while */ - } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__iter_tagged_entries_real() */ - /*------------------------------------------------------------------------- * * Function: H5C__iter_tagged_entries @@ -424,10 +408,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, - H5C_tag_iter_cb_t cb, void *cb_ctx) +H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_tag_iter_cb_t cb, void *cb_ctx) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ FUNC_ENTER_PACKAGE @@ -437,17 +420,17 @@ H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, HDassert(cache->magic == H5C__H5C_T_MAGIC); /* Iterate over the entries for this tag */ - if(H5C__iter_tagged_entries_real(cache, tag, cb, cb_ctx) < 0) + if (H5C__iter_tagged_entries_real(cache, tag, cb, cb_ctx) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") /* Check for iterating over global metadata */ - if(match_global) { + if (match_global) { /* Iterate over the entries for SOHM entries */ - if(H5C__iter_tagged_entries_real(cache, H5AC__SOHM_TAG, cb, cb_ctx) < 0) + if (H5C__iter_tagged_entries_real(cache, H5AC__SOHM_TAG, cb, cb_ctx) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") /* Iterate over the entries for global heap entries */ - if(H5C__iter_tagged_entries_real(cache, H5AC__GLOBALHEAP_TAG, cb, cb_ctx) < 0) + if (H5C__iter_tagged_entries_real(cache, H5AC__GLOBALHEAP_TAG, cb, cb_ctx) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") } /* end if */ @@ -455,7 +438,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__iter_tagged_entries() */ - /*------------------------------------------------------------------------- * * Function: H5C__evict_tagged_entries_cb @@ -473,7 +455,7 @@ static int H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) { H5C_tag_iter_evict_ctx_t *ctx = (H5C_tag_iter_evict_ctx_t *)_ctx; /* Get pointer to iterator context */ - int ret_value = H5_ITER_CONT; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ /* Function enter macro */ FUNC_ENTER_STATIC @@ -483,18 +465,20 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) HDassert(ctx); /* Attempt to evict entry */ - if(entry->is_protected) + if (entry->is_protected) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict protected entry") - else if(entry->is_dirty) + else if (entry->is_dirty) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict dirty entry") - else if(entry->is_pinned) + else if (entry->is_pinned) /* Can't evict at this time, but let's note that we hit a pinned entry and we'll loop back around again (as evicting other entries will hopefully unpin this entry) */ ctx->pinned_entries_need_evicted = TRUE; - else if(!entry->prefetched_dirty) { + else if (!entry->prefetched_dirty) { /* Evict the Entry */ - if(H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + if (H5C__flush_single_entry(ctx->f, entry, + H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.") ctx->evicted_entries_last_pass = TRUE; } @@ -505,7 +489,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__evict_tagged_entries_cb() */ - /*------------------------------------------------------------------------- * * Function: H5C_evict_tagged_entries @@ -520,11 +503,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global) +H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global) { - H5C_t *cache; /* Pointer to cache structure */ - H5C_tag_iter_evict_ctx_t ctx; /* Context for iterator callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_t * cache; /* Pointer to cache structure */ + H5C_tag_iter_evict_ctx_t ctx; /* Context for iterator callback */ + herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ FUNC_ENTER_NOAPI(FAIL) @@ -532,7 +515,7 @@ H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global) /* Sanity checks */ HDassert(f); HDassert(f->shared); - cache = f->shared->cache; /* Get cache pointer */ + cache = f->shared->cache; /* Get cache pointer */ HDassert(cache != NULL); HDassert(cache->magic == H5C__H5C_T_MAGIC); @@ -543,15 +526,15 @@ H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global) do { /* Reset pinned/evicted tracking flags */ ctx.pinned_entries_need_evicted = FALSE; - ctx.evicted_entries_last_pass = FALSE; - ctx.skipped_pf_dirty_entries = FALSE; + ctx.evicted_entries_last_pass = FALSE; + ctx.skipped_pf_dirty_entries = FALSE; /* Iterate through entries in the cache */ - if(H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0) + if (H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") /* Keep doing this until we have stopped evicted entries */ - } while(TRUE == ctx.evicted_entries_last_pass); + } while (TRUE == ctx.evicted_entries_last_pass); /* In most cases, fail if we have finished evicting entries and pinned * entries still need evicted @@ -578,14 +561,13 @@ H5C_evict_tagged_entries(H5F_t * f, haddr_t tag, hbool_t match_global) * Thus we must ignore ctx.pinned_entries_need_evicted if * ctx.skipped_pf_dirty_entries is TRUE. */ - if((!ctx.skipped_pf_dirty_entries) && (ctx.pinned_entries_need_evicted)) + if ((!ctx.skipped_pf_dirty_entries) && (ctx.pinned_entries_need_evicted)) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entries still need evicted?!") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_evict_tagged_entries() */ - /*------------------------------------------------------------------------- * * Function: H5C__mark_tagged_entries_cb @@ -610,13 +592,12 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx) /* We only want to set the flush marker on entries that * actually need flushed (i.e., dirty ones) */ - if(entry->is_dirty) + if (entry->is_dirty) entry->flush_marker = TRUE; FUNC_LEAVE_NOAPI(H5_ITER_CONT) } /* H5C__mark_tagged_entries_cb() */ - /*------------------------------------------------------------------------- * * Function: H5C__mark_tagged_entries @@ -634,7 +615,7 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx) static herr_t H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ FUNC_ENTER_STATIC @@ -646,7 +627,7 @@ H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag) /* Iterate through hash table entries, marking those with specified tag, as * well as any major global entries which should always be flushed * when flushing based on tag value */ - if(H5C__iter_tagged_entries(cache, tag, TRUE, H5C__mark_tagged_entries_cb, NULL) < 0) + if (H5C__iter_tagged_entries(cache, tag, TRUE, H5C__mark_tagged_entries_cb, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") done: @@ -654,7 +635,7 @@ done: } /* H5C__mark_tagged_entries() */ #if H5C_DO_TAGGING_SANITY_CHECKS - + /*------------------------------------------------------------------------- * * Function: H5C_verify_tag @@ -678,10 +659,10 @@ H5C_verify_tag(int id, haddr_t tag) /* 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) + 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) { - if(id != H5AC_PROXY_ENTRY_ID) + else if (tag == H5AC__INVALID_TAG) { + if (id != H5AC_PROXY_ENTRY_ID) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided") } /* end else-if */ else { @@ -690,41 +671,42 @@ H5C_verify_tag(int id, haddr_t tag) * constraints are met. */ /* Superblock */ - if((id == H5AC_SUPERBLOCK_ID) || (id == H5AC_DRVRINFO_ID)) { - if(tag != H5AC__SUPERBLOCK_TAG) + 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") } /* end if */ else { - if(tag == H5AC__SUPERBLOCK_TAG) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__SUPERBLOCK_TAG applied to non-superblock entry") + if (tag == H5AC__SUPERBLOCK_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, + "H5AC__SUPERBLOCK_TAG applied to non-superblock entry") } /* end else */ /* Free Space Manager */ - if(tag == H5AC__FREESPACE_TAG && ((id != H5AC_FSPACE_HDR_ID) && (id != H5AC_FSPACE_SINFO_ID))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry") + if (tag == H5AC__FREESPACE_TAG && ((id != H5AC_FSPACE_HDR_ID) && (id != H5AC_FSPACE_SINFO_ID))) + 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) + 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) + 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") } /* end if */ else { - if(tag == H5AC__GLOBALHEAP_TAG) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry") + if (tag == H5AC__GLOBALHEAP_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, + "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry") } /* end else */ - } /* end else */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_verify_tag */ #endif - /*------------------------------------------------------------------------- * * Function: H5C_flush_tagged_entries @@ -742,8 +724,8 @@ herr_t H5C_flush_tagged_entries(H5F_t *f, haddr_t tag) { /* Variable Declarations */ - H5C_t *cache_ptr = NULL; - herr_t ret_value = SUCCEED; + H5C_t *cache_ptr = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -755,18 +737,17 @@ H5C_flush_tagged_entries(H5F_t *f, haddr_t tag) cache_ptr = f->shared->cache; /* Mark all entries with specified tag */ - if(H5C__mark_tagged_entries(cache_ptr, tag) < 0) + if (H5C__mark_tagged_entries(cache_ptr, tag) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries") /* Flush all marked entries */ - if(H5C__flush_marked_entries(f) < 0) + if (H5C__flush_marked_entries(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_flush_tagged_entries */ - /*------------------------------------------------------------------------- * * Function: H5C_retag_entries @@ -785,8 +766,8 @@ done: herr_t H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag) { - H5C_tag_info_t *tag_info; /* Points to a tag info struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_tag_info_t *tag_info; /* Points to a tag info struct */ + herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ FUNC_ENTER_NOAPI(FAIL) @@ -795,12 +776,12 @@ H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag) HDassert(cache); /* Remove tag info from tag list */ - if(NULL != (tag_info = (H5C_tag_info_t *)H5SL_remove(cache->tag_list, &src_tag))) { + if (NULL != (tag_info = (H5C_tag_info_t *)H5SL_remove(cache->tag_list, &src_tag))) { /* Change to new tag */ tag_info->tag = dest_tag; /* Re-insert tag info into skip list */ - if(H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0) + if (H5SL_insert(cache->tag_list, tag_info, &(tag_info->tag)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list") } /* end if */ @@ -808,7 +789,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_retag_entries() */ - /*------------------------------------------------------------------------- * * Function: H5C__expunge_tag_type_metadata_cb @@ -827,7 +807,7 @@ static int H5C__expunge_tag_type_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 */ + int ret_value = H5_ITER_CONT; /* Return value */ /* Function enter macro */ FUNC_ENTER_STATIC @@ -837,15 +817,14 @@ 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) - if(H5C_expunge_entry(ctx->f, entry->type, entry->addr, ctx->flags) < 0) + 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") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__expunge_tag_type_metadata_cb() */ - /*------------------------------------------------------------------------- * * Function: H5C_expunge_tag_type_metadata @@ -863,9 +842,9 @@ done: herr_t 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 */ - herr_t ret_value = SUCCEED; /* Return value */ + 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) @@ -873,24 +852,23 @@ H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags /* Sanity checks */ HDassert(f); HDassert(f->shared); - cache = f->shared->cache; /* Get cache pointer */ + 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.f = f; ctx.type_id = type_id; - ctx.flags = flags; + 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) + if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__expunge_tag_type_metadata_cb, &ctx) < 0) HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_expunge_tag_type_metadata() */ - /*------------------------------------------------------------------------- * * Function: H5C_get_tag() @@ -907,7 +885,7 @@ done: herr_t H5C_get_tag(const void *thing, haddr_t *tag /*OUT*/) { - const H5C_cache_entry_t *entry = (const H5C_cache_entry_t *)thing; /* Pointer to cache entry */ + const H5C_cache_entry_t *entry = (const H5C_cache_entry_t *)thing; /* Pointer to cache entry */ FUNC_ENTER_NOAPI_NOERR @@ -920,4 +898,3 @@ H5C_get_tag(const void *thing, haddr_t *tag /*OUT*/) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5C_get_tag() */ - |