summaryrefslogtreecommitdiffstats
path: root/src/H5AC.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-05-27 20:27:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-05-27 20:27:13 (GMT)
commit9f90e06bd0b400f5b5d9631eb680c00da3199894 (patch)
treea707a89c16689e8dee5eb927ffacd7ec5a7de91d /src/H5AC.c
parent2f5164b1047a705e81fff46f1b8107426cbcc61b (diff)
downloadhdf5-9f90e06bd0b400f5b5d9631eb680c00da3199894.zip
hdf5-9f90e06bd0b400f5b5d9631eb680c00da3199894.tar.gz
hdf5-9f90e06bd0b400f5b5d9631eb680c00da3199894.tar.bz2
[svn-r18917] Description:
Bring r18911 (plus some adaptions to match the code on the trunk) from the metadata journaling "merging" branch to the trunk: More general changes to align trunk with eventual changes from metadata journaling branch. 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 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
Diffstat (limited to 'src/H5AC.c')
-rw-r--r--src/H5AC.c105
1 files changed, 28 insertions, 77 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 4add188..e3994e5 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -157,9 +157,7 @@ static herr_t H5AC_log_flushed_entry_dummy(H5C_t * cache_ptr,
static herr_t H5AC_log_inserted_entry(H5F_t * f,
H5AC_t * cache_ptr,
- H5AC_info_t * entry_ptr,
- const H5AC_class_t * type,
- haddr_t addr);
+ H5AC_info_t * entry_ptr);
static herr_t H5AC_propagate_flushed_and_still_clean_entries_list(H5F_t * f,
hid_t dxpl_id,
@@ -985,7 +983,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
void *thing, unsigned int flags)
{
herr_t result;
- H5AC_info_t *info;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -1032,74 +1029,43 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
}
#endif /* H5AC__TRACE_FILE_ENABLED */
- /* Get local copy of this information */
- info = (H5AC_info_t *)thing;
-
- info->addr = addr;
- info->type = type;
- info->is_protected = FALSE;
-
-#ifdef H5_HAVE_PARALLEL
- if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) {
-
- result = H5AC_log_inserted_entry(f,
- f->shared->cache,
- (H5AC_info_t *)thing,
- type,
- addr);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
- "H5AC_log_inserted_entry() failed.")
- }
- }
-#endif /* H5_HAVE_PARALLEL */
-
- result = H5C_insert_entry(f,
- dxpl_id,
- H5AC_noblock_dxpl_id,
- type,
- addr,
- thing,
- flags);
-
- if ( result < 0 ) {
-
+ /* Insert entry into metadata cache */
+ if(H5C_insert_entry(f, dxpl_id, H5AC_noblock_dxpl_id, type, addr, thing, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed")
- }
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr != NULL) {
/* make note of the entry size */
trace_entry_size = ((H5C_cache_entry_t *)thing)->size;
}
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
- /* Check if we should try to flush */
- if(aux_ptr && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) {
- hbool_t evictions_enabled;
-
- /* Query if evictions are allowed */
- if(H5C_get_evictions_enabled((const H5C_t *)f->shared->cache, &evictions_enabled) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.")
-
- /* Flush if evictions are allowed */
- if(evictions_enabled) {
- if(H5AC_propagate_flushed_and_still_clean_entries_list(f,
- H5AC_noblock_dxpl_id, f->shared->cache, TRUE) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
+ if(NULL != (aux_ptr = f->shared->cache->aux_ptr)) {
+ if(H5AC_log_inserted_entry(f, f->shared->cache, (H5AC_info_t *)thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC_log_inserted_entry() failed")
+
+ /* Check if we should try to flush */
+ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) {
+ hbool_t evictions_enabled;
+
+ /* Query if evictions are allowed */
+ if(H5C_get_evictions_enabled((const H5C_t *)f->shared->cache, &evictions_enabled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.")
+
+ /* Flush if evictions are allowed */
+ if(evictions_enabled) {
+ if(H5AC_propagate_flushed_and_still_clean_entries_list(f,
+ H5AC_noblock_dxpl_id, f->shared->cache, TRUE) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.")
+ } /* end if */
} /* end if */
} /* end if */
#endif /* H5_HAVE_PARALLEL */
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr != NULL) {
HDfprintf(trace_file_ptr, "%s %d %d\n", trace,
(int)trace_entry_size,
(int)ret_value);
@@ -1107,7 +1073,6 @@ done:
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_set() */
@@ -3397,12 +3362,9 @@ done:
static herr_t
H5AC_log_inserted_entry(H5F_t * f,
H5AC_t * cache_ptr,
- H5AC_info_t * entry_ptr,
- const H5AC_class_t * type,
- haddr_t addr)
+ H5AC_info_t * entry_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
- size_t size;
H5AC_aux_t * aux_ptr = NULL;
H5AC_slist_entry_t * slist_entry_ptr = NULL;
@@ -3417,24 +3379,13 @@ H5AC_log_inserted_entry(H5F_t * f,
HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
HDassert( entry_ptr != NULL );
- HDassert( entry_ptr->addr == addr );
- HDassert( entry_ptr->type == type );
-
- /* the size field of the entry will not have been set yet, so we
- * have to obtain it directly.
- */
- if ( (type->size)(f, (void *)entry_ptr, &size) < 0 ) {
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \
- "Can't get size of entry to be inserted.")
- }
if ( aux_ptr->mpi_rank == 0 ) {
HDassert( aux_ptr->d_slist_ptr != NULL );
HDassert( aux_ptr->c_slist_ptr != NULL );
- if ( H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr)) == NULL ) {
+ if ( H5SL_search(aux_ptr->d_slist_ptr, (void *)(&entry_ptr->addr)) == NULL ) {
/* insert the address of the entry in the dirty entry list, and
* add its size to the dirty_bytes count.
@@ -3446,7 +3397,7 @@ H5AC_log_inserted_entry(H5F_t * f,
}
slist_entry_ptr->magic = H5AC__H5AC_SLIST_ENTRY_T_MAGIC;
- slist_entry_ptr->addr = addr;
+ slist_entry_ptr->addr = entry_ptr->addr;
if ( H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr,
&(slist_entry_ptr->addr)) < 0 ) {
@@ -3463,14 +3414,14 @@ H5AC_log_inserted_entry(H5F_t * f,
"Inserted entry already in dirty slist.")
}
- if ( H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr)) != NULL ) {
+ if ( H5SL_search(aux_ptr->c_slist_ptr, (void *)(&entry_ptr->addr)) != NULL ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Inserted entry in clean slist.")
}
}
- aux_ptr->dirty_bytes += size;
+ aux_ptr->dirty_bytes += entry_ptr->size;
#if H5AC_DEBUG_DIRTY_BYTES_CREATION
aux_ptr->insert_dirty_bytes += size;