diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-05-18 19:09:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-05-18 19:09:04 (GMT) |
commit | 4e0e18dfa5aab1bf63e130c9569ffba83ce3697e (patch) | |
tree | 376f356a2d69eb6939c6aacbab8be276f96df7fc /src/H5AC.c | |
parent | 38df150e1635103c44ec4c89ee9eff43a61ebc84 (diff) | |
download | hdf5-4e0e18dfa5aab1bf63e130c9569ffba83ce3697e.zip hdf5-4e0e18dfa5aab1bf63e130c9569ffba83ce3697e.tar.gz hdf5-4e0e18dfa5aab1bf63e130c9569ffba83ce3697e.tar.bz2 |
[svn-r18851] Description:
Bring r18837 from trunk to 1.8 branch:
Remove the size parameter from H5[A]C_unprotect() and the
H5[A]C__SIZE_CHANGED_FLAG, switching all clients & tests over to using
H5[A]C_resize_entry appropriately.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug 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
(h5committested on trunk)
Diffstat (limited to 'src/H5AC.c')
-rw-r--r-- | src/H5AC.c | 60 |
1 files changed, 20 insertions, 40 deletions
@@ -155,9 +155,7 @@ static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr, unsigned int flags); static herr_t H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, - haddr_t addr, - hbool_t size_changed, - size_t new_size); + haddr_t addr); static herr_t H5AC_log_flushed_entry(H5C_t * cache_ptr, haddr_t addr, @@ -1272,7 +1270,7 @@ H5AC_mark_entry_dirty(void *thing) if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) && (NULL != cache_ptr->aux_ptr)) { - if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, FALSE, 0) < 0) + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") } /* end if */ } @@ -1662,6 +1660,9 @@ H5AC_resize_entry(void *thing, size_t new_size) (int)new_size); #endif /* H5AC__TRACE_FILE_ENABLED */ + if(H5C_resize_entry(thing, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") + #ifdef H5_HAVE_PARALLEL { H5AC_info_t * entry_ptr = (H5AC_info_t *)thing; @@ -1671,19 +1672,12 @@ H5AC_resize_entry(void *thing, size_t new_size) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) { - /* Check for usage errors */ - if(!(entry_ptr->is_pinned || entry_ptr->is_protected)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned or protected??") - - if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, TRUE, new_size) < 0) + if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") } /* end if */ } #endif /* H5_HAVE_PARALLEL */ - if(H5C_resize_entry(thing, new_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") - done: #if H5AC__TRACE_FILE_ENABLED if(trace_file_ptr) @@ -1839,7 +1833,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, { herr_t result; hbool_t dirtied; - size_t new_size = 0; + hbool_t deleted; #ifdef H5_HAVE_PARALLEL hbool_t size_changed = FALSE; H5AC_aux_t * aux_ptr = NULL; @@ -1886,32 +1880,28 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, dirtied = (hbool_t)( ( (flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG ) || ( ((H5AC_info_t *)thing)->dirtied ) ); + deleted = (hbool_t)( (flags & H5C__DELETED_FLAG) == H5C__DELETED_FLAG ); - if ( dirtied ) { + /* Check if the size changed out from underneath us, if we're not deleting + * the entry. + */ + if ( dirtied && !deleted ) { + size_t curr_size = 0; - if ( (type->size)(f, thing, &new_size) < 0 ) { + if ( (type->size)(f, thing, &curr_size) < 0 ) { HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \ "Can't get size of thing") } - if ( ((H5AC_info_t *)thing)->size != new_size ) { - -#ifdef H5_HAVE_PARALLEL - size_changed = TRUE; -#endif /* H5_HAVE_PARALLEL */ - flags = flags | H5AC__SIZE_CHANGED_FLAG; -#if H5AC__TRACE_FILE_ENABLED - trace_flags = flags; - trace_new_size = new_size; -#endif /* H5AC__TRACE_FILE_ENABLED */ - } + if(((H5AC_info_t *)thing)->size != curr_size) + HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "size of entry changed") } #ifdef H5_HAVE_PARALLEL if ( ( dirtied ) && ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) && ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) ) { - if(H5AC_log_dirtied_entry((H5AC_info_t *)thing, addr, size_changed, new_size) < 0) + if(H5AC_log_dirtied_entry((H5AC_info_t *)thing, addr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") } @@ -1938,8 +1928,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, type, addr, thing, - flags, - new_size); + flags); if ( result < 0 ) { @@ -3357,9 +3346,7 @@ done: #ifdef H5_HAVE_PARALLEL static herr_t H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, - haddr_t addr, - hbool_t size_changed, - size_t new_size) + haddr_t addr) { size_t entry_size; H5AC_t * cache_ptr; @@ -3382,14 +3369,7 @@ H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, HDassert( aux_ptr != NULL ); HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC ); - if ( size_changed ) { - - entry_size = new_size; - - } else { - - entry_size = entry_ptr->size; - } + entry_size = entry_ptr->size; if ( aux_ptr->mpi_rank == 0 ) { H5AC_slist_entry_t * slist_entry_ptr; |