diff options
author | Quincey Koziol <koziol@lbl.gov> | 2017-03-22 22:07:34 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2017-03-22 22:07:34 (GMT) |
commit | dfc0b2f4f68e8fb47d2526262d6e51523537369e (patch) | |
tree | ec3ba075637c098d0354b173c711cc4a3163cbb5 | |
parent | 30d5cf6c96d937b0ef5c97b43951ac778847d74c (diff) | |
parent | 46c9ab600de491657520897322b75659c3bdfb5f (diff) | |
download | hdf5-dfc0b2f4f68e8fb47d2526262d6e51523537369e.zip hdf5-dfc0b2f4f68e8fb47d2526262d6e51523537369e.tar.gz hdf5-dfc0b2f4f68e8fb47d2526262d6e51523537369e.tar.bz2 |
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()"
-rw-r--r-- | src/H5AC.c | 26 | ||||
-rw-r--r-- | src/H5Cprivate.h | 1 | ||||
-rw-r--r-- | src/H5Cquery.c | 30 | ||||
-rw-r--r-- | src/H5F.c | 40 | ||||
-rw-r--r-- | src/H5Fpublic.h | 1 | ||||
-rw-r--r-- | tools/src/misc/h5clear.c | 19 |
6 files changed, 102 insertions, 15 deletions
@@ -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() */ + diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 539dece..bdfb23e 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -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, diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 33a322d..5108013 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -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() */ + @@ -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() */ + diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index f87aaad..84c0d38 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -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); diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index b6c6ea3..5c33b72 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -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"); - 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"); + if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) { + error_msg("H5Fget_mdc_image_info\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() */ + |