summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-12-19 14:42:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-12-19 14:42:15 (GMT)
commit9ceca0f89a0d27a6dfaeb3dd0cab2680281c5b60 (patch)
tree70640ab8a5ea83537c05afa0a1d4450802239c1f /src/H5C.c
parent2c55e17cfb6d396ffc33065bcba2ef8ceb7081b8 (diff)
downloadhdf5-9ceca0f89a0d27a6dfaeb3dd0cab2680281c5b60.zip
hdf5-9ceca0f89a0d27a6dfaeb3dd0cab2680281c5b60.tar.gz
hdf5-9ceca0f89a0d27a6dfaeb3dd0cab2680281c5b60.tar.bz2
[svn-r28710] Description:
Bring r28708 from revise_chunks branch: Fix earray, farray and btree2 use of incorrect file pointer when two files are opened and used to access the data structure. Misc. minor code cleanups as well. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel h5committest forthcoming
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c93
1 files changed, 35 insertions, 58 deletions
diff --git a/src/H5C.c b/src/H5C.c
index 2a4b4cf..c78c32c 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -2938,7 +2938,7 @@ done:
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \
"an extreme sanity check failed on exit.\n");
}
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
@@ -6802,7 +6802,7 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
/* Get cache entry for this node */
next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
- if ( NULL == next_entry_ptr )
+ if(NULL == next_entry_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -7240,8 +7240,8 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags)
#if H5C_DO_EXTREME_SANITY_CHECKS
if((H5C_validate_protected_entry_list(cache_ptr) < 0) ||
- (H5C_validate_pinned_entry_list(cache_ptr) < 0 ||
- (H5C_validate_lru_list(cache_ptr) < 0)) {
+ (H5C_validate_pinned_entry_list(cache_ptr) < 0) ||
+ (H5C_validate_lru_list(cache_ptr) < 0))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n");
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
@@ -7604,7 +7604,7 @@ done:
*
* Refactored function to delay all modifications of the
* metadata cache data structures until after any calls
- * to the pre-serialize or serialize callbacks.
+ * to the pre-serialize or serialize callbacks.
*
* Need to do this, as some pre-serialize or serialize
* calls result in calls to the metadata cache and
@@ -7668,7 +7668,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
else
destroy_entry = destroy;
- /* we will write the entry to disk if it exists, is dirty, and if the
+ /* we will write the entry to disk if it exists, is dirty, and if the
* clear only flag is not set.
*/
if(entry_ptr->is_dirty && !clear_only)
@@ -8057,7 +8057,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
/* only log a flush if we actually wrote to disk */
H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
- }
+ } /* end else if */
if(destroy) {
if(take_ownership)
@@ -8066,7 +8066,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
HDassert(destroy_entry);
H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership)
- }
+ } /* end if */
/* If the entry's type has a 'notify' callback and the entry is about
* to be removed from the cache, send a 'before eviction' notice while
@@ -8306,12 +8306,12 @@ H5C_load_entry(H5F_t * f,
/* verify absence of prohibited or unsupported type flag combinations */
HDassert(!(type->flags & H5C__CLASS_NO_IO_FLAG));
-
+
/* for now, we do not combine the speculative load and compressed flags */
HDassert(!((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) &&
(type->flags & H5C__CLASS_COMPRESSED_FLAG)));
- /* Can't see how skip reads could be usefully combined with
+ /* Can't see how skip reads could be usefully combined with
* either the speculative read or compressed flags. Hence disallow.
*/
HDassert(!((type->flags & H5C__CLASS_SKIP_READS) &&
@@ -8433,12 +8433,10 @@ H5C_load_entry(H5F_t * f,
}
/* Allocate the buffer for reading the on-disk entry image */
if(NULL == (image = H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE)))
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \
- "memory allocation failed for on disk image buffer.")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer.")
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)image) + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
/* Get the on-disk entry image */
@@ -8472,12 +8470,9 @@ H5C_load_entry(H5F_t * f,
/* Get the actual image size for the thing */
if(type->image_len(thing, &new_len, &compressed, &compressed_size) < 0)
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, \
- "can't retrieve image length")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image length")
if(new_len == 0)
-
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "image length is 0")
HDassert(((type->flags & H5C__CLASS_COMPRESSED_FLAG) != 0) ||
@@ -8521,15 +8516,13 @@ H5C_load_entry(H5F_t * f,
if(NULL == (new_image = H5MM_realloc(image,
new_len + H5C_IMAGE_EXTRA_SPACE)))
- HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \
- "image null after H5MM_realloc()")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()")
image = new_image;
#if H5C_DO_MEMORY_SANITY_CHECKS
- HDmemcpy(((uint8_t *)image) + new_len,
- H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
+ HDmemcpy(((uint8_t *)image) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
@@ -8550,15 +8543,13 @@ H5C_load_entry(H5F_t * f,
if ( type->free_icr(thing) < 0 )
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, \
- "free_icr callback failed")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed")
/* Go get the on-disk image again */
if(H5F_block_read(f, type->mem_type, addr,
new_len, dxpl_id, image) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \
- "Can't read image")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image")
/* Deserialize on-disk image into native memory
* form again
@@ -8621,7 +8612,7 @@ H5C_load_entry(H5F_t * f,
*
* HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) );
*
- * note that type ids 5 & 6 are associated with object headers in the
+ * note that type ids 5 & 6 are associated with object headers in the
* metadata cache.
*
* When we get to using H5C for other purposes, we may wish to
@@ -8824,8 +8815,8 @@ H5C_make_space_in_cache(H5F_t * f,
( entry_ptr != NULL )
)
{
- HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
- HDassert( ! (entry_ptr->is_protected) );
+ HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
+ HDassert( !(entry_ptr->is_protected) );
HDassert( ! (entry_ptr->is_read_only) );
HDassert( (entry_ptr->ro_ref_count) == 0 );
@@ -8857,8 +8848,8 @@ H5C_make_space_in_cache(H5F_t * f,
* last_entry_removed_ptr prior to the call to
* H5C__flush_single_entry() so that we can spot
* unexpected removals of entries from the cache,
- * and set the restart_scan flag if proceeding
- * would be likely to cause us to scan an entry
+ * and set the restart_scan flag if proceeding
+ * would be likely to cause us to scan an entry
* that is no longer in the cache.
*/
cache_ptr->entries_removed_counter = 0;
@@ -8881,7 +8872,6 @@ H5C_make_space_in_cache(H5F_t * f,
if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
-
} else {
/* We have enough space so don't flush clean entry. */
#if H5C_COLLECT_CACHE_STATS
@@ -8906,15 +8896,15 @@ H5C_make_space_in_cache(H5F_t * f,
if ( didnt_flush_entry ) {
- /* epoch markers don't get flushed, and we don't touch
+ /* epoch markers don't get flushed, and we don't touch
* entries that are in the process of being flushed.
- * Hence no need for sanity checks, as we haven't
- * flushed anything. Thus just set entry_ptr to prev_ptr
+ * Hence no need for sanity checks, as we haven't
+ * flushed anything. Thus just set entry_ptr to prev_ptr
* and go on.
*/
entry_ptr = prev_ptr;
- } else if ( ( restart_scan )
+ } else if ( ( restart_scan )
||
( prev_ptr->is_dirty != prev_is_dirty )
||
@@ -9084,10 +9074,8 @@ H5C_validate_lru_list(H5C_t * cache_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
}
- if ( ( cache_ptr->LRU_list_len < 0 ) || ( cache_ptr->LRU_list_size < 0 ) ) {
-
+ if(cache_ptr->LRU_list_len < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- }
if ( ( cache_ptr->LRU_list_len == 1 )
&&
@@ -9214,10 +9202,8 @@ H5C_validate_pinned_entry_list(H5C_t * cache_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
}
- if ( ( cache_ptr->pel_len < 0 ) || ( cache_ptr->pel_size < 0 ) ) {
-
+ if(cache_ptr->pel_len < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- }
if ( ( cache_ptr->pel_len == 1 )
&&
@@ -9337,21 +9323,12 @@ H5C_validate_protected_entry_list(H5C_t * cache_ptr)
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- if ( ( ( cache_ptr->pl_head_ptr == NULL )
- ||
- ( cache_ptr->pl_tail_ptr == NULL )
- )
- &&
- ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr )
- ) {
-
+ if(((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL))
+ && (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed")
- }
-
- if ( ( cache_ptr->pl_len < 0 ) || ( cache_ptr->pl_size < 0 ) ) {
+ if(cache_ptr->pl_len < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed")
- }
if ( ( cache_ptr->pl_len == 1 )
&&
@@ -9682,7 +9659,7 @@ done:
* Function: H5C_ignore_tags
*
* Purpose: Override all assertion frameworks associated with making
- * sure proper tags are applied to metadata.
+ * sure proper tags are applied to cache entries.
*
* NOTE: This should really only be used in tests that need
* to access internal functions without going through
@@ -9794,7 +9771,7 @@ done:
* Return: FAIL if error is detected, SUCCEED otherwise.
*
* Programmer: Mike McGreevy
- * November 3, 2009
+ * August 19, 2010
*
*-------------------------------------------------------------------------
*/
@@ -9837,7 +9814,7 @@ done:
* Return: FAIL if error is detected, SUCCEED otherwise.
*
* Programmer: Mike McGreevy
- * November 3, 2009
+ * September 9, 2010
*
*-------------------------------------------------------------------------
*/
@@ -9883,7 +9860,7 @@ H5C_mark_tagged_entries(H5C_t * cache_ptr, haddr_t tag)
* Return: FAIL if error is detected, SUCCEED otherwise.
*
* Programmer: Mike McGreevy
- * November 3, 2009
+ * November 3, 2010
*
*-------------------------------------------------------------------------
*/