summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-20 11:38:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-20 11:38:15 (GMT)
commit6a183ca20ce41b70feae9a52a4e04913d276be34 (patch)
treef38ffd7e1b810802f1786290bfb659bbdcd07ca5
parentb3ebfdd526cbce840a696df2ab544653bab5ca55 (diff)
downloadhdf5-6a183ca20ce41b70feae9a52a4e04913d276be34.zip
hdf5-6a183ca20ce41b70feae9a52a4e04913d276be34.tar.gz
hdf5-6a183ca20ce41b70feae9a52a4e04913d276be34.tar.bz2
[svn-r18862] Description:
Add 'get_load_size' client callback to determine the image size for reading a metadata cache entry from the file. Remove the 'size' parameter from the H5[A]C_protect() calls. General cleanups to align with code on trunk. Tested on: Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
-rw-r--r--src/H5AC.c646
-rw-r--r--src/H5ACprivate.h45
-rw-r--r--src/H5B.c46
-rw-r--r--src/H5B2.c28
-rw-r--r--src/H5B2cache.c165
-rw-r--r--src/H5B2dbg.c8
-rw-r--r--src/H5B2int.c53
-rw-r--r--src/H5B2stat.c2
-rw-r--r--src/H5B2test.c8
-rw-r--r--src/H5Bcache.c44
-rw-r--r--src/H5C.c960
-rw-r--r--src/H5Cjournal.c16
-rw-r--r--src/H5Cprivate.h63
-rw-r--r--src/H5FS.c4
-rw-r--r--src/H5FScache.c78
-rw-r--r--src/H5FSdbg.c4
-rw-r--r--src/H5FSsection.c2
-rw-r--r--src/H5Gnode.c91
-rw-r--r--src/H5HFcache.c126
-rw-r--r--src/H5HFdblock.c18
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5HFiblock.c8
-rw-r--r--src/H5HFiter.c4
-rw-r--r--src/H5HFpkg.h7
-rw-r--r--src/H5HG.c2
-rwxr-xr-xsrc/H5HGcache.c42
-rw-r--r--src/H5HGpkg.h1
-rw-r--r--src/H5HL.c18
-rw-r--r--src/H5HLcache.c72
-rw-r--r--src/H5O.c13
-rw-r--r--src/H5Oalloc.c14
-rw-r--r--src/H5Oattribute.c8
-rw-r--r--src/H5Ocache.c84
-rw-r--r--src/H5Ochunk.c9
-rw-r--r--src/H5Omessage.c2
-rw-r--r--src/H5Opkg.h3
-rwxr-xr-xsrc/H5SM.c108
-rw-r--r--src/H5SMcache.c99
-rwxr-xr-xsrc/H5SMpkg.h10
-rw-r--r--src/H5SMtest.c9
-rw-r--r--test/cache.c12
-rw-r--r--test/cache_common.c260
-rw-r--r--test/cache_common.h280
-rw-r--r--testpar/Makefile.am3
-rw-r--r--testpar/t_cache.c65
45 files changed, 1443 insertions, 2099 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 6f3c3f5..4e79dfa 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -24,22 +24,6 @@
* with a particular HDF file share the same cache; each
* HDF file has it's own cache.
*
- * Modifications:
- *
- * Robb Matzke, 4 Aug 1997
- * Added calls to H5E.
- *
- * Quincey Koziol, 22 Apr 2000
- * Turned on "H5AC_SORT_BY_ADDR"
- *
- * John Mainzer, 5/19/04
- * Complete redesign and rewrite. See the header comments for
- * H5AC_t for an overview of what is going on.
- *
- * John Mainzer, 6/4/04
- * Factored the new cache code into a separate file (H5C.c) to
- * facilitate re-use. Re-worked this file again to use H5C.
- *
*-------------------------------------------------------------------------
*/
@@ -210,8 +194,6 @@ static herr_t H5AC_set_cache_config(H5AC_t * cache_ptr,
* Programmer: Quincey Koziol
* Saturday, January 18, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -237,8 +219,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 18, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -358,8 +338,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 18, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -421,70 +399,6 @@ H5AC_term_interface(void)
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- *
- * Complete re-design and re-write to support the re-designed
- * metadata cache.
- *
- * At present, the size_hint is ignored, and the
- * max_cache_size and min_clean_size fields are hard
- * coded. This should be fixed, but a parameter
- * list change will be required, so I will leave it
- * for now.
- *
- * Since no-one seems to care, the function now returns
- * one on success.
- * JRM - 4/28/04
- *
- * Reworked the function again after abstracting its guts to
- * the similar function in H5C.c. The function is now a
- * wrapper for H5C_create().
- * JRM - 6/4/04
- *
- * Deleted the old size_hint parameter and added the
- * max_cache_size, and min_clean_size parameters.
- *
- * JRM - 3/10/05
- *
- * Deleted the max_cache_size, and min_clean_size parameters,
- * and added the config_ptr parameter. Added code to
- * validate the resize configuration before we do anything.
- *
- * JRM - 3/24/05
- *
- * Changed the type of config_ptr from H5AC_auto_size_ctl_t *
- * to H5AC_cache_config_t *. Propagated associated changes
- * through the function.
- * JRM - 4/7/05
- *
- * Added code allocating and initializing the auxilary
- * structure (an instance of H5AC_aux_t), and linking it
- * to the instance of H5C_t created by H5C_create(). At
- * present, the auxilary structure is only used in PHDF5.
- *
- * JRM - 6/28/05
- *
- * Added code to set the prefix if required.
- *
- * JRM - 1/20/06
- *
- * Added code to initialize the new write_done field.
- *
- * JRM - 5/11/06
- *
- * Reworked code to conform with changes in the cache
- * API.
- * JRM - 10/18/07
- *
- * Added the dxpl_id parameter, and updated for parameter
- * list changes in H5C_create().
- * JRM - 3/26/08
- *
- * Updated code for the removal of the f, dxpl_id, and
- * journal_recovered parameters for H5C_create().
- *
- * JRM 7/10/08
- *
*-------------------------------------------------------------------------
*/
@@ -748,29 +662,6 @@ done:
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- *
- * Complete re-design and re-write to support the re-designed
- * metadata cache.
- * JRM - 5/12/04
- *
- * Abstracted the guts of the function to H5C_dest() in H5C.c,
- * and then re-wrote the function as a wrapper for H5C_dest().
- *
- * JRM - 6/7/04
- *
- * Added code to free the auxiliary structure and its
- * associated slist if present.
- * JRM - 6/28/05
- *
- * Added code to close the trace file if it is present.
- *
- * JRM - 6/8/06
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -849,13 +740,8 @@ done:
* Programmer: John Mainzer
* 4/12/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_begin_transaction(hid_t id,
hbool_t * do_transaction_ptr,
@@ -997,13 +883,8 @@ done:
* Programmer: John Mainzer
* 7/4/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_check_for_journaling(H5F_t * f,
hid_t dxpl_id,
@@ -1076,13 +957,8 @@ done:
* Programmer: John Mainzer
* 8/15/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_deregister_mdjsc_callback(H5F_t * file_ptr,
int32_t idx)
@@ -1153,13 +1029,8 @@ done:
* Programmer: John Mainzer
* 4/12/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_end_transaction(hbool_t do_transaction,
H5O_loc_t * id_oloc_ptr,
@@ -1263,13 +1134,8 @@ done:
* Programmer: John Mainzer
* 8/15/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_register_mdjsc_callback(const H5F_t * file_ptr,
H5C_mdj_status_change_func_t fcn_ptr,
@@ -1359,12 +1225,6 @@ done:
* Programmer: John Mainzer
* 6/30/06
*
- * Modifications:
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1408,9 +1268,9 @@ H5AC_expunge_entry(H5F_t *f,
#endif /* H5AC__TRACE_FILE_ENABLED */
result = H5C_expunge_entry(f,
- dxpl_id,
- type,
- addr);
+ dxpl_id,
+ type,
+ addr);
if ( result < 0 ) {
@@ -1482,33 +1342,6 @@ done:
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-27
- * The ADDR argument is passed by value.
- *
- * Complete re-write. See above for details. -- JRM 5/11/04
- *
- * Abstracted the guts of the function to H5C_flush_cache()
- * in H5C.c, and then re-wrote the function as a wrapper for
- * H5C_flush_cache().
- *
- * JRM - 6/7/04
- *
- * JRM - 7/5/05
- * Modified function as part of a fix for a cache coherency
- * bug in PHDF5. See the header comments on the H5AC_aux_t
- * structure for details.
- *
- * JRM -- 5/11/06
- * Added call to the write_done callback.
- *
- * JRM -- 6/6/06
- * Added trace file support.
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1590,8 +1423,8 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags)
aux_ptr->write_permitted = TRUE;
status = H5C_flush_cache(f,
- dxpl_id,
- init_flush_flags);
+ dxpl_id,
+ init_flush_flags);
aux_ptr->write_permitted = FALSE;
@@ -1615,8 +1448,8 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags)
#endif /* H5_HAVE_PARALLEL */
status = H5C_flush_cache(f,
- dxpl_id,
- flags);
+ dxpl_id,
+ flags);
if ( status < 0 ) {
@@ -1656,12 +1489,6 @@ done:
* Programmer: John Mainzer
* 4/27/06
*
- * Modifications:
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1734,60 +1561,11 @@ done:
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-27
- * The ADDR argument is passed by value.
- *
- * Bill Wendling, 2003-09-16
- * Added automatic "flush" if the FPHDF5 driver is being
- * used. This'll write the metadata to the SAP where other,
- * lesser processes can grab it.
- *
- * JRM - 5/13/04
- * Complete re-write for the new metadata cache. The new
- * code is functionally almost identical to the old, although
- * the sanity check for a protected entry is now an assert
- * at the beginning of the function.
- *
- * JRM - 6/7/04
- * Abstracted the guts of the function to H5C_insert_entry()
- * in H5C.c, and then re-wrote the function as a wrapper for
- * H5C_insert_entry().
- *
- * JRM - 1/6/05
- * Added the flags parameter. At present, this parameter is
- * only used to set the new flush_marker field on the new
- * entry. Since this doesn't apply to the SAP code, no change
- * is needed there. Thus the only change to the body of the
- * code is to pass the flags parameter through to
- * H5C_insert_entry().
- *
- * JRM - 6/6/05
- * Added code to force newly inserted entries to be dirty
- * in the flexible parallel case. The normal case is handled
- * in H5C.c. This is part of a series of changes directed at
- * moving management of the dirty flag on cache entries into
- * the cache code.
- *
- * JRM - 7/5/05
- * Added code to track dirty byte generation, and to trigger
- * clean entry list propagation when it exceeds a user
- * specified threshold. Note that this code only applies in
- * the PHDF5 case. It should have no effect on either the
- * serial or FPHSD5 cases.
- *
- * JRM - 6/6/06
- * Added trace file support.
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, size_t len, void *thing, unsigned int flags)
+H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
+ size_t len, void *thing, unsigned int flags)
{
herr_t result;
H5AC_info_t *info;
@@ -1844,11 +1622,11 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, size_t
if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) {
result = H5AC_log_inserted_entry(f,
- f->shared->cache,
- (H5AC_info_t *)thing,
- type,
- addr,
- len);
+ f->shared->cache,
+ (H5AC_info_t *)thing,
+ type,
+ addr,
+ len);
if ( result < 0 ) {
@@ -1859,12 +1637,12 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, size_t
#endif /* H5_HAVE_PARALLEL */
result = H5C_insert_entry(f,
- dxpl_id,
- type,
- addr,
- len,
- thing,
- flags);
+ dxpl_id,
+ type,
+ addr,
+ len,
+ thing,
+ flags);
if ( result < 0 ) {
@@ -2145,72 +1923,23 @@ done:
* or flushed -- nor may it be accessed by another call to
* H5AC_protect. Any attempt to do so will result in a failure.
*
- * This comment is a re-write of the original Purpose: section.
- * For historical interest, the original version is reproduced
- * below:
- *
- * Original Purpose section:
- *
- * Similar to H5AC_find() except the object is removed from
- * the cache and given to the caller, preventing other parts
- * of the program from modifying the protected object or
- * preempting it from the cache.
- *
- * The caller must call H5AC_unprotect() when finished with
- * the pointer.
- *
* Return: Success: Ptr to the object.
- *
* Failure: NULL
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Sep 2 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-27
- * The ADDR argument is passed by value.
- *
- * Bill Wendling, 2003-09-10
- * Added parameter to indicate whether this is a READ or
- * WRITE type of protect.
- *
- * JRM -- 5/17/04
- * Complete re-write for the new client cache. See revised
- * Purpose section above.
- *
- * JRM - 6/7/04
- * Abstracted the guts of the function to H5C_protect()
- * in H5C.c, and then re-wrote the function as a wrapper for
- * H5C_protect().
- *
- * JRM - 6/6/06
- * Added trace file support.
- *
- * JRM - 3/18/07
- * Modified code to support the new flags parameter for
- * H5C_protect(). For now, that means passing in the
- * H5C_READ_ONLY_FLAG if rw == H5AC_READ.
- *
- * Also updated the trace file output to save the
- * rw parameter, since we are now doing something with it.
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
void *
H5AC_protect(H5F_t *f,
- hid_t dxpl_id,
- const H5AC_class_t *type,
- haddr_t addr,
- size_t len,
- void *udata,
- H5AC_protect_t rw)
+ hid_t dxpl_id,
+ const H5AC_class_t *type,
+ haddr_t addr,
+ void *udata,
+ H5AC_protect_t rw)
{
- /* char * fcn_name = "H5AC_protect"; */
unsigned protect_flags = H5C__NO_FLAGS_SET;
void * thing = (void *)NULL;
void * ret_value; /* Return value */
@@ -2261,9 +1990,8 @@ H5AC_protect(H5F_t *f,
rw_string = "???";
}
- sprintf(trace, "H5AC_protect 0x%lx %ld %d %s",
+ sprintf(trace, "H5AC_protect 0x%lx %d %s",
(unsigned long)addr,
- (long)len,
(int)(type->id),
rw_string);
}
@@ -2275,12 +2003,11 @@ H5AC_protect(H5F_t *f,
}
thing = H5C_protect(f,
- dxpl_id,
- type,
- addr,
- len,
- udata,
- protect_flags);
+ dxpl_id,
+ type,
+ addr,
+ udata,
+ protect_flags);
if ( thing == NULL ) {
@@ -2466,61 +2193,6 @@ done:
* matzke@llnl.gov
* Sep 2 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-27
- * The ADDR argument is passed by value.
- *
- * Quincey Koziol, 2003-03-19
- * Added "deleted" argument
- *
- * Bill Wendling, 2003-09-18
- * If this is an FPHDF5 driver and the data is dirty,
- * perform a "flush" that writes the data to the SAP.
- *
- * John Mainzer 5/19/04
- * Complete re-write for the new metadata cache.
- *
- * JRM - 6/7/04
- * Abstracted the guts of the function to H5C_unprotect()
- * in H5C.c, and then re-wrote the function as a wrapper for
- * H5C_unprotect().
- *
- * JRM - 1/6/05
- * Replaced the deleted parameter with the new flags parameter.
- * Since the deleted parameter is not used by the FPHDF5 code,
- * the only change in the body is to replace the deleted
- * parameter with the flags parameter in the call to
- * H5C_unprotect().
- *
- * JRM - 6/6/05
- * Added the dirtied flag and supporting code. This is
- * part of a collection of changes directed at moving
- * management of cache entry dirty flags into the H5C code.
- *
- * JRM - 7/5/05
- * Added code to track dirty byte generation, and to trigger
- * clean entry list propagation when it exceeds a user
- * specified threshold. Note that this code only applies in
- * the PHDF5 case. It should have no effect on either the
- * serial or FPHSD5 cases.
- *
- * JRM - 9/8/05
- * Added code to track entry size changes. This is necessary
- * as it can effect dirty byte creation counts, thereby
- * throwing the caches out of sync in the PHDF5 case.
- *
- * JRM - 5/16/06
- * Added code to use the new dirtied field in
- * H5C_cache_entry_t in the test to see if the entry has
- * been dirtied.
- *
- * JRM - 6/7/06
- * Added support for the trace file.
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2534,7 +2206,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#endif /* H5_HAVE_PARALLEL */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
- unsigned trace_flags = 0;
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
herr_t ret_value=SUCCEED; /* Return value */
@@ -2565,8 +2236,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
sprintf(trace, "H5AC_unprotect 0x%lx %d",
(unsigned long)addr,
(int)(type->id));
-
- trace_flags = flags;
}
#endif /* H5AC__TRACE_FILE_ENABLED */
@@ -2598,11 +2267,11 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#endif /* H5_HAVE_PARALLEL */
result = H5C_unprotect(f,
- dxpl_id,
- type,
- addr,
- thing,
- flags);
+ dxpl_id,
+ type,
+ addr,
+ thing,
+ flags);
if ( result < 0 ) {
@@ -2656,15 +2325,8 @@ done:
* Programmer: John Mainzer
* 5/11/06
*
- * Modifications:
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
herr_t
H5AC_set_write_done_callback(H5C_t * cache_ptr,
@@ -2707,19 +2369,6 @@ done:
* Programmer: Robb Matzke
* Thursday, October 30, 1997
*
- * Modifications:
- * John Mainzer 5/19/04
- * Re-write to support the new metadata cache.
- *
- * JRM - 6/7/04
- * Abstracted the guts of the function to H5C_stats()
- * in H5C.c, and then re-wrote the function as a wrapper for
- * H5C_stats().
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2752,46 +2401,8 @@ done:
* Programmer: John Mainzer
* 3/10/05
*
- * Modifications:
- *
- * JRM - 4/6/05
- * Reworked for the addition of struct H5AC_cache_config_t.
- *
- * JRM - 10/25/05
- * Added support for the new dirty_bytes_threshold field of
- * both H5AC_cache_config_t and H5AC_aux_t.
- *
- * JRM - 6/8/06
- * Added support for the new trace file related fields.
- *
- * JRM - 7/28/07
- * Added support for the new evictions enabled related fields.
- *
- * Observe that H5AC_get_cache_auto_resize_config() and
- * H5AC_set_cache_auto_resize_config() are becoming generic
- * metadata cache configuration routines as they gain
- * switches for functions that are only tenuously related
- * to auto resize configuration.
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
- * JRM - 1/2/08
- * Added support for the new flash cache increment related
- * fields.
- *
- * JRM -- 4/12/08
- * Added support for the new journaling control fields.
- *
- * JRM - 8/1/08
- * Removed support for the new journaling control fields.
- * This functionality is now handled through the
- * H5AC_jnl_config_t structure and the related calls.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr,
H5AC_cache_config_t *config_ptr)
@@ -2916,15 +2527,8 @@ done:
* Programmer: John Mainzer
* 7/31/08
*
- * Modifications:
- *
- * JRM -- 8/14/08
- * Reworked for change in argument list to
- * H5C_get_journal_config().
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_get_jnl_config(H5AC_t * cache_ptr,
H5AC_jnl_config_t * config_ptr)
@@ -3007,12 +2611,6 @@ done:
* Programmer: John Mainzer
* 3/11/05
*
- * Modifications:
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3056,12 +2654,6 @@ done:
* Programmer: John Mainzer
* 3/10/05
*
- * Modifications:
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3089,15 +2681,8 @@ done:
*
* Programmer: John Mainzer, 3/10/05
*
- * Modifications:
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr)
{
@@ -3131,43 +2716,6 @@ done:
* Programmer: John Mainzer
* 3/10/05
*
- * Modifications:
- *
- * John Mainzer -- 4/6/05
- * Updated for the addition of H5AC_cache_config_t.
- *
- * John Mainzer -- 10/25/05
- * Added support for the new dirty_bytes_threshold field of
- * both H5AC_cache_config_t and H5AC_aux_t.
- *
- * John Mainzer -- 6/7/06
- * Added trace file support.
- *
- * John Mainzer -- 7/28/07
- * Added support for the new evictions enabled related fields.
- *
- * Observe that H5AC_get_cache_auto_resize_config() and
- * H5AC_set_cache_auto_resize_config() are becoming generic
- * metadata cache configuration routines as they gain
- * switches for functions that are only tenuously related
- * to auto resize configuration.
- *
- * JRM - 10/18/07
- * Modified code in support of revised cache API needed
- * to permit journaling.
- *
- * John Mainzer -- 1/3/07
- * Updated trace file code to record the new flash cache
- * size increase related fields.
- *
- * John Mainzer -- 4/13/08
- * Added code to allow control of metadata journaling.
- * This required the addition of the dxpl_id parameter.
- *
- * John Mainzer -- 8/1/08
- * Pulled journaling configuration back out of the
- * function, and teh dxpl_id parameter with it.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3295,22 +2843,6 @@ done:
* Programmer: John Mainzer
* 7/31/08
*
- * Modifications:
- *
- * JRM -- 8/14/08
- * Revised code for the use of the H5C_mdj_config_t
- * structure in H5C_get_journal_config() and
- * H5C_begin_journaling().
- *
- * Per Quincey's request, also added code to
- * throw an error if journaling is requested when
- * it is already enabled, or if the end of journaling
- * is requested when it is already disabled.
- *
- * Note that this required the addition of the
- * initializing parameter, which allows us to
- * avoid generating an error on startup.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3319,7 +2851,6 @@ H5AC_set_jnl_config(H5F_t * f,
const H5AC_jnl_config_t *config_ptr,
hbool_t initializing)
{
- /* const char * fcn_name = "H5AC_set_jnl_config"; */
H5AC_t * cache_ptr;
herr_t result;
H5C_mdj_config_t internal_config;
@@ -3472,18 +3003,12 @@ done:
* Programmer: John Mainzer
* 7/7/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_set_cache_config(H5AC_t * cache_ptr,
H5AC_cache_config_t *config_ptr)
{
- /* const char * fcn_name = "H5AC_set_cache_config"; */
herr_t result;
herr_t ret_value = SUCCEED; /* Return value */
H5C_auto_size_ctl_t internal_config;
@@ -3613,29 +3138,6 @@ done:
* Programmer: John Mainzer
* 4/6/05
*
- * Modifications:
- *
- * - Added code testing the trace file configuration fields.
- * These tests are not comprehensive, as many errors cannot
- * be caught until the directives contained in these fields
- * are applied.
- * JRM - 5/15/06
- *
- * - Added code testing the evictions enabled field. At
- * present this consists of verifying that if
- * evictions_enabled is FALSE, then automatic cache
- * resizing in disabled.
- *
- * JRM - 7/28/07
- *
- * Modified code in support of revised cache API needed
- * to permit journaling.
- * JRM - 10/18/07
- *
- * Pulled journaling related code out of this function.
- *
- * JRM - 8/1/08
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3763,10 +3265,6 @@ done:
* Programmer: John Mainzer
* 7/31/08
*
- * Modifications:
- *
- * - None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3875,10 +3373,6 @@ done:
* Programmer: John Mainzer
* 8/13/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
hbool_t
@@ -3901,10 +3395,6 @@ H5AC_validate_jnl_config_ver(int version_num)
* Programmer: John Mainzer
* 8/13/08
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
hbool_t
@@ -3930,15 +3420,8 @@ H5AC_validate_cache_config_ver(int version_num)
* Programmer: John Mainzer
* 6/2/06
*
- * Modifications:
- *
- * Modified code in support of revised cache API needed
- * to permit journaling.
- * JRM - 10/18/07
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5AC_close_trace_file(H5AC_t * cache_ptr)
@@ -3995,12 +3478,6 @@ done:
* Programmer: John Mainzer
* 6/1/06
*
- * Modifications:
- *
- * Modified code in support of revised cache API needed
- * to permit journaling.
- * JRM - 10/18/07
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4120,11 +3597,8 @@ done:
*
* Programmer: John Mainzer, 7/1/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
H5AC_broadcast_clean_list(H5AC_t * cache_ptr)
@@ -4297,21 +3771,8 @@ done:
*
* Programmer: John Mainzer, 5/15/04
*
- * Modifications:
- *
- * John Mainzer, 9/23/05
- * Rewrote function to return the value of the
- * write_permitted field in aux structure if the structure
- * exists and mpi_rank is 0.
- *
- * If the aux structure exists, but mpi_rank isn't 0, the
- * function now returns FALSE.
- *
- * In all other cases, the function returns TRUE.
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
H5AC_check_if_write_permitted(const H5F_t *f,
@@ -4380,12 +3841,6 @@ done:
* Programmer: John Mainzer
* 1/26/06
*
- * Modifications:
- *
- * Updated function for flash cache increment fields.
- *
- * JRM -- 1/2/08
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4459,11 +3914,8 @@ done:
*
* Programmer: John Mainzer, 6/29/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
H5AC_log_deleted_entry(H5AC_t * cache_ptr,
@@ -4699,11 +4151,8 @@ done:
*
* Programmer: John Mainzer, 6/29/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
#if 0 /* This is useful debugging code. -- JRM */
static herr_t
@@ -4861,14 +4310,8 @@ done:
*
* Programmer: John Mainzer, 6/30/05
*
- * Modifications:
- *
- * JRM -- 10/24/07
- * Added the size parameter.
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
H5AC_log_inserted_entry(H5F_t * f,
@@ -4996,8 +4439,6 @@ done:
*
* Programmer: John Mainzer, 6/30/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_PARALLEL
@@ -5224,14 +4665,8 @@ done:
* Programmer: John Mainzer
* July 5, 2005
*
- * Modifications:
- *
- * JRM -- 5/11/06
- * Added code to call the write_done callback.
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
herr_t
H5AC_propagate_flushed_and_still_clean_entries_list(H5F_t * f,
@@ -5310,7 +4745,7 @@ H5AC_propagate_flushed_and_still_clean_entries_list(H5F_t * f,
} else {
if ( H5AC_receive_and_apply_clean_list(f, dxpl_id,
- cache_ptr) < 0 ) {
+ cache_ptr) < 0 ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Can't receive and/or process clean slist broadcast.")
@@ -5352,15 +4787,8 @@ done:
*
* Programmer: John Mainzer, 7/4/05
*
- * Modifications:
- *
- * JRM --10/24/07
- * Reworked parameter list in support of the revised cache
- * API.
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
H5AC_receive_and_apply_clean_list(H5F_t * f,
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index fdad092..aa0ded9 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -118,11 +118,11 @@ typedef enum {
#define H5AC__SERIALIZE_RESIZED_FLAG H5C__SERIALIZE_RESIZED_FLAG
#define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG
+typedef H5C_get_load_size_func_t H5AC_get_load_size_func_t;
typedef H5C_deserialize_func_t H5AC_deserialize_func_t;
typedef H5C_image_len_func_t H5AC_image_len_func_t;
typedef H5C_serialize_func_t H5AC_serialize_func_t;
typedef H5C_free_icr_func_t H5AC_free_icr_func_t;
-typedef H5C_clear_dirty_bits_func_t H5AC_clear_dirty_bits_func_t;
typedef H5C_class_t H5AC_class_t;
@@ -274,39 +274,38 @@ struct H5O_loc_t; /* Defined in H5Oprivate.h */
H5_DLL herr_t H5AC_init(void);
H5_DLL herr_t H5AC_check_for_journaling(H5F_t * f,
- hid_t dxpl_id,
- H5C_t * cache_ptr,
- hbool_t journal_recovered);
+ hid_t dxpl_id,
+ H5C_t * cache_ptr,
+ hbool_t journal_recovered);
H5_DLL herr_t H5AC_deregister_mdjsc_callback(H5F_t * file_ptr,
- int32_t idx);
+ int32_t idx);
H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_begin_transaction(hid_t id,
- hbool_t * do_transaction_ptr,
- struct H5O_loc_t * id_oloc_ptr,
- hbool_t * id_oloc_open_ptr,
- hbool_t * transaction_begun_ptr,
- uint64_t * trans_num_ptr,
- const char * api_call_name);
+ hbool_t * do_transaction_ptr,
+ struct H5O_loc_t * id_oloc_ptr,
+ hbool_t * id_oloc_open_ptr,
+ hbool_t * transaction_begun_ptr,
+ uint64_t * trans_num_ptr,
+ const char * api_call_name);
H5_DLL herr_t H5AC_end_transaction(hbool_t do_transaction,
- struct H5O_loc_t * id_oloc_ptr,
- hbool_t id_oloc_open,
- hbool_t transaction_begun,
- hid_t dxpl_id,
- uint64_t trans_num,
- const char * api_call_name);
+ struct H5O_loc_t * id_oloc_ptr,
+ hbool_t id_oloc_open,
+ hbool_t transaction_begun,
+ hid_t dxpl_id,
+ uint64_t trans_num,
+ const char * api_call_name);
H5_DLL herr_t H5AC_get_entry_status(const H5F_t *f, haddr_t addr,
unsigned * status_ptr);
H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
- haddr_t addr, size_t len, void *thing, unsigned int flags);
+ haddr_t addr, size_t len, void *thing, unsigned int flags);
H5_DLL herr_t H5AC_pin_protected_entry(void *thing);
H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
- haddr_t addr, size_t len, void *udata,
- H5AC_protect_t rw);
+ haddr_t addr, void *udata, H5AC_protect_t rw);
H5_DLL herr_t H5AC_resize_entry(void *thing, size_t new_size);
H5_DLL herr_t H5AC_unpin_entry(void *thing);
H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id,
@@ -353,9 +352,9 @@ H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_set_jnl_config(H5F_t * f,
- hid_t dxpl_id,
- const H5AC_jnl_config_t *config_ptr,
- hbool_t initializing);
+ hid_t dxpl_id,
+ const H5AC_jnl_config_t *config_ptr,
+ hbool_t initializing);
H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t * config_ptr);
diff --git a/src/H5B.c b/src/H5B.c
index 14fce3e..4898835 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -329,7 +329,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
rt = bt->nchildren;
@@ -500,7 +500,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
cache_udata.f = f;
cache_udata.type = shared->type;
cache_udata.rc_shared = old_bt->rc_shared;
- if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree")
new_bt->level = old_bt->level;
@@ -544,7 +544,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
cache_udata2.f = f;
cache_udata2.type = shared->type;
cache_udata2.rc_shared = old_bt->rc_shared;
- if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->sizeof_rnode, &cache_udata2, H5AC_WRITE)))
+ if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, &cache_udata2, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling")
tmp_bt->left = *new_addr_p;
@@ -625,7 +625,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree")
level = bt->level;
@@ -638,7 +638,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
bt = NULL;
/* the new node */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new node")
if(!rt_key_changed)
@@ -658,7 +658,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root")
/* update the new child's left pointer */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child")
bt->left = old_root;
@@ -672,7 +672,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
* at the new location -QAK
*/
/* Bring the old root into the cache if it's not already */
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child")
/* Make certain the old root info is marked as dirty before moving it, */
@@ -880,7 +880,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
rt = bt->nchildren;
@@ -1043,7 +1043,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
if(bt->nchildren == shared->two_k) {
if(H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node")
- if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
if(idx < bt->nchildren) {
tmp_bt = bt;
@@ -1143,7 +1143,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node")
if(bt->level > 0) {
@@ -1207,7 +1207,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
if(H5F_addr_defined(next_addr)) {
/* Protect the next node to the right */
addr = next_addr;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "B-tree node")
/* Cache information from this node */
@@ -1344,7 +1344,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node")
rt = bt->nchildren;
@@ -1423,7 +1423,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
if(ret_value != H5B_INS_REMOVE && level > 0) {
if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
/* Make certain the native key for the right sibling is set up */
@@ -1451,7 +1451,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
bt->nchildren = 0;
if(level > 0) {
if(H5F_addr_defined(bt->left)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node from tree")
sibling->right = bt->right;
@@ -1461,7 +1461,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
sibling = NULL; /* Make certain future references will be caught */
} /* end if */
if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
/* Copy left-most key from deleted node to left-most key in it's right neighbor */
@@ -1523,7 +1523,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
if(level > 0) {
if(H5F_addr_defined(bt->right)) {
- if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
@@ -1622,7 +1622,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree root node")
if(0 == bt->nchildren && 0 != bt->level) {
@@ -1682,7 +1682,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/* Iterate over all children in tree, deleting them */
@@ -1939,7 +1939,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/* Cache information from this node */
@@ -1963,7 +1963,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
while(H5F_addr_defined(next_addr)) {
/* Protect the next node to the right */
addr = next_addr;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node")
/* Cache information from this node */
@@ -2126,7 +2126,7 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ)))
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/*
@@ -2246,7 +2246,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
cache_udata.f = f;
cache_udata.type = type;
cache_udata.rc_shared = rc_shared;
- bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, shared->sizeof_rnode, &cache_udata, H5AC_READ);
+ bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, &cache_udata, H5AC_READ);
HDassert(bt);
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
@@ -2267,7 +2267,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
* test.
*/
for(ncell = 0; cur; ncell++) {
- bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, shared->sizeof_rnode, &cache_udata, H5AC_READ);
+ bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, &cache_udata, H5AC_READ);
HDassert(bt);
/* Check node header */
diff --git a/src/H5B2.c b/src/H5B2.c
index f556d71..0bbd7b8 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -184,7 +184,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the b-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -270,7 +270,7 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -358,7 +358,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -439,7 +439,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
@@ -528,7 +528,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -645,7 +645,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Sanity check index */
@@ -707,7 +707,7 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the b-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -793,7 +793,7 @@ H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
/* Look up the b-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -885,7 +885,7 @@ H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get B-tree number of records */
@@ -945,7 +945,7 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -1016,7 +1016,7 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_WRITE)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -1088,7 +1088,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -1181,7 +1181,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
@@ -1269,7 +1269,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index a593bce..3f49f36 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -64,6 +64,7 @@
/********************/
/* Metadata cache callbacks */
+static herr_t H5B2_cache_hdr_get_load_size(const void *udata, size_t *image_len);
static void *H5B2_cache_hdr_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5B2_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id,
@@ -71,13 +72,15 @@ static herr_t H5B2_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id,
haddr_t *new_addr, size_t *new_len, void **new_image);
static herr_t H5B2_cache_hdr_free_icr(void *thing);
-static void *H5B2_cache_internal_deserialize(const void *image, size_t len,
+static herr_t H5B2_cache_int_get_load_size(const void *udata, size_t *image_len);
+static void *H5B2_cache_int_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
-static herr_t H5B2_cache_internal_serialize(const H5F_t *f, hid_t dxpl_id,
+static herr_t H5B2_cache_int_serialize(const H5F_t *f, hid_t dxpl_id,
haddr_t addr, size_t len, void *image, void *thing, unsigned *flags,
haddr_t *new_addr, size_t *new_len, void **new_image);
-static herr_t H5B2_cache_internal_free_icr(void *thing);
+static herr_t H5B2_cache_int_free_icr(void *thing);
+static herr_t H5B2_cache_leaf_get_load_size(const void *udata, size_t *image_len);
static void *H5B2_cache_leaf_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5B2_cache_leaf_serialize(const H5F_t *f, hid_t dxpl_id,
@@ -94,6 +97,7 @@ const H5AC_class_t H5AC_BT2_HDR[1] = {{
H5AC_BT2_HDR_ID,
"v2 b-tree header",
H5FD_MEM_BTREE,
+ H5B2_cache_hdr_get_load_size,
H5B2_cache_hdr_deserialize,
NULL,
H5B2_cache_hdr_serialize,
@@ -105,10 +109,11 @@ const H5AC_class_t H5AC_BT2_INT[1] = {{
H5AC_BT2_INT_ID,
"v2 b-tree internal node",
H5FD_MEM_BTREE,
- H5B2_cache_internal_deserialize,
+ H5B2_cache_int_get_load_size,
+ H5B2_cache_int_deserialize,
NULL,
- H5B2_cache_internal_serialize,
- H5B2_cache_internal_free_icr,
+ H5B2_cache_int_serialize,
+ H5B2_cache_int_free_icr,
}};
/* H5B2 inherits cache-like properties from H5AC */
@@ -116,6 +121,7 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{
H5AC_BT2_LEAF_ID,
"v2 b-tree leaf node",
H5FD_MEM_BTREE,
+ H5B2_cache_leaf_get_load_size,
H5B2_cache_leaf_deserialize,
NULL,
H5B2_cache_leaf_serialize,
@@ -134,6 +140,37 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{
/*-------------------------------------------------------------------------
+ * Function: H5B2_cache_hdr_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_cache_hdr_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5B2_hdr_cache_ud_t *udata = (const H5B2_hdr_cache_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_hdr_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5B2_HEADER_SIZE(udata->f);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_cache_hdr_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2_cache_hdr_deserialize
*
* Purpose: Loads a B-tree header from the disk.
@@ -178,7 +215,7 @@ H5B2_cache_hdr_deserialize(const void *image, size_t UNUSED len,
size = H5B2_HEADER_SIZE(udata->f);
/* Get temporary pointer to serialized header */
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
@@ -281,7 +318,7 @@ H5B2_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
size = H5B2_HEADER_SIZE(f);
/* Get temporary pointer to serialized header */
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
HDmemcpy(p, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
@@ -354,7 +391,7 @@ H5B2_cache_hdr_free_icr(void *thing)
HDassert(thing);
/* Destroy v2 b-tree header */
- if(H5B2_hdr_dest(thing) < 0)
+ if(H5B2_hdr_dest((H5B2_t *)thing) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header node")
done:
@@ -363,7 +400,43 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5B2_cache_internal_deserialize
+ * Function: H5B2_cache_int_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_cache_int_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5B2_internal_cache_ud_t *udata = (const H5B2_internal_cache_ud_t *)_udata; /* User data for callback */
+ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_int_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Get the pointer to the shared B-tree info */
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(udata->bt2_shared);
+ HDassert(shared);
+
+ /* Set the image length size */
+ *image_len = shared->node_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_cache_int_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_cache_int_deserialize
*
* Purpose: Deserialize a B-tree internal node from the disk.
*
@@ -377,7 +450,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5B2_cache_internal_deserialize(const void *image, size_t UNUSED len,
+H5B2_cache_int_deserialize(const void *image, size_t UNUSED len,
void *_udata, hbool_t UNUSED *dirty)
{
H5B2_internal_cache_ud_t *udata = (H5B2_internal_cache_ud_t *)_udata; /* Pointer to user data */
@@ -391,7 +464,7 @@ H5B2_cache_internal_deserialize(const void *image, size_t UNUSED len,
unsigned u; /* Local index variable */
H5B2_internal_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_deserialize)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_int_deserialize)
/* Check arguments */
HDassert(image);
@@ -410,7 +483,7 @@ H5B2_cache_internal_deserialize(const void *image, size_t UNUSED len,
shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
@@ -486,11 +559,11 @@ done:
HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree internal node")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_cache_internal_deserialize() */ /*lint !e818 Can't make udata a pointer to const */
+} /* H5B2_cache_int_deserialize() */ /*lint !e818 Can't make udata a pointer to const */
/*-------------------------------------------------------------------------
- * Function: H5B2_cache_internal_serialize
+ * Function: H5B2_cache_int_serialize
*
* Purpose: Serializes a B-tree internal node for writing to disk.
*
@@ -503,7 +576,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
+H5B2_cache_int_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing,
unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len,
void UNUSED **new_image)
@@ -517,7 +590,7 @@ H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
H5B2_internal_t *internal = (H5B2_internal_t *)_thing; /* Pointer to the b-tree internal node */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_serialize)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_int_serialize)
/* check arguments */
HDassert(f);
@@ -529,7 +602,7 @@ H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
shared = (H5B2_shared_t *)H5RC_GET_OBJ(internal->shared);
HDassert(shared);
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
HDmemcpy(p, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
@@ -581,11 +654,11 @@ H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_cache_internal_serialize() */
+} /* H5B2_cache_int_serialize() */
/*-------------------------------------------------------------------------
- * Function: H5B2_cache_internal_free_icr
+ * Function: H5B2_cache_int_free_icr
*
* Purpose: Destroy/release an "in core representation" of a data
* structure
@@ -599,22 +672,58 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_cache_internal_free_icr(void *thing)
+H5B2_cache_int_free_icr(void *thing)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_free_icr)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_int_free_icr)
/* Check arguments */
HDassert(thing);
/* Destroy v2 b-tree internal node */
- if(H5B2_internal_dest(thing) < 0)
+ if(H5B2_internal_dest((H5B2_internal_t *)thing) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree internal node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_cache_internal_free_icr() */
+} /* H5B2_cache_int_free_icr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_cache_leaf_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_cache_leaf_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5B2_leaf_cache_ud_t *udata = (const H5B2_leaf_cache_ud_t *)_udata; /* User data for callback */
+ H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_leaf_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Get the pointer to the shared B-tree info */
+ shared = (H5B2_shared_t *)H5RC_GET_OBJ(udata->bt2_shared);
+ HDassert(shared);
+
+ /* Set the image length size */
+ *image_len = shared->node_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_cache_leaf_get_load_size() */
/*-------------------------------------------------------------------------
@@ -663,7 +772,7 @@ H5B2_cache_leaf_deserialize(const void *image, size_t UNUSED len,
shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
HDassert(shared);
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
@@ -697,7 +806,7 @@ H5B2_cache_leaf_deserialize(const void *image, size_t UNUSED len,
native += shared->type->nrec_size;
} /* end for */
- /* Compute checksum on internal node */
+ /* Compute checksum on leaf node */
computed_chksum = H5_checksum_metadata(image, (size_t)(p - (const uint8_t *)image), 0);
/* Metadata checksum */
@@ -764,7 +873,7 @@ H5B2_cache_leaf_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
shared = (H5B2_shared_t *)H5RC_GET_OBJ(leaf->shared);
HDassert(shared);
- p = image;
+ p = (uint8_t *)image;
/* magic number */
HDmemcpy(p, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
@@ -831,7 +940,7 @@ H5B2_cache_leaf_free_icr(void *thing)
HDassert(thing);
/* Destroy v2 b-tree leaf node */
- if(H5B2_leaf_dest(thing) < 0)
+ if(H5B2_leaf_dest((H5B2_leaf_t *)thing) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node")
done:
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index ada729d..56e3c4d 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -114,7 +114,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
*/
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -229,7 +229,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
*/
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -362,7 +362,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
*/
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
@@ -375,7 +375,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &nrec;
cache_leaf_udata.bt2_shared = bt2->shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
/* Release the B-tree header */
diff --git a/src/H5B2int.c b/src/H5B2int.c
index a4be82b..a1532ca 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -271,11 +271,11 @@ H5B2_shared_free(void *_shared)
/* Free the B-tree node buffer */
if(shared->page)
- (void)H5FL_BLK_FREE(node_page, shared->page);
+ shared->page = H5FL_BLK_FREE(node_page, shared->page);
/* Free the array of offsets into the native key block */
if(shared->nat_off)
- H5FL_SEQ_FREE(size_t, shared->nat_off);
+ shared->nat_off = H5FL_SEQ_FREE(size_t, shared->nat_off);
/* Release the node info */
if(shared->node_info) {
@@ -292,11 +292,11 @@ H5B2_shared_free(void *_shared)
} /* end for */
/* Free the array of node info structs */
- H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info);
+ shared->node_info = H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info);
} /* end if */
/* Free the shared B-tree info itself */
- H5FL_FREE(H5B2_shared_t, shared);
+ shared = H5FL_FREE(H5B2_shared_t, shared);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -444,11 +444,11 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
cache_leaf_udata.bt2_shared = internal->shared;
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx + 1].node_nrec);
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -703,11 +703,11 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
cache_leaf_udata.bt2_shared = internal->shared;
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx + 1].node_nrec);
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -949,15 +949,15 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(internal->node_ptrs[idx-1].node_nrec);
cache_leaf_udata.bt2_shared = internal->shared;
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
- if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx+1].node_nrec);
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for child nodes */
@@ -1317,11 +1317,11 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
cache_leaf_udata.bt2_shared = internal->shared;
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx+1].node_nrec);
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1493,15 +1493,15 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(internal->node_ptrs[idx-1].node_nrec);
cache_leaf_udata.bt2_shared = internal->shared;
- if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (left_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, left_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
- if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (middle_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, middle_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
cache_leaf_udata.nrec = &(internal->node_ptrs[idx+1].node_nrec);
- if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (right_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, right_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1694,7 +1694,7 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(internal->node_ptrs[idx].node_nrec);
cache_leaf_udata.bt2_shared = internal->shared;
- if(NULL == (child_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, child_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (child_leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, child_class, child_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* More setup for accessing child node information */
@@ -1767,7 +1767,7 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Must have a leaf node with enough space to insert a record now */
@@ -2124,7 +2124,6 @@ H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr,
unsigned nrec, unsigned depth, H5AC_protect_t rw)
{
H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */
- H5B2_shared_t *shared; /* B-tree's shared info */
H5B2_internal_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_protect_internal)
@@ -2141,12 +2140,8 @@ H5B2_protect_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, haddr_t addr,
udata.depth = depth;
udata.f = f;
- /* Get the pointer to the shared B-tree info */
- shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2_shared);
- HDassert(shared);
-
/* Protect the internal node */
- if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_INT, addr, (size_t)shared->node_size, &udata, rw)))
+ if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_INT, addr, &udata, rw)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree internal node")
done:
@@ -2224,7 +2219,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node->node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Set up information about current node */
@@ -2320,7 +2315,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Sanity check number of records */
@@ -2627,7 +2622,7 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Sanity check number of records */
@@ -2999,7 +2994,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr->node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Locate node pointer for child */
@@ -3192,7 +3187,7 @@ H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, unsigned depth,
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node->node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_WRITE)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node->addr, &cache_leaf_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node")
/* Set up information about current node */
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index b50f25b..8aaa248 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -102,7 +102,7 @@ H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get pointer to reference counted shared B-tree info */
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 9631267..8b48fa2 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -272,7 +272,7 @@ H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get B-tree root addr */
@@ -325,7 +325,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
/* Look up the B-tree header */
cache_udata.f = f;
cache_udata.type = type;
- if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (bt2 = (H5B2_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
@@ -403,7 +403,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr
cache_leaf_udata.f = f;
cache_leaf_udata.nrec = &(curr_node_ptr.node_nrec);
cache_leaf_udata.bt2_shared = bt2_shared;
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, (size_t)shared->node_size, &cache_leaf_udata, H5AC_READ)))
+ if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &cache_leaf_udata, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
/* Locate record */
@@ -466,7 +466,7 @@ H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, hadd
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info")
/* Set return value */
- ret_value = ninfo.depth;
+ ret_value = (int)ninfo.depth;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index 0911a7b..0ed6916 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -54,6 +54,7 @@
/********************/
/* Metadata cache callbacks */
+static herr_t H5B_get_load_size(const void *udata, size_t *image_len);
static void *H5B_deserialize( const void *image, size_t len, void *udata,
hbool_t *dirty);
static herr_t H5B_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
@@ -71,6 +72,7 @@ const H5AC_class_t H5AC_BT[1] = {{
H5AC_BT_ID,
"v1 B-tree",
H5FD_MEM_BTREE,
+ H5B_get_load_size,
H5B_deserialize,
NULL,
H5B_serialize,
@@ -84,6 +86,42 @@ const H5AC_class_t H5AC_BT[1] = {{
/*-------------------------------------------------------------------------
+ * Function: H5B_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5B_cache_ud_t *udata = (const H5B_cache_ud_t *)_udata; /* User data for callback */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Get shared info for B-tree */
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(udata->rc_shared);
+ HDassert(shared);
+
+ /* Set the image length size */
+ *image_len = shared->sizeof_rnode;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -134,7 +172,7 @@ H5B_deserialize(const void *image, size_t UNUSED len, void *_udata,
HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't allocate buffer for child addresses")
/* Set the pointer into the image */
- p = image;
+ p = (const uint8_t *)image;
/* magic number */
if(HDmemcmp(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC))
@@ -224,7 +262,7 @@ H5B_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
HDassert(shared);
/* Set the local pointer into the serialized image */
- p = image;
+ p = (uint8_t *)image;
/* magic number */
HDmemcpy(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC);
@@ -295,7 +333,7 @@ H5B_free_icr(void *thing)
HDassert(thing);
/* Destroy B-tree node */
- if(H5B_node_dest(thing) < 0)
+ if(H5B_node_dest((H5B_t *)thing) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
done:
diff --git a/src/H5C.c b/src/H5C.c
index 4a632ce..0cedf4d 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -32,24 +32,6 @@
* For a detailed overview of the cache, please see the
* header comment for H5C_t in H5Cpkg.h.
*
- * Modifications:
- *
- * QAK - 11/27/2004
- * Switched over to using skip list routines instead of TBBT
- * routines.
- *
- * JRM - 12/15/04
- * Added code supporting manual and automatic cache resizing.
- * See the header for H5C_auto_size_ctl_t in H5Cprivate.h for
- * an overview.
- *
- * Some elements of the automatic cache resize code depend on
- * the LRU list. Thus if we ever choose to support a new
- * replacement policy, we will either have to disable those
- * elements of the auto resize code when running the new
- * policy, or modify them to make use of similar information
- * maintained by the new policy code.
- *
*-------------------------------------------------------------------------
*/
@@ -63,13 +45,6 @@
*
* - Change protect/unprotect to lock/unlock.
*
- * - Change the way the dirty flag is set. Probably pass it in
- * as a parameter in unprotect & insert.
- *
- * - Size should also be passed in as a parameter in insert and
- * unprotect -- or some other way should be found to advise the
- * cache of changes in entry size.
- *
* - Flush entries in increasing address order in
* H5C_make_space_in_cache().
*
@@ -168,7 +143,6 @@ static void * H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- size_t len,
void * udata);
static herr_t H5C_make_space_in_cache(H5F_t * f,
@@ -200,6 +174,8 @@ static herr_t H5C_verify_not_in_index(H5C_t * cache_ptr,
#define H5C__EPOCH_MARKER_TYPE H5C__MAX_NUM_TYPE_IDS
+static herr_t H5C_epoch_marker_get_load_size(const void *udata_ptr,
+ size_t *image_len_ptr);
static void * H5C_epoch_marker_deserialize(const void * image_ptr,
size_t len,
void * udata,
@@ -223,6 +199,7 @@ const H5C_class_t epoch_marker_class =
/* id = */ H5C__EPOCH_MARKER_TYPE,
/* name = */ "epoch marker",
/* mem_type = */ H5FD_MEM_DEFAULT, /* value doesn't matter */
+ /* get_load_size = */ &H5C_epoch_marker_get_load_size,
/* deserialize = */ &H5C_epoch_marker_deserialize,
/* image_len = */ &H5C_epoch_marker_image_len,
/* serialize = */ &H5C_epoch_marker_serialize,
@@ -239,6 +216,20 @@ const H5C_class_t epoch_marker_class =
*
***************************************************************************/
+static herr_t
+H5C_epoch_marker_get_load_size(const void UNUSED *udata_ptr,
+ size_t UNUSED *image_len_ptr)
+{
+ herr_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5C_epoch_marker_get_load_size, FAIL)
+
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
static void *
H5C_epoch_marker_deserialize(const void UNUSED * image_ptr,
size_t UNUSED len,
@@ -252,7 +243,6 @@ H5C_epoch_marker_deserialize(const void UNUSED * image_ptr,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "called unreachable fcn.")
done:
-
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -267,7 +257,6 @@ H5C_epoch_marker_image_len(const void UNUSED *thing,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
done:
-
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -290,7 +279,6 @@ H5C_epoch_marker_serialize(const H5F_t UNUSED *f,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
done:
-
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -304,11 +292,9 @@ H5C_epoch_marker_free_icr(void UNUSED * thing)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")
done:
-
FUNC_LEAVE_NOAPI(ret_value)
}
-
/*-------------------------------------------------------------------------
* Function: H5C_create
@@ -332,87 +318,8 @@ done:
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/20/04
- * Updated for the addition of the hash table.
- *
- * JRM -- 10/5/04
- * Added call to H5C_reset_cache_hit_rate_stats(). Also
- * added initialization for cache_is_full flag and for
- * resize_ctl.
- *
- * JRM -- 11/12/04
- * Added initialization for the new size_decreased field.
- *
- * JRM -- 11/17/04
- * Added/updated initialization for the automatic cache
- * size control data structures.
- *
- * JRM -- 6/24/05
- * Added support for the new write_permitted field of
- * the H5C_t structure.
- *
- * JRM -- 7/5/05
- * Added the new log_flush parameter and supporting code.
- *
- * JRM -- 9/21/05
- * Added the new aux_ptr parameter and supporting code.
- *
- * JRM -- 1/20/06
- * Added initialization of the new prefix field in H5C_t.
- *
- * JRM -- 3/16/06
- * Added initialization for the pinned entry related fields.
- *
- * JRM -- 5/31/06
- * Added initialization for the trace_file_ptr field.
- *
- * JRM -- 8/19/06
- * Added initialization for the flush_in_progress field.
- *
- * JRM -- 8/25/06
- * Added initialization for the slist_len_increase and
- * slist_size_increase fields. These fields are used
- * for sanity checking in the flush process, and are not
- * compiled in unless H5C_DO_SANITY_CHECKS is TRUE.
- *
- * JRM -- 3/28/07
- * Added initialization for the new is_read_only and
- * ro_ref_count fields.
- *
- * JRM -- 7/10/07
- * Added the f parameter, along with initialization of
- * the field of the same in in H5C_t. Also removed the
- * type name table, as type names are now included in
- * instances of H5C_class_t.
- *
- * JRM -- 3/28/07
- * Added initialization for the new is_read_only and
- * ro_ref_count fields.
- *
- * JRM -- 12/31/07
- * Added initialization for the new flash cache size increase
- * related fields of H5C_t.
- *
- * JRM -- 3/6/08
- * Added initialization for metadata journaling related
- * fields in H5C_t.
- *
- * JRM -- 3/26/08
- * Added dxpl_id and journal_recovered parameters. Also
- * added code to test to see if the file is marked as having
- * journaling in progress, and fail if it does unless
- * the journal_recovered parameter is TRUE.
- *
- * JRM -- 7/10/08
- * Removed the f, dxpl_id, and journal_recovered parameters,
- * as checking for journaling in progress is no longer handled
- * in H5C_create().
- *
*-------------------------------------------------------------------------
*/
-
H5C_t *
H5C_create(size_t max_cache_size,
size_t min_clean_size,
@@ -626,7 +533,7 @@ H5C_create(size_t max_cache_size,
* the table will grow and shrink as needed.
*/
cache_ptr->mdjsc_cb_tbl =
- H5MM_malloc(H5C__MIN_MDJSC_CB_TBL_LEN *
+ (H5C_mdjsc_record_t *)H5MM_malloc(H5C__MIN_MDJSC_CB_TBL_LEN *
sizeof(H5C_mdjsc_record_t));
if ( cache_ptr->mdjsc_cb_tbl == NULL ) {
@@ -707,19 +614,6 @@ done:
* Programmer: John Mainzer
* 10/27/04
*
- * Modifications:
- *
- * JRM -- 11/22/04
- * Reworked function to adapt it to the addition of the
- * ageout method of cache size reduction.
- *
- * JRM -- 1/19/06
- * Updated function for display the new prefix field of
- * H5C_t in output.
- *
- * JRM 12/31/07
- * Updated function to handle flash size increases.
- *
*-------------------------------------------------------------------------
*/
void
@@ -909,14 +803,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/11/07
- * Reworked parameter list for the revised cache API.
- * The function lost its pointer to an instance of
- * H5F_t (now supplied via cache_ptr), and one of its
- * dxlp ids.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -959,7 +845,7 @@ H5C_dest(H5F_t * f,
if ( cache_ptr->mdjsc_cb_tbl != NULL ) {
- cache_ptr->mdjsc_cb_tbl = H5MM_xfree(cache_ptr->mdjsc_cb_tbl);
+ cache_ptr->mdjsc_cb_tbl = (H5C_mdjsc_record_t *)H5MM_xfree(cache_ptr->mdjsc_cb_tbl);
if ( cache_ptr->mdjsc_cb_tbl != NULL ) {
@@ -992,10 +878,6 @@ done:
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1046,21 +928,6 @@ done:
* Programmer: John Mainzer
* 6/29/06
*
- * Modifications:
- *
- * JRM -- 7/11/07
- * Reworked the parameter list for the revised cache API.
- * The function lost its file pointer (now passed in the
- * *cache_ptr), and one of the dxpl ids.
- *
- * JRM -- 4/3/08
- * Added code to test to see if journaling is enabled, and
- * if it is, test to see if entry_ptr->last_trans > zero.
- * If so, must remove the entry from the transaction list
- * (if it is present), remove the entry from the journal
- * write in progress list, and set entry_ptr->last_trans to
- * zero before calling H5C_flush_single_entry().
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1196,99 +1063,6 @@ done:
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/20/04
- * Modified the function for the addition of the hash table.
- *
- * JRM -- 11/22/04
- * Added code to remove all epoch markers (if any) from the
- * LRU list before a destroy. Strictly speaking, this isn't
- * necessary, as the marker entries reside only in the LRU
- * list, never in the index or in the tree. However, it
- * never hurts to tidy up.
- *
- * JRM -- 1/6/05
- * Reworked code to support the new
- * H5C__FLUSH_MARKED_ENTRIES_FLAG, and for the replacement of
- * H5F_FLUSH_INVALIDATE flag with H5C__FLUSH_INVALIDATE_FLAG.
- *
- * Note that the H5C__FLUSH_INVALIDATE_FLAG takes precidence
- * over the H5C__FLUSH_MARKED_ENTRIES_FLAG. Thus if both are
- * set, the functions behaves as if just the
- * H5C__FLUSH_INVALIDATE_FLAG was set.
- *
- * The H5C__FLUSH_CLEAR_ONLY_FLAG flag can co-exist with
- * either the H5C__FLUSH_MARKED_ENTRIES_FLAG, or the
- * H5C__FLUSH_INVALIDATE_FLAG. In all cases, it is simply
- * passed along to H5C_flush_single_entry(). In the case of
- * H5C__FLUSH_MARKED_ENTRIES_FLAG, it will only apply to
- * the marked entries.
- *
- * JRM -- 10/15/05
- * Added code supporting the new
- * H5C__FLUSH_IGNORE_PROTECTED_FLAG. We need this flag, as
- * we now use this function to flush large number of entries
- * in increasing address order. We do this by marking the
- * entries to be flushed, calling this function to flush them,
- * and then restoring LRU order.
- *
- * However, it is possible that the cache will contain other,
- * unmarked protected entries, when we make this call. This
- * new flag allows us to ignore them.
- *
- * Note that even with this flag set, it is still an error
- * to try to flush a protected entry.
- *
- * JRM -- 3/25/06
- * Updated function to handle pinned entries.
- *
- * JRM -- 8/19/06
- * Added code managing the new flush_in_progress field of
- * H5C_t.
- *
- * Also reworked function to allow for the possibility that
- * entries will be dirtied, resized, or moved during flush
- * callbacks. As a result, we may have to make multiple
- * passes through the skip list before the cache is flushed.
- *
- * JRM -- 7/11/07
- * Reworked function to support the new metadata cache API.
- * The function lost the H5F_t parameter (now passed via
- * *cache_ptr), and one of the dxpl id parameters.
- *
- * JRM -- 10/13/07
- * Added code to detect and manage the case in which a
- * serialize callback changes the s-list out from under
- * the function. The only way I can think of in which this
- * can happen is if a serialize function loads an entry
- * into the cache that isn't there already. Quincey tells
- * me that this will never happen, but I'm not sure I
- * believe him.
- *
- * Note that this is a pretty bad scenario if it ever
- * happens. The code I have added should allow us to
- * handle the situation, but one can argue that I should
- * just scream and die if I ever detect the condidtion.
- *
- * JRM -- 10/13/07
- * Added code to detect and manage the case in which a
- * flush callback changes the s-list out from under
- * the function. The only way I can think of in which this
- * can happen is if a flush function loads an entry
- * into the cache that isn't there already. Quincey tells
- * me that this will never happen, but I'm not sure I
- * believe him.
- *
- * Note that this is a pretty bad scenario if it ever
- * happens. The code I have added should allow us to
- * handle the situation under all but the worst conditions,
- * but one can argue that I should just scream and die if I
- * ever detect the condidtion.
- *
- * JRM -- 4/10/08
- * Added code to support journaling.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1673,40 +1447,6 @@ done:
* Programmer: John Mainzer
* 9/16/05
*
- * Modifications:
- *
- * Re-wrote function to flush dirty entries in increasing
- * address order, while maintaining LRU order in the LRU list
- * upon return.
- *
- * Do this by scanning up the dirty LRU list for entries to
- * flush to reach min clean size, setting their flush_marker
- * flags, and recording their addresses in the order
- * encountered.
- *
- * Then call H5C_flush_cache() to flush the marked entries.
- *
- * Finally, use the list of marked entries to force the
- * correct LRU list order after the flush.
- *
- * JRM - 10/13/05
- *
- * This change had the oposite of the desired effect. Lets
- * leave it in (albeit commented out for now). If we can't
- * find a case where it helps, lets get rid of it.
- *
- *
- * Added some sanity checks to the change which verify the
- * expected values of the new is_read_only and ro_ref_count
- * fields.
- * JRM - 3/29/07
- *
- * Modified parameter list for the new metadata cache API.
- * THe function lost its H5F_t parameter (now passed via
- * *cache_ptr), and one of its dxpl ids.
- *
- * JRM - 7/11/07
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1890,10 +1630,6 @@ done:
* Programmer: John Mainzer
* 10/8/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1940,10 +1676,6 @@ done:
* Programmer: John Mainzer
* 10/8/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2003,10 +1735,6 @@ done:
* Programmer: John Mainzer
* 10/7/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2068,11 +1796,6 @@ done:
* Programmer: John Mainzer
* 7/1/05
*
- * Modifications:
- *
- * JRM -- 4/26/06
- * Added the is_pinned_ptr parameter and supporting code.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2160,10 +1883,6 @@ done:
* Programmer: John Mainzer
* 7/27/07
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2282,75 +2001,6 @@ H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr,
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/21/04
- * Updated function for the addition of the hash table.
- *
- * JRM -- 10/28/04
- * Added code to set the cache_full flag to TRUE when ever
- * we need to make space in the cache.
- *
- * JRM -- 11/22/04
- * Updated function for the addition of the first_flush_ptr
- * parameter to H5C_make_space_in_cache().
- *
- * JRM -- 1/6/05
- * Added the flags parameter, and code supporting
- * H5C__SET_FLUSH_MARKER_FLAG. Note that this flag is
- * ignored unless the new entry is dirty.
- *
- * JRM -- 6/6/05
- * Added code to force all inserted entries to be dirty.
- * This is part of a set of changes moving management of the
- * is_dirty field of H5C_cache_entry_t into the H5C code.
- *
- * JRM -- 6/24/05
- * Added support for the new write_permitted field of
- * the H5C_t structure.
- *
- * JRM -- 3/16/06
- * Added initialization for the new is_pinned field of the
- * H5C_cache_entry_t structure.
- *
- * JRM -- 5/3/06
- * Added initialization for the new dirtied field of the
- * H5C_cache_entry_t structure.
- *
- * JRM -- 8/9/06
- * Added code supporting insertion of pinned entries.
- *
- * JRM -- 8/21/06
- * Added initialization for the new flush_in_progress and
- * destroy_in_progress fields.
- *
- * JRM -- 3/29/07
- * Added initialization for the new is_read_only and
- * ro_ref_count fields.
- *
- * JRM -- 7/11/07
- * Reworked the parameter list for the revised metadata
- * cache API. The function lost its pointer to H5F_t
- * (now supplied via *cache_ptr), and one of dxpl id
- * parameters. It gained a entry length parameter.
- * Numerous internal changes to support the API change.
- *
- * JRM -- 8/1/07
- * Added code to disable evictions when the new
- * evictions_enabled field is FALSE.
- *
- * JRM -- 10/12/07
- * Added initialization for the new magic field.
- *
- * JRM -- 12/31/07
- * Added code supporting flash cache size increases.
- *
- * JRM -- 3/26/08
- * Added code initializing the journaling related fields.
- * Also added code to set the new entries last_trans field
- * to the current transaction number and insert the entry
- * in the transaction list if journaling is enabled.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2639,45 +2289,6 @@ done:
* Programmer: John Mainzer
* 7/5/05
*
- * Modifications:
- *
- * Reworked function to flush entries in LRU order instead
- * of increasing address order. The hope is that this will
- * improve the hit rate on the slave caches.
- *
- * JRM - 10/13/05
- *
- * Leave the old code in place for now (commented out) for
- * benchmarking.
- *
- * JRM -- 4/13/06
- * Updated function to deal with pinned entries.
- *
- * JRM -- 7/11/07
- * Revised function for the new metadata cache API. The
- * function lost its point to H5F_t (now supplied via
- * *cache_ptr), and one of its dxpl ids. Also internal
- * changes supporting the revised API.
- *
- * JRM -- 10/13/07
- * Didn't modify this function to detect the case in which
- * the LRU is modified out from under it. It shouldn't be
- * an issue here, as this function is only called in the
- * parallel case, and serialize callbacks must not modify
- * other entries in parallel case. If they do, they will
- * cause inconsistancies in metadata across processes.
- *
- * Further, since this function only clears entries, and
- * thus the serialize functions are never called, the
- * situation will be even worse, as the changes will only
- * exist on process 0.
- *
- * Bottom line -- the calls to H5C_flush_single_entry()
- * in this function will not call serialize, thus no change
- * in the LRU is possible. Even if they did, the serialize()
- * callbacks are banned from making such changes in the
- * parallel case.
- *
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_PARALLEL
@@ -3309,7 +2920,7 @@ H5C_resize_entry(void *thing, size_t new_size)
/* finally, update the entry size proper */
entry_ptr->size = new_size;
- if( !entry_ptr->in_slist ) {
+ if(!entry_ptr->in_slist) {
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
} /* end if */
@@ -3322,8 +2933,7 @@ H5C_resize_entry(void *thing, size_t new_size)
if(entry_ptr->is_pinned) {
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
} /* end if */
-
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3391,87 +3001,11 @@ done:
* or flushed -- nor may it be accessed by another call to
* H5C_protect. Any attempt to do so will result in a failure.
*
- * The primary_dxpl_id and secondary_dxpl_id parameters
- * specify the dxpl_ids used on the first write occasioned
- * by the insertion (primary_dxpl_id), and on all subsequent
- * writes (secondary_dxpl_id). This is useful in the
- * metadata cache, but may not be needed elsewhere. If so,
- * just use the same dxpl_id for both parameters.
- *
- * All reads are performed with the primary_dxpl_id.
- *
- * Similarly, the primary_dxpl_id is passed to the
- * check_write_permitted function if it is called.
- *
* Return: Success: Ptr to the desired entry
- *
* Failure: NULL
*
* Programmer: John Mainzer - 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/21/04
- * Updated for the addition of the hash table.
- *
- * JRM -- 10/28/04
- * Added code to set cache_full to TRUE whenever we try to
- * make space in the cache.
- *
- * JRM -- 11/12/04
- * Added code to call to H5C_make_space_in_cache()
- * after the call to H5C__auto_adjust_cache_size() if that
- * function sets the size_decreased flag is TRUE.
- *
- * JRM -- 4/25/05
- * The size_decreased flag can also be set to TRUE in
- * H5C_set_cache_auto_resize_config() if a new configuration
- * forces an immediate reduction in cache size. Modified
- * the code to deal with this eventuallity.
- *
- * JRM -- 6/24/05
- * Added support for the new write_permitted field of H5C_t.
- *
- * JRM -- 10/22/05
- * Hand optimizations.
- *
- * JRM -- 5/3/06
- * Added code to set the new dirtied field in
- * H5C_cache_entry_t to FALSE prior to return.
- *
- * JRM -- 6/23/06
- * Modified code to allow dirty entries to be loaded from
- * disk. This is necessary as a bug fix in the object
- * header code requires us to modify a header as it is read.
- *
- * JRM -- 3/28/07
- * Added the flags parameter and supporting code. At least
- * for now, this parameter is used to allow the entry to
- * be protected read only, thus allowing multiple protects.
- *
- * Also added code to allow multiple read only protects
- * of cache entries.
- *
- * JRM -- 7/27/07
- * Added code supporting the new evictions_enabled field
- * in H5C_t.
- *
- * JRM -- 7/11/07
- * Revised function for the new metadata cache API. The
- * function lost its point to H5F_t (now supplied via
- * *cache_ptr), one of its dxpl ids. and one of the udata
- * fields. Gained the len parameter. Also internal
- * changes supporting the revised API.
- *
- * JRM -- 1/3/08
- * Added to do a flash cache size increase if appropriate
- * when a large entry is loaded.
- *
- * JRM 3/31/08
- * Updated function to insert the newly protected entry in
- * the transaction list if journaling is enabled and the
- * entry was dirtied on load.
- *
*-------------------------------------------------------------------------
*/
void *
@@ -3479,7 +3013,6 @@ H5C_protect(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- size_t len,
void * udata,
unsigned flags)
{
@@ -3507,7 +3040,6 @@ H5C_protect(H5F_t * f,
HDassert( cache_ptr->skip_file_checks || f );
HDassert( type );
HDassert( H5F_addr_defined(addr) );
- HDassert( len > 0 );
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( H5C_validate_lru_list(cache_ptr) < 0 ) {
@@ -3537,7 +3069,7 @@ H5C_protect(H5F_t * f,
hit = FALSE;
- thing = H5C_load_entry(f, dxpl_id, type, addr, len, udata);
+ thing = H5C_load_entry(f, dxpl_id, type, addr, udata);
if ( thing == NULL ) {
@@ -3763,8 +3295,8 @@ H5C_protect(H5F_t * f,
(cache_ptr->resize_ctl).epoch_length ) ) {
result = H5C__auto_adjust_cache_size(f,
- dxpl_id,
- write_permitted);
+ dxpl_id,
+ write_permitted);
if ( result != SUCCEED ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \
@@ -3785,9 +3317,9 @@ H5C_protect(H5F_t * f,
cache_ptr->cache_full = TRUE;
result = H5C_make_space_in_cache(f,
- dxpl_id,
- (size_t)0,
- write_permitted);
+ dxpl_id,
+ (size_t)0,
+ write_permitted);
if ( result < 0 ) {
@@ -3823,13 +3355,8 @@ done:
*
* Programmer: John Mainzer, 10/5/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr)
{
@@ -3869,21 +3396,6 @@ done:
* Programmer: John Mainzer
* 10/8/04
*
- * Modifications:
- *
- * JRM -- 11/18/04
- * Reworked function to match major changes in
- * H5C_auto_size_ctl_t.
- *
- * JRM -- 4/25/05
- * Added code to set cache_ptr->size_decreased to TRUE
- * if the new configuration forces an immediate reduction
- * in cache size.
- *
- * JRM -- 12/31/07
- * Added code supporting the new flash cache size increase
- * code.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4161,10 +3673,6 @@ done:
* Programmer: John Mainzer
* 7/27/07
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4221,11 +3729,8 @@ done:
* Programmer: John Mainzer
* 1/20/06
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_set_prefix(H5C_t * cache_ptr,
char * prefix)
@@ -4267,11 +3772,8 @@ done:
* Programmer: John Mainzer
* 6/11/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_set_skip_flags(H5C_t * cache_ptr,
hbool_t skip_file_checks,
@@ -4312,11 +3814,8 @@ done:
* Programmer: John Mainzer
* 1/20/06
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_set_trace_file_ptr(H5C_t * cache_ptr,
FILE * trace_file_ptr)
@@ -4351,35 +3850,8 @@ done:
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/21/04
- * Updated function for the addition of the hash table.
- *
- * JRM -- 9/8/05
- * Updated function for the addition of cache entry size
- * change statistics.
- *
- * JRM -- 1/13/06
- * Added code to use the prefix field of H5C_t to allow
- * tagging of statistics output.
- *
- * JRM -- 3/21/06
- * Added code supporting the pinned entry related stats.
- *
- * JRM -- 8/9/06
- * More code supporting pinned entry related stats.
- *
- * JRM -- 8/23/06
- * Added code supporting new flush related statistics.
- *
- * JRM -- 3/31/07
- * Added code supporting the new write_protects,
- * read_protects, and max_read_protects fields.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_stats(H5C_t * cache_ptr,
const char * cache_name,
@@ -4783,34 +4255,8 @@ done:
*
* Programmer: John Mainzer, 4/28/04
*
- * Modifications:
- *
- * JRM - 7/21/04
- * Updated for hash table related statistics.
- *
- * JRM - 9/8/05
- * Updated for size increase / decrease statistics.
- *
- * JRM - 3/20/06
- * Updated for pin / unpin related statistics.
- *
- * JRM - 8/9/06
- * Further updates for pin related statistics.
- *
- * JRM 8/23/06
- * Added initialization code for new flush related statistics.
- *
- * JRM 2/16/07
- * Added conditional compile code to avoid unused parameter
- * warning in the production build.
- *
- * JRM 3/31/07
- * Added initialization for the new write_protects,
- * read_protects, and max_read_protects fields.
- *
*-------------------------------------------------------------------------
*/
-
void
#ifndef NDEBUG
H5C_stats__reset(H5C_t * cache_ptr)
@@ -4977,72 +4423,6 @@ done:
* Programmer: John Mainzer
* 6/2/04
*
- * Modifications:
- *
- * JRM -- 7/21/04
- * Updated the function for the addition of the hash table.
- * In particular, we now add dirty entries to the tree if
- * they aren't in the tree already.
- *
- * JRM -- 1/6/05
- * Added the flags parameter, and code supporting
- * H5C__SET_FLUSH_MARKER_FLAG. Note that this flag is
- * ignored unless the new entry is dirty. Also note that
- * once the flush_marker field of an entry is set, the
- * only way it can be reset is by being flushed.
- *
- * JRM -- 6/3/05
- * Added the dirtied parameter and supporting code. This
- * is part of an effort to move management of the is_dirty
- * field into the cache code. This has become necessary
- * to repair a cache coherency bug in PHDF5.
- *
- * JRM -- 7/5/05
- * Added code supporting the new clear_on_unprotect field
- * of H5C_cache_entry_t. This change is also part of the
- * above mentioned cache coherency bug fix in PHDF5.
- *
- * JRM -- 9/8/05
- * Added the size_changed and new_size parameters and the
- * supporting code. Since the metadata cache synchronizes
- * on dirty bytes creation in the PHDF5 case, we must now
- * track changes in entry size.
- *
- * Note that the new_size parameter is ignored unless the
- * size_changed parameter is TRUE. In this case, the new_size
- * must be positive.
- *
- * Also observe that if size_changed is TRUE, dirtied must be
- * TRUE.
- *
- * JRM -- 9/23/05
- * Moved the size_changed parameter into flags.
- *
- * JRM -- 3/21/06
- * Unpdated function to pin and unpin entries as directed via
- * the new H5C__PIN_ENTRY_FLAG and H5C__UNPIN_ENTRY_FLAG flags.
- *
- * JRM -- 5/3/06
- * Added code to make use of the new dirtied field in
- * H5C_cache_entry_t. If this field is TRUE, it is the
- * equivalent of setting the H5C__DIRTIED_FLAG.
- *
- * JRM -- 3/29/07
- * Modified function to allow a entry to be protected
- * more than once if the entry is protected read only.
- *
- * Also added sanity checks using the new is_read_only and
- * ro_ref_count parameters.
- *
- * JRM -- 9/8/07
- * Revised function for the new metadata cache API. The
- * function lost its pointer to H5F_t (now supplied via
- * *cache_ptr), and one of its dxpl ids. Also internal
- * changes supporting the revised API.
- *
- * JRM -- 12/31/07
- * Modified funtion to support flash cache resizes.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -5062,8 +4442,6 @@ H5C_unprotect(H5F_t * f,
#ifdef H5_HAVE_PARALLEL
hbool_t clear_entry = FALSE;
#endif /* H5_HAVE_PARALLEL */
- herr_t result;
- size_t size_increase = 0;
H5C_cache_entry_t * entry_ptr;
H5C_cache_entry_t * test_entry_ptr;
herr_t ret_value = SUCCEED; /* Return value */
@@ -5385,15 +4763,8 @@ done:
* Programmer: John Mainzer
* 3/23/05
*
- * Modifications:
- *
- * Added validation for the flash increment fields.
- *
- * JRM -- 12/31/07
- *
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr,
unsigned int tests)
@@ -5658,23 +5029,6 @@ done:
*
* Programmer: John Mainzer, 10/7/04
*
- * Modifications:
- *
- * JRM -- 11/18/04
- * Major re-write to support ageout method of cache size
- * reduction, and to adjust to changes in the
- * H5C_auto_size_ctl_t structure.
- *
- * JRM -- 9/8/07
- * Reworked to accomodate cache API changes needed to
- * support metadata journaling. Mostly, this involved
- * removing a bunch of parameters that used to be
- * passed through to other calls, and are no longer
- * needed.
- *
- * JRM -- 1/5/08
- * Added support for flash cache size increases.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -6024,14 +5378,6 @@ done:
*
* Programmer: John Mainzer, 11/18/04
*
- * Modifications:
- *
- * JRM -- 9/9/07
- * Reworked function to support API changes in support of
- * metadata cacheing. In essence, the change involved
- * removal of arguments that are no longer needed by the
- * callbacks, and thus no-longer need be passed through.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -6151,13 +5497,8 @@ done:
*
* Programmer: John Mainzer, 11/22/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
static herr_t
H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr)
{
@@ -6283,27 +5624,6 @@ done:
*
* Programmer: John Mainzer, 11/22/04
*
- * Modifications:
- *
- * JRM -- 9/9/07
- * Reworked function to support API changes in support of
- * metadata cacheing. In essence, the change involved
- * removal of arguments that are no longer needed by the
- * callbacks, and thus no-longer need be passed through.
- *
- * JRM -- 10/13/07
- * Reworked code to allow it to the function to handle the
- * case in which the LRU list is modified out from under the
- * function by a serialize function. This can happen if
- * the serialize function associated with the entry being
- * flushed either accesses the next item in the LRU list,
- * or (as Quincey assures me is impossible), it accesses
- * an entry not currently in cache, causing the eviction
- * of the next entry in the LRU.
- *
- * We handle this situation by detecting it, and restarting
- * the scan of the LRU when it occurs.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -6518,13 +5838,8 @@ done:
*
* Programmer: John Mainzer, 11/19/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
static herr_t
H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr)
{
@@ -6604,13 +5919,8 @@ done:
*
* Programmer: John Mainzer, 11/22/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
static herr_t
H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr)
{
@@ -6690,13 +6000,8 @@ done:
*
* Programmer: John Mainzer, 11/19/04
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
static herr_t
H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr)
{
@@ -6784,10 +6089,6 @@ done:
*
* Programmer: John Mainzer, 12/31/07
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -6973,35 +6274,6 @@ done:
* Programmer: John Mainzer
* 3/24/065
*
- * Modifications:
- *
- * To support the fractal heap, the cache must now deal with
- * entries being dirtied, resized, and/or moved inside
- * flush callbacks. Updated function to support this.
- *
- * -- JRM 8/27/06
- *
- * Added code to detect and manage the case in which a
- * flush callback changes the s-list out from under
- * the function. The only way I can think of in which this
- * can happen is if a flush function loads an entry
- * into the cache that isn't there already. Quincey tells
- * me that this will never happen, but I'm not sure I
- * believe him.
- *
- * Note that this is a pretty bad scenario if it ever
- * happens. The code I have added should allow us to
- * handle the situation under all but the worst conditions,
- * but one can argue that I should just scream and die if I
- * ever detect the condidtion.
- *
- * -- JRM 10/13/07
- *
- * Reworked argument list and code to reflect the
- * removal of the secondary dxpl id, and the decision
- * to store f in H5C_t, removing the need to pass it
- * in all the time.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -7532,81 +6804,6 @@ done:
*
* Programmer: John Mainzer, 5/5/04
*
- * Modifications:
- *
- * JRM -- 7/21/04
- * Updated function for the addition of the hash table.
- *
- * QAK -- 11/26/04
- * Updated function for the switch from TBBTs to skip lists.
- *
- * JRM -- 1/6/05
- * Updated function to reset the flush_marker field.
- * Also replace references to H5F_FLUSH_INVALIDATE and
- * H5F_FLUSH_CLEAR_ONLY with references to
- * H5C__FLUSH_INVALIDATE_FLAG and H5C__FLUSH_CLEAR_ONLY_FLAG
- * respectively.
- *
- * JRM -- 6/24/05
- * Added code to remove dirty entries from the slist after
- * they have been flushed. Also added a sanity check that
- * will scream if we attempt a write when writes are
- * completely disabled.
- *
- * JRM -- 7/5/05
- * Added code to call the new log_flush callback whenever
- * a dirty entry is written to disk. Note that the callback
- * is not called if the H5C__FLUSH_CLEAR_ONLY_FLAG is set,
- * as there is no write to file in this case.
- *
- * JRM -- 8/21/06
- * Added code maintaining the flush_in_progress and
- * destroy_in_progress fields in H5C_cache_entry_t.
- *
- * Also added flush_flags parameter to the call to
- * type_ptr->flush() so that the flush routine can report
- * whether the entry has been resized or moved. Added
- * code using the flush_flags variable to detect the case
- * in which the target entry is resized during flush, and
- * update the caches data structures accordingly.
- *
- *
- * JRM -- 3/29/07
- * Added sanity checks on the new is_read_only and
- * ro_ref_count fields.
- *
- * JRM -- 6/25/07
- * Rewrite of function to use the new metadata cache callback
- * functions. These functions move all metadata file I/O into
- * the cache proper, which is necessary for metadata journaling.
- *
- * To date, the functions of the H5C__FLUSH_INVALIDATE_FLAG
- * and H5C__FLUSH_CLEAR_ONLY_FLAG have not been documented
- * in H5C, as these flags were just passed through to the
- * client callbacks. As much of the callback functionality
- * is now in the cache, the function of these flags should
- * be documented explicitly here in H5C.
- *
- * If the H5C__FLUSH_INVALIDATE_FLAG is set, the entry is to
- * be written to disk if dirty, and then evicted from the
- * cache and discarded. As an optimization, the destroyed
- * is deleted from the slist only on request.
- *
- * If the H5C__FLUSH_CLEAR_ONLY_FLAG is set, the entry is
- * to be marked clean if it is dirty. Under no circumstances
- * will it be written to disk.
- *
- * If both the H5C__FLUSH_INVALIDATE_FLAG and the
- * H5C__FLUSH_CLEAR_ONLY_FLAG are set, the entry is marked
- * clean and then evicted from the cache without writing
- * to disk. If dirty, the entry is removed from the slist
- * or not as requested.
- *
- * JRM -- 3/31/08
- * If journaling is enabled, modified function to remove
- * the target entry from the transaction list on a clear.
- * Also added some sanity checks.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -8266,37 +7463,6 @@ done:
*
* Programmer: John Mainzer, 5/18/04
*
- * Modifications:
- *
- * JRM - 7/21/04
- * Updated function for the addition of the hash table.
- *
- * JRM - 6/23/06
- * Deleted assertion that verified that a newly loaded
- * entry is clean. Due to a bug fix, this need not be
- * the case, as our code will attempt to repair errors
- * on load.
- *
- * JRM - 8/21/06
- * Added initialization for the new flush_in_progress and
- * destroy in progress fields.
- *
- * JRM - 3/29/07
- * Added initialization for the new is_read_only and
- * ro_ref_count fields.
- *
- * JRM - 6/25/07
- * Reworked function to use the new client callback
- * functions that are needed to implement metadata
- * journaling. Removed skip_file_checks parameter.
- *
- * JRM -- 10/12/07
- * Added initialization for the new magic field.
- *
- * JRM -- 3/26/08
- * Added initialization for the journaling related
- * fields.
- *
*-------------------------------------------------------------------------
*/
static void *
@@ -8304,24 +7470,28 @@ H5C_load_entry(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- size_t len,
void * udata)
{
- hbool_t dirty = FALSE;
- void * image_ptr = NULL;
- void * thing = NULL;
- H5C_cache_entry_t * entry_ptr = NULL;
- void * ret_value = NULL;
+ hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */
+ void * image_ptr = NULL; /* Buffer for disk image */
+ void * thing = NULL; /* Pointer to thing loaded */
+ H5C_cache_entry_t * entry_ptr; /* Alias for thing loaded, as cache entry */
+ size_t len; /* Size of image in file */
+ void * ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5C_load_entry)
- HDassert( f );
- HDassert( f->shared );
- HDassert( f->shared->cache );
- HDassert( type );
- HDassert( H5F_addr_defined(addr) );
- HDassert( len > 0 );
- HDassert( type->deserialize );
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->cache);
+ HDassert(type);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(type->get_load_size);
+ HDassert(type->deserialize);
+
+ /* Call the get_load_size callback, to retrieve the initial size of image */
+ if(type->get_load_size(udata, &len) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size")
/* Check for possible speculative read off the end of the file */
/* (Assume speculative reads will only occur if an image_len callback is defined) */
@@ -8353,7 +7523,7 @@ H5C_load_entry(H5F_t * f,
{
/* Trim down the length of the metadata */
- len = eoa - (addr + base_addr);
+ len = (size_t)(eoa - (addr + base_addr));
}
}
@@ -8529,39 +7699,6 @@ done:
*
* Programmer: John Mainzer, 5/14/04
*
- * Modifications:
- *
- * JRM --7/21/04
- * Minor modifications in support of the addition of a hash
- * table to facilitate lookups.
- *
- * JRM -- 11/22/04
- * Added the first_flush_ptr parameter, which replaces the
- * old first_flush local variable. This allows the function
- * to coordinate on the first flush issue with other functions.
- *
- * JRM -- 12/13/04
- * Added code to skip over epoch markers if present.
- *
- * JRM -- 1/3/06
- * Modified function to work correctly when the the cache
- * is not full. This case occurs when we need to flush to
- * min clean size before the cache has filled.
- *
- * JRM -- 3/29/07
- * Added sanity checks using the new is_read_only and
- * ro_ref_count fields.
- *
- * JRM -- 8/24/07
- * Reworked parameter list and code for the removal of the
- * secondary dxpl id, and the decision to store the file
- * pointer f in *cache_ptr.
- *
- * JRM -- 10/12/07
- * Added code to detect the case in which the LRU list has
- * been modified by a serialize callback, and cause the
- * function to re-start its scan at the tail of the LRU.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -8883,11 +8020,8 @@ done:
*
* Programmer: John Mainzer, 7/14/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#if H5C_DO_EXTREME_SANITY_CHECKS
static herr_t
@@ -9006,11 +8140,8 @@ done:
*
* Programmer: John Mainzer, 7/14/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#if H5C_DO_EXTREME_SANITY_CHECKS
static herr_t
@@ -9057,3 +8188,4 @@ done:
} /* H5C_verify_not_in_index() */
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
+
diff --git a/src/H5Cjournal.c b/src/H5Cjournal.c
index 3f8a110..e021b49 100644
--- a/src/H5Cjournal.c
+++ b/src/H5Cjournal.c
@@ -1027,14 +1027,13 @@ H5C_journal_transaction(H5F_t * f,
if ( resized )
{
- /* in the following protect/unprotect, the dxpl_id
- * is irrelement, as we know that the entry is in cache,
+ /* in the following protect/unprotect, the dxpl_id & udata
+ * are irrelement, as we know that the entry is in cache,
* and thus no I/O will take place.
*/
thing = H5C_protect(f, dxpl_id,
entry_ptr->type, entry_ptr->addr,
- entry_ptr->size, NULL,
- H5C__NO_FLAGS_SET);
+ NULL, H5C__NO_FLAGS_SET);
if ( thing == NULL ) {
@@ -3283,8 +3282,6 @@ done:
static herr_t
H5C_jb_aio__make_space_in_ring_buffer(H5C_jbrb_t * struct_ptr)
{
- hbool_t done = FALSE;
- hbool_t buf_write_complete;
herr_t ret_value = SUCCEED;
herr_t result;
uint64_t last_trans_in_ring_buffer;
@@ -3368,6 +3365,9 @@ H5C_jb_aio__make_space_in_ring_buffer(H5C_jbrb_t * struct_ptr)
}
#else /* delete this branch if all goes well -- JRM */
+{
+ hbool_t done = FALSE;
+ hbool_t buf_write_complete;
while ( ! done ) {
@@ -3431,6 +3431,7 @@ H5C_jb_aio__make_space_in_ring_buffer(H5C_jbrb_t * struct_ptr)
}
}
+}
#endif /* JRM */
HDassert( struct_ptr->writes_in_progress == struct_ptr->bufs_in_use );
@@ -3938,7 +3939,6 @@ H5C_jb_aio__queue_buffer_write(H5C_jbrb_t * struct_ptr,
int buf_num,
hbool_t partial_write_ok)
{
- hbool_t write_queued = FALSE;
int result;
int retries = -1;
#if H5C_JB_AIO__QUEUE_BUFFER_WRITE__DEBUG
@@ -3947,7 +3947,7 @@ H5C_jb_aio__queue_buffer_write(H5C_jbrb_t * struct_ptr,
uint64_t last_trans_in_buf;
herr_t herr_result;
herr_t ret_value = SUCCEED;
- hsize_t bytes_to_write;
+ size_t bytes_to_write;
void * buf_ptr = NULL;
struct aiocb * aiocb_ptr = NULL;
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 72d635e..6f53c4f 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -110,6 +110,39 @@ typedef struct H5C_t H5C_t;
* mem_type: Instance of H5FD_mem_t, that is used to supply the
* mem type passed into H5F_block_read().
*
+ * get_load_size: Pointer to the 'get load size' function.
+ *
+ * This function must be able to determing the size of a disk image for
+ * a metadata cache entry, given the 'udata' that will be passed to the
+ * 'deserialize' callback.
+ *
+ * The typedef for the deserialize callback is as follows:
+ *
+ * typedef herr_t (*H5C_get_load_size_func_t)(void *udata_ptr,
+ * size_t *image_len_ptr);
+ *
+ * The parameters of the deserialize callback are as follows:
+ *
+ * udata_ptr: Pointer to user data provided in the protect call, which
+ * will also be passed through to the deserialize callback.
+ *
+ * image_len_ptr: Length in bytes of the in file image to be deserialized.
+ *
+ * This parameter is used by the cache to determine the size of
+ * the disk image for the metadata, in order to read the disk
+ * image from the file.
+ *
+ * Processing in the get_load_size function should proceed as follows:
+ *
+ * If successful, the function will place the length of the on disk
+ * image associated with the in core representation provided in the
+ * thing parameter in *image_len_ptr, and then return SUCCEED.
+ *
+ * On failure, the function must return FAIL and push error information
+ * onto the error stack with the error API routines, without modifying
+ * the value pointed to by the image_len_ptr.
+ *
+ *
* deserialize: Pointer to the deserialize function.
*
* This function must be able to read an on disk image of a metadata
@@ -200,7 +233,8 @@ typedef struct H5C_t H5C_t;
* thing parameter in *image_len_ptr, and then return SUCCEED.
*
* On failure, the function must return FAIL and push error information
- * onto the error stack with the error API routines.
+ * onto the error stack with the error API routines, without modifying
+ * the value pointed to by the image_len_ptr.
*
*
* serialize: Pointer to the serialize callback.
@@ -371,10 +405,13 @@ typedef struct H5C_t H5C_t;
* modified since the last serialize of clear callback.
*
***************************************************************************/
+typedef herr_t (*H5C_get_load_size_func_t)(const void *udata_ptr,
+ size_t *image_len_ptr);
+
typedef void *(*H5C_deserialize_func_t)(const void *image_ptr,
size_t len,
- void * udata_ptr,
- hbool_t * dirty_ptr);
+ void *udata_ptr,
+ hbool_t *dirty_ptr);
typedef herr_t (*H5C_image_len_func_t)(const void *thing,
size_t *image_len_ptr);
@@ -386,23 +423,20 @@ typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f,
hid_t dxpl_id,
haddr_t addr,
size_t len,
- void * image_ptr,
- void * thing,
- unsigned * flags_ptr,
- haddr_t * new_addr_ptr,
- size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-
-typedef herr_t (*H5C_free_icr_func_t)(void * thing);
+ void *image_ptr,
+ void *thing,
+ unsigned *flags_ptr,
+ haddr_t *new_addr_ptr,
+ size_t *new_len_ptr,
+ void **new_image_ptr_ptr);
-typedef herr_t (*H5C_clear_dirty_bits_func_t)(haddr_t addr,
- size_t len,
- void * thing);
+typedef herr_t (*H5C_free_icr_func_t)(void *thing);
typedef struct H5C_class_t {
int id;
const char * name;
H5FD_mem_t mem_type;
+ H5C_get_load_size_func_t get_load_size;
H5C_deserialize_func_t deserialize;
H5C_image_len_func_t image_len;
H5C_serialize_func_t serialize;
@@ -1410,7 +1444,6 @@ H5_DLL void * H5C_protect(H5F_t * f,
hid_t dxpl_id,
const H5C_class_t * type,
haddr_t addr,
- size_t len,
void * udata,
unsigned flags);
diff --git a/src/H5FS.c b/src/H5FS.c
index 946db2f..8565d8b 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -194,7 +194,7 @@ HDfprintf(stderr, "%s: Opening free space manager, nclasses = %Zu\n", FUNC, ncla
cache_udata.addr = fs_addr;
/* Protect the free space header */
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header")
#ifdef QAK
HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
@@ -268,7 +268,7 @@ HDfprintf(stderr, "%s: Deleting free space manager\n", FUNC);
cache_udata.addr = fs_addr;
/* Protect the free space header */
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC_WRITE)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
/* Delete serialized section storage, if there are any */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 6b790fd..8d3ae88 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -75,6 +75,7 @@ static herr_t H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *
static herr_t H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata);
/* Metadata cache callbacks */
+static herr_t H5FS_cache_hdr_get_load_size(const void *udata, size_t *image_len);
static void *H5FS_cache_hdr_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5FS_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id,
@@ -82,6 +83,7 @@ static herr_t H5FS_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id,
haddr_t *new_addr, size_t *new_len, void **new_image);
static herr_t H5FS_cache_hdr_free_icr(void *thing);
+static herr_t H5FS_cache_sinfo_get_load_size(const void *udata, size_t *image_len);
static void *H5FS_cache_sinfo_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5FS_cache_sinfo_serialize(const H5F_t *f, hid_t dxpl_id,
@@ -99,6 +101,7 @@ const H5AC_class_t H5AC_FSPACE_HDR[1] = {{
H5AC_FSPACE_HDR_ID,
"Free space header",
H5FD_MEM_FSPACE_HDR,
+ H5FS_cache_hdr_get_load_size,
H5FS_cache_hdr_deserialize,
NULL,
H5FS_cache_hdr_serialize,
@@ -110,6 +113,7 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{
H5AC_FSPACE_SINFO_ID,
"Free space section info",
H5FD_MEM_FSPACE_SINFO,
+ H5FS_cache_sinfo_get_load_size,
H5FS_cache_sinfo_deserialize,
NULL,
H5FS_cache_sinfo_serialize,
@@ -129,6 +133,37 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{
/*-------------------------------------------------------------------------
+ * Function: H5FS_cache_hdr_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FS_cache_hdr_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5FS_hdr_cache_ud_t *udata = (const H5FS_hdr_cache_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_hdr_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5FS_HEADER_SIZE(udata->f);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FS_cache_hdr_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5FS_cache_hdr_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -171,7 +206,7 @@ H5FS_cache_hdr_deserialize(const void *image, size_t UNUSED len,
/* Compute the size of the free space header on disk */
size = H5FS_HEADER_SIZE(udata->f);
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC))
@@ -288,7 +323,7 @@ H5FS_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
size = H5FS_HEADER_SIZE(f);
/* Get temporary pointer to header */
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
HDmemcpy(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC);
@@ -376,7 +411,7 @@ H5FS_cache_hdr_free_icr(void *thing)
HDassert(thing);
/* Destroy free space header */
- if(H5FS_hdr_dest(thing) < 0)
+ if(H5FS_hdr_dest((H5FS_t *)thing) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header")
done:
@@ -385,6 +420,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5FS_cache_sinfo_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FS_cache_sinfo_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5FS_sinfo_cache_ud_t *udata = (const H5FS_sinfo_cache_ud_t *)_udata; /* user data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_cache_sinfo_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ H5_ASSIGN_OVERFLOW(/* To: */ *image_len, /* From: */ udata->fspace->alloc_sect_size, /* From: */ hsize_t, /* To: */ size_t);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FS_cache_sinfo_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5FS_cache_sinfo_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -430,7 +496,7 @@ H5FS_cache_sinfo_deserialize(const void *image, size_t UNUSED len,
H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ udata->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t);
/* Deserialize free sections from buffer available */
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC))
@@ -687,7 +753,7 @@ H5FS_cache_sinfo_serialize(const H5F_t * f, hid_t UNUSED dxpl_id, haddr_t UNUSED
/* Allocate temporary buffer */
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
HDmemcpy(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC);
@@ -759,7 +825,7 @@ H5FS_cache_sinfo_free_icr(void *thing)
HDassert(thing);
/* Destroy free space info */
- if(H5FS_sinfo_dest(thing) < 0)
+ if(H5FS_sinfo_dest((H5FS_sinfo_t *)thing) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info")
done:
diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c
index 4bd8732..5e69281 100644
--- a/src/H5FSdbg.c
+++ b/src/H5FSdbg.c
@@ -117,7 +117,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int
/*
* Load the free space header.
*/
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header")
/* Print opening message */
@@ -260,7 +260,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int
/*
* Load the free space header.
*/
- if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, H5FS_HEADER_SIZE(f), &cache_udata, H5AC_READ)))
+ if(NULL == (fspace = H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header")
/* Retrieve the client id */
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 6134b05..d370478 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -238,7 +238,7 @@ HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n",
cache_udata.fspace = fspace;
cache_udata.f = f;
cache_udata.dxpl_id = dxpl_id;
- if(NULL == (sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, (size_t)fspace->alloc_sect_size, &cache_udata, H5AC_WRITE)))
+ if(NULL == (sinfo = H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space sections")
/* Pin them in the cache */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 98510ec..67d3dff 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -75,6 +75,7 @@ typedef struct H5G_node_t {
static size_t H5G_node_size_real(const H5F_t *f);
/* Metadata cache callbacks */
+static herr_t H5G_node_get_load_size(const void *udata, size_t *image_len);
static void *H5G_node_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5G_node_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
@@ -109,6 +110,7 @@ const H5AC_class_t H5AC_SNODE[1] = {{
H5AC_SNODE_ID,
"symbol table node",
H5FD_MEM_BTREE,
+ H5G_node_get_load_size,
H5G_node_deserialize,
NULL,
H5G_node_serialize,
@@ -260,7 +262,7 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key,
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:");
- s = H5HL_offset_into(udata->heap, key->offset);
+ s = (const char *)H5HL_offset_into(udata->heap, key->offset);
HDfprintf(stream, "%s\n", s);
} /* end if */
else
@@ -330,6 +332,37 @@ H5G_node_free(H5G_node_t *sym)
/*-------------------------------------------------------------------------
+ * Function: H5G_node_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_node_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5F_t *f = (const H5F_t *)_udata; /* Get file pointer from user data */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_load_size)
+
+ /* Check arguments */
+ HDassert(f);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5G_node_size_real(f);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5G_node_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5G_node_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -359,7 +392,7 @@ H5G_node_deserialize(const void *image, size_t UNUSED len, void *udata,
HDassert(f);
/* Get temporary pointer to serialized symbol table node */
- p = image;
+ p = (const uint8_t *)image;
/* magic */
if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC))
@@ -433,7 +466,7 @@ H5G_node_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
HDassert(flags);
/* Set the local pointer into the serialized image */
- p = image;
+ p = (uint8_t *)image;
/* magic number */
HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC);
@@ -493,7 +526,7 @@ H5G_node_free_icr(void *thing)
HDassert(thing);
/* Destroy symbol table node */
- if(H5G_node_free(thing) < 0)
+ if(H5G_node_free((H5G_node_t *)thing) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node")
done:
@@ -565,8 +598,8 @@ done:
if(ret_value < 0) {
if(sym != NULL) {
if(sym->entry != NULL)
- H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
- H5FL_FREE(H5G_node_t, sym);
+ sym->entry = H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
+ sym = H5FL_FREE(H5G_node_t, sym);
} /* end if */
} /* end if */
@@ -615,7 +648,7 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key)
HDassert(rt_key);
/* Get base address of heap */
- base = H5HL_offset_into(udata->heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->heap, (size_t)0);
HDassert(base);
/* Get pointers to string names */
@@ -674,7 +707,7 @@ H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key)
HDassert(rt_key);
/* Get base address of heap */
- base = H5HL_offset_into(udata->heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->heap, (size_t)0);
HDassert(base);
/* left side */
@@ -742,11 +775,11 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
/*
* Load the symbol table node for exclusive access.
*/
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node")
/* Get base address of heap */
- base = H5HL_offset_into(udata->common.heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0);
HDassert(base);
/*
@@ -848,11 +881,11 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
/*
* Load the symbol node.
*/
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_WRITE)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node")
/* Get base address of heap */
- base = H5HL_offset_into(udata->common.heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0);
HDassert(base);
/*
@@ -891,7 +924,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
if(H5G_node_create(f, dxpl_id, H5B_INS_FIRST, NULL, NULL, NULL, new_node_p/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node")
- if(NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, H5G_node_size_real(f), f, H5AC_WRITE)))
+ if(NULL == (snrt = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node")
HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
@@ -1005,7 +1038,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
HDassert(udata && udata->common.heap);
/* Load the symbol table */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_WRITE)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_WRITE)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node")
/* "Normal" removal of a single entry from the symbol table node */
@@ -1015,7 +1048,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
const char *base; /* Base of heap */
/* Get base address of heap */
- base = H5HL_offset_into(udata->common.heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0);
/* Find the name with a binary search */
rt = sn->nsyms;
@@ -1035,7 +1068,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found")
/* Get a pointer to the name of the link */
- if(NULL == (lnk.name = H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
+ if(NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link name")
/* Set up rest of link structure */
@@ -1044,7 +1077,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
lnk.cset = H5T_CSET_ASCII;
if(sn->entry[idx].type == H5G_CACHED_SLINK) {
lnk.type = H5L_TYPE_SOFT;
- lnk.u.soft.name = H5HL_offset_into(udata->common.heap, sn->entry[idx].cache.slink.lval_offset);
+ lnk.u.soft.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].cache.slink.lval_offset);
} /* end if */
else {
lnk.type = H5L_TYPE_HARD;
@@ -1215,7 +1248,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad
HDassert(udata && udata->heap);
/* Protect the symbol table node & local heap while we iterate over entries */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
/*
@@ -1229,7 +1262,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad
const char *name; /* Pointer to link name in heap */
/* Get the pointer to the name of the link in the heap */
- name = H5HL_offset_into(udata->heap, ents[u].name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, ents[u].name_off);
HDassert(name);
/* Convert the entry to a link */
@@ -1292,7 +1325,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr
HDassert(num_objs);
/* Find the object node and add the number of symbol entries. */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
*num_objs += sn->nsyms;
@@ -1337,7 +1370,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add
HDassert(udata);
/* Get a pointer to the symbol table node */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node");
/* Find the node, locate the object symbol table entry and retrieve the name */
@@ -1475,7 +1508,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
HDassert(udata);
/* load the symbol table into memory from the source file */
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
/* get the base address of the heap */
@@ -1543,7 +1576,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* Construct link information for eventual insertion */
lnk.type = H5L_TYPE_SOFT;
- lnk.u.soft.name = H5HL_offset_into(heap, src_ent->cache.slink.lval_offset);
+ lnk.u.soft.name = (char *)H5HL_offset_into(heap, src_ent->cache.slink.lval_offset);
} /* else if */
else
HDassert(0 && "Unknown entry type");
@@ -1555,7 +1588,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* lnk.name = name; */ /* This will be set in callback */
/* Determine name of source object */
- name = H5HL_offset_into(heap, src_ent->name_off);
+ name = (const char *)H5HL_offset_into(heap, src_ent->name_off);
HDassert(name);
/* Insert the new object in the destination file's group */
@@ -1610,7 +1643,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_
* Save information about the symbol table node since we can't lock it
* because we're about to call an application function.
*/
- if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ)))
+ if(NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node")
/* Check if the link table needs to be extended */
@@ -1619,7 +1652,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_
H5O_link_t *x; /* Pointer to larger array of links */
/* Re-allocate the link table */
- if((x = H5MM_realloc(udata->ltable->lnks, sizeof(H5O_link_t) * na)) == NULL)
+ if((x = (H5O_link_t *)H5MM_realloc(udata->ltable->lnks, sizeof(H5O_link_t) * na)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
udata->ltable->lnks = x;
} /* end if */
@@ -1630,7 +1663,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_
unsigned linkno; /* Link allocated */
/* Get pointer to link's name in the heap */
- name = H5HL_offset_into(udata->heap, sn->entry[u].name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, sn->entry[u].name_off);
HDassert(name);
/* Determine the link to operate on in the table */
@@ -1724,7 +1757,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
* If we couldn't load the symbol table node, then try loading the
* B-tree node.
*/
- if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, H5G_node_size_real(f), f, H5AC_READ))) {
+ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, f, H5AC_READ))) {
H5G_bt_common_t udata; /*data to pass through B-tree */
H5E_clear_stack(NULL); /* discard that error */
@@ -1749,7 +1782,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
fprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u);
if(heap) {
- const char *s = H5HL_offset_into(heap, sn->entry[u].name_off);
+ const char *s = (const char *)H5HL_offset_into(heap, sn->entry[u].name_off);
if(s)
fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s);
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index e20ee87..548c37f 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -51,12 +51,6 @@
#define H5HF_DBLOCK_VERSION 0 /* Direct block */
#define H5HF_IBLOCK_VERSION 0 /* Indirect block */
-/* Size of stack buffer for serialized headers */
-#define H5HF_HDR_BUF_SIZE 512
-
-/* Size of stack buffer for serialized indirect blocks */
-#define H5HF_IBLOCK_BUF_SIZE 4096
-
/******************/
/* Local Typedefs */
@@ -77,6 +71,7 @@ static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dt
static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable);
/* Metadata cache (H5AC) callbacks */
+static herr_t H5HF_cache_hdr_get_load_size(const void *udata, size_t *image_len);
static void *H5HF_cache_hdr_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr);
@@ -85,6 +80,7 @@ static herr_t H5HF_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id,
haddr_t *new_addr, size_t *new_len, void **new_image);
static herr_t H5HF_cache_hdr_free_icr(void *thing);
+static herr_t H5HF_cache_iblock_get_load_size(const void *udata, size_t *image_len);
static void *H5HF_cache_iblock_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, hid_t dxpl_id,
@@ -92,6 +88,7 @@ static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, hid_t dxpl_id,
haddr_t *new_addr, size_t *new_len, void **new_image);
static herr_t H5HF_cache_iblock_free_icr(void *thing);
+static herr_t H5HF_cache_dblock_get_load_size(const void *udata, size_t *image_len);
static void *H5HF_cache_dblock_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HF_cache_dblock_serialize(const H5F_t * f, hid_t dxpl_id,
@@ -109,6 +106,7 @@ const H5AC_class_t H5AC_FHEAP_HDR[1] = {{
H5AC_FHEAP_HDR_ID,
"fractal heap header",
H5FD_MEM_FHEAP_HDR,
+ H5HF_cache_hdr_get_load_size,
H5HF_cache_hdr_deserialize,
H5HF_cache_hdr_image_len,
H5HF_cache_hdr_serialize,
@@ -120,6 +118,7 @@ const H5AC_class_t H5AC_FHEAP_IBLOCK[1] = {{
H5AC_FHEAP_IBLOCK_ID,
"fractal heap indirect block",
H5FD_MEM_FHEAP_IBLOCK,
+ H5HF_cache_iblock_get_load_size,
H5HF_cache_iblock_deserialize,
NULL,
H5HF_cache_iblock_serialize,
@@ -131,6 +130,7 @@ const H5AC_class_t H5AC_FHEAP_DBLOCK[1] = {{
H5AC_FHEAP_DBLOCK_ID,
"fractal head direct block",
H5FD_MEM_FHEAP_DBLOCK,
+ H5HF_cache_dblock_get_load_size,
H5HF_cache_dblock_deserialize,
NULL,
H5HF_cache_dblock_serialize,
@@ -253,6 +253,37 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable)
/*-------------------------------------------------------------------------
+ * Function: H5HF_cache_hdr_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HF_cache_hdr_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HF_hdr_cache_ud_t *udata = (const H5HF_hdr_cache_ud_t *)_udata;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_hdr_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5HF_SPEC_READ_SIZE(udata->f);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_cache_hdr_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_cache_hdr_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -292,7 +323,7 @@ H5HF_cache_hdr_deserialize(const void *image, size_t UNUSED len,
size = H5HF_HEADER_SIZE(hdr);
/* Get temporary pointer to serialized header */
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
@@ -343,7 +374,7 @@ H5HF_cache_hdr_deserialize(const void *image, size_t UNUSED len,
/* Check for I/O filter information to decode */
if(hdr->filter_len > 0) {
- size_t filter_info_off; /* Offset in header of filter information */
+ ptrdiff_t filter_info_off; /* Offset in header of filter information */
size_t filter_info_size; /* Size of filter information */
H5O_pline_t *pline; /* Pipeline information from the header on disk */
@@ -492,7 +523,7 @@ H5HF_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
size = hdr->heap_size;
/* Get temporary pointer to serialized header */
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
HDmemcpy(p, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
@@ -595,7 +626,7 @@ H5HF_cache_hdr_free_icr(void *thing)
HDassert(thing);
/* Destroy fractal heap header */
- if(H5HF_hdr_dest(thing) < 0)
+ if(H5HF_hdr_dest((H5HF_hdr_t *)thing) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap header")
done:
@@ -604,6 +635,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_cache_iblock_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HF_cache_iblock_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HF_iblock_cache_ud_t *udata = (const H5HF_iblock_cache_ud_t *)_udata; /* user data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5HF_IBLOCK_SIZE(udata->par_info->hdr, *udata->nrows);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_cache_iblock_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_cache_iblock_deserialize
*
* Purpose: Loads a fractal heap indirect block from the disk.
@@ -660,8 +722,9 @@ H5HF_cache_iblock_deserialize(const void *image, size_t UNUSED len,
/* Compute size of indirect block */
iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock);
+
/* Get temporary pointer to serialized indirect block */
- p = image;
+ p = (const uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
@@ -819,7 +882,6 @@ H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
#endif /* NDEBUG */
uint32_t metadata_chksum; /* Computed metadata checksum value */
size_t u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_serialize)
@@ -835,7 +897,7 @@ H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
hdr->f = f;
/* Get temporary pointer to buffer for serialized indirect block */
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
HDmemcpy(p, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
@@ -906,8 +968,7 @@ H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
HDassert(max_child == iblock->max_child);
#endif /* NDEBUG */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF_cache_iblock_serialize() */
@@ -936,7 +997,7 @@ H5HF_cache_iblock_free_icr(void *thing)
HDassert(thing);
/* Destroy fractal heap indirect block */
- if(H5HF_man_iblock_dest(thing) < 0)
+ if(H5HF_man_iblock_dest((H5HF_indirect_t *)thing) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block")
done:
@@ -945,6 +1006,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_cache_dblock_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HF_cache_dblock_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HF_dblock_cache_ud_t *udata = (const H5HF_dblock_cache_ud_t *)_udata; /* pointer to user data */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_dblock_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = udata->odi_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_cache_dblock_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_cache_dblock_deserialize
*
* Purpose: Given a direct block disk image, construct and return the
@@ -1401,7 +1493,7 @@ H5HF_cache_dblock_free_icr(void *thing)
HDassert(thing);
/* Destroy fractal heap direct block */
- if(H5HF_man_dblock_dest(thing) < 0)
+ if(H5HF_man_dblock_dest((H5HF_direct_t *)thing) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block")
done:
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index c67874a..1c470b5 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -189,7 +189,8 @@ HDmemset(dblock->blk, 0, dblock->size);
done:
if(ret_value < 0)
if(dblock)
- H5HF_man_dblock_dest(dblock);
+ if(H5HF_man_dblock_dest(dblock) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_dblock_create() */
@@ -429,13 +430,6 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr,
{
H5HF_direct_t *dblock; /* Direct block from cache */
H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */
- size_t odi_size; /* On disk image size of the direct block.
- * Note that there is no necessary relation
- * between this value, and the actual
- * direct block size, as conpression may
- * reduce the size of the on disk image,
- * and check sums may increase it.
- */
H5HF_direct_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect)
@@ -463,7 +457,7 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr,
*/
if(hdr->filter_len > 0) {
if(par_iblock == NULL) {
- odi_size = hdr->pline_root_direct_size;
+ udata.odi_size = hdr->pline_root_direct_size;
udata.filter_mask = hdr->pline_root_direct_filter_mask;
} /* end if */
else {
@@ -471,17 +465,17 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr,
HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr));
/* Set up parameters to read filtered direct block */
- odi_size = par_iblock->filt_ents[par_entry].size;
+ udata.odi_size = par_iblock->filt_ents[par_entry].size;
udata.filter_mask = par_iblock->filt_ents[par_entry].filter_mask;
} /* end else */
} /* end if */
else {
- odi_size = dblock_size;
+ udata.odi_size = dblock_size;
udata.filter_mask = 0;
} /* end else */
/* Protect the direct block */
- if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, odi_size, &udata, rw)))
+ if(NULL == (dblock = (H5HF_direct_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block")
/* Set the return value */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 7656469..3370ae0 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -537,7 +537,7 @@ H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
cache_udata.dxpl_id = dxpl_id;
/* Lock the heap header into memory */
- if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, (size_t)H5HF_SPEC_READ_SIZE(f), &cache_udata, rw)))
+ if(NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, addr, &cache_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header")
/* Set the header's address */
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 3ce6816..4d6d585 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -1129,7 +1129,7 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr,
cache_udata.nrows = &iblock_nrows;
/* Protect the indirect block */
- if(NULL == (iblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, H5HF_IBLOCK_SIZE(hdr, iblock_nrows), &cache_udata, rw)))
+ if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &cache_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block")
/* Set the indirect block's address */
@@ -1602,11 +1602,11 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock)
/* Release entry tables */
if(iblock->ents)
- H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents);
+ iblock->ents = H5FL_SEQ_FREE(H5HF_indirect_ent_t, iblock->ents);
if(iblock->filt_ents)
- H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents);
+ iblock->filt_ents = H5FL_SEQ_FREE(H5HF_indirect_filt_ent_t, iblock->filt_ents);
if(iblock->child_iblocks)
- H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks);
+ iblock->child_iblocks = H5FL_SEQ_FREE(H5HF_indirect_ptr_t, iblock->child_iblocks);
/* Free fractal heap indirect block info */
iblock = H5FL_FREE(H5HF_indirect_t, iblock);
diff --git a/src/H5HFiter.c b/src/H5HFiter.c
index 4dbb186..2c4a720 100644
--- a/src/H5HFiter.c
+++ b/src/H5HFiter.c
@@ -396,7 +396,7 @@ H5HF_man_iter_reset(H5HF_block_iter_t *biter)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
/* Free the current location context */
- H5FL_FREE(H5HF_block_loc_t, curr_loc);
+ curr_loc = H5FL_FREE(H5HF_block_loc_t, curr_loc);
/* Advance to next location */
curr_loc = next_loc;
@@ -488,7 +488,7 @@ H5HF_man_iter_up(H5HF_block_iter_t *biter)
up_loc = biter->curr->up;
/* Release this location */
- H5FL_FREE(H5HF_block_loc_t, biter->curr);
+ biter->curr = H5FL_FREE(H5HF_block_loc_t, biter->curr);
/* Point location to next location up */
biter->curr = up_loc;
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 8e87e88..c7cbddc 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -550,6 +550,13 @@ typedef struct H5HF_iblock_cache_ud_t {
typedef struct H5HF_dblock_cache_ud_t {
H5HF_parent_t par_info; /* Parent info */
H5F_t * f; /* File pointer */
+ size_t odi_size; /* On disk image size of the direct block.
+ * Note that there is no necessary relation
+ * between this value, and the actual
+ * direct block size, as conpression may
+ * reduce the size of the on disk image,
+ * and check sums may increase it.
+ */
size_t dblock_size; /* size of the direct block, which bears
* no necessary relation to the block
* odi_size -- the size of the on disk
diff --git a/src/H5HG.c b/src/H5HG.c
index 90c8751..7ce4101 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -266,7 +266,7 @@ H5HG_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
HDassert(H5F_addr_defined(addr));
/* Lock the heap into memory */
- if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, (size_t)H5HG_SPEC_READ_SIZE, f, rw)))
+ if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, f, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap")
/* Set the heap's address */
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 397000b..e92a712 100755
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -46,6 +46,8 @@
/* Local Macros */
/****************/
+#define H5HG_SPEC_READ_SIZE 4096
+
/******************/
/* Local Typedefs */
@@ -62,6 +64,7 @@
/********************/
/* Metadata cache callbacks */
+static herr_t H5HG_get_load_size(const void *udata, size_t *image_len);
static void *H5HG_deserialize(const void *image, size_t len, void *udata,
hbool_t *dirty);
static herr_t H5HG_image_len(const void *thing, size_t *image_len_ptr);
@@ -82,6 +85,7 @@ const H5AC_class_t H5AC_GHEAP[1] = {{
H5AC_GHEAP_ID,
"global heap",
H5FD_MEM_GHEAP,
+ H5HG_get_load_size,
H5HG_deserialize,
H5HG_image_len,
H5HG_serialize,
@@ -101,6 +105,37 @@ const H5AC_class_t H5AC_GHEAP[1] = {{
/*-------------------------------------------------------------------------
+ * Function: H5HG_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HG_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5F_t *f = (const H5F_t *)_udata;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_get_load_size)
+
+ /* Check arguments */
+ HDassert(f);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5HG_SPEC_READ_SIZE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HG_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HG_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -134,7 +169,7 @@ H5HG_deserialize(const void *image, size_t UNUSED len, void *_udata,
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
heap->shared = f->shared;
- p = image;
+ p = (uint8_t *)image;
/* Magic number */
if(HDmemcmp(p, H5HG_MAGIC, (size_t)H5HG_SIZEOF_MAGIC))
@@ -163,10 +198,11 @@ H5HG_deserialize(const void *image, size_t UNUSED len, void *_udata,
/* Decode each object */
p = heap->chunk + H5HG_SIZEOF_HDR(f);
- nalloc = H5HG_NOBJS(f, heap->size);
+
/* Calloc the obj array because the file format spec makes no guarantee
* about the order of the objects, and unused slots must be set to zero.
*/
+ nalloc = H5HG_NOBJS(f, heap->size);
if(NULL == (heap->obj = H5FL_SEQ_CALLOC(H5HG_obj_t, nalloc)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
heap->nalloc = nalloc;
@@ -398,7 +434,7 @@ H5HG_free_icr(void *thing)
HDassert(thing);
/* Destroy global heap collection */
- if(H5HG_free(thing) < 0)
+ if(H5HG_free((H5HG_heap_t *)thing) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap")
done:
diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h
index 962623f..6c60656 100644
--- a/src/H5HGpkg.h
+++ b/src/H5HGpkg.h
@@ -117,7 +117,6 @@ H5FL_BLK_EXTERN(gheap_chunk);
#define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \
H5HG_SIZEOF_OBJHDR(f)+2))
-#define H5HG_SPEC_READ_SIZE 4096
/****************************/
/* Package Private Typedefs */
diff --git a/src/H5HL.c b/src/H5HL.c
index 8c16692..17861eb 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -49,12 +49,6 @@
#define H5HL_MIN_HEAP 128 /* Minimum size to reduce heap buffer to */
-/* Set the local heap size to speculatively read in */
-/* (needs to be more than the local heap prefix size to work at all and
- * should be larger than the default local heap size to save the
- * extra I/O operations) */
-#define H5HL_SPEC_READ_SIZE 512
-
/******************/
/* Local Typedefs */
@@ -463,7 +457,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, H5HL_SPEC_READ_SIZE, &prfx_udata, rw)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix")
/* Get the pointer to the heap */
@@ -487,7 +481,7 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
dblk_udata.loaded = FALSE;
/* Protect the local heap data block */
- if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, heap->dblk_size, &dblk_udata, rw)))
+ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, &dblk_udata, rw)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block")
/* Pin the prefix, if the data block was loaded from file */
@@ -1085,7 +1079,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, H5HL_SPEC_READ_SIZE, &prfx_udata, H5AC_WRITE)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
/* Get the pointer to the heap */
@@ -1102,7 +1096,7 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
dblk_udata.loaded = FALSE;
/* Protect the local heap data block */
- if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, heap->dblk_size, &dblk_udata, H5AC_WRITE)))
+ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, &dblk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block")
/* Pin the prefix, if the data block was loaded from file */
@@ -1185,7 +1179,7 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, H5HL_SPEC_READ_SIZE, &prfx_udata, H5AC_READ)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
/* Get the pointer to the heap */
@@ -1240,7 +1234,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size)
prfx_udata.free_block = H5HL_FREE_NULL;
/* Protect the local heap prefix */
- if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, H5HL_SPEC_READ_SIZE, &prfx_udata, H5AC_READ)))
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC_READ)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
/* Get the pointer to the heap */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 39d9789..643d3d6 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -49,6 +49,12 @@
/* Value indicating end of free list on disk */
#define H5HL_FREE_NULL 1
+/* Set the local heap size to speculatively read in */
+/* (needs to be more than the local heap prefix size to work at all and
+ * should be larger than the default local heap size to save the
+ * extra I/O operations) */
+#define H5HL_SPEC_READ_SIZE 512
+
/******************/
/* Local Typedefs */
@@ -65,6 +71,7 @@
/********************/
/* Metadata cache callbacks */
+static herr_t H5HL_prfx_get_load_size(const void *_udata, size_t *image_len);
static void *H5HL_prfx_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HL_prfx_image_len(const void *thing, size_t *image_len_ptr);
@@ -73,6 +80,7 @@ static herr_t H5HL_prfx_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, s
size_t *new_len, void **new_image);
static herr_t H5HL_prfx_free_icr(void *thing);
+static herr_t H5HL_dblk_get_load_size(const void *_udata, size_t *image_len);
static void *H5HL_dblk_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5HL_dblk_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t len,
@@ -92,6 +100,7 @@ const H5AC_class_t H5AC_LHEAP_PRFX[1] = {{
H5AC_LHEAP_PRFX_ID,
"local heap prefix",
H5FD_MEM_LHEAP,
+ H5HL_prfx_get_load_size,
H5HL_prfx_deserialize,
H5HL_prfx_image_len,
H5HL_prfx_serialize,
@@ -105,6 +114,7 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{
H5AC_LHEAP_DBLK_ID,
"local heap data block",
H5FD_MEM_LHEAP,
+ H5HL_dblk_get_load_size,
H5HL_dblk_deserialize,
NULL,
H5HL_dblk_serialize,
@@ -230,6 +240,37 @@ H5HL_fl_serialize(const H5HL_t *heap)
/*-------------------------------------------------------------------------
+ * Function: H5HL_prfx_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_prfx_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HL_cache_prfx_ud_t *udata = (const H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_prfx_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5HL_SPEC_READ_SIZE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_prfx_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HL_prfx_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -491,6 +532,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HL_dblk_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_dblk_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5HL_cache_dblk_ud_t *udata = (const H5HL_cache_dblk_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_dblk_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = udata->heap->dblk_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_dblk_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HL_dblk_deserialize
*
* Purpose: Deserialize the data structure from disk.
diff --git a/src/H5O.c b/src/H5O.c
index ada6e2a..74e194a 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -52,12 +52,6 @@
/* Local Macros */
/****************/
-/* Set the object header size to speculatively read in */
-/* (needs to be more than the object header prefix size to work at all and
- * should be larger than the largest object type's default object header
- * size to save the extra I/O operations) */
-#define H5O_SPEC_READ_SIZE 512
-
/******************/
/* Local Typedefs */
@@ -1586,7 +1580,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
udata.common.addr = loc->addr;
/* Lock the object header into the cache */
- if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, (size_t)H5O_SPEC_READ_SIZE, &udata, prot)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, &udata, prot)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check if there are any continuation messages to process */
@@ -1621,7 +1615,8 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
/* Bring the chunk into the cache */
/* (which adds to the object header */
chk_udata.common.addr = cont_msg_info.msgs[curr_msg].addr;
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, cont_msg_info.msgs[curr_msg].size, &chk_udata, prot)))
+ chk_udata.size = cont_msg_info.msgs[curr_msg].size;
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, &chk_udata, prot)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
/* Sanity check */
@@ -1871,7 +1866,7 @@ herr_t
H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
- hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
time_t now; /* Current time */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 71de295..2adf3a9 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -234,7 +234,7 @@ H5O_eliminate_gap(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg,
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
uint8_t *move_start, *move_end; /* Pointers to area of messages to move */
- hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */
+ hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_eliminate_gap)
@@ -520,8 +520,8 @@ static htri_t
H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
size_t size, unsigned * msg_idx)
{
- H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
- hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
+ H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
size_t delta; /* Change in chunk's size */
size_t aligned_size = H5O_ALIGN_OH(oh, size);
uint8_t *old_image; /* Old address of chunk's image in memory */
@@ -680,7 +680,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
if(chunkno > 0 && (H5O_CONT_ID == oh->mesg[u].type->id) &&
(((H5O_cont_t *)(oh->mesg[u].native))->chunkno == chunkno)) {
H5O_chunk_proxy_t *chk_proxy2 = NULL; /* Chunk that continuation message is in */
- hbool_t chk_dirtied2 = FALSE; /* Flags for unprotecting chunk */
+ hbool_t chk_dirtied2 = FALSE; /* Flag for unprotecting chunk */
unsigned cont_chunkno = oh->mesg[u].chunkno; /* Chunk # for continuation message */
/* Protect chunk containing continuation message */
@@ -1150,9 +1150,9 @@ herr_t
H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg,
hbool_t adj_link)
{
- H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
- hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_release_mesg, FAIL)
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 6e7c3ac..1304340 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -822,8 +822,8 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
{
H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
- hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_write_cb)
@@ -1030,8 +1030,8 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
- hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_rename_mod_cb)
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 7622898..0955151 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -44,6 +44,12 @@
/* Local Macros */
/****************/
+/* Set the object header size to speculatively read in */
+/* (needs to be more than the object header prefix size to work at all and
+ * should be larger than the largest object type's default object header
+ * size to save the extra I/O operations) */
+#define H5O_SPEC_READ_SIZE 512
+
/******************/
/* Local Typedefs */
@@ -60,6 +66,7 @@
/********************/
/* Metadata cache callbacks */
+static herr_t H5O_cache_get_load_size(const void *_udata, size_t *image_len);
static void *H5O_cache_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5O_cache_image_len(const void *thing, size_t *image_len_ptr);
@@ -68,6 +75,7 @@ static herr_t H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
size_t *new_len, void **new_image);
static herr_t H5O_cache_free_icr(void *thing);
+static herr_t H5O_cache_chk_get_load_size(const void *_udata, size_t *image_len);
static void *H5O_cache_chk_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5O_cache_chk_serialize(const H5F_t *f, hid_t dxpl_id,
@@ -98,6 +106,7 @@ const H5AC_class_t H5AC_OHDR[1] = {{
H5AC_OHDR_ID,
"object header",
H5FD_MEM_OHDR,
+ H5O_cache_get_load_size,
H5O_cache_deserialize,
H5O_cache_image_len,
H5O_cache_serialize,
@@ -109,6 +118,7 @@ const H5AC_class_t H5AC_OHDR_CHK[1] = {{
H5AC_OHDR_CHK_ID,
"object header chunk",
H5FD_MEM_OHDR,
+ H5O_cache_chk_get_load_size,
H5O_cache_chk_deserialize,
NULL,
H5O_cache_chk_serialize,
@@ -137,6 +147,37 @@ H5FL_SEQ_DEFINE(H5O_cont_t);
/*-------------------------------------------------------------------------
+ * Function: H5O_cache_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_cache_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5O_cache_ud_t *udata = (const H5O_cache_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5O_SPEC_READ_SIZE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_cache_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_cache_deserialize
*
* Purpose: Deserializes an object header prefix + first chunk
@@ -178,7 +219,7 @@ H5O_cache_deserialize(const void *image, size_t len, void *_udata,
oh->sizeof_addr = H5F_SIZEOF_ADDR(udata->common.f);
/* Get temporary pointer to serialized header */
- p = image;
+ p = (const uint8_t *)image;
/* Check for presence of magic number */
/* (indicates version 2 or later) */
@@ -297,7 +338,7 @@ H5O_cache_deserialize(const void *image, size_t len, void *_udata,
*/
if(len >= (oh->chunk0_size + H5O_SIZEOF_HDR(oh))) {
/* Parse the first chunk */
- if(H5O_chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, image, &(udata->common), dirty) < 0)
+ if(H5O_chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, (const uint8_t *)image, &(udata->common), dirty) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk")
} /* end if */
else
@@ -366,7 +407,7 @@ H5O_cache_image_len(const void *thing, size_t *image_len_ptr)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr,
+H5O_cache_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
size_t UNUSED len, void *image, void *_thing, unsigned *flags,
haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image)
{
@@ -473,7 +514,7 @@ H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr,
HDassert((size_t)(p - (uint8_t *)oh->chunk[0].image) == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
/* Serialize messages for this chunk */
- if(H5O_chunk_serialize(f, oh, (unsigned)0, image) < 0)
+ if(H5O_chunk_serialize(f, oh, (unsigned)0, (uint8_t *)image) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize first object header chunk")
/* Reset the cache flags for this operation */
@@ -521,6 +562,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_cache_chk_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_cache_chk_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5O_chk_cache_ud_t *udata = (const H5O_chk_cache_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_cache_chk_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = udata->size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_cache_chk_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_cache_chk_deserialize
*
* Purpose: Deserializes an object header continuation chunk
@@ -562,7 +634,7 @@ H5O_cache_chk_deserialize(const void *image, size_t len, void *_udata,
HDassert(udata->common.cont_msg_info);
/* Parse the chunk */
- if(H5O_chunk_deserialize(udata->oh, udata->common.addr, len, image, &(udata->common), dirty) < 0)
+ if(H5O_chunk_deserialize(udata->oh, udata->common.addr, len, (const uint8_t *)image, &(udata->common), dirty) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk")
/* Set the fields for the chunk proxy */
@@ -631,7 +703,7 @@ H5O_cache_chk_serialize(const H5F_t *f, hid_t UNUSED dxpl_id,
HDassert(flags);
/* Serialize messages for this chunk */
- if(H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno, image) < 0)
+ if(H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno, (uint8_t *)image) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header chunk")
/* Reset the cache flags for this operation */
diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c
index 769b8a5..ee321e8 100644
--- a/src/H5Ochunk.c
+++ b/src/H5Ochunk.c
@@ -173,9 +173,10 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HDmemset(&chk_udata, 0, sizeof(chk_udata));
chk_udata.oh = oh;
chk_udata.chunkno = idx;
+ chk_udata.size = oh->chunk[idx].size;
/* Get the chunk proxy */
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, oh->chunk[idx].size, &chk_udata, H5AC_WRITE)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
/* Sanity check */
@@ -317,9 +318,10 @@ H5O_chunk_update_idx(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HDmemset(&chk_udata, 0, sizeof(chk_udata));
chk_udata.oh = oh;
chk_udata.chunkno = idx;
+ chk_udata.size = oh->chunk[idx].size;
/* Get the chunk proxy */
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, oh->chunk[idx].size, &chk_udata, H5AC_WRITE)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Update index for chunk proxy in cache */
@@ -368,9 +370,10 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
HDmemset(&chk_udata, 0, sizeof(chk_udata));
chk_udata.oh = oh;
chk_udata.chunkno = idx;
+ chk_udata.size = oh->chunk[idx].size;
/* Get the chunk proxy */
- if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, oh->chunk[idx].size, &chk_udata, H5AC_WRITE)))
+ if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
/* Sanity check */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index bdbc726..bb02473 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1996,7 +1996,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
{
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
H5O_mesg_t *idx_msg = &oh->mesg[idx]; /* Pointer to message to modify */
- hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */
+ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_copy_mesg)
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 57bdc0e..96ea7f8 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -361,6 +361,7 @@ typedef struct H5O_chk_cache_ud_t {
hbool_t decoding; /* Whether the object header is being decoded */
H5O_t *oh; /* Object header for this chunk */
unsigned chunkno; /* Index of chunk being brought in (for re-loads) */
+ size_t size; /* Size of chunk in the file */
H5O_common_cache_ud_t common; /* Common object header cache callback info */
} H5O_chk_cache_ud_t;
@@ -547,7 +548,7 @@ H5_DLL herr_t H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx);
H5_DLL H5O_chunk_proxy_t *H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
unsigned idx);
H5_DLL herr_t H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- H5O_chunk_proxy_t *chk_proxy, hbool_t dirtied);
+ H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied);
H5_DLL herr_t H5O_chunk_update_idx(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy);
H5_DLL herr_t H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx);
diff --git a/src/H5SM.c b/src/H5SM.c
index 4d0cfeb..48d163c 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -234,7 +234,7 @@ done:
if(table_addr != HADDR_UNDEF)
H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)H5SM_TABLE_SIZE(f));
if(table != NULL)
- H5FL_FREE(H5SM_master_table_t, table);
+ table = H5FL_FREE(H5SM_master_table_t, table);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -355,12 +355,13 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id)
/* Look up the master SOHM table */
if(H5F_addr_defined(f->shared->sohm_addr)) {
- hsize_t table_size; /* Size of SOHM master table in file */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
else
@@ -400,7 +401,7 @@ herr_t
H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_addr)
{
H5SM_master_table_t *table = NULL; /* Shared object master table */
- hsize_t table_size; /* Size of SOHM master table in file */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
ssize_t index_num; /* Which index */
herr_t ret_value = SUCCEED; /* Return value */
@@ -410,11 +411,12 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad
HDassert(f);
HDassert(fheap_addr);
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Look up index for message type */
@@ -646,7 +648,7 @@ done:
if(list != NULL) {
if(list->messages != NULL)
H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
- H5FL_FREE(H5SM_list_t, list);
+ list = H5FL_FREE(H5SM_list_t, list);
} /* end if */
if(addr != HADDR_UNDEF)
H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, size);
@@ -801,7 +803,7 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i
cache_udata.header = header;
/* Protect the SOHM list */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, H5SM_LIST_SIZE(f, header->list_max), &cache_udata, H5AC_WRITE)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM list index")
/* Delete the B-tree and have messages copy themselves to the
@@ -887,7 +889,6 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
{
size_t mesg_size;
H5SM_master_table_t *my_table = NULL;
- hsize_t table_size; /* Size of SOHM master table in file */
ssize_t index_num;
htri_t tri_ret;
htri_t ret_value = TRUE;
@@ -900,15 +901,18 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table,
if(tri_ret == FALSE)
HGOTO_DONE(FALSE)
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
-
/* Look up the master SOHM table */
/* (use incoming master SOHM table if possible) */
if(table)
my_table = table;
else {
- if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
+
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+
+ if(NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
} /* end if */
@@ -998,7 +1002,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
void *mesg, unsigned *mesg_flags)
{
H5SM_master_table_t *table = NULL;
- hsize_t table_size; /* Size of SOHM master table in file */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
unsigned cache_flags = H5AC__NO_FLAGS_SET;
ssize_t index_num;
htri_t tri_ret;
@@ -1014,11 +1018,12 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
if(tri_ret == FALSE)
HGOTO_DONE(FALSE)
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_WRITE)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* "complex" sharing checks */
@@ -1202,7 +1207,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
cache_udata.header = header;
/* The index is a list; get it from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, H5SM_LIST_SIZE(f, header->list_max), &cache_udata, H5AC_WRITE)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* See if the message is already in the index and get its location.
@@ -1380,8 +1385,8 @@ herr_t
H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
{
H5SM_master_table_t *table = NULL;
- hsize_t table_size; /* Size of SOHM master table in file */
unsigned cache_flags = H5AC__NO_FLAGS_SET;
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
ssize_t index_num;
void *mesg_buf = NULL;
void *native_mesg = NULL;
@@ -1397,11 +1402,12 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
/* Get message type */
type_id = sh_mesg->msg_type_id;
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_WRITE)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and try to delete from it */
@@ -1669,7 +1675,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
cache_udata.header = header;
/* If the index is stored as a list, get it from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, H5SM_LIST_SIZE(f, header->list_max), &cache_udata, H5AC_WRITE)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
@@ -1811,7 +1817,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
} /* end if */
else {
- hsize_t table_size; /* Size of SOHM master table in file */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
unsigned index_flags[H5O_SHMESG_MAX_NINDEXES]; /* Message flags for each index */
unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Minimum message size for each index */
unsigned sohm_l2b; /* SOHM list-to-btree cutoff */
@@ -1829,11 +1835,12 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
HDassert(H5F_addr_defined(shared->sohm_addr));
HDassert(shared->sohm_nindexes > 0 && shared->sohm_nindexes <= H5O_SHMESG_MAX_NINDEXES);
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Read the rest of the SOHM table information from the cache */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get index conversion limits */
@@ -2042,11 +2049,11 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
{
H5HF_t *fheap = NULL; /* Fractal heap that contains shared messages */
H5SM_master_table_t *table = NULL; /* SOHM master table */
+ H5SM_table_cache_ud_t tbl_cache_udata; /* User-data for callback */
H5SM_list_t *list = NULL; /* SOHM index list for message type (if in list form) */
H5SM_index_header_t *header=NULL; /* Index header for message type */
H5SM_mesg_key_t key; /* Key for looking up message */
H5SM_sohm_t message; /* Shared message returned from callback */
- hsize_t table_size; /* Size of SOHM master table in file */
ssize_t index_num; /* Table index for message type */
size_t buf_size; /* Size of the encoded message */
void * encoding_buf = NULL; /* Buffer for encoded message */
@@ -2059,11 +2066,12 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
HDassert(sh_mesg);
HDassert(ref_count);
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ tbl_cache_udata.f = f;
+ tbl_cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &tbl_cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index and find the message in it */
@@ -2094,15 +2102,15 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Try to find the message in the index */
if(header->index_type == H5SM_LIST) {
- H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ H5SM_list_cache_ud_t lst_cache_udata; /* User-data for metadata cache callback */
size_t list_pos; /* Position of the message in the list */
/* Set up user data for metadata cache callback */
- cache_udata.f = f;
- cache_udata.header = header;
+ lst_cache_udata.f = f;
+ lst_cache_udata.header = header;
/* If the index is stored as a list, get it from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, H5SM_LIST_SIZE(f, header->list_max), &cache_udata, H5AC_READ)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, &lst_cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Find the message in the list */
@@ -2362,7 +2370,7 @@ H5SM_table_free(H5SM_master_table_t *table)
H5FL_ARR_FREE(H5SM_index_header_t, table->indexes);
- H5FL_FREE(H5SM_master_table_t, table);
+ table = H5FL_FREE(H5SM_master_table_t, table);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_table_free() */
@@ -2390,7 +2398,7 @@ H5SM_list_free(H5SM_list_t *list)
H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
- H5FL_FREE(H5SM_list_t, list);
+ list = H5FL_FREE(H5SM_list_t, list);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_list_free() */
@@ -2417,7 +2425,7 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
unsigned table_vers, unsigned num_indexes)
{
H5SM_master_table_t *table = NULL; /* SOHM master table */
- hsize_t table_size; /* Size of SOHM master table in file */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
unsigned x; /* Counter variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2447,11 +2455,12 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
if(num_indexes == 0 || num_indexes > H5O_SHMESG_MAX_NINDEXES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t) (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
HDfprintf(stream, "%*sShared Message Master Table...\n", indent, "");
@@ -2537,7 +2546,7 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
cache_udata.header = &header;
/* Get the list from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, H5SM_LIST_SIZE(f, header.list_max), &cache_udata, H5AC_READ)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
HDfprintf(stream, "%*sShared Message List Index...\n", indent, "");
@@ -2596,8 +2605,8 @@ herr_t
H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
{
H5SM_master_table_t *table = NULL; /* SOHM master table */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
H5HF_t *fheap = NULL; /* Fractal heap handle */
- hsize_t table_size; /* Size of SOHM master table in file */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2608,11 +2617,12 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, H5F_info_t *finfo)
HDassert(H5F_addr_defined(f->shared->sohm_addr));
HDassert(finfo);
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Get SOHM header size */
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 6d45969..3e9bbe6 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -36,12 +36,6 @@
/* Local Macros */
/****************/
-/* Size of stack buffer for serialized tables */
-#define H5SM_TBL_BUF_SIZE 1024
-
-/* Size of stack buffer for serialized list indices */
-#define H5SM_LST_BUF_SIZE 1024
-
/******************/
/* Local Typedefs */
@@ -54,6 +48,7 @@
/* Metadata cache (H5AC) callbacks */
+static herr_t H5SM_table_get_load_size(const void *_udata, size_t *image_len);
static void *H5SM_table_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5SM_table_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr,
@@ -61,6 +56,7 @@ static herr_t H5SM_table_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr,
size_t *new_len, void **new_image);
static herr_t H5SM_table_free_icr(void *thing);
+static herr_t H5SM_list_get_load_size(const void *_udata, size_t *image_len);
static void *H5SM_list_deserialize(const void *image, size_t len,
void *udata, hbool_t *dirty);
static herr_t H5SM_list_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr,
@@ -77,6 +73,7 @@ const H5AC_class_t H5AC_SOHM_TABLE[1] = {{
H5AC_SOHM_TABLE_ID,
"shared object header message",
H5FD_MEM_SOHM_TABLE,
+ H5SM_table_get_load_size,
H5SM_table_deserialize,
NULL,
H5SM_table_serialize,
@@ -87,6 +84,7 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{
H5AC_SOHM_LIST_ID,
"shared object header message",
H5FD_MEM_SOHM_INDEX,
+ H5SM_list_get_load_size,
H5SM_list_deserialize,
NULL,
H5SM_list_serialize,
@@ -106,6 +104,37 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{
/*-------------------------------------------------------------------------
+ * Function: H5SM_table_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5SM_table_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5SM_table_cache_ud_t *udata = (const H5SM_table_cache_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_table_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = udata->table_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5SM_table_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5SM_table_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -123,7 +152,7 @@ H5SM_table_deserialize(const void *image, size_t UNUSED len, void *_udata,
hbool_t UNUSED *dirty)
{
H5SM_master_table_t *table = NULL;
- H5F_t *f = (H5F_t *)_udata; /* File pointer */
+ H5SM_table_cache_ud_t *udata = (H5SM_table_cache_ud_t *)_udata; /* User data for callback */
const uint8_t *p; /* Pointer into input buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -135,20 +164,21 @@ H5SM_table_deserialize(const void *image, size_t UNUSED len, void *_udata,
/* Verify that we're reading version 0 of the table; this is the only
* version defined so far.
*/
- HDassert(f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
HDassert(image);
+ HDassert(udata);
+ HDassert(udata->f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
/* Allocate space for the master table in memory */
if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read number of indexes and version from file superblock */
- table->num_indexes = f->shared->sohm_nindexes;
+ table->num_indexes = udata->f->shared->sohm_nindexes;
HDassert(table->num_indexes > 0);
/* Get temporary pointer to serialized table */
- p = image;
+ p = (const uint8_t *)image;
/* Check magic number */
if(HDmemcmp(p, H5SM_TABLE_MAGIC, (size_t)H5SM_SIZEOF_MAGIC))
@@ -158,7 +188,7 @@ H5SM_table_deserialize(const void *image, size_t UNUSED len, void *_udata,
/* Don't count the checksum in the table size yet, since it comes after
* all of the index headers
*/
- HDassert((size_t)(p - (const uint8_t *)image) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM);
+ HDassert((size_t)(p - (const uint8_t *)image) == H5SM_TABLE_SIZE(udata->f) - H5SM_SIZEOF_CHECKSUM);
/* Allocate space for the index headers in memory*/
if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
@@ -189,10 +219,10 @@ H5SM_table_deserialize(const void *image, size_t UNUSED len, void *_udata,
UINT16DECODE(p, table->indexes[x].num_messages);
/* Address of the actual index */
- H5F_addr_decode(f, &p, &(table->indexes[x].index_addr));
+ H5F_addr_decode(udata->f, &p, &(table->indexes[x].index_addr));
/* Address of the index's heap */
- H5F_addr_decode(f, &p, &(table->indexes[x].heap_addr));
+ H5F_addr_decode(udata->f, &p, &(table->indexes[x].heap_addr));
} /* end for */
/* Read in checksum */
@@ -261,7 +291,7 @@ H5SM_table_serialize(const H5F_t * f, hid_t UNUSED dxlp_id, haddr_t UNUSED addr,
HDassert(f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
/* Get temporary pointer to buffer for serialized table */
- p = image;
+ p = (uint8_t *)image;
/* Encode magic number */
HDmemcpy(p, H5SM_TABLE_MAGIC, (size_t)H5SM_SIZEOF_MAGIC);
@@ -336,7 +366,7 @@ H5SM_table_free_icr(void *thing)
HDassert(thing);
/* Destroy Shared Object Header Message table */
- if(H5SM_table_free(thing) < 0)
+ if(H5SM_table_free((H5SM_master_table_t *)thing) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message table")
done:
@@ -345,6 +375,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5SM_list_get_load_size
+ *
+ * Purpose: Compute the size of the data structure on disk.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * May 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5SM_list_get_load_size(const void *_udata, size_t *image_len)
+{
+ const H5SM_list_cache_ud_t *udata = (const H5SM_list_cache_ud_t *)_udata; /* User data for callback */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_list_get_load_size)
+
+ /* Check arguments */
+ HDassert(udata);
+ HDassert(image_len);
+
+ /* Set the image length size */
+ *image_len = H5SM_LIST_SIZE(udata->f, udata->header->list_max);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5SM_list_get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5SM_list_deserialize
*
* Purpose: Deserialize the data structure from disk.
@@ -390,7 +451,7 @@ H5SM_list_deserialize(const void *image, size_t UNUSED len, void *_udata,
size = H5SM_LIST_SIZE(udata->f, udata->header->num_messages);
/* Get temporary pointer to serialized list index */
- p = image;
+ p = (const uint8_t *)image;
/* Check magic number */
if(HDmemcmp(p, H5SM_LIST_MAGIC, (size_t)H5SM_SIZEOF_MAGIC))
@@ -431,7 +492,7 @@ done:
/* Release resources */
if(!ret_value && list) {
if(list->messages)
- list->messages = H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
+ list->messages = (H5SM_sohm_t *)H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
list = H5FL_FREE(H5SM_list_t, list);
} /* end if */
@@ -476,7 +537,7 @@ H5SM_list_serialize(const H5F_t * f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr,
size = H5SM_LIST_SIZE(f, list->header->num_messages);
/* Get temporary pointer to buffer for serialized list index */
- p = image;
+ p = (uint8_t *)image;
/* Encode magic number */
HDmemcpy(p, H5SM_LIST_MAGIC, (size_t)H5SM_SIZEOF_MAGIC);
@@ -535,7 +596,7 @@ H5SM_list_free_icr(void *thing)
HDassert(thing);
/* Destroy Shared Object Header Message list */
- if(H5SM_list_free(thing) < 0)
+ if(H5SM_list_free((H5SM_list_t *)thing) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message list")
done:
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index fadf416..d3566dc 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -221,9 +221,15 @@ typedef struct {
hid_t dxpl_id;
} H5SM_incr_ref_opdata;
-/* Callback info for loading a shared message index into the cache */
+/* Callback info for loading a shared message table index into the cache */
+typedef struct H5SM_table_cache_ud_t {
+ H5F_t *f; /* File that shared message index stored as a table is in */
+ size_t table_size; /* Size of SOHM master table in file */
+} H5SM_table_cache_ud_t;
+
+/* Callback info for loading a shared message list index into the cache */
typedef struct H5SM_list_cache_ud_t {
- H5F_t *f; /* File that shared message index stored as a list is in */
+ H5F_t *f; /* File that shared message index stored as a table is in */
H5SM_index_header_t *header; /* Index header for this list */
} H5SM_list_cache_ud_t;
diff --git a/src/H5SMtest.c b/src/H5SMtest.c
index 7321da0..67140dd 100644
--- a/src/H5SMtest.c
+++ b/src/H5SMtest.c
@@ -91,14 +91,15 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id,
/* Check for shared messages being enabled */
if(H5F_addr_defined(f->shared->sohm_addr)) {
H5SM_index_header_t *header; /* Index header for message type */
- hsize_t table_size; /* Size of SOHM master table in file */
+ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
ssize_t index_num; /* Table index for message type */
- /* Determine size of table in file */
- table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t)(f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
+ /* Set up user data for callback */
+ cache_udata.f = f;
+ cache_udata.table_size = H5SM_TABLE_SIZE(f) + (f->shared->sohm_nindexes * H5SM_INDEX_HEADER_SIZE(f));
/* Look up the master SOHM table */
- if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, (size_t)table_size, f, H5AC_READ)))
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, &cache_udata, H5AC_READ)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Find the correct index for this message type */
diff --git a/test/cache.c b/test/cache.c
index d6ab964..cb568cd 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -16735,13 +16735,6 @@ check_pin_entry_errs(void)
* Programmer: John Mainzer
* 6/24/04
*
- * Modifications:
- *
- * - Modified call to H5C_protect() to pass H5C__NO_FLAGS_SET in the
- * the new flags parameter.
- *
- * JRM -- 3/28/07
- *
*-------------------------------------------------------------------------
*/
@@ -16780,8 +16773,7 @@ check_double_protect_err(void)
cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
&(types[0]), entry_ptr->addr,
- entry_ptr->size, &entry_ptr->addr,
- H5C__NO_FLAGS_SET);
+ &entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( cache_entry_ptr != NULL ) {
@@ -17428,7 +17420,7 @@ check_protect_ro_rw_err(void)
thing_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
&(types[0]), entry_ptr->addr,
- entry_ptr->size, &entry_ptr->addr, H5C__NO_FLAGS_SET);
+ &entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( thing_ptr != NULL ) {
diff --git a/test/cache_common.c b/test/cache_common.c
index 6b12ae4..b95467d 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -82,6 +82,112 @@ test_entry_t huge_entries[NUM_HUGE_ENTRIES];
test_entry_t monster_entries[NUM_MONSTER_ENTRIES];
test_entry_t variable_entries[NUM_VARIABLE_ENTRIES];
+static herr_t pico_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t nano_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t micro_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t tiny_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t small_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t medium_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t large_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t huge_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t monster_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+static herr_t variable_get_load_size(const void * udata_ptr, size_t *image_len_ptr);
+
+static void * pico_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * nano_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * micro_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * tiny_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * small_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * medium_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * large_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * huge_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * monster_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+static void * variable_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
+ hbool_t * dirty_ptr);
+
+static herr_t pico_image_len(void *thing, size_t *image_len_ptr);
+static herr_t nano_image_len(void *thing, size_t *image_len_ptr);
+static herr_t micro_image_len(void *thing, size_t *image_len_ptr);
+static herr_t tiny_image_len(void *thing, size_t *image_len_ptr);
+static herr_t small_image_len(void *thing, size_t *image_len_ptr);
+static herr_t medium_image_len(void *thing, size_t *image_len_ptr);
+static herr_t large_image_len(void *thing, size_t *image_len_ptr);
+static herr_t huge_image_len(void *thing, size_t *image_len_ptr);
+static herr_t monster_image_len(void *thing, size_t *image_len_ptr);
+static herr_t variable_image_len(void *thing, size_t *image_len_ptr);
+
+static herr_t pico_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t nano_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t micro_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t tiny_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t small_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t medium_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t large_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t huge_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t monster_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+static herr_t variable_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ size_t len, void * image_ptr,
+ void * thing, unsigned * flags_ptr,
+ haddr_t * new_addr_ptr, size_t * new_len_ptr,
+ void ** new_image_ptr_ptr);
+
+static herr_t pico_free_icr(void * thing);
+static herr_t nano_free_icr(void * thing);
+static herr_t micro_free_icr(void * thing);
+static herr_t tiny_free_icr(void * thing);
+static herr_t small_free_icr(void * thing);
+static herr_t medium_free_icr(void * thing);
+static herr_t large_free_icr(void * thing);
+static herr_t huge_free_icr(void * thing);
+static herr_t monster_free_icr(void * thing);
+static herr_t variable_free_icr(void * thing);
+
+
test_entry_t * entries[NUMBER_OF_ENTRY_TYPES] =
{
pico_entries,
@@ -175,6 +281,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
PICO_ENTRY_TYPE,
"pico_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)pico_get_load_size,
(H5C_deserialize_func_t)pico_deserialize,
(H5C_image_len_func_t)pico_image_len,
(H5C_serialize_func_t)pico_serialize,
@@ -184,6 +291,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
NANO_ENTRY_TYPE,
"nano_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)nano_get_load_size,
(H5C_deserialize_func_t)nano_deserialize,
(H5C_image_len_func_t)nano_image_len,
(H5C_serialize_func_t)nano_serialize,
@@ -193,6 +301,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
MICRO_ENTRY_TYPE,
"micro_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)micro_get_load_size,
(H5C_deserialize_func_t)micro_deserialize,
(H5C_image_len_func_t)micro_image_len,
(H5C_serialize_func_t)micro_serialize,
@@ -202,6 +311,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
TINY_ENTRY_TYPE,
"tiny_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)tiny_get_load_size,
(H5C_deserialize_func_t)tiny_deserialize,
(H5C_image_len_func_t)tiny_image_len,
(H5C_serialize_func_t)tiny_serialize,
@@ -211,6 +321,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
SMALL_ENTRY_TYPE,
"small_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)small_get_load_size,
(H5C_deserialize_func_t)small_deserialize,
(H5C_image_len_func_t)small_image_len,
(H5C_serialize_func_t)small_serialize,
@@ -220,6 +331,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
MEDIUM_ENTRY_TYPE,
"medium_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)medium_get_load_size,
(H5C_deserialize_func_t)medium_deserialize,
(H5C_image_len_func_t)medium_image_len,
(H5C_serialize_func_t)medium_serialize,
@@ -229,6 +341,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
LARGE_ENTRY_TYPE,
"large_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)large_get_load_size,
(H5C_deserialize_func_t)large_deserialize,
(H5C_image_len_func_t)large_image_len,
(H5C_serialize_func_t)large_serialize,
@@ -238,6 +351,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
HUGE_ENTRY_TYPE,
"huge_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)huge_get_load_size,
(H5C_deserialize_func_t)huge_deserialize,
(H5C_image_len_func_t)huge_image_len,
(H5C_serialize_func_t)huge_serialize,
@@ -247,6 +361,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
MONSTER_ENTRY_TYPE,
"monster_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)monster_get_load_size,
(H5C_deserialize_func_t)monster_deserialize,
(H5C_image_len_func_t)monster_image_len,
(H5C_serialize_func_t)monster_serialize,
@@ -256,6 +371,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
VARIABLE_ENTRY_TYPE,
"variable_entry",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)variable_get_load_size,
(H5C_deserialize_func_t)variable_deserialize,
(H5C_image_len_func_t)variable_image_len,
(H5C_serialize_func_t)variable_serialize,
@@ -263,6 +379,9 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
}
};
+static herr_t get_load_size(const void * udata_ptr,
+ size_t *image_len_ptr);
+
static void * deserialize(const void * image_ptr,
size_t len,
void * udata_ptr,
@@ -398,6 +517,107 @@ check_write_permitted(const H5F_t UNUSED * f,
/*-------------------------------------------------------------------------
+ * Function: get_load_size & friends
+ *
+ * Purpose: Query the image size for loading an entry. The helper
+ * functions funnel into get_load_size proper.
+ *
+ * Return: SUCCEED
+ *
+ * Programmer: Quincey Koziol
+ * 5/18/10
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+get_load_size(const void * udata_ptr, size_t *image_len_ptr)
+{
+ haddr_t addr = *(const haddr_t *)udata_ptr;
+ int32_t type;
+ int32_t idx;
+ test_entry_t * entry_ptr;
+ test_entry_t * base_addr;
+
+ addr_to_type_and_index(addr, &type, &idx);
+
+ base_addr = entries[type];
+ entry_ptr = &(base_addr[idx]);
+
+ HDassert( entry_ptr->type >= 0 );
+ HDassert( entry_ptr->type < NUMBER_OF_ENTRY_TYPES );
+ HDassert( entry_ptr->index == idx );
+ HDassert( entry_ptr->index >= 0 );
+ HDassert( entry_ptr->index <= max_indices[type] );
+ HDassert( entry_ptr == entry_ptr->self );
+ HDassert( entry_ptr->addr == addr );
+
+ *image_len_ptr = entry_ptr->size;
+
+ return(SUCCEED);
+} /* get_load_size() */
+
+static herr_t
+pico_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+nano_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+micro_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+tiny_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+small_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+medium_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+large_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+huge_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+monster_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+static herr_t
+variable_get_load_size(const void *udata_ptr, size_t *image_len_ptr)
+{
+ return get_load_size(udata_ptr, image_len_ptr);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: deserialize & friends
*
* Purpose: deserialize the entry. The helper functions verify that the
@@ -411,7 +631,6 @@ check_write_permitted(const H5F_t UNUSED * f,
*
*-------------------------------------------------------------------------
*/
-
static void *
deserialize(const void * image_ptr, size_t len, void *udata, hbool_t * dirty_ptr)
{
@@ -729,7 +948,6 @@ serialize(haddr_t addr, size_t len, void * image_ptr, void * thing,
void ** new_image_ptr_ptr)
{
const char * fcn_name = "serialize()";
- char * char_ptr;
hbool_t verbose = FALSE;
herr_t ret_val = SUCCEED;
int32_t i;
@@ -2388,7 +2606,7 @@ setup_cache(size_t max_cache_size,
} else {
- file_ptr = H5I_object_verify(fid, H5I_FILE);
+ file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE);
if ( file_ptr == NULL ) {
@@ -2443,13 +2661,13 @@ setup_cache(size_t max_cache_size,
file_ptr->shared->cache = NULL;
cache_ptr = H5C_create(max_cache_size,
- min_clean_size,
- (NUMBER_OF_ENTRY_TYPES - 1),
- (const char **)entry_type_names,
- check_write_permitted,
- TRUE,
- NULL,
- NULL);
+ min_clean_size,
+ (NUMBER_OF_ENTRY_TYPES - 1),
+ (const char **)entry_type_names,
+ check_write_permitted,
+ TRUE,
+ NULL,
+ NULL);
file_ptr->shared->cache = cache_ptr;
}
@@ -2706,9 +2924,9 @@ expunge_entry(H5F_t * file_ptr,
void
flush_cache(H5F_t * file_ptr,
- hbool_t destroy_entries,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats)
+ hbool_t destroy_entries,
+ hbool_t dump_stats,
+ hbool_t dump_detailed_stats)
{
const char * fcn_name = "flush_cache()";
H5C_t * cache_ptr;
@@ -3182,10 +3400,9 @@ protect_entry(H5F_t * file_ptr,
(long)(entry_ptr->size));
}
- cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
&(types[type]), entry_ptr->addr,
- entry_ptr->size, &entry_ptr->addr,
- H5C__NO_FLAGS_SET);
+ &entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( verbose ) {
HDfprintf(stdout,
@@ -3269,9 +3486,9 @@ protect_entry_ro(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
- H5C_t * cache_ptr;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ H5C_t *cache_ptr;
+ test_entry_t *base_addr;
+ test_entry_t *entry_ptr;
H5C_cache_entry_t * cache_entry_ptr;
if ( pass ) {
@@ -3292,10 +3509,9 @@ protect_entry_ro(H5F_t * file_ptr,
( ( entry_ptr->is_read_only ) &&
( entry_ptr->ro_ref_count > 0 ) ) );
- cache_entry_ptr = H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
&(types[type]), entry_ptr->addr,
- entry_ptr->size, &entry_ptr->addr,
- H5C__READ_ONLY_FLAG);
+ &entry_ptr->addr, H5C__READ_ONLY_FLAG);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
diff --git a/test/cache_common.h b/test/cache_common.h
index f4c0d31..885c4e1 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -545,100 +545,6 @@ herr_t check_write_permitted(const H5F_t UNUSED * f,
hbool_t * write_permitted_ptr);
-void * pico_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * nano_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * micro_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * tiny_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * small_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * medium_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * large_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * huge_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * monster_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-void * variable_deserialize(const void * image_ptr, size_t len, void * udata_ptr,
- hbool_t * dirty_ptr);
-
-herr_t pico_image_len(void *thing, size_t *image_len_ptr);
-herr_t nano_image_len(void *thing, size_t *image_len_ptr);
-herr_t micro_image_len(void *thing, size_t *image_len_ptr);
-herr_t tiny_image_len(void *thing, size_t *image_len_ptr);
-herr_t small_image_len(void *thing, size_t *image_len_ptr);
-herr_t medium_image_len(void *thing, size_t *image_len_ptr);
-herr_t large_image_len(void *thing, size_t *image_len_ptr);
-herr_t huge_image_len(void *thing, size_t *image_len_ptr);
-herr_t monster_image_len(void *thing, size_t *image_len_ptr);
-herr_t variable_image_len(void *thing, size_t *image_len_ptr);
-
-herr_t pico_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t nano_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t micro_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t tiny_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t small_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t medium_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t large_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t huge_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t monster_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-herr_t variable_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr,
- size_t len, void * image_ptr,
- void * thing, unsigned * flags_ptr,
- haddr_t * new_addr_ptr, size_t * new_len_ptr,
- void ** new_image_ptr_ptr);
-
-herr_t pico_free_icr(void * thing);
-herr_t nano_free_icr(void * thing);
-herr_t micro_free_icr(void * thing);
-herr_t tiny_free_icr(void * thing);
-herr_t small_free_icr(void * thing);
-herr_t medium_free_icr(void * thing);
-herr_t large_free_icr(void * thing);
-herr_t huge_free_icr(void * thing);
-herr_t monster_free_icr(void * thing);
-herr_t variable_free_icr(void * thing);
-
/* callback table extern */
@@ -648,67 +554,67 @@ extern const H5C_class_t types[NUMBER_OF_ENTRY_TYPES];
/* function declarations: */
void add_flush_op(int target_type,
- int target_idx,
- int op_code,
- int type,
- int idx,
- hbool_t flag,
- size_t size);
+ int target_idx,
+ int op_code,
+ int type,
+ int idx,
+ hbool_t flag,
+ size_t size);
void addr_to_type_and_index(haddr_t addr,
- int32_t * type_ptr,
- int32_t * index_ptr);
+ int32_t * type_ptr,
+ int32_t * index_ptr);
#if 0 /* keep this for a while -- it may be useful */
haddr_t type_and_index_to_addr(int32_t type,
- int32_t idx);
+ int32_t idx);
#endif
void dirty_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- hbool_t dirty_pin);
+ int32_t type,
+ int32_t idx,
+ hbool_t dirty_pin);
void expunge_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+ int32_t type,
+ int32_t idx);
void insert_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- unsigned int flags);
+ int32_t type,
+ int32_t idx,
+ unsigned int flags);
void mark_entry_dirty(H5F_t * file_ptr,
int32_t type,
int32_t idx);
void move_entry(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx,
- hbool_t main_addr);
+ int32_t type,
+ int32_t idx,
+ hbool_t main_addr);
void pin_protected_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+ int32_t type,
+ int32_t idx);
void protect_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+ int32_t type,
+ int32_t idx);
void protect_entry_ro(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+ int32_t type,
+ int32_t idx);
hbool_t entry_in_cache(H5C_t * cache_ptr,
- int32_t type,
- int32_t idx);
+ int32_t type,
+ int32_t idx);
void create_pinned_entry_dependency(H5F_t * file_ptr,
- int pinning_type,
- int pinning_idx,
- int pinned_type,
- int pinned_idx);
+ int pinning_type,
+ int pinning_idx,
+ int pinned_type,
+ int pinned_idx);
void execute_flush_op(H5F_t * file_ptr,
struct test_entry_t * entry_ptr,
@@ -720,14 +626,37 @@ hbool_t recommend_core_file_driver(void);
void reset_entries(void);
void resize_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- size_t new_size,
- hbool_t resize_pin);
+ int32_t type,
+ int32_t idx,
+ size_t new_size,
+ hbool_t in_cache);
-H5F_t * setup_cache(size_t max_cache_size, size_t min_clean_size);
+H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size);
void row_major_scan_forward(H5F_t * file_ptr,
+ int32_t max_index,
+ int32_t lag,
+ hbool_t verbose,
+ hbool_t reset_stats,
+ hbool_t display_stats,
+ hbool_t display_detailed_stats,
+ hbool_t do_inserts,
+ hbool_t do_moves,
+ hbool_t move_to_main_addr,
+ hbool_t do_destroys,
+ hbool_t do_mult_ro_protects,
+ int dirty_destroys,
+ int dirty_unprotects);
+
+void hl_row_major_scan_forward(H5F_t * file_ptr,
+ int32_t max_index,
+ hbool_t verbose,
+ hbool_t reset_stats,
+ hbool_t display_stats,
+ hbool_t display_detailed_stats,
+ hbool_t do_inserts);
+
+void row_major_scan_backward(H5F_t * file_ptr,
int32_t max_index,
int32_t lag,
hbool_t verbose,
@@ -742,7 +671,7 @@ void row_major_scan_forward(H5F_t * file_ptr,
int dirty_destroys,
int dirty_unprotects);
-void hl_row_major_scan_forward(H5F_t * file_ptr,
+void hl_row_major_scan_backward(H5F_t * file_ptr,
int32_t max_index,
hbool_t verbose,
hbool_t reset_stats,
@@ -750,30 +679,26 @@ void hl_row_major_scan_forward(H5F_t * file_ptr,
hbool_t display_detailed_stats,
hbool_t do_inserts);
-void row_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- hbool_t do_moves,
- hbool_t move_to_main_addr,
- hbool_t do_destroys,
- hbool_t do_mult_ro_protects,
- int dirty_destroys,
- int dirty_unprotects);
+void col_major_scan_forward(H5F_t * file_ptr,
+ int32_t max_index,
+ int32_t lag,
+ hbool_t verbose,
+ hbool_t reset_stats,
+ hbool_t display_stats,
+ hbool_t display_detailed_stats,
+ hbool_t do_inserts,
+ int dirty_unprotects);
-void hl_row_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts);
+void hl_col_major_scan_forward(H5F_t * file_ptr,
+ int32_t max_index,
+ hbool_t verbose,
+ hbool_t reset_stats,
+ hbool_t display_stats,
+ hbool_t display_detailed_stats,
+ hbool_t do_inserts,
+ int dirty_unprotects);
-void col_major_scan_forward(H5F_t * file_ptr,
+void col_major_scan_backward(H5F_t * file_ptr,
int32_t max_index,
int32_t lag,
hbool_t verbose,
@@ -783,7 +708,7 @@ void col_major_scan_forward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects);
-void hl_col_major_scan_forward(H5F_t * file_ptr,
+void hl_col_major_scan_backward(H5F_t * file_ptr,
int32_t max_index,
hbool_t verbose,
hbool_t reset_stats,
@@ -792,49 +717,30 @@ void hl_col_major_scan_forward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects);
-void col_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- int32_t lag,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- int dirty_unprotects);
-
-void hl_col_major_scan_backward(H5F_t * file_ptr,
- int32_t max_index,
- hbool_t verbose,
- hbool_t reset_stats,
- hbool_t display_stats,
- hbool_t display_detailed_stats,
- hbool_t do_inserts,
- int dirty_unprotects);
-
void takedown_cache(H5F_t * file_ptr,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats);
+ hbool_t dump_stats,
+ hbool_t dump_detailed_stats);
void flush_cache(H5F_t * file_ptr,
- hbool_t destroy_entries,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats);
+ hbool_t destroy_entries,
+ hbool_t dump_stats,
+ hbool_t dump_detailed_stats);
void unpin_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx);
+ int32_t type,
+ int32_t idx);
void unprotect_entry(H5F_t * file_ptr,
- int32_t type,
- int32_t idx,
- unsigned int flags);
+ int32_t type,
+ int32_t idx,
+ unsigned int flags);
void verify_clean(void);
void verify_entry_status(H5C_t * cache_ptr,
- int tag,
- int num_entries,
- struct expected_entry_status expected[]);
+ int tag,
+ int num_entries,
+ struct expected_entry_status expected[]);
void verify_unprotected(void);
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index a2759f1..02cf742 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -25,8 +25,7 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test
# Test programs and scripts. These are our main targets.
#
-TEST_PROG_PARA=t_mpi t_posix_compliant testphdf5 t_cache \
- t_pflush1 t_pflush2
+TEST_PROG_PARA=t_mpi t_posix_compliant testphdf5 t_cache t_pflush1 t_pflush2
TEST_SCRIPT_PARA=testph5.sh
check_PROGRAMS = $(TEST_PROG_PARA)
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index a546904..efa8275 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -315,6 +315,9 @@ hbool_t serve_write_request(struct mssg_t * mssg_ptr);
/* call back functions & related data structures */
+static herr_t datum_get_load_size(const void * udata_ptr,
+ size_t *image_len_ptr);
+
static void * datum_deserialize(const void * image_ptr,
size_t len,
void * udata_ptr,
@@ -346,6 +349,7 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
DATUM_ENTRY_TYPE,
"datum",
H5FD_MEM_DEFAULT,
+ (H5C_get_load_size_func_t)datum_get_load_size,
(H5C_deserialize_func_t)datum_deserialize,
(H5C_image_len_func_t)datum_image_len,
(H5C_serialize_func_t)datum_serialize,
@@ -1664,6 +1668,57 @@ serve_write_request(struct mssg_t * mssg_ptr)
/*-------------------------------------------------------------------------
+ * Function: datum_get_load_size
+ *
+ * Purpose: Query the image size for an entry before deserializing it
+ *
+ * Return: SUCCEED
+ *
+ * Programmer: Quincey Koziol
+ * 5/18/10
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+datum_get_load_size(const void * udata_ptr,
+ size_t *image_len_ptr)
+{
+ const char * fcn_name = "datum_get_load_size()";
+ haddr_t addr = *(haddr_t *)udata_ptr;
+ int idx;
+ struct datum * entry_ptr;
+
+ HDassert( udata_ptr );
+ HDassert( image_len_ptr );
+
+ idx = addr_to_datum_index(addr);
+
+ HDassert( idx >= 0 );
+ HDassert( idx < NUM_DATA_ENTRIES );
+ HDassert( idx < virt_num_data_entries );
+
+ entry_ptr = &(data[idx]);
+
+ HDassert( addr == entry_ptr->base_addr );
+ HDassert( ! entry_ptr->global_pinned );
+ HDassert( ! entry_ptr->local_pinned );
+
+ if ( callbacks_verbose ) {
+
+ HDfprintf(stdout,
+ "%d: get_load_size() idx = %d, addr = %ld, len = %d.\n",
+ world_mpi_rank, idx, (long)addr, (int)entry_ptr->local_len);
+ fflush(stdout);
+ }
+
+ /* Set image length size */
+ *image_len_ptr = entry_ptr->local_len;
+
+ return(SUCCEED);
+} /* get_load_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: datum_deserialize
*
* Purpose: deserialize the entry.
@@ -2692,7 +2747,7 @@ lock_entry(H5C_t * cache_ptr,
cache_entry_ptr = H5AC_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
&(types[0]), entry_ptr->base_addr,
- entry_ptr->local_len, &entry_ptr->base_addr, H5AC_WRITE);
+ &entry_ptr->base_addr, H5AC_WRITE);
if ( ( cache_entry_ptr != (void *)(&(entry_ptr->header)) ) ||
( entry_ptr->header.type != &(types[0]) ) ||
@@ -3178,7 +3233,7 @@ setup_cache_for_test(hid_t * fid_ptr,
}
if ( file_ptr == NULL ) {
-
+ nerrors++;
if ( verbose ) {
HDfprintf(stdout, "%d:%s: Can't get file_ptr.\n",
world_mpi_rank, fcn_name);
@@ -5394,15 +5449,15 @@ trace_file_check(void)
"H5AC_set 0x402 2 16 0x0 2 0\n",
"H5AC_set 0x404 4 16 0x0 4 0\n",
"H5AC_set 0x408 6 16 0x0 6 0\n",
- "H5AC_protect 0x400 2 16 H5AC_WRITE 2 1\n",
+ "H5AC_protect 0x400 2 H5AC_WRITE 2 1\n",
"H5AC_mark_entry_dirty 0x400 0\n",
"H5AC_unprotect 0x400 16 2 0 0\n",
- "H5AC_protect 0x402 2 16 H5AC_WRITE 2 1\n",
+ "H5AC_protect 0x402 2 H5AC_WRITE 2 1\n",
"H5AC_pin_protected_entry 0x402 0\n",
"H5AC_unprotect 0x402 16 2 0 0\n",
"H5AC_unpin_entry 0x402 0\n",
"H5AC_expunge_entry 0x402 16 0\n",
- "H5AC_protect 0x404 4 16 H5AC_WRITE 4 1\n",
+ "H5AC_protect 0x404 4 H5AC_WRITE 4 1\n",
"H5AC_pin_protected_entry 0x404 0\n",
"H5AC_unprotect 0x404 16 4 0 0\n",
"H5AC_mark_entry_dirty 0x404 0\n",