summaryrefslogtreecommitdiffstats
path: root/src/H5C2.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-06-09 21:58:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-06-09 21:58:27 (GMT)
commitd0acd2431f5151d25e32d67667cda93587dc33e4 (patch)
treec95693a891b54562f389faede5c9da847332e372 /src/H5C2.c
parent32f3fe6586828a0a04263bb34464b6ea0057900b (diff)
downloadhdf5-d0acd2431f5151d25e32d67667cda93587dc33e4.zip
hdf5-d0acd2431f5151d25e32d67667cda93587dc33e4.tar.gz
hdf5-d0acd2431f5151d25e32d67667cda93587dc33e4.tar.bz2
[svn-r15185] Description:
Added a pointer to the cache that an entry is contained within to the cache entry structure. This allows us to remove the file pointer from some of the H5AC2 calls, easing the conversion of some of the cache clients (the free space section info and fractal heap direct blocks, and probably others). Removed file pointer from the H5AC2_unpin_entry() call. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.5.2 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5C2.c')
-rw-r--r--src/H5C2.c83
1 files changed, 58 insertions, 25 deletions
diff --git a/src/H5C2.c b/src/H5C2.c
index a85a78c..6945084 100644
--- a/src/H5C2.c
+++ b/src/H5C2.c
@@ -2243,33 +2243,60 @@ done:
*/
herr_t
-H5C2_get_trace_file_ptr(H5C2_t * cache_ptr,
+H5C2_get_trace_file_ptr(const H5C2_t * cache_ptr,
FILE ** trace_file_ptr_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_NOAPI_NOFUNC(H5C2_get_trace_file_ptr)
- FUNC_ENTER_NOAPI(H5C2_get_trace_file_ptr, FAIL)
+ HDassert( cache_ptr );
+ HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC );
+ HDassert( trace_file_ptr_ptr );
- /* 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 != H5C2__H5C2_T_MAGIC ) ) {
+ *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
- }
+ FUNC_LEAVE_NOAPI(SUCCEED)
- if ( trace_file_ptr_ptr == NULL ) {
+} /* H5C2_get_trace_file_ptr() */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL trace_file_ptr_ptr")
- }
+
+/*-------------------------------------------------------------------------
+ * Function: H5C2_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
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
- *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;
+herr_t
+H5C2_get_trace_file_ptr_from_entry(const H5C2_cache_entry_t *entry_ptr,
+ FILE ** trace_file_ptr_ptr)
+{
+ const H5C2_t *cache_ptr; /* Cache pointer, from entry */
-done:
+ FUNC_ENTER_NOAPI_NOFUNC(H5C2_get_trace_file_ptr)
- FUNC_LEAVE_NOAPI(ret_value)
+ /* Sanity checks */
+ HDassert( entry_ptr );
+ HDassert( entry_ptr->cache_ptr );
-} /* H5C2_get_trace_file_ptr() */
+ cache_ptr = entry_ptr->cache_ptr;
+
+ H5C2_get_trace_file_ptr(cache_ptr, trace_file_ptr_ptr);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+
+} /* H5C2_get_trace_file_ptr_from_entry() */
/*-------------------------------------------------------------------------
@@ -2426,6 +2453,7 @@ H5C2_insert_entry(H5F_t * f,
#ifndef NDEBUG
entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = cache_ptr;
entry_ptr->addr = addr;
entry_ptr->type = type;
@@ -5278,28 +5306,27 @@ H5C2_stats__reset(H5C2_t UNUSED * cache_ptr)
* Modified routine to allow it to operate on protected
* entries.
*
+ * QAK -- 6/9/08
+ * Dropped file pointer parameter and retrieve cache pointer from
+ * entry.
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5C2_unpin_entry(H5F_t * f,
- void * thing)
+H5C2_unpin_entry(void *_entry_ptr)
{
H5C2_t *cache_ptr;
+ H5C2_cache_entry_t *entry_ptr = (H5C2_cache_entry_t *)_entry_ptr;
herr_t ret_value = SUCCEED; /* Return value */
- H5C2_cache_entry_t * entry_ptr;
FUNC_ENTER_NOAPI(H5C2_unpin_entry, FAIL)
- HDassert( f );
- HDassert( f->shared );
+ HDassert( entry_ptr );
- cache_ptr = f->shared->cache2;
+ cache_ptr = entry_ptr->cache_ptr;
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC );
- HDassert( thing );
-
- entry_ptr = (H5C2_cache_entry_t *)thing;
if ( ! ( entry_ptr->is_pinned ) ) {
@@ -8712,10 +8739,13 @@ H5C2_flush_single_entry(const H5F_t * f,
/* we are about to discard the in core representation --
* set the magic field to bad magic so we can detect a
* freed entry if we see one.
+ *
+ * Also reset the pointer to the cache the entry is within. -QAK
*/
#ifndef NDEBUG
entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_BAD_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = NULL;
if ( type_ptr->free_icr(entry_ptr->addr, entry_ptr->size,
(void *)entry_ptr) != SUCCEED )
{
@@ -8820,6 +8850,8 @@ H5C2_load_entry(H5F_t * f,
FUNC_ENTER_NOAPI_NOINIT(H5C2_load_entry)
HDassert( f );
+ HDassert( f->shared );
+ HDassert( f->shared->cache2 );
HDassert( type );
HDassert( H5F_addr_defined(addr) );
HDassert( len > 0 );
@@ -8924,6 +8956,7 @@ H5C2_load_entry(H5F_t * f,
#ifndef NDEBUG
entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = f->shared->cache2;
entry_ptr->addr = addr;
entry_ptr->size = len;
entry_ptr->image_ptr = image_ptr;