summaryrefslogtreecommitdiffstats
path: root/src/H5AC.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5AC.c')
-rw-r--r--src/H5AC.c529
1 files changed, 161 insertions, 368 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 8e2ced6..659c4e6 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -154,8 +154,7 @@ static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr,
haddr_t addr,
unsigned int flags);
-static herr_t H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
- H5C_cache_entry_t * entry_ptr,
+static herr_t H5AC_log_dirtied_entry(const H5C_cache_entry_t *entry_ptr,
haddr_t addr,
hbool_t size_changed,
size_t new_size);
@@ -190,7 +189,7 @@ static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f,
hid_t secondary_dxpl_id,
H5AC_t * cache_ptr);
-static herr_t H5AC_log_renamed_entry(H5AC_t * cache_ptr,
+static herr_t H5AC_log_renamed_entry(const H5F_t * f,
haddr_t old_addr,
haddr_t new_addr);
@@ -480,7 +479,8 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] =
{
"B-tree nodes",
"symbol table nodes",
- "local heaps",
+ "local heap prefixes",
+ "local heap data blocks",
"global heaps",
"object headers",
"v2 B-tree headers",
@@ -522,11 +522,11 @@ H5AC_create(const H5F_t *f,
FUNC_ENTER_NOAPI(H5AC_create, FAIL)
- HDassert ( f );
- HDassert ( NULL == f->shared->cache );
- HDassert ( config_ptr != NULL ) ;
- HDassert ( NELMTS(H5AC_entry_type_names) == H5AC_NTYPES);
- HDassert ( H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
+ HDassert(f);
+ HDassert(NULL == f->shared->cache);
+ HDassert(config_ptr != NULL) ;
+ HDcompile_assert(NELMTS(H5AC_entry_type_names) == H5AC_NTYPES);
+ HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
result = H5AC_validate_config(config_ptr);
@@ -744,25 +744,6 @@ done:
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- *
- * Complete re-design and re-write to support the re-designed
- * metadata cache.
- * JRM - 5/12/04
- *
- * Abstracted the guts of the function to H5C_dest() in H5C.c,
- * and then re-wrote the function as a wrapper for H5C_dest().
- *
- * JRM - 6/7/04
- *
- * Added code to free the auxiliary structure and its
- * associated slist if present.
- * JRM - 6/28/05
- *
- * Added code to close the trace file if it is present.
- *
- * JRM - 6/8/06
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -796,7 +777,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
#endif /* H5_HAVE_PARALLEL */
/* Destroy the cache */
- if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache) < 0)
+ if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache")
f->shared->cache = NULL;
@@ -845,7 +826,6 @@ H5AC_expunge_entry(H5F_t *f,
unsigned flags)
{
herr_t result;
- H5AC_t * cache_ptr = NULL;
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
@@ -862,11 +842,13 @@ H5AC_expunge_entry(H5F_t *f,
HDassert(type->dest);
HDassert(H5F_addr_defined(addr));
- cache_ptr = f->shared->cache;
-
#if H5AC__TRACE_FILE_ENABLED
- /* For the expunge entry call, only the addr, and type id are really
- * necessary in the trace file. Write the return value to catch occult
+{
+ H5AC_t * cache_ptr = f->shared->cache;
+
+
+ /* For the expunge entry call, only the addr, and type id are really
+ * necessary in the trace file. Write the return value to catch occult
* errors.
*/
if ( ( cache_ptr != NULL ) &&
@@ -877,12 +859,12 @@ H5AC_expunge_entry(H5F_t *f,
(unsigned long)addr,
(int)(type->id));
}
+}
#endif /* H5AC__TRACE_FILE_ENABLED */
result = H5C_expunge_entry(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- cache_ptr,
type,
addr,
flags);
@@ -960,7 +942,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id)
#endif /* H5_HAVE_PARALLEL */
/* Flush the cache */
- if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache, H5AC__NO_FLAGS_SET) < 0)
+ if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.")
done:
@@ -998,14 +980,12 @@ done:
*
*-------------------------------------------------------------------------
*/
-
herr_t
-H5AC_get_entry_status(H5F_t * f,
+H5AC_get_entry_status(const H5F_t *f,
haddr_t addr,
unsigned * status_ptr)
{
H5C_t *cache_ptr = f->shared->cache;
- herr_t ret_value = SUCCEED; /* Return value */
herr_t result;
hbool_t in_cache;
hbool_t is_dirty;
@@ -1015,6 +995,7 @@ H5AC_get_entry_status(H5F_t * f,
hbool_t is_flush_dep_parent;
size_t entry_size;
unsigned status = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_get_entry_status, FAIL)
@@ -1026,7 +1007,7 @@ H5AC_get_entry_status(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.")
}
- result = H5C_get_entry_status(cache_ptr, addr, &entry_size, &in_cache,
+ result = H5C_get_entry_status(f, addr, &entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned, &is_flush_dep_parent,
&is_flush_dep_child);
@@ -1135,7 +1116,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
{
herr_t result;
H5AC_info_t *info;
- H5AC_t *cache;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -1182,7 +1162,6 @@ 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 */
- cache = f->shared->cache;
info = (H5AC_info_t *)thing;
info->addr = addr;
@@ -1209,7 +1188,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
result = H5C_insert_entry(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- cache,
type,
addr,
thing,
@@ -1274,109 +1252,66 @@ done:
* Programmer: John Mainzer
* 4/11/06
*
- * Modifications:
- *
- * Added trace file support. JRM -- 6/6/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_mark_pinned_entry_dirty(H5F_t * f,
- void * thing,
- hbool_t size_changed,
- size_t new_size)
+H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_mark_pinned_entry_dirty, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the mark pinned entry dirty call, only the addr, size_changed,
* and new_size are really necessary in the trace file. Write the result
* to catch occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_mark_pinned_entry_dirty 0x%lx %d %d",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s 0x%lx %d %d", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr),
(int)size_changed,
(int)new_size);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_info_t *entry_ptr = (H5AC_info_t *)thing;
+ H5C_t *cache_ptr = entry_ptr->cache_ptr;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) &&
- ( NULL != cache_ptr->aux_ptr) ) {
-
- H5AC_info_t * entry_ptr;
-
- HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) );
-
- entry_ptr = (H5AC_info_t *)thing;
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry is protected??")
- }
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- result = H5AC_log_dirtied_entry(cache_ptr,
- entry_ptr,
- entry_ptr->addr,
- size_changed,
- new_size);
+ if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) {
+ /* Check for usage errors */
+ if(!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??")
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??")
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
- }
+ if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, size_changed, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ } /* end if */
+}
#endif /* H5_HAVE_PARALLEL */
- result = H5C_mark_pinned_entry_dirty(cache_ptr,
- thing,
- size_changed,
- new_size);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5C_mark_pinned_entry_dirty() failed.")
-
- }
+ if(H5C_mark_pinned_entry_dirty(thing, size_changed, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned entry dirty")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_mark_pinned_entry_dirty() */
@@ -1394,92 +1329,59 @@ done:
* Programmer: John Mainzer
* 5/16/06
*
- * Modifications:
- *
- * Added trace file support. JRM -- 6/6/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f,
- void * thing)
+H5AC_mark_pinned_or_protected_entry_dirty(void *thing)
{
- H5C_t * cache_ptr = f->shared->cache;
-#ifdef H5_HAVE_PARALLEL
- H5AC_info_t * info_ptr;
-#endif /* H5_HAVE_PARALLEL */
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_mark_pinned_or_protected_entry_dirty, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the mark pinned or protected entry dirty call, only the addr
* is really necessary in the trace file. Write the result to catch
* occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_mark_pinned_or_protected_entry_dirty %lx",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s %lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_info_t *entry_ptr = (H5AC_info_t *)thing;
+ H5C_t *cache_ptr = entry_ptr->cache_ptr;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- info_ptr = (H5AC_info_t *)thing;
-
- if ( ( info_ptr->is_dirty == FALSE ) &&
- ( ! ( info_ptr->is_protected ) ) &&
- ( info_ptr->is_pinned ) &&
- ( NULL != cache_ptr->aux_ptr) ) {
-
- result = H5AC_log_dirtied_entry(cache_ptr,
- info_ptr,
- info_ptr->addr,
- FALSE,
- 0);
-
- if ( result < 0 ) {
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
- }
+ 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)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ } /* end if */
+}
#endif /* H5_HAVE_PARALLEL */
- result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr, thing);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5C_mark_pinned_entry_dirty() failed.")
-
- }
+ if(H5C_mark_pinned_or_protected_entry_dirty(thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_mark_pinned_or_protected_entry_dirty() */
@@ -1570,16 +1472,8 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_ad
#ifdef H5_HAVE_PARALLEL
if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) {
-
- result = H5AC_log_renamed_entry(f->shared->cache,
- old_addr,
- new_addr);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5AC_log_renamed_entry() failed.")
- }
+ if(H5AC_log_renamed_entry(f, old_addr, new_addr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log renamed entry")
}
#endif /* H5_HAVE_PARALLEL */
@@ -1635,60 +1529,42 @@ done:
* Programmer: John Mainzer
* 4/27/06
*
- * Modifications:
- *
- * Added trace file support. 6/6/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_pin_protected_entry(H5F_t * f,
- void * thing)
+H5AC_pin_protected_entry(void *thing)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_pin_protected_entry, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the pin protected entry call, only the addr is really necessary
* in the trace file. Also write the result to catch occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_pin_protected_entry %lx",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s %lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
- result = H5C_pin_protected_entry(cache_ptr, thing);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \
- "H5C_pin_protected_entry() failed.")
- }
+ if(H5C_pin_protected_entry(thing) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_pin_protected_entry() */
@@ -1706,9 +1582,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
+H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
{
- H5C_t *cache_ptr = f->shared->cache;
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
@@ -1718,13 +1593,12 @@ H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
FUNC_ENTER_NOAPI(H5AC_create_flush_dependency, FAIL)
/* Sanity check */
- HDassert(cache_ptr);
HDassert(parent_thing);
HDassert(child_thing);
#if H5AC__TRACE_FILE_ENABLED
- if ( ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
+ if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
sprintf(trace, "%s %lx %lx",
FUNC,
(unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr),
@@ -1732,7 +1606,7 @@ H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
} /* end if */
#endif /* H5AC__TRACE_FILE_ENABLED */
- if(H5C_create_flush_dependency(cache_ptr, parent_thing, child_thing) < 0)
+ if(H5C_create_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed.")
done:
@@ -1891,7 +1765,6 @@ H5AC_protect(H5F_t *f,
thing = H5C_protect(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- f->shared->cache,
type,
addr,
udata1,
@@ -1941,104 +1814,65 @@ done:
* Programmer: John Mainzer
* 7/5/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_resize_pinned_entry(H5F_t * f,
- void * thing,
- size_t new_size)
+H5AC_resize_pinned_entry(void *thing, size_t new_size)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_resize_pinned_entry, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the resize pinned entry call, only the addr, and new_size are
* really necessary in the trace file. Write the result to catch
* occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_resize_pinned_entry 0x%lx %d",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s 0x%lx %d", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr),
(int)new_size);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_info_t * entry_ptr = (H5AC_info_t *)thing;
+ H5C_t *cache_ptr = entry_ptr->cache_ptr;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) &&
- ( NULL != cache_ptr->aux_ptr) ) {
-
- H5AC_info_t * entry_ptr;
-
- entry_ptr = (H5AC_info_t *)thing;
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry is protected??")
- }
-
- result = H5AC_log_dirtied_entry(cache_ptr,
- entry_ptr,
- entry_ptr->addr,
- TRUE,
- new_size);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if ( result < 0 ) {
+ if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) {
+ /* Check for usage errors */
+ if(!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??")
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??")
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
- }
+ if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, TRUE, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ } /* end if */
+}
#endif /* H5_HAVE_PARALLEL */
- result = H5C_resize_pinned_entry(cache_ptr,
- thing,
- new_size);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "H5C_resize_pinned_entry() failed.")
-
- }
+ if(H5C_resize_pinned_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 != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_resize_pinned_entry() */
@@ -2053,59 +1887,42 @@ done:
* Programmer: John Mainzer
* 4/11/06
*
- * Modifications:
- *
- * Added code supporting the trace file. JRM -- 6/7/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_unpin_entry(H5F_t * f,
- void * thing)
+H5AC_unpin_entry(void * thing)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_unpin_entry, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the unpin entry call, only the addr is really necessary
* in the trace file. Also write the result to catch occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_unpin_entry %lx",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s %lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
- result = H5C_unpin_entry(cache_ptr, thing);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "H5C_unpin_entry() failed.")
- }
+ if(H5C_unpin_entry(thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_unpin_entry() */
@@ -2122,9 +1939,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
+H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
{
- H5C_t *cache_ptr = f->shared->cache;
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
@@ -2134,13 +1950,12 @@ H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing
FUNC_ENTER_NOAPI(H5AC_destroy_flush_dependency, FAIL)
/* Sanity check */
- HDassert(cache_ptr);
HDassert(parent_thing);
HDassert(child_thing);
#if H5AC__TRACE_FILE_ENABLED
- if ( ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
+ if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
sprintf(trace, "%s %lx",
FUNC,
(unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr),
@@ -2148,7 +1963,7 @@ H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing
} /* end if */
#endif /* H5AC__TRACE_FILE_ENABLED */
- if(H5C_destroy_flush_dependency(cache_ptr, parent_thing, child_thing) < 0)
+ if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed.")
done:
@@ -2331,18 +2146,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#ifdef H5_HAVE_PARALLEL
if ( ( dirtied ) && ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) &&
( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) ) {
-
- result = H5AC_log_dirtied_entry(f->shared->cache,
- (H5AC_info_t *)thing,
- addr,
- size_changed,
- new_size);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
+ if(H5AC_log_dirtied_entry((H5AC_info_t *)thing, addr, size_changed, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry")
}
if ( ( (flags & H5C__DELETED_FLAG) != 0 ) &&
@@ -2365,7 +2170,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
result = H5C_unprotect(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- f->shared->cache,
type,
addr,
thing,
@@ -2541,7 +2345,7 @@ done:
*/
herr_t
-H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
+H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr,
H5AC_cache_config_t *config_ptr)
{
herr_t result;
@@ -2573,7 +2377,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
}
- result = H5C_get_cache_auto_resize_config((H5C_t *)cache_ptr,
+ result = H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr,
&internal_config);
if ( result < 0 ) {
@@ -2582,7 +2386,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
"H5C_get_cache_auto_resize_config() failed.")
}
- result = H5C_get_evictions_enabled((H5C_t *)cache_ptr, &evictions_enabled);
+ result = H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled);
if ( result < 0 ) {
@@ -2818,10 +2622,9 @@ done:
*/
herr_t
-H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
+H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
H5AC_cache_config_t *config_ptr)
{
- /* const char * fcn_name = "H5AC_set_cache_auto_resize_config"; */
herr_t result;
herr_t ret_value = SUCCEED; /* Return value */
H5C_auto_size_ctl_t internal_config;
@@ -2832,6 +2635,8 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
FUNC_ENTER_NOAPI(H5AC_set_cache_auto_resize_config, FAIL)
+ HDassert( cache_ptr );
+
#if H5AC__TRACE_FILE_ENABLED
/* Make note of the new configuration. Don't look up the trace file
* pointer, as that may change before we use it.
@@ -2922,30 +2727,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
}
}
- if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) !=
- SUCCEED ) {
+ if(H5AC_ext_config_2_int_config(config_ptr, &internal_config) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_ext_config_2_int_config() failed.")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_ext_config_2_int_config() failed.")
- }
+ if(H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed.")
- result = H5C_set_cache_auto_resize_config((H5C_t *)cache_ptr,
- &internal_config);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5C_set_cache_auto_resize_config() failed.")
- }
-
-
- result = H5C_set_evictions_enabled((H5C_t *)cache_ptr,
- config_ptr->evictions_enabled);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5C_set_evictions_enabled() failed.")
- }
+ if(H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.")
#ifdef H5_HAVE_PARALLEL
if ( cache_ptr->aux_ptr != NULL ) {
@@ -3817,26 +3606,28 @@ done:
*
* Programmer: John Mainzer, 6/29/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
- H5AC_info_t * entry_ptr,
+H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr,
haddr_t addr,
hbool_t size_changed,
size_t new_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
size_t entry_size;
- H5AC_aux_t * aux_ptr = NULL;
- H5AC_slist_entry_t * slist_entry_ptr = NULL;
+ H5AC_t * cache_ptr;
+ H5AC_aux_t * aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_log_dirtied_entry, FAIL)
+ HDassert( entry_ptr != NULL );
+ HDassert( entry_ptr->addr == addr );
+ HDassert( entry_ptr->is_dirty == FALSE );
+
+ cache_ptr = entry_ptr->cache_ptr;
+
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
@@ -3845,10 +3636,6 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
HDassert( aux_ptr != NULL );
HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
- HDassert( entry_ptr != NULL );
- HDassert( entry_ptr->addr == addr );
- HDassert( entry_ptr->is_dirty == FALSE );
-
if ( size_changed ) {
entry_size = new_size;
@@ -3859,6 +3646,7 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
}
if ( aux_ptr->mpi_rank == 0 ) {
+ H5AC_slist_entry_t * slist_entry_ptr;
HDassert( aux_ptr->d_slist_ptr != NULL );
HDassert( aux_ptr->c_slist_ptr != NULL );
@@ -4266,10 +4054,11 @@ done:
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5AC_log_renamed_entry(H5AC_t * cache_ptr,
+H5AC_log_renamed_entry(const H5F_t *f,
haddr_t old_addr,
haddr_t new_addr)
{
+ H5AC_t * cache_ptr;
herr_t ret_value = SUCCEED; /* Return value */
hbool_t entry_in_cache;
hbool_t entry_dirty;
@@ -4279,7 +4068,12 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr,
FUNC_ENTER_NOAPI(H5AC_log_renamed_entry, FAIL)
- HDassert( cache_ptr != NULL );
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = (H5AC_t *)f->shared->cache;
+
+ HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
aux_ptr = cache_ptr->aux_ptr;
@@ -4288,7 +4082,7 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr,
HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
/* get entry status, size, etc here */
- if ( H5C_get_entry_status(cache_ptr, old_addr, &entry_size, &entry_in_cache,
+ if ( H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache,
&entry_dirty, NULL, NULL, NULL, NULL) < 0 ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.")
@@ -4800,7 +4594,6 @@ H5AC_flush_entries(H5F_t *f)
status = H5C_flush_cache(f,
H5AC_noblock_dxpl_id,
H5AC_noblock_dxpl_id,
- f->shared->cache,
H5AC__NO_FLAGS_SET);
aux_ptr->write_permitted = FALSE;