diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 14:04:36 (GMT) |
commit | f1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch) | |
tree | ebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /src/H5ACmpio.c | |
parent | 10343c197906415388f2a4c8d292e21d25cf7381 (diff) | |
download | hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2 |
Source formatted
Diffstat (limited to 'src/H5ACmpio.c')
-rw-r--r-- | src/H5ACmpio.c | 762 |
1 files changed, 365 insertions, 397 deletions
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index c6ffc80..b5e1462 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -27,20 +27,19 @@ /* Module Setup */ /****************/ -#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ - +#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACpkg.h" /* Metadata cache */ -#include "H5Cprivate.h" /* Cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACpkg.h" /* Metadata cache */ +#include "H5Cprivate.h" /* Cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_PARALLEL @@ -48,7 +47,6 @@ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ @@ -70,46 +68,41 @@ * removed when they appear in a clean entries broadcast. * ****************************************************************************/ -typedef struct H5AC_slist_entry_t -{ - haddr_t addr; +typedef struct H5AC_slist_entry_t { + haddr_t addr; } H5AC_slist_entry_t; /* User data for address list building callbacks */ -typedef struct H5AC_addr_list_ud_t -{ - H5AC_aux_t * aux_ptr; /* 'Auxiliary' parallel cache info */ - haddr_t * addr_buf_ptr; /* Array to store addresses */ - unsigned u; /* Counter for position in array */ +typedef struct H5AC_addr_list_ud_t { + H5AC_aux_t *aux_ptr; /* 'Auxiliary' parallel cache info */ + haddr_t * addr_buf_ptr; /* Array to store addresses */ + unsigned u; /* Counter for position in array */ } H5AC_addr_list_ud_t; - /********************/ /* Local Prototypes */ /********************/ -static herr_t H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, - unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); +static herr_t H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, + haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__broadcast_clean_list(H5AC_t *cache_ptr); -static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr, - H5AC_aux_t *aux_ptr, int sync_point_op); -static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, - unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); -static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f); -static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f); +static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, int sync_point_op); +static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, + haddr_t **haddr_buf_ptr_ptr); +static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f); +static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f); static herr_t H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, - haddr_t **haddr_buf_ptr_ptr); -static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr, - unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); + haddr_t **haddr_buf_ptr_ptr); +static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, + haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f); static herr_t H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, - haddr_t *candidates_list_ptr); + haddr_t *candidates_list_ptr); static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f); static herr_t H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f); static herr_t H5AC__rsp__p0_only__flush(H5F_t *f); static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f); - /*********************/ /* Package Variables */ /*********************/ @@ -117,12 +110,10 @@ static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f); /* Declare a free list to manage the H5AC_aux_t struct */ H5FL_DEFINE(H5AC_aux_t); - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ @@ -130,8 +121,6 @@ H5FL_DEFINE(H5AC_aux_t); /* Declare a free list to manage the H5AC_slist_entry_t struct */ H5FL_DEFINE_STATIC(H5AC_slist_entry_t); - - /*------------------------------------------------------------------------- * Function: H5AC__set_sync_point_done_callback * @@ -148,10 +137,10 @@ H5FL_DEFINE_STATIC(H5AC_slist_entry_t); *------------------------------------------------------------------------- */ herr_t -H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, - void (* sync_point_done)(unsigned num_writes, haddr_t * written_entries_tbl)) +H5AC__set_sync_point_done_callback(H5C_t *cache_ptr, + void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl)) { - H5AC_aux_t * aux_ptr; + H5AC_aux_t *aux_ptr; FUNC_ENTER_PACKAGE_NOERR @@ -166,7 +155,6 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__set_sync_point_done_callback() */ - /*------------------------------------------------------------------------- * Function: H5AC__set_write_done_callback * @@ -182,9 +170,9 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, *------------------------------------------------------------------------- */ herr_t -H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)) +H5AC__set_write_done_callback(H5C_t *cache_ptr, void (*write_done)(void)) { - H5AC_aux_t * aux_ptr; + H5AC_aux_t *aux_ptr; FUNC_ENTER_PACKAGE_NOERR @@ -199,7 +187,6 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__set_write_done_callback() */ - /*------------------------------------------------------------------------- * Function: H5AC_add_candidate() * @@ -219,11 +206,11 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)) *------------------------------------------------------------------------- */ herr_t -H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr) +H5AC_add_candidate(H5AC_t *cache_ptr, haddr_t addr) { - H5AC_aux_t * aux_ptr; - H5AC_slist_entry_t * slist_entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_aux_t * aux_ptr; + H5AC_slist_entry_t *slist_entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -238,23 +225,22 @@ H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr) /* Construct an entry for the supplied address, and insert * it into the candidate slist. */ - if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) + if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate candidate slist entry") - slist_entry_ptr->addr = addr; + slist_entry_ptr->addr = addr; - if(H5SL_insert(aux_ptr->candidate_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) + 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") done: /* Clean up on error */ - if(ret_value < 0) - if(slist_entry_ptr) + if (ret_value < 0) + if (slist_entry_ptr) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_add_candidate() */ - /*------------------------------------------------------------------------- * * Function: H5AC__broadcast_candidate_list() @@ -280,14 +266,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, - haddr_t **haddr_buf_ptr_ptr) +H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { - H5AC_aux_t * aux_ptr = NULL; - haddr_t * haddr_buf_ptr = NULL; - int mpi_result; - unsigned num_entries; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_aux_t *aux_ptr = NULL; + haddr_t * haddr_buf_ptr = NULL; + int mpi_result; + unsigned num_entries; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -309,25 +294,26 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, * any, we are done. */ num_entries = (unsigned)H5SL_count(aux_ptr->candidate_slist_ptr); - if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) - if(num_entries > 0) { - size_t buf_size = 0; - unsigned chk_num_entries = 0; + if (num_entries > 0) { + size_t buf_size = 0; + unsigned chk_num_entries = 0; /* convert the candidate list into the format we * are used to receiving from process 0, and also load it * into a buffer for transmission. */ - if(H5AC__copy_candidate_list_to_buffer(cache_ptr, &chk_num_entries, &haddr_buf_ptr) < 0) + if (H5AC__copy_candidate_list_to_buffer(cache_ptr, &chk_num_entries, &haddr_buf_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.") HDassert(chk_num_entries == num_entries); HDassert(haddr_buf_ptr != NULL); /* Now broadcast the list of candidate entries */ buf_size = sizeof(haddr_t) * num_entries; - if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm))) + if (MPI_SUCCESS != + (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ @@ -335,18 +321,17 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, * back to the caller. Do this so that we can use the same code * to apply the candidate list to all the processes. */ - *num_entries_ptr = num_entries; + *num_entries_ptr = num_entries; *haddr_buf_ptr_ptr = haddr_buf_ptr; done: - if(ret_value < 0) - if(haddr_buf_ptr) + if (ret_value < 0) + if (haddr_buf_ptr) haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__broadcast_candidate_list() */ - /*------------------------------------------------------------------------- * * Function: H5AC__broadcast_clean_list_cb() @@ -361,12 +346,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, - void *_udata) +H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */ - H5AC_addr_list_ud_t * udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */ - haddr_t addr; + H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */ + H5AC_addr_list_ud_t *udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */ + haddr_t addr; FUNC_ENTER_STATIC_NOERR @@ -375,7 +359,7 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, HDassert(udata); /* Store the entry's address in the buffer */ - addr = slist_entry_ptr->addr; + addr = slist_entry_ptr->addr; udata->addr_buf_ptr[udata->u] = addr; udata->u++; @@ -385,13 +369,13 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, /* and also remove the matching entry from the dirtied list * if it exists. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(udata->aux_ptr->d_slist_ptr, (void *)(&addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(udata->aux_ptr->d_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__broadcast_clean_list_cb() */ - /*------------------------------------------------------------------------- * * Function: H5AC__broadcast_clean_list() @@ -413,13 +397,13 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, *------------------------------------------------------------------------- */ static herr_t -H5AC__broadcast_clean_list(H5AC_t * cache_ptr) +H5AC__broadcast_clean_list(H5AC_t *cache_ptr) { - haddr_t * addr_buf_ptr = NULL; - H5AC_aux_t * aux_ptr; - int mpi_result; - unsigned num_entries = 0; - herr_t ret_value = SUCCEED; /* Return value */ + haddr_t * addr_buf_ptr = NULL; + H5AC_aux_t *aux_ptr; + int mpi_result; + unsigned num_entries = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -436,30 +420,31 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) * any, we are done. */ num_entries = (unsigned)H5SL_count(aux_ptr->c_slist_ptr); - if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) - if(num_entries > 0) { + if (num_entries > 0) { H5AC_addr_list_ud_t udata; - size_t buf_size; + size_t buf_size; /* allocate a buffer to store the list of entry base addresses in */ buf_size = sizeof(haddr_t) * num_entries; - if(NULL == (addr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) + if (NULL == (addr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for addr buffer") /* Set up user data for callback */ - udata.aux_ptr = aux_ptr; + udata.aux_ptr = aux_ptr; udata.addr_buf_ptr = addr_buf_ptr; - udata.u = 0; + udata.u = 0; /* Free all the clean list entries, building the address list in the callback */ /* (Callback also removes the matching entries from the dirtied list) */ - if(H5SL_free(aux_ptr->c_slist_ptr, H5AC__broadcast_clean_list_cb, &udata) < 0) + if (H5SL_free(aux_ptr->c_slist_ptr, H5AC__broadcast_clean_list_cb, &udata) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for clean entries") /* Now broadcast the list of cleaned entries */ - if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)addr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm))) + if (MPI_SUCCESS != + (mpi_result = MPI_Bcast((void *)addr_buf_ptr, (int)buf_size, MPI_BYTE, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ @@ -467,17 +452,16 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) * that this callback is defined purely for testing purposes, * and should be undefined under normal operating circumstances. */ - if(aux_ptr->sync_point_done) + if (aux_ptr->sync_point_done) (aux_ptr->sync_point_done)(num_entries, addr_buf_ptr); done: - if(addr_buf_ptr) + if (addr_buf_ptr) addr_buf_ptr = (haddr_t *)H5MM_xfree((void *)addr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__broadcast_clean_list() */ - /*------------------------------------------------------------------------- * Function: H5AC__construct_candidate_list() * @@ -499,9 +483,9 @@ done: */ static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUSED *aux_ptr, - int sync_point_op) + int sync_point_op) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -516,29 +500,30 @@ H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUS HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); HDassert(aux_ptr->candidate_slist_ptr != NULL); HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); - HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || (sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE)); + HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || + (sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE)); - 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.") - break; + 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.") + 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.") - 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.") + break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation.") - break; + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation.") + break; } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__construct_candidate_list() */ - /*------------------------------------------------------------------------- * * Function: H5AC__copy_candidate_list_to_buffer_cb @@ -553,11 +538,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, - void *_udata) +H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */ - H5AC_addr_list_ud_t * udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */ + H5AC_slist_entry_t * slist_entry_ptr = (H5AC_slist_entry_t *)_item; /* Address of item */ + H5AC_addr_list_ud_t *udata = (H5AC_addr_list_ud_t *)_udata; /* Context for callback */ FUNC_ENTER_STATIC_NOERR @@ -575,7 +559,6 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__copy_candidate_list_to_buffer_cb() */ - /*------------------------------------------------------------------------- * * Function: H5AC__copy_candidate_list_to_buffer @@ -609,14 +592,14 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, */ static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, - haddr_t **haddr_buf_ptr_ptr) + haddr_t **haddr_buf_ptr_ptr) { - H5AC_aux_t * aux_ptr = NULL; - H5AC_addr_list_ud_t udata; - haddr_t * haddr_buf_ptr = NULL; - size_t buf_size; - unsigned num_entries = 0; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_aux_t * aux_ptr = NULL; + H5AC_addr_list_ud_t udata; + haddr_t * haddr_buf_ptr = NULL; + size_t buf_size; + unsigned num_entries = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -639,33 +622,32 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri * base addresses in */ buf_size = sizeof(haddr_t) * num_entries; - if(NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) + if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") /* Set up user data for callback */ - udata.aux_ptr = aux_ptr; + udata.aux_ptr = aux_ptr; udata.addr_buf_ptr = haddr_buf_ptr; - udata.u = 0; + udata.u = 0; /* 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) + 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") /* Pass the number of entries and the buffer pointer * back to the caller. */ - *num_entries_ptr = num_entries; + *num_entries_ptr = num_entries; *haddr_buf_ptr_ptr = haddr_buf_ptr; done: - if(ret_value < 0) - if(haddr_buf_ptr) + if (ret_value < 0) + if (haddr_buf_ptr) haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__copy_candidate_list_to_buffer() */ - /*------------------------------------------------------------------------- * * Function: H5AC__log_deleted_entry() @@ -686,16 +668,16 @@ done: herr_t H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - H5AC_slist_entry_t * slist_entry_ptr = NULL; - haddr_t addr; + H5AC_t * cache_ptr; + H5AC_aux_t * aux_ptr; + H5AC_slist_entry_t *slist_entry_ptr = NULL; + haddr_t addr; FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ HDassert(entry_ptr); - addr = entry_ptr->addr; + addr = entry_ptr->addr; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); @@ -706,17 +688,16 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) HDassert(aux_ptr->c_slist_ptr != NULL); /* if the entry appears in the dirtied entry slist, remove it. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) + if (NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); /* if the entry appears in the cleaned entry slist, remove it. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) + if (NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__log_deleted_entry() */ - /*------------------------------------------------------------------------- * * Function: H5AC__log_dirtied_entry() @@ -741,9 +722,9 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) herr_t H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -756,36 +737,37 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - if(aux_ptr->mpi_rank == 0) { + if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; - haddr_t addr = entry_ptr->addr; + haddr_t addr = entry_ptr->addr; /* Sanity checks */ HDassert(aux_ptr->d_slist_ptr != NULL); HDassert(aux_ptr->c_slist_ptr != NULL); - if(NULL == H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) { + if (NULL == H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) { /* 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))) + if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") - slist_entry_ptr->addr = addr; + slist_entry_ptr->addr = addr; - if(H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) + 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.") aux_ptr->dirty_bytes += entry_ptr->size; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - aux_ptr->unprotect_dirty_bytes += entry_ptr->size; - aux_ptr->unprotect_dirty_bytes_updates += 1; -#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ + aux_ptr->unprotect_dirty_bytes += entry_ptr->size; + aux_ptr->unprotect_dirty_bytes_updates += 1; +#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ } /* end if */ /* the entry is dirty. If it exists on the cleaned entries list, * remove it. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); } /* end if */ else { @@ -794,13 +776,12 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) aux_ptr->unprotect_dirty_bytes += entry_size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ - } /* end else */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__log_dirtied_entry() */ - /*------------------------------------------------------------------------- * * Function: H5AC__log_cleaned_entry() @@ -819,8 +800,8 @@ done: herr_t H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; FUNC_ENTER_PACKAGE_NOERR @@ -833,18 +814,20 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - if(aux_ptr->mpi_rank == 0) { + if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; - haddr_t addr = entry_ptr->addr; + haddr_t addr = entry_ptr->addr; /* Sanity checks */ HDassert(aux_ptr->d_slist_ptr != NULL); HDassert(aux_ptr->c_slist_ptr != NULL); /* Remove it from both the cleaned list and the dirtied list. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); } /* end if */ @@ -855,7 +838,6 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__log_cleaned_entry() */ - /*------------------------------------------------------------------------- * * Function: H5AC__log_flushed_entry() @@ -878,13 +860,12 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) *------------------------------------------------------------------------- */ herr_t -H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, - unsigned flags) +H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsigned flags) { - hbool_t cleared; - H5AC_aux_t * aux_ptr; - H5AC_slist_entry_t * slist_entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t cleared; + H5AC_aux_t * aux_ptr; + H5AC_slist_entry_t *slist_entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -899,32 +880,33 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, /* Set local flags */ cleared = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); - if(cleared) { + if (cleared) { /* If the entry has been cleared, must remove it from both the * cleaned list and the dirtied list. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); } /* end if */ - else if(was_dirty) { - if(NULL == H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr))) { + else if (was_dirty) { + 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))) + if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) 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) + 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.") } /* end if */ - } /* end else-if */ + } /* end else-if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__log_flushed_entry() */ - /*------------------------------------------------------------------------- * * Function: H5AC__log_inserted_entry() @@ -948,9 +930,9 @@ done: herr_t H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -962,27 +944,27 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - if(aux_ptr->mpi_rank == 0) { + if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; HDassert(aux_ptr->d_slist_ptr != NULL); HDassert(aux_ptr->c_slist_ptr != NULL); /* Entry to insert should not be in dirty list currently */ - if(NULL != H5SL_search(aux_ptr->d_slist_ptr, (const void *)(&entry_ptr->addr))) + 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.") /* 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))) + if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) 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) + 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.") /* Entry to insert should not be in clean list either */ - if(NULL != H5SL_search(aux_ptr->c_slist_ptr, (const void *)(&entry_ptr->addr))) + 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.") } /* end if */ @@ -997,7 +979,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__log_inserted_entry() */ - /*------------------------------------------------------------------------- * * Function: H5AC__log_moved_entry() @@ -1047,12 +1028,12 @@ done: herr_t H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - hbool_t entry_in_cache; - hbool_t entry_dirty; - size_t entry_size; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + hbool_t entry_in_cache; + hbool_t entry_dirty; + size_t entry_size; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1066,14 +1047,14 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); /* 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) + 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.") - if(!entry_in_cache) + if (!entry_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; + if (aux_ptr->mpi_rank == 0) { + H5AC_slist_entry_t *slist_entry_ptr; HDassert(aux_ptr->d_slist_ptr != NULL); HDassert(aux_ptr->c_slist_ptr != NULL); @@ -1081,24 +1062,26 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) /* if the entry appears in the cleaned entry slist, under its old * address, remove it. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&old_addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)(&old_addr)))) slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); /* if the entry appears in the dirtied entry slist under its old * address, remove it, but don't free it. Set addr to new_addr. */ - if(NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&old_addr)))) + if (NULL != + (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&old_addr)))) slist_entry_ptr->addr = new_addr; else { - /* otherwise, allocate a new entry that is ready - * for insertion, and increment dirty_bytes. - * - * Note that the fact that the entry wasn't in the dirtied - * list under its old address implies that it must have - * been clean to start with. - */ + /* otherwise, allocate a new entry that is ready + * for insertion, and increment dirty_bytes. + * + * Note that the fact that the entry wasn't in the dirtied + * list under its old address implies that it must have + * been clean to start with. + */ HDassert(!entry_dirty); - if(NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) + if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") slist_entry_ptr->addr = new_addr; @@ -1107,27 +1090,26 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) #if H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->move_dirty_bytes += entry_size; aux_ptr->move_dirty_bytes_updates += 1; -#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ +#endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ } /* end else */ /* insert / reinsert the entry in the dirty slist */ - if(H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) + 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.") } /* end if */ - else if(!entry_dirty) { + else if (!entry_dirty) { aux_ptr->dirty_bytes += entry_size; #if H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->move_dirty_bytes += entry_size; aux_ptr->move_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ - } /* end else-if */ + } /* end else-if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__log_moved_entry() */ - /*------------------------------------------------------------------------- * Function: H5AC__propagate_and_apply_candidate_list * @@ -1224,14 +1206,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__propagate_and_apply_candidate_list(H5F_t *f) +H5AC__propagate_and_apply_candidate_list(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - haddr_t * candidates_list_ptr = NULL; - int mpi_result; - unsigned num_candidates = 0; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + haddr_t * candidates_list_ptr = NULL; + int mpi_result; + unsigned num_candidates = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1247,22 +1229,22 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) /* to prevent "messages from the future" we must synchronize all * processes before we write any entries. */ - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) - if(aux_ptr->mpi_rank == 0) { - if(H5AC__broadcast_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0) + 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.") HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); } /* end if */ else { - if(H5AC__receive_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0) + 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.") } /* end else */ - if(num_candidates > 0) { - herr_t result; + if (num_candidates > 0) { + herr_t result; /* all processes apply the candidate list. * H5C_apply_candidate_list() handles the details of @@ -1273,34 +1255,34 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) aux_ptr->write_permitted = TRUE; /* Apply the candidate list */ - result = H5C_apply_candidate_list(f, cache_ptr, num_candidates, - candidates_list_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size); + result = H5C_apply_candidate_list(f, cache_ptr, num_candidates, candidates_list_ptr, + aux_ptr->mpi_rank, aux_ptr->mpi_size); /* Disable writes again */ aux_ptr->write_permitted = FALSE; /* Check for error on the write operation */ - if(result < 0) + if (result < 0) 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 * file system in our parallel tests. */ - if(aux_ptr->write_done) - (aux_ptr->write_done)(); + if (aux_ptr->write_done) + (aux_ptr->write_done)(); /* to prevent "messages from the past" we must synchronize all * processes again before we go on. */ - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) - /* if this is process zero, tidy up the dirtied, + /* if this is process zero, tidy up the dirtied, * and flushed and still clean lists. */ - if(aux_ptr->mpi_rank == 0) - if(H5AC__tidy_cache_0_lists(cache_ptr, num_candidates, candidates_list_ptr) < 0) + 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.") } /* end if */ @@ -1308,17 +1290,16 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) * that this callback is defined purely for testing purposes, * and should be undefined under normal operating circumstances. */ - if(aux_ptr->sync_point_done) + if (aux_ptr->sync_point_done) (aux_ptr->sync_point_done)(num_candidates, candidates_list_ptr); done: - if(candidates_list_ptr) + if (candidates_list_ptr) candidates_list_ptr = (haddr_t *)H5MM_xfree((void *)candidates_list_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__propagate_and_apply_candidate_list() */ - /*------------------------------------------------------------------------- * Function: H5AC__propagate_flushed_and_still_clean_entries_list * @@ -1391,11 +1372,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) +H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1408,20 +1389,18 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); - if(aux_ptr->mpi_rank == 0) { - if(H5AC__broadcast_clean_list(cache_ptr) < 0) + 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.") HDassert(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.") + 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.") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__propagate_flushed_and_still_clean_entries_list() */ - /*------------------------------------------------------------------------- * * Function: H5AC__receive_haddr_list() @@ -1443,13 +1422,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, - haddr_t **haddr_buf_ptr_ptr) +H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { - haddr_t * haddr_buf_ptr = NULL; - int mpi_result; - unsigned num_entries; - herr_t ret_value = SUCCEED; /* Return value */ + haddr_t *haddr_buf_ptr = NULL; + int mpi_result; + unsigned num_entries; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1463,37 +1441,37 @@ H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, * can set up a buffer to receive them. If there aren't * any, we are done. */ - if(MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Bcast(&num_entries, 1, MPI_UNSIGNED, 0, mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) - if(num_entries > 0) { + if (num_entries > 0) { size_t buf_size; /* allocate buffers to store the list of entry base addresses in */ buf_size = sizeof(haddr_t) * num_entries; - if(NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) + if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") /* Now receive the list of candidate entries */ - if(MPI_SUCCESS != (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, mpi_comm))) + if (MPI_SUCCESS != + (mpi_result = MPI_Bcast((void *)haddr_buf_ptr, (int)buf_size, MPI_BYTE, 0, mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ /* finally, pass the number of entries and the buffer pointer * back to the caller. */ - *num_entries_ptr = num_entries; + *num_entries_ptr = num_entries; *haddr_buf_ptr_ptr = haddr_buf_ptr; done: - if(ret_value < 0) - if(haddr_buf_ptr) + if (ret_value < 0) + if (haddr_buf_ptr) haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__receive_haddr_list() */ - /*------------------------------------------------------------------------- * * Function: H5AC__receive_and_apply_clean_list() @@ -1515,11 +1493,11 @@ done: static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - haddr_t * haddr_buf_ptr = NULL; - unsigned num_entries = 0; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + haddr_t * haddr_buf_ptr = NULL; + unsigned num_entries = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1533,29 +1511,28 @@ H5AC__receive_and_apply_clean_list(H5F_t *f) HDassert(aux_ptr->mpi_rank != 0); /* Retrieve the clean list from process 0 */ - if(H5AC__receive_haddr_list(aux_ptr->mpi_comm, &num_entries, &haddr_buf_ptr) < 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") - if(num_entries > 0) + if (num_entries > 0) /* mark the indicated entries as clean */ - if(H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0) + 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.") /* if it is defined, call the sync point done callback. Note * that this callback is defined purely for testing purposes, * and should be undefined under normal operating circumstances. */ - if(aux_ptr->sync_point_done) + if (aux_ptr->sync_point_done) (aux_ptr->sync_point_done)(num_entries, haddr_buf_ptr); done: - if(haddr_buf_ptr) + if (haddr_buf_ptr) haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__receive_and_apply_clean_list() */ - /*------------------------------------------------------------------------- * * Function: H5AC__receive_candidate_list() @@ -1577,11 +1554,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, - haddr_t **haddr_buf_ptr_ptr) +H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr) { - H5AC_aux_t * aux_ptr; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_aux_t *aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1591,21 +1567,20 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); - HDassert(aux_ptr-> metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); HDassert(num_entries_ptr != NULL); HDassert(*num_entries_ptr == 0); HDassert(haddr_buf_ptr_ptr != NULL); HDassert(*haddr_buf_ptr_ptr == NULL); /* Retrieve the candidate list from process 0 */ - if(H5AC__receive_haddr_list(aux_ptr->mpi_comm, num_entries_ptr, haddr_buf_ptr_ptr) < 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") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__receive_candidate_list() */ - /*------------------------------------------------------------------------- * Function: H5AC__rsp__dist_md_write__flush * @@ -1658,12 +1633,12 @@ done: static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - haddr_t * haddr_buf_ptr = NULL; - int mpi_result; - unsigned num_entries = 0; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + haddr_t * haddr_buf_ptr = NULL; + int mpi_result; + unsigned num_entries = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1679,16 +1654,16 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) /* first construct the candidate list -- initially, this will be in the * form of a skip list. We will convert it later. */ - if(H5C_construct_candidate_list__clean_cache(cache_ptr) < 0) + if (H5C_construct_candidate_list__clean_cache(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.") - if(H5SL_count(aux_ptr->candidate_slist_ptr) > 0) { - herr_t result; + if (H5SL_count(aux_ptr->candidate_slist_ptr) > 0) { + herr_t result; /* convert the candidate list into the format we * are used to receiving from process 0. */ - if(H5AC__copy_candidate_list_to_buffer(cache_ptr, &num_entries, &haddr_buf_ptr) < 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.") /* Initial sync point barrier @@ -1696,40 +1671,40 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) * When flushing from within the close operation from a file, * it's possible to skip this barrier (on the second flush of the cache). */ - if(!H5CX_get_mpi_file_flushing()) - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if (!H5CX_get_mpi_file_flushing()) + if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) /* Enable writes during this operation */ aux_ptr->write_permitted = TRUE; /* Apply the candidate list */ - result = H5C_apply_candidate_list(f, cache_ptr, num_entries, - haddr_buf_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size); + result = H5C_apply_candidate_list(f, cache_ptr, num_entries, haddr_buf_ptr, aux_ptr->mpi_rank, + aux_ptr->mpi_size); /* Disable writes again */ aux_ptr->write_permitted = FALSE; /* Check for error on the write operation */ - if(result < 0) + if (result < 0) 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 * file system in our parallel tests. */ - if(aux_ptr->write_done) + if (aux_ptr->write_done) (aux_ptr->write_done)(); /* final sync point barrier */ - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) - /* if this is process zero, tidy up the dirtied, + /* if this is process zero, tidy up the dirtied, * and flushed and still clean lists. */ - if(aux_ptr->mpi_rank == 0) - if(H5AC__tidy_cache_0_lists(cache_ptr, num_entries, haddr_buf_ptr) < 0) + 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.") } /* end if */ @@ -1737,17 +1712,16 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) * that this callback is defined purely for testing purposes, * and should be undefined under normal operating circumstances. */ - if(aux_ptr->sync_point_done) + if (aux_ptr->sync_point_done) (aux_ptr->sync_point_done)(num_entries, haddr_buf_ptr); done: - if(haddr_buf_ptr) + if (haddr_buf_ptr) haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__rsp__dist_md_write__flush() */ - /*------------------------------------------------------------------------- * Function: H5AC__rsp__dist_md_write__flush_to_min_clean * @@ -1805,10 +1779,10 @@ done: static herr_t H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - hbool_t evictions_enabled; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + hbool_t evictions_enabled; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1822,17 +1796,18 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); /* Query if evictions are allowed */ - if(H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) + 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.") - if(evictions_enabled) { + if (evictions_enabled) { /* construct candidate list -- process 0 only */ - if(aux_ptr->mpi_rank == 0) - if(H5AC__construct_candidate_list(cache_ptr, aux_ptr, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if (aux_ptr->mpi_rank == 0) + if (H5AC__construct_candidate_list(cache_ptr, aux_ptr, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < + 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.") /* propagate and apply candidate list -- all processes */ - if(H5AC__propagate_and_apply_candidate_list(f) < 0) + if (H5AC__propagate_and_apply_candidate_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list.") } /* evictions enabled */ @@ -1840,7 +1815,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__rsp__dist_md_write__flush_to_min_clean() */ - /*------------------------------------------------------------------------- * Function: H5AC__rsp__p0_only__flush * @@ -1880,10 +1854,10 @@ done: static herr_t H5AC__rsp__p0_only__flush(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - int mpi_result; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + int mpi_result; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1903,13 +1877,13 @@ H5AC__rsp__p0_only__flush(H5F_t *f) * However, when flushing from within the close operation from a file, * it's possible to skip this barrier (on the second flush of the cache). */ - if(!H5CX_get_mpi_file_flushing()) - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if (!H5CX_get_mpi_file_flushing()) + if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) /* Flush data to disk, from rank 0 process */ - if(aux_ptr->mpi_rank == 0) { - herr_t result; + if (aux_ptr->mpi_rank == 0) { + herr_t result; /* Enable writes during this operation */ aux_ptr->write_permitted = TRUE; @@ -1921,26 +1895,25 @@ H5AC__rsp__p0_only__flush(H5F_t *f) aux_ptr->write_permitted = FALSE; /* Check for error on the write operation */ - if(result < 0) + if (result < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") /* this code exists primarily for the test bed -- it allows us to * enforce POSIX semantics on the server that pretends to be a * file system in our parallel tests. */ - if(aux_ptr->write_done) + if (aux_ptr->write_done) (aux_ptr->write_done)(); } /* end if */ /* Propagate cleaned entries to other ranks. */ - if(H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) + if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__rsp__p0_only__flush() */ - /*------------------------------------------------------------------------- * Function: H5AC__rsp__p0_only__flush_to_min_clean * @@ -1986,10 +1959,10 @@ done: static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - hbool_t evictions_enabled; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + hbool_t evictions_enabled; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2003,7 +1976,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); /* Query if evictions are allowed */ - if(H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) + 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.") /* Flush if evictions are allowed -- following call @@ -2013,18 +1986,18 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) * * Otherwise, do nothing. */ - if(evictions_enabled) { - int mpi_result; + if (evictions_enabled) { + int mpi_result; /* to prevent "messages from the future" we must synchronize all * processes before we start the flush. This synchronization may * already be done -- hence the do_barrier parameter. */ - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) - if(0 == aux_ptr->mpi_rank) { - herr_t result; + if (0 == aux_ptr->mpi_rank) { + herr_t result; /* here, process 0 flushes as many entries as necessary to * comply with the currently specified min clean size. @@ -2042,18 +2015,18 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) aux_ptr->write_permitted = FALSE; /* Check for error on the write operation */ - if(result < 0) + if (result < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_to_min_clean() failed.") /* this call exists primarily for the test code -- it is used - * to enforce POSIX semantics on the process used to simulate - * reads and writes in t_cache.c. + * to enforce POSIX semantics on the process used to simulate + * reads and writes in t_cache.c. */ - if(aux_ptr->write_done) + if (aux_ptr->write_done) (aux_ptr->write_done)(); } /* end if */ - if(H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) + if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") } /* end if */ @@ -2061,7 +2034,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__rsp__p0_only__flush_to_min_clean() */ - /*------------------------------------------------------------------------- * Function: H5AC__run_sync_point * @@ -2096,9 +2068,9 @@ done: herr_t H5AC__run_sync_point(H5F_t *f, int sync_point_op) { - H5AC_t * cache_ptr; - H5AC_aux_t * aux_ptr; - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_t * cache_ptr; + H5AC_aux_t *aux_ptr; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2110,18 +2082,14 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || - (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); + (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); #if H5AC_DEBUG_DIRTY_BYTES_CREATION -HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", - aux_ptr->mpi_rank, - aux_ptr->dirty_bytes_propagations, - aux_ptr->unprotect_dirty_bytes, - aux_ptr->unprotect_dirty_bytes_updates, - aux_ptr->insert_dirty_bytes, - aux_ptr->insert_dirty_bytes_updates, - aux_ptr->rename_dirty_bytes, - aux_ptr->rename_dirty_bytes_updates); + HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu/%u\n", aux_ptr->mpi_rank, + aux_ptr->dirty_bytes_propagations, aux_ptr->unprotect_dirty_bytes, + aux_ptr->unprotect_dirty_bytes_updates, aux_ptr->insert_dirty_bytes, + aux_ptr->insert_dirty_bytes_updates, aux_ptr->rename_dirty_bytes, + aux_ptr->rename_dirty_bytes_updates); #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ /* clear collective access flag on half of the entries in the @@ -2129,56 +2097,58 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu evicted later. All ranks are guaranteed to mark the same entries since we don't modify the order of the collectively accessed entries except through collective access. */ - if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") - switch(aux_ptr->metadata_write_strategy) { + switch (aux_ptr->metadata_write_strategy) { case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: - switch(sync_point_op) { + switch (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.") - break; + 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.") + break; - case H5AC_SYNC_POINT_OP__FLUSH_CACHE: - if(H5AC__rsp__p0_only__flush(f) < 0) + 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.") - break; + break; - default: + default: HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown flush op"); - break; - } /* end switch */ - break; + break; + } /* end switch */ + break; - case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: - switch(sync_point_op) { + case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: + switch (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.") - break; + 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.") + break; - case H5AC_SYNC_POINT_OP__FLUSH_CACHE: - if(H5AC__rsp__dist_md_write__flush(f) < 0) + 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.") - break; + break; - default: + default: HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown flush op"); - break; - } /* end switch */ - break; + break; + } /* end switch */ + break; - default: + default: HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown metadata write strategy.") - break; + break; } /* end switch */ /* reset the dirty bytes count */ aux_ptr->dirty_bytes = 0; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - aux_ptr->dirty_bytes_propagations += 1; + aux_ptr->dirty_bytes_propagations += 1; aux_ptr->unprotect_dirty_bytes = 0; aux_ptr->unprotect_dirty_bytes_updates = 0; aux_ptr->insert_dirty_bytes = 0; @@ -2191,7 +2161,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__run_sync_point() */ - /*------------------------------------------------------------------------- * Function: H5AC__tidy_cache_0_lists() * @@ -2228,11 +2197,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, - haddr_t *candidates_list_ptr) +H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr) { - H5AC_aux_t * aux_ptr; - unsigned u; + H5AC_aux_t *aux_ptr; + unsigned u; FUNC_ENTER_STATIC_NOERR @@ -2253,26 +2221,27 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, * cleaned list. However, for this metadata write strategy, * we just want to remove all references to the candidate entries. */ - for(u = 0; u < num_candidates; u++) { - H5AC_slist_entry_t * d_slist_entry_ptr; - H5AC_slist_entry_t * c_slist_entry_ptr; - haddr_t addr; + for (u = 0; u < num_candidates; u++) { + H5AC_slist_entry_t *d_slist_entry_ptr; + H5AC_slist_entry_t *c_slist_entry_ptr; + haddr_t addr; addr = candidates_list_ptr[u]; /* addr may be either on the dirtied list, or on the flushed * and still clean list. Remove it. */ - if(NULL != (d_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)&addr))) + if (NULL != + (d_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)&addr))) d_slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, d_slist_entry_ptr); - if(NULL != (c_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)&addr))) + if (NULL != + (c_slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->c_slist_ptr, (void *)&addr))) c_slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, c_slist_entry_ptr); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__tidy_cache_0_lists() */ - /*------------------------------------------------------------------------- * Function: H5AC__flush_entries * @@ -2291,7 +2260,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, herr_t H5AC__flush_entries(H5F_t *f) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2300,12 +2269,11 @@ H5AC__flush_entries(H5F_t *f) HDassert(f->shared->cache); /* 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) + 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.") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__flush_entries() */ #endif /* H5_HAVE_PARALLEL */ - |