diff options
author | Sean McBride <sean@rogue-research.com> | 2023-08-02 13:39:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 13:39:15 (GMT) |
commit | 2b0badb90e4e516d0758efbd8ec96449188c7249 (patch) | |
tree | 074e38039b95ca7121a0117069974eff52a04519 /src/H5ACmpio.c | |
parent | 56451503c55ef6e5f67fc3bb710f9e5b649b1af2 (diff) | |
download | hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.zip hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.tar.gz hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.tar.bz2 |
Made HGOTO_ERROR a do-while loop (#3308)
* Made HGOTO_ERROR a do-while loop
Diffstat (limited to 'src/H5ACmpio.c')
-rw-r--r-- | src/H5ACmpio.c | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 3be2bc6..0a634c0 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -210,11 +210,11 @@ H5AC_add_candidate(H5AC_t *cache_ptr, haddr_t addr) * it into the candidate slist. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate candidate slist entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate candidate slist entry"); slist_entry_ptr->addr = addr; if (H5SL_insert(aux_ptr->candidate_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist"); done: /* Clean up on error */ @@ -485,17 +485,17 @@ H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUS switch (sync_point_op) { case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: if (H5C_construct_candidate_list__min_clean((H5C_t *)cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__min_clean() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__min_clean() failed."); break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: if (H5C_construct_candidate_list__clean_cache((H5C_t *)cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "H5C_construct_candidate_list__clean_cache() failed.") + "H5C_construct_candidate_list__clean_cache() failed."); break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation."); break; } /* end switch */ @@ -597,7 +597,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri */ buf_size = sizeof(haddr_t) * num_entries; if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer"); /* Set up user data for callback */ udata.aux_ptr = aux_ptr; @@ -606,7 +606,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri /* Free all the candidate list entries, building the address list in the callback */ if (H5SL_free(aux_ptr->candidate_slist_ptr, H5AC__copy_candidate_list_to_buffer_cb, &udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for candidate entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for candidate entries"); /* Pass the number of entries and the buffer pointer * back to the caller. @@ -718,11 +718,11 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) * add its size to the dirty_bytes count. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry ."); slist_entry_ptr->addr = addr; if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist."); aux_ptr->dirty_bytes += entry_ptr->size; #ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION @@ -856,11 +856,11 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsig if (NULL == H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr))) { /* insert the address of the entry in the clean entry list. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate clean slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate clean slist entry ."); slist_entry_ptr->addr = addr; if (H5SL_insert(aux_ptr->c_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into clean entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into clean entry slist."); } /* end if */ } /* end else-if */ @@ -910,20 +910,20 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) /* Entry to insert should not be in dirty list currently */ if (NULL != H5SL_search(aux_ptr->d_slist_ptr, (const void *)(&entry_ptr->addr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry already in dirty slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry already in dirty slist."); /* insert the address of the entry in the dirty entry list, and * add its size to the dirty_bytes count. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry ."); slist_entry_ptr->addr = entry_ptr->addr; if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist."); /* Entry to insert should not be in clean list either */ if (NULL != H5SL_search(aux_ptr->c_slist_ptr, (const void *)(&entry_ptr->addr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry in clean slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry in clean slist."); } /* end if */ aux_ptr->dirty_bytes += entry_ptr->size; @@ -1004,9 +1004,9 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) /* get entry status, size, etc here */ if (H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache, &entry_dirty, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status."); if (!entry_in_cache) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry not in cache.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry not in cache."); if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; @@ -1037,7 +1037,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) */ assert(!entry_dirty); if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry ."); slist_entry_ptr->addr = new_addr; aux_ptr->dirty_bytes += entry_size; @@ -1050,7 +1050,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) /* insert / reinsert the entry in the dirty slist */ if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist."); } /* end if */ else if (!entry_dirty) { aux_ptr->dirty_bytes += entry_size; @@ -1185,13 +1185,13 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) if (aux_ptr->mpi_rank == 0) { if (H5AC__broadcast_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast candidate slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast candidate slist."); assert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); } /* end if */ else { if (H5AC__receive_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive candidate broadcast.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive candidate broadcast."); } /* end else */ if (num_candidates > 0) { @@ -1214,7 +1214,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) /* Check for error on the write operation */ if (result < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list."); /* this code exists primarily for the test bed -- it allows us to * enforce posix semantics on the server that pretends to be a @@ -1234,7 +1234,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) */ if (aux_ptr->mpi_rank == 0) if (H5AC__tidy_cache_0_lists(cache_ptr, num_candidates, candidates_list_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists."); } /* end if */ /* if it is defined, call the sync point done callback. Note @@ -1338,11 +1338,11 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) if (aux_ptr->mpi_rank == 0) { if (H5AC__broadcast_clean_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast clean slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast clean slist."); assert(H5SL_count(aux_ptr->c_slist_ptr) == 0); } /* end if */ else if (H5AC__receive_and_apply_clean_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1456,12 +1456,12 @@ H5AC__receive_and_apply_clean_list(H5F_t *f) /* Retrieve the clean list from process 0 */ if (H5AC__receive_haddr_list(aux_ptr->mpi_comm, &num_entries, &haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list"); if (num_entries > 0) /* Mark the indicated entries as clean */ if (H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean."); /* if it is defined, call the sync point done callback. Note * that this callback is defined purely for testing purposes, @@ -1516,7 +1516,7 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, /* Retrieve the candidate list from process 0 */ if (H5AC__receive_haddr_list(aux_ptr->mpi_comm, num_entries_ptr, haddr_buf_ptr_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1592,7 +1592,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) * form of a skip list. We will convert it later. */ if (H5C_construct_candidate_list__clean_cache(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list."); if (H5SL_count(aux_ptr->candidate_slist_ptr) > 0) { herr_t result; @@ -1601,7 +1601,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) * are used to receiving from process 0. */ if (H5AC__copy_candidate_list_to_buffer(cache_ptr, &num_entries, &haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer."); /* Initial sync point barrier * @@ -1624,7 +1624,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) /* Check for error on the write operation */ if (result < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list."); /* this code exists primarily for the test bed -- it allows us to * enforce posix semantics on the server that pretends to be a @@ -1642,7 +1642,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) */ if (aux_ptr->mpi_rank == 0) if (H5AC__tidy_cache_0_lists(cache_ptr, num_entries, haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists."); } /* end if */ /* if it is defined, call the sync point done callback. Note @@ -1730,7 +1730,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) /* Query if evictions are allowed */ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed."); if (evictions_enabled) { /* construct candidate list -- process 0 only */ @@ -1745,7 +1745,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) /* propagate and apply candidate list -- all processes */ if (H5AC__propagate_and_apply_candidate_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list."); } /* evictions enabled */ done: @@ -1847,7 +1847,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f) /* Propagate cleaned entries to other ranks. */ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1912,7 +1912,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) /* Query if evictions are allowed */ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed."); /* Flush if evictions are allowed -- following call * will cause process 0 to flush to min clean size, @@ -1968,7 +1968,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) } /* end if */ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list."); } /* end if */ done: @@ -2036,7 +2036,7 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) * access. */ if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed."); switch (aux_ptr->metadata_write_strategy) { case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: @@ -2044,12 +2044,12 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: if (H5AC__rsp__p0_only__flush_to_min_clean(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, - "H5AC__rsp__p0_only__flush_to_min_clean() failed.") + "H5AC__rsp__p0_only__flush_to_min_clean() failed."); break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: if (H5AC__rsp__p0_only__flush(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush() failed."); break; default: @@ -2063,12 +2063,13 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: if (H5AC__rsp__dist_md_write__flush_to_min_clean(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, - "H5AC__rsp__dist_md_write__flush_to_min_clean() failed.") + "H5AC__rsp__dist_md_write__flush_to_min_clean() failed."); break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: if (H5AC__rsp__dist_md_write__flush(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__dist_md_write__flush() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, + "H5AC__rsp__dist_md_write__flush() failed."); break; default: @@ -2078,7 +2079,7 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown metadata write strategy.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown metadata write strategy."); break; } /* end switch */ @@ -2202,7 +2203,7 @@ H5AC__flush_entries(H5F_t *f) /* Check if we have >1 ranks */ if (H5C_get_aux_ptr(f->shared->cache)) if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point."); done: FUNC_LEAVE_NOAPI(ret_value) |