From 5f2e591745df8a05950c07e4c86de00d6678828e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 24 Mar 2009 15:14:07 -0500 Subject: [svn-r16607] Description: Bring r16600:16606 back trom trunk to revise_chunks branch. Tested: Mac OS X/32 10.5.6 (amazon) Too minor to require h5committest --- src/H5AC.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5ACprivate.h | 4 +++ 2 files changed, 109 insertions(+) diff --git a/src/H5AC.c b/src/H5AC.c index ccdd493..74bed21 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -1826,6 +1826,59 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_create_flush_dependency() + * + * Purpose: Create a flush dependency between two entries in the metadata + * cache. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 3/24/09 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_create_flush_dependency(H5F_t * f, 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; +#endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ + + 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 ) ) { + sprintf(trace, "%s %lx %lx", + FUNC, + (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr), + (unsigned long)(((H5C_cache_entry_t *)child_thing)->addr)); + } /* end if */ +#endif /* H5AC__TRACE_FILE_ENABLED */ + + if(H5C_create_flush_dependency(cache_ptr, parent_thing, child_thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed.") + +done: +#if H5AC__TRACE_FILE_ENABLED + if(trace_file_ptr != NULL) + HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); +#endif /* H5AC__TRACE_FILE_ENABLED */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_create_flush_dependency() */ + + +/*------------------------------------------------------------------------- * Function: H5AC_protect * * Purpose: If the target entry is not in the cache, load it. If @@ -2190,6 +2243,58 @@ done: /*------------------------------------------------------------------------- + * Function: H5AC_destroy_flush_dependency() + * + * Purpose: Destroy a flush dependency between two entries. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 3/24/09 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_destroy_flush_dependency(H5F_t * f, 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; +#endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ + + 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 ) ) { + sprintf(trace, "%s %lx", + FUNC, + (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr), + (unsigned long)(((H5C_cache_entry_t *)child_thing)->addr)); + } /* end if */ +#endif /* H5AC__TRACE_FILE_ENABLED */ + + if(H5C_destroy_flush_dependency(cache_ptr, parent_thing, child_thing) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed.") + +done: +#if H5AC__TRACE_FILE_ENABLED + if( trace_file_ptr != NULL ) + HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); +#endif /* H5AC__TRACE_FILE_ENABLED */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_destroy_flush_dependency() */ + + +/*------------------------------------------------------------------------- * Function: H5AC_unprotect * * Purpose: Undo an H5AC_protect() call -- specifically, mark the diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 66bdf2d..b8de0c9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -277,6 +277,8 @@ H5_DLL herr_t H5AC_get_entry_status(H5F_t * f, haddr_t addr, H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags); H5_DLL herr_t H5AC_pin_protected_entry(H5F_t * f, void * thing); +H5_DLL herr_t H5AC_create_flush_dependency(H5F_t *f, void *parent_thing, + void *child_thing); H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2, H5AC_protect_t rw); @@ -285,6 +287,8 @@ H5_DLL herr_t H5AC_resize_pinned_entry(H5F_t * f, size_t new_size); H5_DLL herr_t H5AC_unpin_entry(H5F_t * f, void * thing); +H5_DLL herr_t H5AC_destroy_flush_dependency(H5F_t *f, void *parent_thing, + void *child_thing); H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags); -- cgit v0.12