diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-24 19:09:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-24 19:09:36 (GMT) |
commit | b6494f0fc9159fae1418e033126826cf61a3ff21 (patch) | |
tree | d69e857ee6484f6e716400d92f2b8dae61b0e627 /src/H5C.c | |
parent | 81e3eef99a7c0363d10c4d8972163da25a0da662 (diff) | |
download | hdf5-b6494f0fc9159fae1418e033126826cf61a3ff21.zip hdf5-b6494f0fc9159fae1418e033126826cf61a3ff21.tar.gz hdf5-b6494f0fc9159fae1418e033126826cf61a3ff21.tar.bz2 |
[svn-r17415] Description:
Bring r17408, 17411, 17412, 17413 & 17414 from trunk back to 1.8 branch:
r17408:
Move flush operation on mounted file hierarchy into H5Fmount module.
r17411:
Make H5AC_flush just flush the cache and make H5AC_dest perform the
proper parallel synchronization before destroying the cache. Also, further
discriminate between 'closing' and 'non-closing' actions in H5F_flush.
r17412:
Seperate 'flush' functionality from 'destroy' functionality at the
H5F level also.
r17413:
Remove vestigial intermediate routine for flushing file and move it
into API routine. Also, remove private, unused (now) 'H5F_FLUSH_DOWN' symbol
from public header file.
r17414:
Flush the core VFD's buffer before closing the file, also flush the
metadata accumulator before reseting it. Write the driver info message out
in the superblock flush routine more directly, instead of using wrapper
routine, since the wrapper routine won't work when the superblock is being
shutdown.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
(h5committest performed on trunk)
Diffstat (limited to 'src/H5C.c')
-rw-r--r-- | src/H5C.c | 113 |
1 files changed, 23 insertions, 90 deletions
@@ -3445,10 +3445,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, * Programmer: John Mainzer * 6/2/04 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t @@ -3461,21 +3457,20 @@ H5C_dest(H5F_t * f, FUNC_ENTER_NOAPI(H5C_dest, FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->skip_file_checks || f ); - - if ( H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id, - cache_ptr, H5C__FLUSH_INVALIDATE_FLAG) < 0 ) { + /* Sanity check */ + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->skip_file_checks || f); + /* Flush and invalidate all cache entries */ + if(H5C_flush_invalidate_cache(f, primary_dxpl_id, secondary_dxpl_id, + cache_ptr, H5C__NO_FLAGS_SET) < 0 ) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } - - if ( cache_ptr->slist_ptr != NULL ) { + if(cache_ptr->slist_ptr != NULL) { H5SL_close(cache_ptr->slist_ptr); cache_ptr->slist_ptr = NULL; - } + } /* end if */ cache_ptr->magic = 0; @@ -3483,66 +3478,10 @@ H5C_dest(H5F_t * f, done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_dest() */ /*------------------------------------------------------------------------- - * Function: H5C_dest_empty - * - * Purpose: Destroy an empty cache. - * - * This function fails if the cache is not empty on entry. - * - * Note that *cache_ptr has been freed upon successful return. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/2/04 - * - * Modifications: - * - * None. - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_dest_empty(H5C_t * cache_ptr) -{ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5C_dest_empty, FAIL) - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ( ( ! cache_ptr ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( cache_ptr->index_len != 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad cache_ptr or non-empty cache on entry.") - } - - - if ( cache_ptr->slist_ptr != NULL ) { - - H5SL_close(cache_ptr->slist_ptr); - cache_ptr->slist_ptr = NULL; - } - - cache_ptr->magic = 0; - - (void)H5FL_FREE(H5C_t, cache_ptr); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_dest_empty() */ - - -/*------------------------------------------------------------------------- * * Function: H5C_expunge_entry * @@ -9890,7 +9829,6 @@ H5C_flush_invalidate_cache(H5F_t * f, { herr_t status; herr_t ret_value = SUCCEED; - hbool_t done = FALSE; hbool_t first_flush = TRUE; int32_t protected_entries = 0; int32_t i; @@ -9966,7 +9904,7 @@ H5C_flush_invalidate_cache(H5F_t * f, cur_pel_len = cache_ptr->pel_len; old_pel_len = cache_ptr->pel_len; - while ( ! done ) + while ( cache_ptr->index_len > 0 ) { /* first, try to flush-destroy any dirty entries. Do this by * making a scan through the slist. Note that new dirty entries @@ -10082,12 +10020,10 @@ H5C_flush_invalidate_cache(H5F_t * f, /* increment node pointer now, before we delete its target * from the slist. */ - node_ptr = H5SL_next(node_ptr); if ( node_ptr != NULL ) { next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( next_entry_ptr == NULL ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "next_entry_ptr == NULL 2 ?!?!"); @@ -10333,24 +10269,21 @@ H5C_flush_invalidate_cache(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "Maximum passes on flush exceeded.") } - - if ( cache_ptr->index_len <= 0 ) { - - done = TRUE; - HDassert( cache_ptr->index_size == 0 ); - HDassert( cache_ptr->clean_index_size == 0 ); - HDassert( cache_ptr->dirty_index_size == 0 ); - HDassert( cache_ptr->slist_len == 0 ); - HDassert( cache_ptr->slist_size == 0 ); - HDassert( cache_ptr->pel_len == 0 ); - HDassert( cache_ptr->pel_size == 0 ); - HDassert( cache_ptr->pl_len == 0 ); - HDassert( cache_ptr->pl_size == 0 ); - HDassert( cache_ptr->LRU_list_len == 0 ); - HDassert( cache_ptr->LRU_list_size == 0 ); - } } /* main while loop */ + /* Invariants, after destroying all entries in the hash table */ + HDassert( cache_ptr->index_size == 0 ); + HDassert( cache_ptr->clean_index_size == 0 ); + HDassert( cache_ptr->dirty_index_size == 0 ); + HDassert( cache_ptr->slist_len == 0 ); + HDassert( cache_ptr->slist_size == 0 ); + HDassert( cache_ptr->pel_len == 0 ); + HDassert( cache_ptr->pel_size == 0 ); + HDassert( cache_ptr->pl_len == 0 ); + HDassert( cache_ptr->pl_size == 0 ); + HDassert( cache_ptr->LRU_list_len == 0 ); + HDassert( cache_ptr->LRU_list_size == 0 ); + HDassert( protected_entries <= cache_ptr->pl_len ); |