summaryrefslogtreecommitdiffstats
path: root/src/H5AC.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-18 12:14:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-18 12:14:44 (GMT)
commit2fc65cf787c134a7c1d7c12d0a990c56d21d381e (patch)
treeea6fa916e2b136579861f34ff026360758d44664 /src/H5AC.c
parentef8cfc3e9f1fa4819e0e7dfffc7231c44365995c (diff)
downloadhdf5-2fc65cf787c134a7c1d7c12d0a990c56d21d381e.zip
hdf5-2fc65cf787c134a7c1d7c12d0a990c56d21d381e.tar.gz
hdf5-2fc65cf787c134a7c1d7c12d0a990c56d21d381e.tar.bz2
[svn-r18837] Description:
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 Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/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
Diffstat (limited to 'src/H5AC.c')
-rw-r--r--src/H5AC.c60
1 files changed, 20 insertions, 40 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 63a9cb2..fe69703 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -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,
@@ -1290,7 +1288,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 */
}
@@ -1731,6 +1729,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;
@@ -1740,19 +1741,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)
@@ -1958,7 +1952,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;
@@ -2005,32 +1999,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")
}
@@ -2057,8 +2047,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 ) {
@@ -3476,9 +3465,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;
@@ -3501,14 +3488,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;