summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-04-05 03:21:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-04-05 03:21:41 (GMT)
commit1c425ac9d2dead1c028370a068ac7add6634ed85 (patch)
tree6c10d9fb596929e980714f6aa571fb40a95a56ad /src/H5F.c
parente023ad625fbfa97ed0cfcd05861f626e55b4b262 (diff)
downloadhdf5-1c425ac9d2dead1c028370a068ac7add6634ed85.zip
hdf5-1c425ac9d2dead1c028370a068ac7add6634ed85.tar.gz
hdf5-1c425ac9d2dead1c028370a068ac7add6634ed85.tar.bz2
[svn-r14796] Description:
Switch v1 B-tree nodes from using previous cache to use the new journaling cache code. This is a major switch for the cache callbacks. Switched the metadata caching code from having a pointer to the file it's in to receiving a pointer to the file, when needed. This was necessary in order to avoid crashing when two files IDs were open on the same underlying file and one of those files was closed with cache entries using the file pointers. Also took out the check in the caching code for reading off the end of the file, which didn't play nicely with the multi-file VFD. Switching the cache from having a pointer internally to requiring one externally meant tweaking almost all the test code. :-/ Added correct exit codes to cache2 tests that didn't have them already, so the 'make check' will stop when they fail. Use the path to the h5diff in this build in the tools/h5recover testing script, since we can't guarantee a user has HDF5 already installed. Assorted minor tweaks to get everything to compile more cleanly and pass all the tests (on my Mac :-). Tested on: Mac OS X (10.5.2) w/C++ (more testing coming up shortly, I just didn't have my "rsync testbed" set up for this branch when I started making changes to the code)
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c81
1 files changed, 48 insertions, 33 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 3b0770f..0f70009 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -23,9 +23,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Aprivate.h" /* Attributes */
#include "H5ACprivate.h" /* Metadata cache */
-#if 1 /* JRM */
#include "H5AC2private.h" /* Metadata cache2 */
-#endif /* JRM */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
@@ -933,15 +931,14 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
*/
if(SUCCEED != H5AC_create(f, &(f->shared->mdc_initCacheCfg)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache")
-#if 1 /* JRM */
- /* create a metadata cache with modified API along side the regular
+
+ /* Create a metadata cache with modified API along side the regular
* version. For now, this is just for testing. Once we get it
* fully in use, we will delete the old version.
*/
- if(SUCCEED != H5AC2_create(f,
- (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg)))
+ if(H5AC2_create(f, (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache2")
-#endif /* JRM */
+
/* Create the file's "open object" information */
if(H5FO_create(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure")
@@ -1040,12 +1037,10 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
if(H5AC_dest(f, dxpl_id))
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
-#if 1 /* JRM */
/* also destroy the modified cache */
if(H5AC2_dest(f, dxpl_id))
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
-#endif /* JRM */
if(H5FO_dest(f) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
@@ -1719,12 +1714,9 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags)
if((flags & H5F_FLUSH_INVALIDATE) != 0 )
H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG;
if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush meta data cache")
-#if 1 /* JRM */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
if(H5AC2_flush(f, dxpl_id, H5AC_flags) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "unable to flush meta data cache2")
-#endif /* JRM */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache2")
/*
* If we are invalidating everything (which only happens just before
@@ -3075,7 +3067,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_addr_encode
+ * Function: H5F_addr_encode_len
*
* Purpose: Encodes an address into the buffer pointed to by *PP and
* then increments the pointer to the first byte after the
@@ -3086,31 +3078,54 @@ done:
* Programmer: Robb Matzke
* Friday, November 7, 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
void
-H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
+H5F_addr_encode_len(uint8_t **pp/*in,out*/, haddr_t addr, unsigned addr_len)
{
- unsigned i;
+ unsigned u; /* Local index variable */
- assert(f);
- assert(pp && *pp);
+ HDassert(pp && *pp);
- if (H5F_addr_defined(addr)) {
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++) {
+ if(H5F_addr_defined(addr)) {
+ for(u = 0; u < addr_len; u++) {
*(*pp)++ = (uint8_t)(addr & 0xff);
addr >>= 8;
- }
+ } /* end for */
assert("overflow" && 0 == addr);
-
- } else {
- for (i=0; i<H5F_SIZEOF_ADDR(f); i++)
+ } /* end if */
+ else {
+ for(u = 0; u < addr_len; u++)
*(*pp)++ = 0xff;
- }
-}
+ } /* end else */
+} /* end H5F_addr_encode_len() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_addr_encode
+ *
+ * Purpose: Encodes an address into the buffer pointed to by *PP and
+ * then increments the pointer to the first byte after the
+ * address. An undefined value is stored as all 1's.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Friday, November 7, 1997
+ *
+ * Modifications:
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
+ *-------------------------------------------------------------------------
+ */
+void
+H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr)
+{
+ HDassert(f);
+ HDassert(pp && *pp);
+
+ H5F_addr_encode_len(pp, addr, H5F_SIZEOF_ADDR(f));
+} /* end H5F_addr_encode() */
/*-------------------------------------------------------------------------
@@ -3351,9 +3366,9 @@ H5Fset_mdc_config(hid_t file_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"H5AC_set_cache_auto_resize_config() failed.");
}
-#if 1 /* JRM */
+
/* pass the resize configuration to the modified cache as well. */
- result = H5AC2_set_cache_auto_resize_config(file->shared->cache2,
+ result = H5AC2_set_cache_auto_resize_config(file,
(H5AC2_cache_config_t *)config_ptr);
if ( result != SUCCEED ) {
@@ -3361,7 +3376,7 @@ H5Fset_mdc_config(hid_t file_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
"H5AC2_set_cache_auto_resize_config() failed.");
}
-#endif /* JRM */
+
done:
FUNC_LEAVE_API(ret_value)