summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-27 15:07:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-27 15:07:42 (GMT)
commit032766b521a2b22d77059e89a1eb3a76a5d83875 (patch)
tree0681d291691b47f16bf2f0832c581158e5579bb0 /src/H5C.c
parent0b761d78c765c902b5ca13c9067878e5097f9afb (diff)
downloadhdf5-032766b521a2b22d77059e89a1eb3a76a5d83875.zip
hdf5-032766b521a2b22d77059e89a1eb3a76a5d83875.tar.gz
hdf5-032766b521a2b22d77059e89a1eb3a76a5d83875.tar.bz2
[svn-r18171] Description:
Bring r18169 from 'merge_metadata_journaling' branch back to trunk: Converge changes on metadata_journaling branch and trunk: - Remove H5F_t* parameter from H5HL_unprotect() - Remove H5F_t* parameter from H5HL_dirty() - Remove H5F_t* parameter from H5O_unprotect() - Bring changes to metadata caching routines back: - H5AC_pin_protected_entry() - H5AC_resize_pinned_entry() - H5AC_unpin_entry() - H5AC_mark_pinned_entry_dirty() - H5AC_mark_pinned_or_protected_entry_dirty() - Revise internal H5C routines to drop H5F_t* and/or H5C_t* as parameter where possible - Revise tests to follow internal routine changes Also, drop file/cache pointer parameter from create/destroy flush dependency internal cache calls. Also, other minor changes to speedup the 'cache' test. 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-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c402
1 files changed, 167 insertions, 235 deletions
diff --git a/src/H5C.c b/src/H5C.c
index d40cd62..d8688b2 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -3439,9 +3439,9 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
herr_t
H5C_dest(H5F_t * f,
hid_t primary_dxpl_id,
- hid_t secondary_dxpl_id,
- H5C_t * cache_ptr)
+ hid_t secondary_dxpl_id)
{
+ H5C_t * cache_ptr = f->shared->cache;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_dest, FAIL)
@@ -3463,7 +3463,7 @@ H5C_dest(H5F_t * f,
cache_ptr->magic = 0;
- (void)H5FL_FREE(H5C_t, cache_ptr);
+ cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3489,32 +3489,33 @@ done:
*
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_expunge_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
unsigned flags)
{
+ H5C_t * cache_ptr;
herr_t result;
hbool_t first_flush = TRUE;
- hbool_t free_file_space;
H5C_cache_entry_t * entry_ptr = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_expunge_entry, FAIL)
- free_file_space = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 );
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
- HDassert( H5F_addr_defined(addr) );
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( type );
HDassert( type->clear );
HDassert( type->dest );
+ HDassert( H5F_addr_defined(addr) );
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( H5C_validate_lru_list(cache_ptr) < 0 ) {
@@ -3548,15 +3549,12 @@ H5C_expunge_entry(H5F_t * f,
}
/* Pass along 'free file space' flag to cache client */
-
- entry_ptr->free_file_space_on_destroy = free_file_space;
-
+ entry_ptr->free_file_space_on_destroy = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 );
/* If we get this far, call H5C_flush_single_entry() with the
* H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG.
* This will clear the entry, and then delete it from the cache.
*/
-
result = H5C_flush_single_entry(f,
primary_dxpl_id,
secondary_dxpl_id,
@@ -3690,9 +3688,9 @@ herr_t
H5C_flush_cache(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
unsigned flags)
{
+ H5C_t * cache_ptr = f->shared->cache;
herr_t status;
herr_t ret_value = SUCCEED;
hbool_t destroy;
@@ -4244,8 +4242,7 @@ H5C_flush_to_min_clean(H5F_t * f,
/* Flush the marked entries */
result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id,
- cache_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_IGNORE_PROTECTED_FLAG);
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG);
if ( result < 0 ) {
@@ -4301,7 +4298,7 @@ done:
*/
herr_t
-H5C_get_cache_auto_resize_config(H5C_t * cache_ptr,
+H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr,
H5C_auto_size_ctl_t *config_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4483,7 +4480,7 @@ done:
*/
herr_t
-H5C_get_entry_status(H5C_t * cache_ptr,
+H5C_get_entry_status(const H5F_t *f,
haddr_t addr,
size_t * size_ptr,
hbool_t * in_cache_ptr,
@@ -4493,11 +4490,17 @@ H5C_get_entry_status(H5C_t * cache_ptr,
hbool_t * is_flush_dep_parent_ptr,
hbool_t * is_flush_dep_child_ptr)
{
+ H5C_t * cache_ptr;
H5C_cache_entry_t * entry_ptr = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL)
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
+
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( H5F_addr_defined(addr) );
@@ -4581,7 +4584,7 @@ done:
*/
herr_t
-H5C_get_evictions_enabled(H5C_t * cache_ptr,
+H5C_get_evictions_enabled(const H5C_t * cache_ptr,
hbool_t * evictions_enabled_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4622,38 +4625,55 @@ done:
* Programmer: John Mainzer
* 1/20/06
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5C_get_trace_file_ptr(H5C_t * cache_ptr,
- FILE ** trace_file_ptr_ptr)
+H5C_get_trace_file_ptr(const H5C_t *cache_ptr, FILE **trace_file_ptr_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr)
- FUNC_ENTER_NOAPI(H5C_get_trace_file_ptr, 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 ) ) {
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(trace_file_ptr_ptr);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
- }
+ *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;
- if ( trace_file_ptr_ptr == NULL ) {
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5C_get_trace_file_ptr() */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL trace_file_ptr_ptr")
- }
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_get_trace_file_ptr_from_entry
+ *
+ * Purpose: Get the trace_file_ptr field from the cache, via an entry.
+ *
+ * This field will either be NULL (which indicates that trace
+ * file logging is turned off), or contain a pointer to the
+ * open file to which trace file data is to be written.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 6/9/08
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr,
+ FILE **trace_file_ptr_ptr)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr_from_entry)
- *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->cache_ptr);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ /* Go get the trace file pointer for the cache */
+ H5C_get_trace_file_ptr(entry_ptr->cache_ptr, trace_file_ptr_ptr);
-} /* H5C_get_trace_file_ptr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5C_get_trace_file_ptr_from_entry() */
/*-------------------------------------------------------------------------
@@ -4768,12 +4788,12 @@ herr_t
H5C_insert_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
void * thing,
unsigned int flags)
{
+ H5C_t * cache_ptr;
herr_t result;
hbool_t first_flush = TRUE;
hbool_t insert_pinned;
@@ -4787,6 +4807,11 @@ H5C_insert_entry(H5F_t * f,
FUNC_ENTER_NOAPI(H5C_insert_entry, FAIL)
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
+
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->skip_file_checks || f );
@@ -4839,6 +4864,7 @@ H5C_insert_entry(H5F_t * f,
#ifndef NDEBUG
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = cache_ptr;
entry_ptr->addr = addr;
entry_ptr->type = type;
@@ -5372,59 +5398,31 @@ done:
* Programmer: John Mainzer
* 3/22/06
*
- * Modifications:
- *
- * Added code to do a flash cache size increase if
- * appropriate.
- * JRM -- 1/11/08
- *
- *
- * Added code to update the clean_index_size and
- * dirty_index_size fields of H5C_t in cases where the
- * the entry was clean on protect, was marked dirty in
- * this call, and did not change its size. Do this via
- * a call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY().
- *
- * If the size changed, this case is already dealt with by
- * by the pre-existing call to
- * H5C__UPDATE_INDEX_FOR_SIZE_CHANGE().
- *
- * JRM -- 11/5/08
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
- void * thing,
- hbool_t size_changed,
- size_t new_size)
+H5C_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
- herr_t result;
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
hbool_t was_clean;
size_t size_increase;
- H5C_cache_entry_t * entry_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
- HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) );
-
- entry_ptr = (H5C_cache_entry_t *)thing;
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry is protected??")
- }
+ /* 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??")
/* make note of whether the entry was dirty to begin with */
was_clean = ! ( entry_ptr->is_dirty );
@@ -5443,17 +5441,9 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
size_increase = new_size - entry_ptr->size;
if ( size_increase >=
- cache_ptr->flash_size_increase_threshold ) {
-
- result = H5C__flash_increase_cache_size(cache_ptr,
- entry_ptr->size,
- new_size);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5C__flash_increase_cache_size failed.")
- }
+ cache_ptr->flash_size_increase_threshold ) {
+ if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed")
}
}
}
@@ -5494,9 +5484,7 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_mark_pinned_entry_dirty() */
@@ -5521,16 +5509,6 @@ done:
* Programmer: John Mainzer
* 5/15/06
*
- * Modifications:
- *
- * JRM -- 3/29/07
- * Added sanity check to verify that the pinned entry
- * is not protected read only.
- *
- * This sanity check is commented out for now -- uncomment
- * it once we deal with the problem of entries being protected
- * read only, and then dirtied.
- *
* JRM -- 11/5/08
* Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to
* update the new clean_index_size and dirty_index_size
@@ -5540,20 +5518,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
- void * thing)
+H5C_mark_pinned_or_protected_entry_dirty(void *thing)
{
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
herr_t ret_value = SUCCEED; /* Return value */
- hbool_t was_pinned_unprotected_and_clean;
- H5C_cache_entry_t * entry_ptr;
FUNC_ENTER_NOAPI(H5C_mark_pinned_or_protected_entry_dirty, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- entry_ptr = (H5C_cache_entry_t *)thing;
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
if ( entry_ptr->is_protected ) {
#if 0 /* JRM - uncomment this when possible */
@@ -5563,6 +5541,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
entry_ptr->dirtied = TRUE;
} else if ( entry_ptr->is_pinned ) {
+ hbool_t was_pinned_unprotected_and_clean;
was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty );
@@ -5588,9 +5567,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
}
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_mark_pinned_or_protected_entry_dirty() */
@@ -5810,64 +5787,33 @@ done:
* Programmer: John Mainzer
* 7/5/06
*
- * Modifications:
- *
- * Added code to apply a flash cache size increment if
- * appropriate.
- * JRM -- 1/11/08
- *
- * Added code to update the clean_index_size and
- * dirty_index_size fields of H5C_t in cases where the
- * the entry was clean prior to this call, was marked dirty,
- * and did not change its size. Do this via a call to
- * H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY().
- *
- * If the size changed, this case is already dealt with by
- * by the pre-existing call to
- * H5C__UPDATE_INDEX_FOR_SIZE_CHANGE().
- *
- * JRM -- 11/5/08
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5C_resize_pinned_entry(H5C_t * cache_ptr,
- void * thing,
- size_t new_size)
+H5C_resize_pinned_entry(void *thing, size_t new_size)
{
- /* const char * fcn_name = "H5C_resize_pinned_entry()"; */
- herr_t ret_value = SUCCEED; /* Return value */
- herr_t result;
- hbool_t was_clean;
- H5C_cache_entry_t * entry_ptr;
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
size_t size_increase;
+ hbool_t was_clean;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_resize_pinned_entry, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- entry_ptr = (H5C_cache_entry_t *)thing;
-
- if ( new_size <= 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "New size is non-positive.")
- }
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry is protected??")
- }
+ /* Check for usage errors */
+ if(new_size <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "New size is non-positive.")
+ 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??")
/* make note of whether the entry was clean to begin with */
was_clean = ! ( entry_ptr->is_dirty );
@@ -5890,15 +5836,11 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr,
if ( size_increase >=
cache_ptr->flash_size_increase_threshold ) {
- result = H5C__flash_increase_cache_size(cache_ptr,
- entry_ptr->size,
- new_size);
-
- if ( result < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5C__flash_increase_cache_size failed.")
- }
+ if(H5C__flash_increase_cache_size(cache_ptr,
+ entry_ptr->size,
+ new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed")
}
}
}
@@ -5940,9 +5882,7 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr,
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_resize_pinned_entry() */
@@ -6007,38 +5947,23 @@ done:
* Programmer: John Mainzer
* 4/26/06
*
- * Modifications:
- *
- * JRM -- 4/26/06
- * Modified routine to allow it to operate on protected
- * entries.
- *
- * JRM -- 2/16/07
- * Added conditional compile to avoid unused parameter
- * warning in production compile.
- *
- * JRM -- 4/4/07
- * Fixed typo -- canged macro call to
- * H5C__UPDATE_STATS_FOR_UNPIN to call to
- * H5C__UPDATE_STATS_FOR_PIN.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5C_pin_protected_entry(H5C_t * cache_ptr,
- void * thing)
+H5C_pin_protected_entry(void *thing)
{
- H5C_cache_entry_t * entry_ptr; /* Pointer to entry to pin */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_pin_protected_entry, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
- entry_ptr = (H5C_cache_entry_t *)thing;
- HDassert( entry_ptr );
- HDassert( H5F_addr_defined(entry_ptr->addr) );
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Only protected entries can be pinned */
if(!entry_ptr->is_protected)
@@ -6160,7 +6085,6 @@ void *
H5C_protect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
const void * udata1,
@@ -6168,6 +6092,7 @@ H5C_protect(H5F_t * f,
unsigned flags)
{
/* const char * fcn_name = "H5C_protect()"; */
+ H5C_t * cache_ptr;
hbool_t hit;
hbool_t first_flush;
hbool_t have_write_permitted = FALSE;
@@ -6182,6 +6107,9 @@ H5C_protect(H5F_t * f,
FUNC_ENTER_NOAPI(H5C_protect, NULL)
/* check args */
+ HDassert( f );
+ HDassert( f->shared );
+ cache_ptr = f->shared->cache;
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->skip_file_checks || f );
@@ -6609,14 +6537,13 @@ done:
*/
herr_t
-H5C_set_cache_auto_resize_config(H5C_t * cache_ptr,
+H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
H5C_auto_size_ctl_t *config_ptr)
{
- /* const char *fcn_name = "H5C_set_cache_auto_resize_config()"; */
- herr_t ret_value = SUCCEED; /* Return value */
herr_t result;
size_t new_max_cache_size;
size_t new_min_clean_size;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_set_cache_auto_resize_config, FAIL)
@@ -6892,7 +6819,7 @@ done:
*/
herr_t
-H5C_set_evictions_enabled(H5C_t * cache_ptr,
+H5C_set_evictions_enabled(H5C_t *cache_ptr,
hbool_t evictions_enabled)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -7756,20 +7683,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_unpin_entry(H5C_t * cache_ptr,
- void * thing)
+H5C_unpin_entry(void *thing)
{
- H5C_cache_entry_t * entry_ptr; /* Pointer to entry to unpin */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to unpin */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_unpin_entry, FAIL)
- /* Sanity checking */
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
- entry_ptr = (H5C_cache_entry_t *)thing;
- HDassert( entry_ptr );
+ /* Sanity check */
+ HDassert(entry_ptr);
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Unpin the entry */
if(H5C_unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0)
@@ -7900,13 +7826,13 @@ herr_t
H5C_unprotect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
void * thing,
unsigned int flags,
size_t new_size)
{
+ H5C_t * cache_ptr;
hbool_t deleted;
hbool_t dirtied;
hbool_t set_flush_marker;
@@ -7942,6 +7868,11 @@ H5C_unprotect(H5F_t * f,
dirtied |= size_changed;
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
+
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->skip_file_checks || f );
@@ -8665,16 +8596,10 @@ H5C_adjust_flush_dependency_rc(H5C_cache_entry_t * cache_entry,
*
*-------------------------------------------------------------------------
*/
-#ifndef NDEBUG
-herr_t
-H5C_create_flush_dependency(H5C_t * cache_ptr, void * parent_thing,
- void * child_thing)
-#else
herr_t
-H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing,
- void * child_thing)
-#endif
+H5C_create_flush_dependency(void * parent_thing, void * child_thing)
{
+ H5C_t * cache_ptr;
H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */
H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */
#ifndef NDEBUG
@@ -8685,8 +8610,6 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing,
FUNC_ENTER_NOAPI(H5C_create_flush_dependency, FAIL)
/* Sanity checks */
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(parent_entry);
HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(parent_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS);
@@ -8695,6 +8618,10 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing,
HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(H5F_addr_defined(child_entry->addr));
HDassert(child_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS);
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
/* More sanity checks */
if(child_entry == parent_entry)
@@ -8783,9 +8710,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing,
- void * child_thing)
+H5C_destroy_flush_dependency(void *parent_thing, void * child_thing)
{
+ H5C_t * cache_ptr;
H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */
H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */
#ifndef NDEBUG
@@ -8796,8 +8723,6 @@ H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing,
FUNC_ENTER_NOAPI(H5C_destroy_flush_dependency, FAIL)
/* Sanity checks */
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(parent_entry);
HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(H5F_addr_defined(parent_entry->addr));
@@ -8806,6 +8731,10 @@ H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing,
HDassert(child_entry->flush_dep_parent != child_entry);
HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(H5F_addr_defined(child_entry->addr));
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
/* Usage checks */
if(!parent_entry->is_pinned)
@@ -11170,17 +11099,18 @@ H5C_flush_single_entry(H5F_t * f,
/* Clear the dirty flag only, if requested */
if ( clear_only ) {
-#ifndef NDEBUG
if ( destroy ) {
- /* we are about to call the clear callback with the
+#ifndef NDEBUG
+ /* we are about to call the clear callback with the
* destroy flag set -- this will result in *entry_ptr
* being freed. Set the magic field to bad magic
* so we can detect a freed cache entry if we see
* one.
*/
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- }
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = NULL;
+ }
/* Call the callback routine to clear all dirty flags for object */
if ( (entry_ptr->type->clear)(f, entry_ptr, destroy_entry) < 0 ) {
@@ -11198,17 +11128,18 @@ H5C_flush_single_entry(H5F_t * f,
}
#endif /* H5C_DO_SANITY_CHECKS */
-#ifndef NDEBUG
if ( destroy ) {
- /* we are about to call the flush callback with the
+#ifndef NDEBUG
+ /* we are about to call the flush callback with the
* destroy flag set -- this will result in *entry_ptr
* being freed. Set the magic field to bad magic
* so we can detect a freed cache entry if we see
* one.
*/
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- }
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = NULL;
+ }
/* Only block for all the processes on the first piece of metadata
*/
@@ -11491,6 +11422,7 @@ H5C_load_entry(H5F_t * f,
#ifndef NDEBUG
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = f->shared->cache;
entry_ptr->addr = addr;
entry_ptr->type = type;
entry_ptr->is_protected = FALSE;