mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
Merge pull request #361 in HDFFV/hdf5 from merge_h5clear_revert to develop
* commit '46c9ab600de491657520897322b75659c3bdfb5f': Minor style cleanups Revert "Switch h5clear for cache images to use existing H5Pget_cache_image_config()"
This commit is contained in:
parent
a533dba4d1
commit
9ab96feda6
26
src/H5AC.c
26
src/H5AC.c
@ -3310,3 +3310,29 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5AC_remove_entry() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5AC_get_mdc_image_info
|
||||
*
|
||||
* Purpose: Wrapper function for H5C_get_mdc_image_info().
|
||||
*
|
||||
* Return: SUCCEED on success, and FAIL on failure.
|
||||
*
|
||||
* Programmer: Vailin Choi; March 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
if(H5C_get_mdc_image_info((H5C_t *)cache_ptr, image_addr, image_len) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5AC_get_mdc_image_info() */
|
||||
|
||||
|
@ -2321,6 +2321,7 @@ H5_DLL herr_t H5C_remove_entry(void *thing);
|
||||
H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr,
|
||||
hbool_t *write_ci_ptr);
|
||||
H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
|
||||
H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id,
|
||||
|
@ -454,3 +454,33 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5C_get_entry_ring() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5C_get_mdc_image_info
|
||||
*
|
||||
* Purpose: To retrieve the address and size of the cache image in the file.
|
||||
*
|
||||
* Return: SUCCEED on success, and FAIL on failure.
|
||||
*
|
||||
* Programmer: Vailin Choi; March 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_len)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry")
|
||||
if(image_addr == NULL || image_len == NULL)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry")
|
||||
|
||||
*image_addr = cache_ptr->image_addr;
|
||||
*image_len = cache_ptr->image_len;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5C_get_mdc_image_info() */
|
||||
|
||||
|
40
src/H5F.c
40
src/H5F.c
@ -2086,3 +2086,43 @@ done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Fget_page_buffering_stats() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Fget_mdc_image_info
|
||||
*
|
||||
* Purpose: Retrieves the image_addr and image_len for the cache image in the file.
|
||||
* image_addr: --base address of the on disk metadata cache image
|
||||
* --HADDR_UNDEF if no cache image
|
||||
* image_len: --size of the on disk metadata cache image
|
||||
* --zero if no cache image
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Vailin Choi; March 2017
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
|
||||
{
|
||||
H5F_t *file; /* File object for file ID */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE3("e", "i*a*h", file_id, image_addr, image_len);
|
||||
|
||||
/* Check args */
|
||||
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
|
||||
if(NULL == image_addr || NULL == image_len)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len")
|
||||
|
||||
/* Go get the address and size of the cache image */
|
||||
if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* H5Fget_mdc_image_info() */
|
||||
|
||||
|
@ -267,6 +267,7 @@ H5_DLL herr_t H5Fformat_convert(hid_t fid);
|
||||
H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
|
||||
H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
|
||||
unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
|
||||
H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
|
||||
|
@ -246,28 +246,16 @@ main (int argc, const char *argv[])
|
||||
|
||||
/* -m option */
|
||||
if(remove_cache_image) {
|
||||
H5AC_cache_image_config_t config;
|
||||
|
||||
/* Retrieve cache image config */
|
||||
if((fapl = H5Fget_access_plist(fid)) < 0) {
|
||||
error_msg("H5Fget_access_plist\n");
|
||||
if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) {
|
||||
error_msg("H5Fget_mdc_image_info\n");
|
||||
h5tools_setstatus(EXIT_FAILURE);
|
||||
goto done;
|
||||
}
|
||||
config.version = H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION;
|
||||
if(H5Pget_mdc_image_config(fapl, &config) < 0) {
|
||||
error_msg("H5Pget_mdc_image_config\n");
|
||||
h5tools_setstatus(EXIT_FAILURE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Check for image */
|
||||
if(!config.generate_image)
|
||||
if(image_addr == HADDR_UNDEF && image_len == 0)
|
||||
warn_msg("No cache image in the file\n");
|
||||
}
|
||||
|
||||
h5tools_setstatus(EXIT_SUCCESS);
|
||||
|
||||
done:
|
||||
if(fname)
|
||||
HDfree(fname);
|
||||
@ -281,3 +269,4 @@ done:
|
||||
|
||||
leave(h5tools_getstatus());
|
||||
} /* main() */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user