From 817f42c3bb8c0090a12dc78a9c537cbaefb2dd93 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 20 May 2010 06:39:05 -0500 Subject: [svn-r18863] Description: General cleanups to align metadata journaling branch and trunk Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode 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 --- src/H5AC.c | 443 ++------------------------------- src/H5B2int.c | 8 +- src/H5B2test.c | 2 +- src/H5C.c | 697 +--------------------------------------------------- src/H5F.c | 2 +- src/H5Gnode.c | 54 ++-- src/H5HFdblock.c | 8 +- src/H5HFiblock.c | 8 +- src/H5HFiter.c | 4 +- src/H5HFpkg.h | 7 + src/H5O.c | 2 +- src/H5Oalloc.c | 2 +- src/H5Oattribute.c | 2 +- src/H5Ocache.c | 6 +- src/H5Ochunk.c | 8 +- src/H5Opkg.h | 4 +- src/H5Pfapl.c | 8 - src/H5Ppublic.h | 2 +- src/H5SM.c | 81 ++++-- src/H5SMpkg.h | 10 +- src/H5SMtest.c | 7 +- test/cache_common.c | 111 +++++++-- test/cache_common.h | 83 +------ test/ohdr.c | 18 ++ testpar/t_cache.c | 10 +- 25 files changed, 287 insertions(+), 1300 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index e1c74d1..8f04841 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. - * *------------------------------------------------------------------------- */ @@ -205,8 +189,6 @@ static herr_t H5AC_log_moved_entry(const H5F_t * f, * Programmer: Quincey Koziol * Saturday, January 18, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -232,8 +214,6 @@ done: * Programmer: Quincey Koziol * Thursday, July 18, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -353,8 +333,6 @@ done: * Programmer: Quincey Koziol * Thursday, July 18, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -416,57 +394,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 - * *------------------------------------------------------------------------- */ @@ -808,10 +735,6 @@ done: * Programmer: John Mainzer * 6/30/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -857,10 +780,10 @@ H5AC_expunge_entry(H5F_t *f, #endif /* H5AC__TRACE_FILE_ENABLED */ result = H5C_expunge_entry(f, - dxpl_id, + dxpl_id, H5AC_noblock_dxpl_id, - type, - addr); + type, + addr); if ( result < 0 ) { @@ -932,29 +855,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. - * *------------------------------------------------------------------------- */ herr_t @@ -1062,9 +962,9 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) #endif /* H5_HAVE_PARALLEL */ status = H5C_flush_cache(f, - dxpl_id, + dxpl_id, H5AC_noblock_dxpl_id, - flags); + flags); if ( status < 0 ) { @@ -1104,10 +1004,6 @@ done: * Programmer: John Mainzer * 4/27/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -1180,54 +1076,8 @@ 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. - * *------------------------------------------------------------------------- */ - herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags) { @@ -1300,12 +1150,12 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * #endif /* H5_HAVE_PARALLEL */ result = H5C_insert_entry(f, - dxpl_id, + dxpl_id, H5AC_noblock_dxpl_id, - type, - addr, - thing, - flags); + type, + addr, + thing, + flags); if ( result < 0 ) { @@ -1586,56 +1436,13 @@ 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. - * *------------------------------------------------------------------------- */ void * @@ -1646,7 +1453,6 @@ H5AC_protect(H5F_t *f, 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 */ @@ -1711,11 +1517,11 @@ H5AC_protect(H5F_t *f, } thing = H5C_protect(f, - dxpl_id, + dxpl_id, H5AC_noblock_dxpl_id, - type, - addr, - udata, + type, + addr, + udata, protect_flags); if ( thing == NULL ) { @@ -1902,57 +1708,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. - * *------------------------------------------------------------------------- */ herr_t @@ -1967,8 +1722,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] = ""; - size_t trace_new_size = 0; - unsigned trace_flags = 0; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ herr_t ret_value=SUCCEED; /* Return value */ @@ -2000,8 +1753,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 */ @@ -2050,12 +1801,12 @@ 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, + dxpl_id, H5AC_noblock_dxpl_id, - type, - addr, - thing, - flags); + type, + addr, + thing, + flags); if ( result < 0 ) { @@ -2085,10 +1836,9 @@ done: #if H5AC__TRACE_FILE_ENABLED if ( trace_file_ptr != NULL ) { - HDfprintf(trace_file_ptr, "%s %d %x %d\n", + HDfprintf(trace_file_ptr, "%s %x %d\n", trace, - (int)trace_new_size, - (unsigned)trace_flags, + (unsigned)flags, (int)ret_value); } #endif /* H5AC__TRACE_FILE_ENABLED */ @@ -2110,11 +1860,8 @@ done: * Programmer: John Mainzer * 5/11/06 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL herr_t H5AC_set_write_done_callback(H5C_t * cache_ptr, @@ -2157,15 +1904,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(). - * *------------------------------------------------------------------------- */ herr_t @@ -2198,34 +1936,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 - 1/2/08 - * Added support for the new flash cache increment related - * fields. - * *------------------------------------------------------------------------- */ - herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, H5AC_cache_config_t *config_ptr) @@ -2345,10 +2057,6 @@ done: * Programmer: John Mainzer * 3/11/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -2392,10 +2100,6 @@ done: * Programmer: John Mainzer * 3/10/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -2423,13 +2127,8 @@ done: * * Programmer: John Mainzer, 3/10/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr) { @@ -2463,31 +2162,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. - * - * John Mainzer -- 1/3/07 - * Updated trace file code to record the new flash cache - * size increase related fields. - * *------------------------------------------------------------------------- */ herr_t @@ -2685,21 +2359,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 - * *------------------------------------------------------------------------- */ herr_t @@ -2827,13 +2486,8 @@ done: * Programmer: John Mainzer * 6/2/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t H5AC_close_trace_file(H5AC_t * cache_ptr) @@ -2890,10 +2544,6 @@ done: * Programmer: John Mainzer * 6/1/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -3013,11 +2663,8 @@ done: * * Programmer: John Mainzer, 7/1/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL static herr_t H5AC_broadcast_clean_list(H5AC_t * cache_ptr) @@ -3190,21 +2837,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, @@ -3273,12 +2907,6 @@ done: * Programmer: John Mainzer * 1/26/06 * - * Modifications: - * - * Updated function for flash cache increment fields. - * - * JRM -- 1/2/08 - * *------------------------------------------------------------------------- */ herr_t @@ -3352,11 +2980,8 @@ done: * * Programmer: John Mainzer, 6/29/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr, @@ -3473,7 +3098,6 @@ static herr_t H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, haddr_t addr) { - size_t entry_size; H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; herr_t ret_value = SUCCEED; /* Return value */ @@ -3494,8 +3118,6 @@ H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, HDassert( aux_ptr != NULL ); HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); - entry_size = entry_ptr->size; - if ( aux_ptr->mpi_rank == 0 ) { H5AC_slist_entry_t * slist_entry_ptr; @@ -3524,9 +3146,9 @@ H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, } aux_ptr->d_slist_len += 1; - aux_ptr->dirty_bytes += entry_size; + aux_ptr->dirty_bytes += entry_ptr->size; #if H5AC_DEBUG_DIRTY_BYTES_CREATION - aux_ptr->unprotect_dirty_bytes += entry_size; + aux_ptr->unprotect_dirty_bytes += entry_ptr->size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ } @@ -3561,7 +3183,7 @@ H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, } } else { - aux_ptr->dirty_bytes += entry_size; + aux_ptr->dirty_bytes += entry_ptr->size; #if H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->unprotect_dirty_bytes += entry_size; aux_ptr->unprotect_dirty_bytes_updates += 1; @@ -3595,11 +3217,8 @@ done: * * Programmer: John Mainzer, 6/29/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL #if 0 /* This is useful debugging code. -- JRM */ static herr_t @@ -3757,11 +3376,8 @@ done: * * Programmer: John Mainzer, 6/30/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL static herr_t H5AC_log_inserted_entry(H5F_t * f, @@ -3898,8 +3514,6 @@ done: * * Programmer: John Mainzer, 6/30/05 * - * Modifications: - * *------------------------------------------------------------------------- */ #ifdef H5_HAVE_PARALLEL @@ -4126,14 +3740,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, @@ -4255,11 +3863,8 @@ done: * * Programmer: John Mainzer, 7/4/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #ifdef H5_HAVE_PARALLEL static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f, diff --git a/src/H5B2int.c b/src/H5B2int.c index ecf9bae..d31231e 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) diff --git a/src/H5B2test.c b/src/H5B2test.c index d1435b5..8b48fa2 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -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/H5C.c b/src/H5C.c index 9623f04..adfcc23 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(). * @@ -319,7 +294,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } - /*------------------------------------------------------------------------- * Function: H5C_create @@ -343,66 +317,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/27/07 - * Added initialization for the new evictions_enabled - * field of H5C_t. - * - * JRM -- 12/31/07 - * Added initialization for the new flash cache size increase - * related fields of H5C_t. - * *------------------------------------------------------------------------- */ - H5C_t * H5C_create(size_t max_cache_size, size_t min_clean_size, @@ -638,19 +554,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 @@ -840,10 +743,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/2/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -896,10 +795,6 @@ done: * Programmer: John Mainzer * 6/2/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -950,10 +845,6 @@ done: * Programmer: John Mainzer * 6/29/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -1073,77 +964,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 -- 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. - * *------------------------------------------------------------------------- */ herr_t @@ -1511,34 +1331,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 - * *------------------------------------------------------------------------- */ herr_t @@ -1726,10 +1518,6 @@ done: * Programmer: John Mainzer * 10/8/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -1776,10 +1564,6 @@ done: * Programmer: John Mainzer * 10/8/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -1839,10 +1623,6 @@ done: * Programmer: John Mainzer * 10/7/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -1904,11 +1684,6 @@ done: * Programmer: John Mainzer * 7/1/05 * - * Modifications: - * - * JRM -- 4/26/06 - * Added the is_pinned_ptr parameter and supporting code. - * *------------------------------------------------------------------------- */ herr_t @@ -1996,10 +1771,6 @@ done: * Programmer: John Mainzer * 7/27/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -2118,59 +1889,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 -- 8/1/07 - * Added code to disable evictions when the new - * evictions_enabled field is FALSE. - * - * JRM -- 12/31/07 - * Added code supporting flash cache size increases. - * *------------------------------------------------------------------------- */ herr_t @@ -2456,20 +2174,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. - * *------------------------------------------------------------------------- */ #ifdef H5_HAVE_PARALLEL @@ -3008,7 +2712,7 @@ H5C_resize_entry(void *thing, size_t new_size) if(new_size <= 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive.") if(!(entry_ptr->is_pinned || entry_ptr->is_protected)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned or protected??") + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") /* update for change in entry size if necessary */ if ( entry_ptr->size != new_size ) { @@ -3034,12 +2738,12 @@ H5C_resize_entry(void *thing, size_t new_size) if(entry_ptr->is_pinned) { H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ (cache_ptr->pel_size), \ - (entry_ptr->size), (new_size)); + (entry_ptr->size), (new_size)) } /* end if */ if(entry_ptr->is_protected) { H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \ (cache_ptr->pl_size), \ - (entry_ptr->size), (new_size)); + (entry_ptr->size), (new_size)) } /* end if */ /* update the hash table */ @@ -3147,62 +2851,10 @@ done: * 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 -- 1/3/08 - * Added to do a flash cache size increase if appropriate - * when a large entry is loaded. - * *------------------------------------------------------------------------- */ void * @@ -3541,13 +3193,8 @@ done: * * Programmer: John Mainzer, 10/5/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr) { @@ -3587,21 +3234,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 @@ -3879,10 +3511,6 @@ done: * Programmer: John Mainzer * 7/27/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -3938,11 +3566,8 @@ done: * Programmer: John Mainzer * 1/20/06 * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix) @@ -3984,11 +3609,8 @@ done: * Programmer: John Mainzer * 6/11/04 * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5C_set_skip_flags(H5C_t * cache_ptr, hbool_t skip_file_checks, @@ -4029,11 +3651,8 @@ done: * Programmer: John Mainzer * 1/20/06 * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5C_set_trace_file_ptr(H5C_t * cache_ptr, FILE * trace_file_ptr) @@ -4068,35 +3687,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, @@ -4500,34 +4092,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) @@ -4694,66 +4260,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 -- 12/31/07 - * Modified funtion to support flash cache resizes. - * *------------------------------------------------------------------------- */ herr_t @@ -4939,8 +4445,8 @@ H5C_unprotect(H5F_t * f, } - /* H5C__UPDATE_RP_FOR_UNPROTECT will places the unprotected entry on - * the pinned entry list if entry_ptr->is_pined is TRUE. + /* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on + * the pinned entry list if entry_ptr->is_pinned is TRUE. */ H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, FAIL) @@ -5079,15 +4585,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) @@ -5352,16 +4851,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 -- 1/5/08 - * Added support for flash cache size increases. - * *------------------------------------------------------------------------- */ static herr_t @@ -5715,10 +5204,6 @@ done: * * Programmer: John Mainzer, 11/18/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ static herr_t @@ -5841,13 +5326,8 @@ done: * * Programmer: John Mainzer, 11/22/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) { @@ -5973,23 +5453,6 @@ done: * * Programmer: John Mainzer, 11/22/04 * - * Modifications: - * - * JRM -- 10/13/07 - * Added code to detect and manage the case in which a - * flush callback changes the LRU-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. - * *------------------------------------------------------------------------- */ static herr_t @@ -6208,13 +5671,8 @@ done: * * Programmer: John Mainzer, 11/19/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr) { @@ -6294,13 +5752,8 @@ done: * * Programmer: John Mainzer, 11/22/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr) { @@ -6380,13 +5833,8 @@ done: * * Programmer: John Mainzer, 11/19/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr) { @@ -6474,10 +5922,6 @@ done: * * Programmer: John Mainzer, 12/31/07 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ static herr_t @@ -6663,30 +6107,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 - * *------------------------------------------------------------------------- */ static herr_t @@ -7230,49 +6650,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. - * *------------------------------------------------------------------------- */ static herr_t @@ -7813,25 +7190,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. - * *------------------------------------------------------------------------- */ static void * @@ -7971,44 +7329,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 -- 10/13/07 - * Added code to detect and manage the case in which a - * flush callback changes the LRU-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. - * *------------------------------------------------------------------------- */ static herr_t @@ -8336,11 +7656,8 @@ done: * * Programmer: John Mainzer, 7/14/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #if H5C_DO_EXTREME_SANITY_CHECKS static herr_t @@ -8459,11 +7776,8 @@ done: * * Programmer: John Mainzer, 7/14/05 * - * Modifications: - * *------------------------------------------------------------------------- */ - #if H5C_DO_EXTREME_SANITY_CHECKS static herr_t @@ -8510,3 +7824,4 @@ done: } /* H5C_verify_not_in_index() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + diff --git a/src/H5F.c b/src/H5F.c index b7825bd..4900ab7 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -933,7 +933,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) * The cache might be created with a different number of elements and * the access property list should be updated to reflect that. */ - if(SUCCEED != H5AC_create(f, &(f->shared->mdc_initCacheCfg))) + if(H5AC_create(f, &(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create metadata cache") /* Create the file's "open object" information */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index bb411a2..a040490 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -107,7 +107,7 @@ static herr_t H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, cons static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); -/* H5G inherits cache-like properties from H5AC */ +/* H5G symbol table node inherits cache-like properties from H5AC */ const H5AC_class_t H5AC_SNODE[1] = {{ H5AC_SNODE_ID, (H5AC_load_func_t)H5G_node_load, @@ -262,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 @@ -694,8 +694,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 */ @@ -744,7 +744,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 */ @@ -803,7 +803,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 */ @@ -871,11 +871,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, 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); /* @@ -977,11 +977,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, 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); /* @@ -1020,7 +1020,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, 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), @@ -1134,7 +1134,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, 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 */ @@ -1144,7 +1144,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; @@ -1164,7 +1164,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 */ @@ -1173,7 +1173,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; @@ -1344,7 +1344,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, 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") /* @@ -1358,7 +1358,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 */ @@ -1421,7 +1421,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, 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; @@ -1466,7 +1466,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, 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 */ @@ -1604,7 +1604,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, 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 */ @@ -1672,7 +1672,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"); @@ -1684,7 +1684,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 */ @@ -1739,7 +1739,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, 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 */ @@ -1748,7 +1748,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 */ @@ -1759,7 +1759,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 */ @@ -1853,7 +1853,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, 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 */ @@ -1878,7 +1878,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/H5HFdblock.c b/src/H5HFdblock.c index 39c0738..78af693 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -457,6 +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) { + udata.odi_size = hdr->pline_root_direct_size; udata.filter_mask = hdr->pline_root_direct_filter_mask; } /* end if */ else { @@ -464,14 +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 */ + 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 + else { + 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, &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/H5HFiblock.c b/src/H5HFiblock.c index 7f83271..9a2926c 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, &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 171a14f..74d6c1a 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -491,6 +491,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/H5O.c b/src/H5O.c index 4a207e6..80cd835 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1611,7 +1611,7 @@ 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; - chk_udata.chunk_size = cont_msg_info.msgs[curr_msg].size; + 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") diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index afc22bd..2adf3a9 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -680,8 +680,8 @@ 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 */ - unsigned cont_chunkno = oh->mesg[u].chunkno; /* Chunk # for continuation message */ 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 */ if(NULL == (chk_proxy2 = H5O_chunk_protect(f, dxpl_id, oh, cont_chunkno))) diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 6ba9d47..1304340 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -1030,7 +1030,7 @@ 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 */ + 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 9aba140..752d4a4 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -650,11 +650,11 @@ H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough for serialized header */ - if(NULL == (buf = (uint8_t *)H5WB_actual(wb, udata->chunk_size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, udata->size))) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read rest of the raw data */ - if(H5F_block_read(f, H5FD_MEM_OHDR, addr, udata->chunk_size, dxpl_id, buf) < 0) + if(H5F_block_read(f, H5FD_MEM_OHDR, addr, udata->size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header continuation chunk") /* Check if we are still decoding the object header */ @@ -665,7 +665,7 @@ H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HDassert(udata->common.cont_msg_info); /* Parse the chunk */ - if(H5O_chunk_deserialize(udata->oh, udata->common.addr, udata->chunk_size, buf, &(udata->common), &chk_proxy->cache_info.is_dirty) < 0) + if(H5O_chunk_deserialize(udata->oh, udata->common.addr, udata->size, buf, &(udata->common), &chk_proxy->cache_info.is_dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk") /* Set the fields for the chunk proxy */ diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index d683a7b..bc0f718 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -173,7 +173,7 @@ 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.chunk_size = oh->chunk[idx].size; + 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, &chk_udata, H5AC_WRITE))) @@ -232,7 +232,7 @@ H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_p chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy); } /* end if */ else { - /* Release the chunk proxy from the cache, marking it dirty */ + /* Release the chunk proxy from the cache, possibly marking it dirty */ if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[chk_proxy->chunkno].addr, chk_proxy, (dirtied ? H5AC__DIRTIED_FLAG : H5AC__NO_FLAGS_SET)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") } /* end else */ @@ -318,7 +318,7 @@ 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.chunk_size = oh->chunk[idx].size; + 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, &chk_udata, H5AC_WRITE))) @@ -370,7 +370,7 @@ 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.chunk_size = oh->chunk[idx].size; + 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, &chk_udata, H5AC_WRITE))) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 2298935..e8f838f 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -361,7 +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 chunk_size; /* Chunk size */ + 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; @@ -545,7 +545,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, unsigned chk_flags); + 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/H5Pfapl.c b/src/H5Pfapl.c index fae421b..439ca0c 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1319,10 +1319,6 @@ done: * Programmer: J. Mainzer * Thursday, April 7, 2005 * - * Modifications: - * - * Done. - * *------------------------------------------------------------------------- */ herr_t @@ -1371,10 +1367,6 @@ done: * Programmer: J. Mainzer * Thursday, April 7, 2005 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index bab5a1a..82e885f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -24,7 +24,7 @@ /* Public headers needed by this file */ #include "H5public.h" -#include "H5Cpublic.h" +#include "H5ACpublic.h" #include "H5Dpublic.h" #include "H5Fpublic.h" #include "H5FDpublic.h" diff --git a/src/H5SM.c b/src/H5SM.c index 6a80cc4..f52d177 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,7 +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)) { - if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, 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 == (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 @@ -395,6 +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 */ + H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ ssize_t index_num; /* Which index */ herr_t ret_value = SUCCEED; /* Return value */ @@ -404,8 +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); + /* 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, 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 */ @@ -637,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); @@ -895,7 +906,13 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table, 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, 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 */ @@ -985,6 +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; + 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; @@ -1000,8 +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) + /* 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, 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 */ @@ -1364,6 +1386,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg) { H5SM_master_table_t *table = NULL; 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; @@ -1379,8 +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; + /* 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, 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 */ @@ -1790,6 +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 { + 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 */ @@ -1807,8 +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); + /* 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, 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 */ @@ -2017,6 +2049,7 @@ 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 */ @@ -2033,8 +2066,12 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id, HDassert(sh_mesg); HDassert(ref_count); + /* 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, 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 */ @@ -2065,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, &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 */ @@ -2333,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() */ @@ -2361,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() */ @@ -2388,6 +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 */ + H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ unsigned x; /* Counter variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2417,8 +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") + /* 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, 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, ""); @@ -2563,6 +2605,7 @@ 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 */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2574,8 +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); + /* 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, 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/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 3b4f363..67140dd 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -91,10 +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 */ + H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ ssize_t index_num; /* Table index for message type */ + /* 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, 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_common.c b/test/cache_common.c index 0eb04f0..98ff0dd 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -74,6 +74,75 @@ 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_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t nano_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t micro_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t tiny_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t small_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t medium_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t large_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t huge_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t monster_clear(H5F_t * f, void * thing, hbool_t dest); +static herr_t variable_clear(H5F_t * f, void * thing, hbool_t dest); + + +static herr_t pico_dest(H5F_t * f, void * thing); +static herr_t nano_dest(H5F_t * f, void * thing); +static herr_t micro_dest(H5F_t * f, void * thing); +static herr_t tiny_dest(H5F_t * f, void * thing); +static herr_t small_dest(H5F_t * f, void * thing); +static herr_t medium_dest(H5F_t * f, void * thing); +static herr_t large_dest(H5F_t * f, void * thing); +static herr_t huge_dest(H5F_t * f, void * thing); +static herr_t monster_dest(H5F_t * f, void * thing); +static herr_t variable_dest(H5F_t * f, void * thing); + + +static herr_t pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t nano_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t micro_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t tiny_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t small_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t medium_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t large_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t huge_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); +static herr_t variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); + + +static void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); +static void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); + + +static herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t nano_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t micro_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t tiny_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t small_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t medium_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t large_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t huge_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t monster_size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t variable_size(H5F_t * f, void * thing, size_t * size_ptr); + test_entry_t * entries[NUMBER_OF_ENTRY_TYPES] = { pico_entries, @@ -259,6 +328,7 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, /* address translation funtions: */ + /*------------------------------------------------------------------------- * Function: addr_to_type_and_index * @@ -1629,25 +1699,20 @@ reset_entries(void) /*------------------------------------------------------------------------- - * Function: resize_entry + * Function: resize_entry * - * Purpose: Given a pointer to a cache, an entry type, an index, and + * Purpose: Given a pointer to a cache, an entry type, an index, and * a new size, set the size of the target entry to the new size. * * Note that at present, the type of the entry must be * VARIABLE_ENTRY_TYPE. * - * If the in_cache parameter is true, verify that the - * target entry is in the cache. If it - * isn't, scream and die. If it is, use the - * H5C_resize_entry() call to resize it. - * - * Do nothing if pass is false on entry. + * Do nothing if pass is false on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer - * 6/10/04 + * Programmer: John Mainzer + * 1/11/08 * *------------------------------------------------------------------------- */ @@ -1656,7 +1721,7 @@ void resize_entry(H5F_t * file_ptr, int32_t type, int32_t idx, - size_t new_size, + size_t new_size, hbool_t in_cache) { test_entry_t * base_addr; @@ -1711,8 +1776,8 @@ resize_entry(H5F_t * file_ptr, HDassert( entry_ptr->size = (entry_ptr->header).size ); } - } - } + } + } } else { protect_entry(file_ptr, type, idx); @@ -2267,7 +2332,7 @@ setup_cache(size_t max_cache_size, cache_ptr = H5C_create(max_cache_size, min_clean_size, (NUMBER_OF_ENTRY_TYPES - 1), - (const char **)entry_type_names, + (const char **)entry_type_names, check_write_permitted, TRUE, NULL, @@ -2368,7 +2433,7 @@ setup_cache(size_t max_cache_size, * Return: void * * Programmer: John Mainzer - * 6/11/04 + * 9/14/07 * *------------------------------------------------------------------------- */ @@ -2945,10 +3010,9 @@ protect_entry_ro(H5F_t * file_ptr, int32_t type, int32_t idx) { - /* const char * fcn_name = "protect_entry_ro()"; */ H5C_t *cache_ptr; - test_entry_t * base_addr; - test_entry_t * entry_ptr; + test_entry_t *base_addr; + test_entry_t *entry_ptr; H5C_cache_entry_t * cache_entry_ptr; if ( pass ) { @@ -3021,7 +3085,6 @@ void unpin_entry(int32_t type, int32_t idx) { - /* const char * fcn_name = "unpin_entry()"; */ herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -3041,7 +3104,7 @@ unpin_entry(int32_t type, HDassert( entry_ptr->header.is_pinned ); HDassert( entry_ptr->is_pinned ); - result = H5C_unpin_entry((void *)entry_ptr); + result = H5C_unpin_entry(entry_ptr); if ( ( result < 0 ) || ( entry_ptr->header.is_pinned ) || @@ -3843,7 +3906,7 @@ row_major_scan_backward(H5F_t * file_ptr, } else { unprotect_entry(file_ptr, type, idx + lag, - (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); + (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); } break; @@ -3878,7 +3941,7 @@ row_major_scan_backward(H5F_t * file_ptr, ( ( idx + lag) <= max_indices[type] ) ) { if ( verbose ) - HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag)); + HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag)); unprotect_entry(file_ptr, type, idx + lag, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); @@ -4021,8 +4084,6 @@ hl_row_major_scan_backward(H5F_t * file_ptr, * Programmer: John Mainzer * 6/23/04 * - * Modifications: - * *------------------------------------------------------------------------- */ diff --git a/test/cache_common.h b/test/cache_common.h index 13ef83f..2e0f872 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -423,75 +423,6 @@ herr_t check_write_permitted(const H5F_t * f, hid_t dxpl_id, hbool_t * write_permitted_ptr); -herr_t pico_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t nano_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t micro_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t tiny_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t small_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t medium_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t large_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t huge_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t monster_clear(H5F_t * f, void * thing, hbool_t dest); -herr_t variable_clear(H5F_t * f, void * thing, hbool_t dest); - - -herr_t pico_dest(H5F_t * f, void * thing); -herr_t nano_dest(H5F_t * f, void * thing); -herr_t micro_dest(H5F_t * f, void * thing); -herr_t tiny_dest(H5F_t * f, void * thing); -herr_t small_dest(H5F_t * f, void * thing); -herr_t medium_dest(H5F_t * f, void * thing); -herr_t large_dest(H5F_t * f, void * thing); -herr_t huge_dest(H5F_t * f, void * thing); -herr_t monster_dest(H5F_t * f, void * thing); -herr_t variable_dest(H5F_t * f, void * thing); - - -herr_t pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t nano_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t micro_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t tiny_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t small_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t medium_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t large_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t huge_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); -herr_t variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, - haddr_t addr, void *thing, unsigned * flags_ptr); - - -void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); -void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); - - -herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t nano_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t micro_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t tiny_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t small_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t medium_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t large_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t huge_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t monster_size(H5F_t * f, void * thing, size_t * size_ptr); -herr_t variable_size(H5F_t * f, void * thing, size_t * size_ptr); - /* callback table extern */ extern const H5C_class_t types[NUMBER_OF_ENTRY_TYPES]; @@ -535,9 +466,9 @@ void mark_entry_dirty(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 protect_entry(H5F_t * file_ptr, int32_t type, @@ -560,10 +491,10 @@ void create_pinned_entry_dependency(H5F_t * file_ptr, void reset_entries(void); void resize_entry(H5F_t * file_ptr, - int32_t type, - int32_t idx, - size_t new_size, - hbool_t in_cache); + 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); diff --git a/test/ohdr.c b/test/ohdr.c index 67624c6..0b74c2a 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -264,6 +264,8 @@ main(void) envval = "nomatch"; if(HDstrcmp(envval, "multi") && HDstrcmp(envval, "split") && HDstrcmp(envval, "family")) { hid_t file2; /* File ID for 'bogus' object file */ + hid_t sid; /* Dataspace ID */ + hid_t aid; /* Attribute ID */ char testpath[512] = ""; char testfile[512] = ""; char *srcdir = HDgetenv("srcdir"); @@ -344,6 +346,22 @@ main(void) if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR + /* Create data space */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + FAIL_STACK_ERROR + + /* Create an attribute, to get the object header into write access */ + if((aid = H5Acreate2(dset, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Close dataspace */ + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + + /* Close attribute */ + if(H5Aclose(aid) < 0) + FAIL_STACK_ERROR + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 74ac06c..d99cec0 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -3557,8 +3557,7 @@ unlock_entry(H5C_t * cache_ptr, } result = H5AC_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), - entry_ptr->base_addr, - (void *)(&(entry_ptr->header)), flags); + entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags); if ( ( result < 0 ) || ( entry_ptr->header.type != &(types[0]) ) || @@ -4193,7 +4192,7 @@ smoke_check_2(void) /* we can't move pinned entries, so release any local pins now. */ local_unpin_all_entries(cache_ptr, file_ptr, FALSE); - /* move the first half of the entries... */ + /* Move the first half of the entries... */ for ( i = 0; i < (virt_num_data_entries / 2); i++ ) { lock_entry(cache_ptr, file_ptr, i); @@ -5048,10 +5047,7 @@ smoke_check_5(void) resize_entry(i, data[i].len / 2); } - if ( i % 4 == 0 ) - mark_entry_dirty(cache_ptr, file_ptr, i); - else - mark_entry_dirty(cache_ptr, file_ptr, i); + mark_entry_dirty(cache_ptr, file_ptr, i); if ( i % 8 <= 4 ) { -- cgit v0.12