summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-03-22 16:58:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-03-22 16:58:40 (GMT)
commit9c606c3d901f4190e456730266f25b0a65c88ab9 (patch)
tree41b9bfa18b2c784c0bcdcc02e75b986e95a50641
parentf09abb150e965200ac1b06a5bc4b374d8969776c (diff)
downloadhdf5-9c606c3d901f4190e456730266f25b0a65c88ab9.zip
hdf5-9c606c3d901f4190e456730266f25b0a65c88ab9.tar.gz
hdf5-9c606c3d901f4190e456730266f25b0a65c88ab9.tar.bz2
Revert "Switch h5clear for cache images to use existing H5Pget_cache_image_config()"
This reverts commit dd5105fc9912c77f6d6074700d83e5e8282e86c9.
-rw-r--r--src/H5AC.c25
-rw-r--r--src/H5Cprivate.h1
-rw-r--r--src/H5Cquery.c29
-rw-r--r--src/H5F.c41
-rw-r--r--src/H5Fpublic.h1
-rw-r--r--tools/src/misc/h5clear.c18
6 files changed, 100 insertions, 15 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index be41b6a..38d2aa7 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -3310,3 +3310,28 @@ 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_SYSTEM, FAIL, "H5C_get_mdc_image_info() failed")
+
+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..1ae70e2 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -454,3 +454,32 @@ 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_SYSTEM, FAIL, "Bad cache_ptr on entry.")
+ if(image_addr == NULL || image_len == NULL)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, 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() */
diff --git a/src/H5F.c b/src/H5F.c
index a0f7599..01fb58e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2073,8 +2073,10 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2
/* 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 == file->shared->page_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file")
+
if(NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
@@ -2085,4 +2087,43 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2
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_SYSTEM, FAIL, "H5AC_get_mdc_image_info() failed.")
+
+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..9ec562e 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);