Code style and warning cleanups, from revise_chunks branch.

This commit is contained in:
Quincey Koziol 2016-11-06 12:08:19 -08:00
parent 2b5efccc30
commit bb6cb6adb0
39 changed files with 5219 additions and 5830 deletions

View File

@ -38,7 +38,6 @@
namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5Location default constructor (protected)
// Programmer Binh-Minh Ribler - 2000

View File

@ -85,7 +85,6 @@ H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
// H5Object::H5Object(const H5Object& original) : H5Location() {}
//--------------------------------------------------------------------------
// Function: H5Object::createAttribute
///\brief Creates an attribute for a group, dataset, or named datatype.

View File

@ -3341,6 +3341,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
tools/test/h5dump/testh5dumppbits.sh
tools/test/h5dump/testh5dumpvds.sh
tools/test/h5dump/testh5dumpxml.sh
tools/test/h5ls/Makefile
tools/test/h5ls/testh5ls.sh
tools/test/h5ls/testh5lsvds.sh
tools/test/h5import/Makefile
@ -3356,15 +3357,14 @@ AC_CONFIG_FILES([src/libhdf5.settings
tools/test/h5repack/Makefile
tools/test/h5repack/h5repack.sh
tools/test/h5repack/h5repack_plugin.sh
tools/test/h5ls/Makefile
tools/test/h5copy/Makefile
tools/test/h5copy/testh5copy.sh
tools/test/misc/Makefile
tools/test/misc/testh5mkgrp.sh
tools/test/misc/testh5repart.sh
tools/test/misc/vds/Makefile
tools/test/h5stat/testh5stat.sh
tools/test/h5stat/Makefile
tools/test/h5stat/testh5stat.sh
tools/test/perform/Makefile
examples/Makefile
examples/run-c-ex.sh

View File

@ -32,7 +32,7 @@
/****************/
#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
#define H5F_FRIEND /* Suppress error about including H5Fpkg */
#define H5F_FRIEND /* Suppress error about including H5Fpkg */
/***********/
@ -880,7 +880,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add
#endif /* H5AC__TRACE_FILE_ENABLED */
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && (H5AC__verify_tag(dxpl_id, type) < 0))
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(dxpl_id, type) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Bad tag value")
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
@ -966,8 +966,7 @@ H5AC_mark_entry_dirty(void *thing)
* occult errors.
*/
if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
sprintf(trace, "%s 0x%lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr));
#endif /* H5AC__TRACE_FILE_ENABLED */
/* Check if log messages are being emitted */
@ -1291,7 +1290,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#endif /* H5_HAVE_PARALLEL */
/* Check for invalid access request */
if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
#if H5AC__TRACE_FILE_ENABLED
@ -1305,7 +1304,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#endif /* H5AC__TRACE_FILE_ENABLED */
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && (H5AC__verify_tag(dxpl_id, type) < 0))
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(dxpl_id, type) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value")
#endif /* H5AC_DO_TAGGING_SANITY_CHECKS */
@ -2449,7 +2448,6 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, hid_t dxpl_id, haddr_t tag, int type_id
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_tag_type_metadata*/

View File

@ -730,12 +730,10 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr)
*
* If mpi_rank is 0, we must first check to see if the entry
* appears in the dirty entries slist. If it is, do nothing.
* If it isn't, add the size to th dirty_bytes count, add the
* If it isn't, add the size to the dirty_bytes count, add the
* entry to the dirty entries slist, and remove it from the
* cleaned list (if it is present there).
*
* Return SUCCEED on success, and FAIL on failure.
*
* Return: Non-negative on success/Negative on failure.
*
* Programmer: John Mainzer, 6/29/05

View File

@ -53,35 +53,35 @@
/* Types of metadata objects cached */
typedef enum {
H5AC_BT_ID = 0, /* ( 0) B-tree nodes */
H5AC_SNODE_ID, /* ( 1) symbol table nodes */
H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */
H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */
H5AC_GHEAP_ID, /* ( 4) global heap */
H5AC_OHDR_ID, /* ( 5) object header */
H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */
H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */
H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */
H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */
H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */
H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */
H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */
H5AC_FSPACE_HDR_ID, /* (13) free space header */
H5AC_FSPACE_SINFO_ID, /* (14) free space sections */
H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */
H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */
H5AC_EARRAY_HDR_ID, /* (17) extensible array header */
H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */
H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */
H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */
H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */
H5AC_FARRAY_HDR_ID, /* (22) fixed array header */
H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */
H5AC_FARRAY_DBLK_PAGE_ID, /* (24) fixed array data block page */
H5AC_SUPERBLOCK_ID, /* (25) file superblock */
H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock) */
H5AC_TEST_ID, /* (27) test entry -- not used for actual files */
H5AC_NTYPES /* Number of types, must be last */
H5AC_BT_ID = 0, /* ( 0) B-tree nodes */
H5AC_SNODE_ID, /* ( 1) symbol table nodes */
H5AC_LHEAP_PRFX_ID, /* ( 2) local heap prefix */
H5AC_LHEAP_DBLK_ID, /* ( 3) local heap data block */
H5AC_GHEAP_ID, /* ( 4) global heap */
H5AC_OHDR_ID, /* ( 5) object header */
H5AC_OHDR_CHK_ID, /* ( 6) object header chunk */
H5AC_BT2_HDR_ID, /* ( 7) v2 B-tree header */
H5AC_BT2_INT_ID, /* ( 8) v2 B-tree internal node */
H5AC_BT2_LEAF_ID, /* ( 9) v2 B-tree leaf node */
H5AC_FHEAP_HDR_ID, /* (10) fractal heap header */
H5AC_FHEAP_DBLOCK_ID, /* (11) fractal heap direct block */
H5AC_FHEAP_IBLOCK_ID, /* (12) fractal heap indirect block */
H5AC_FSPACE_HDR_ID, /* (13) free space header */
H5AC_FSPACE_SINFO_ID, /* (14) free space sections */
H5AC_SOHM_TABLE_ID, /* (15) shared object header message master table */
H5AC_SOHM_LIST_ID, /* (16) shared message index stored as a list */
H5AC_EARRAY_HDR_ID, /* (17) extensible array header */
H5AC_EARRAY_IBLOCK_ID, /* (18) extensible array index block */
H5AC_EARRAY_SBLOCK_ID, /* (19) extensible array super block */
H5AC_EARRAY_DBLOCK_ID, /* (20) extensible array data block */
H5AC_EARRAY_DBLK_PAGE_ID, /* (21) extensible array data block page */
H5AC_FARRAY_HDR_ID, /* (22) fixed array header */
H5AC_FARRAY_DBLOCK_ID, /* (23) fixed array data block */
H5AC_FARRAY_DBLK_PAGE_ID, /* (24) fixed array data block page */
H5AC_SUPERBLOCK_ID, /* (25) file superblock */
H5AC_DRVRINFO_ID, /* (26) driver info block (supplements superblock)*/
H5AC_TEST_ID, /* (27) test entry -- not used for actual files */
H5AC_NTYPES /* Number of types, must be last */
} H5AC_type_t;
/* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when
@ -188,7 +188,6 @@ typedef H5C_class_t H5AC_class_t;
/* Cache entry info */
typedef H5C_cache_entry_t H5AC_info_t;
/* Typedef for metadata cache (defined in H5Cpkg.h) */
typedef H5C_t H5AC_t;

455
src/H5C.c
View File

@ -270,26 +270,18 @@ H5C_create(size_t max_cache_size,
HDassert( type_name_table_ptr );
for ( i = 0; i <= max_type_id; i++ ) {
HDassert( (type_name_table_ptr)[i] );
HDassert( HDstrlen(( type_name_table_ptr)[i]) > 0 );
}
if ( NULL == (cache_ptr = H5FL_CALLOC(H5C_t)) ) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \
"memory allocation failed")
}
if ( (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL ) {
if(NULL == (cache_ptr = H5FL_CALLOC(H5C_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if(NULL == (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list.")
}
if ( (cache_ptr->cork_list_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL ) {
if ( (cache_ptr->cork_list_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL )
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list for corked object addresses.")
}
/* If we get this far, we should succeed. Go ahead and initialize all
* the fields.
@ -460,12 +452,9 @@ H5C_create(size_t max_cache_size,
ret_value = cache_ptr;
done:
if ( ret_value == 0 ) {
if ( cache_ptr != NULL ) {
if ( cache_ptr->slist_ptr != NULL )
if(NULL == ret_value) {
if(cache_ptr != NULL) {
if(cache_ptr->slist_ptr != NULL)
H5SL_close(cache_ptr->slist_ptr);
if ( cache_ptr->cork_list_ptr != NULL )
@ -473,13 +462,10 @@ done:
cache_ptr->magic = 0;
cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
} /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_create() */
@ -677,7 +663,8 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; January 2014
* Programmer: Vailin Choi
* January 2014
*
*-------------------------------------------------------------------------
*/
@ -858,8 +845,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type,
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
if(H5C_validate_lru_list(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"LRU extreme sanity check failed on exit.\n");
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
@ -1327,9 +1313,8 @@ H5C_insert_entry(H5F_t * f,
*/
entry_ptr->compressed = FALSE;
entry_ptr->compressed_size = 0;
if((type->image_len)(thing, &(entry_ptr->size), &(entry_ptr->compressed),
&(entry_ptr->compressed_size)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing")
if((type->image_len)(thing, &(entry_ptr->size), &(entry_ptr->compressed), &(entry_ptr->compressed_size)) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing")
HDassert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE);
HDassert(((type->flags & H5C__CLASS_COMPRESSED_FLAG) != 0) ||
(entry_ptr->compressed == FALSE));
@ -1338,10 +1323,8 @@ H5C_insert_entry(H5F_t * f,
* been computed yet. Thus if entry_ptr->compressed is TRUE,
* entry_ptr->size must equal entry_ptr->compressed_size.
*/
HDassert((entry_ptr->compressed == FALSE) ||
(entry_ptr->size == entry_ptr->compressed_size));
HDassert((entry_ptr->compressed == TRUE) ||
(entry_ptr->compressed_size == 0));
HDassert(!entry_ptr->compressed || (entry_ptr->size == entry_ptr->compressed_size));
HDassert(entry_ptr->compressed || (entry_ptr->compressed_size == 0));
entry_ptr->in_slist = FALSE;
@ -1378,25 +1361,20 @@ H5C_insert_entry(H5F_t * f,
H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)
if ( ( cache_ptr->flash_size_increase_possible ) &&
( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) {
if(cache_ptr->flash_size_increase_possible &&
(entry_ptr->size > cache_ptr->flash_size_increase_threshold))
if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed.")
}
if(cache_ptr->index_size >= cache_ptr->max_cache_size)
empty_space = 0;
empty_space = 0;
else
empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
if ( ( cache_ptr->evictions_enabled ) &&
( ( (cache_ptr->index_size + entry_ptr->size) >
cache_ptr->max_cache_size)
if(cache_ptr->evictions_enabled &&
(((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size)
||
( ( ( empty_space + cache_ptr->clean_index_size ) <
cache_ptr->min_clean_size ) ) ) ) {
(((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)))) {
size_t space_needed;
if(empty_space <= entry_ptr->size)
@ -1577,11 +1555,12 @@ H5C_mark_entry_dirty(void *thing)
entry_ptr->dirtied = TRUE;
} else if ( entry_ptr->is_pinned ) {
hbool_t was_clean;
hbool_t was_clean; /* Whether the entry was previously clean */
/* Remember previous dirty status */
was_clean = !entry_ptr->is_dirty;
/* mark the entry as dirty if it isn't already */
/* Mark the entry as dirty if it isn't already */
entry_ptr->is_dirty = TRUE;
entry_ptr->image_up_to_date = FALSE;
@ -1638,56 +1617,40 @@ H5C_move_entry(H5C_t * cache_ptr,
FUNC_ENTER_NOAPI(FAIL)
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( type );
HDassert( H5F_addr_defined(old_addr) );
HDassert( H5F_addr_defined(new_addr) );
HDassert( H5F_addr_ne(old_addr, new_addr) );
HDassert(cache_ptr);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(type);
HDassert(H5F_addr_defined(old_addr));
HDassert(H5F_addr_defined(new_addr));
HDassert(H5F_addr_ne(old_addr, new_addr));
#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 ) ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"an extreme sanity check failed on entry.\n");
}
if((H5C_validate_protected_entry_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 */
H5C__SEARCH_INDEX(cache_ptr, old_addr, entry_ptr, FAIL)
if ( ( entry_ptr == NULL ) || ( entry_ptr->type != type ) ) {
if(entry_ptr == NULL || entry_ptr->type != type)
/* the old item doesn't exist in the cache, so we are done. */
HGOTO_DONE(SUCCEED)
}
HDassert( entry_ptr->addr == old_addr );
HDassert( entry_ptr->type == type );
HDassert(entry_ptr->addr == old_addr);
HDassert(entry_ptr->type == type);
if ( entry_ptr->is_protected ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, \
"Target entry is protected.")
}
if(entry_ptr->is_protected)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "target entry is protected.")
H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL)
if ( test_entry_ptr != NULL ) { /* we are hosed */
if ( test_entry_ptr->type == type ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, \
"Target already moved & reinserted???.")
} else {
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, \
"New address already in use?.")
}
}
if(test_entry_ptr != NULL) { /* we are hosed */
if(test_entry_ptr->type == type)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "target already moved & reinserted???")
else
HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "new address already in use?")
} /* end if */
/* If we get this far we have work to do. Remove *entry_ptr from
* the hash table (and skip list if necessary), change its address to the
@ -1704,31 +1667,29 @@ H5C_move_entry(H5C_t * cache_ptr,
* change the addr. If the entry is only in the process of being flushed,
* don't mark it as dirty either, lest we confuse the flush call back.
*/
if ( ! ( entry_ptr->destroy_in_progress ) ) {
if(!entry_ptr->destroy_in_progress) {
H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr)
if ( entry_ptr->in_slist ) {
HDassert( cache_ptr->slist_ptr );
if(entry_ptr->in_slist) {
HDassert(cache_ptr->slist_ptr);
H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr)
#if H5C_DO_SANITY_CHECKS
removed_entry_from_slist = TRUE;
#endif /* H5C_DO_SANITY_CHECKS */
}
}
} /* end if */
} /* end if */
entry_ptr->addr = new_addr;
if(!entry_ptr->destroy_in_progress) {
hbool_t was_dirty;
hbool_t was_dirty; /* Whether the entry was previously dirty */
/* Remember previous dirty status */
was_dirty = entry_ptr->is_dirty;
/* Mark the entry as dirty if it isn't already */
entry_ptr->is_dirty = TRUE;
/* This shouldn't be needed, but it keeps the test code happy */
@ -1743,7 +1704,6 @@ H5C_move_entry(H5C_t * cache_ptr,
} /* end if */
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
#if H5C_DO_SANITY_CHECKS
@ -1759,7 +1719,7 @@ H5C_move_entry(H5C_t * cache_ptr,
#endif /* H5C_DO_SANITY_CHECKS */
if(!entry_ptr->flush_in_progress) {
/* skip the update if a flush is in progress */
/* Update the replacement policy for the entry */
H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL)
}
} /* end if */
@ -1768,13 +1728,10 @@ H5C_move_entry(H5C_t * cache_ptr,
done:
#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 ) ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"an extreme sanity check failed on exit.\n");
}
if((H5C_validate_protected_entry_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 exit.\n")
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
@ -1884,14 +1841,12 @@ H5C_resize_entry(void *thing, size_t new_size)
#endif /* H5_HAVE_PARALLEL */
/* update the hash table */
H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\
(new_size), (entry_ptr), (was_clean));
H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \
new_size, entry_ptr, was_clean);
/* if the entry is in the skip list, update that too */
if ( entry_ptr->in_slist ) {
H5C__UPDATE_SLIST_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\
(new_size));
} /* end if */
if(entry_ptr->in_slist)
H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size);
/* update statistics just before changing the entry size */
H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE((cache_ptr), (entry_ptr), \
@ -1900,13 +1855,11 @@ H5C_resize_entry(void *thing, size_t new_size)
/* finally, update the entry size proper */
entry_ptr->size = new_size;
if(!entry_ptr->in_slist) {
if(!entry_ptr->in_slist)
H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
} /* end if */
if(entry_ptr->is_pinned) {
if(entry_ptr->is_pinned)
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
} /* end if */
} /* end if */
done:
@ -2536,7 +2489,6 @@ H5C_protect(H5F_t * f,
#endif /* H5_HAVE_PARALLEL */
done:
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
@ -2545,7 +2497,6 @@ done:
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_protect() */
@ -2568,18 +2519,14 @@ H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr)
FUNC_ENTER_NOAPI(FAIL)
if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
}
if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry.")
cache_ptr->cache_hits = 0;
cache_ptr->cache_accesses = 0;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_reset_cache_hit_rate_stats() */
@ -2606,137 +2553,95 @@ herr_t
H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
H5C_auto_size_ctl_t *config_ptr)
{
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(FAIL)
if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
}
if ( config_ptr == NULL ) {
if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry.")
if(config_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry.")
}
if ( config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version.")
}
if(config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown config version.")
/* check general configuration section of the config: */
if ( SUCCEED != H5C_validate_resize_config(config_ptr,
H5C_RESIZE_CFG__VALIDATE_GENERAL) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, \
"error in general configuration fields of new config.")
}
if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_GENERAL) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in general configuration fields of new config.")
/* check size increase control fields of the config: */
if ( SUCCEED != H5C_validate_resize_config(config_ptr,
H5C_RESIZE_CFG__VALIDATE_INCREMENT) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, \
"error in the size increase control fields of new config.")
}
if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INCREMENT) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size increase control fields of new config.")
/* check size decrease control fields of the config: */
if ( SUCCEED != H5C_validate_resize_config(config_ptr,
H5C_RESIZE_CFG__VALIDATE_DECREMENT) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, \
"error in the size decrease control fields of new config.")
}
if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_DECREMENT) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size decrease control fields of new config.")
/* check for conflicts between size increase and size decrease controls: */
if ( SUCCEED != H5C_validate_resize_config(config_ptr,
H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) ) {
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, \
"conflicting threshold fields in new config.")
}
if(H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "conflicting threshold fields in new config.")
/* will set the increase possible fields to FALSE later if needed */
cache_ptr->size_increase_possible = TRUE;
cache_ptr->flash_size_increase_possible = TRUE;
cache_ptr->size_decrease_possible = TRUE;
switch ( config_ptr->incr_mode )
{
switch(config_ptr->incr_mode) {
case H5C_incr__off:
cache_ptr->size_increase_possible = FALSE;
break;
case H5C_incr__threshold:
if ( ( config_ptr->lower_hr_threshold <= (double)0.0f ) ||
( config_ptr->increment <= (double)1.0f ) ||
( ( config_ptr->apply_max_increment ) &&
( config_ptr->max_increment <= 0 ) ) ) {
if((config_ptr->lower_hr_threshold <= (double)0.0f) ||
(config_ptr->increment <= (double)1.0f) ||
((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0)))
cache_ptr->size_increase_possible = FALSE;
}
break;
default: /* should be unreachable */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.")
}
} /* end switch */
/* logically, this is were configuration for flash cache size increases
* should go. However, this configuration depends on max_cache_size, so
* we wait until the end of the function, when this field is set.
*/
switch ( config_ptr->decr_mode )
{
switch(config_ptr->decr_mode) {
case H5C_decr__off:
cache_ptr->size_decrease_possible = FALSE;
break;
case H5C_decr__threshold:
if ( ( config_ptr->upper_hr_threshold >= (double)1.0f ) ||
( config_ptr->decrement >= (double)1.0f ) ||
( ( config_ptr->apply_max_decrement ) &&
( config_ptr->max_decrement <= 0 ) ) ) {
if((config_ptr->upper_hr_threshold >= (double)1.0f) ||
(config_ptr->decrement >= (double)1.0f) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
}
break;
case H5C_decr__age_out:
if ( ( ( config_ptr->apply_empty_reserve ) &&
( config_ptr->empty_reserve >= (double)1.0f ) ) ||
( ( config_ptr->apply_max_decrement ) &&
( config_ptr->max_decrement <= 0 ) ) ) {
if(((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)))
cache_ptr->size_decrease_possible = FALSE;
}
break;
case H5C_decr__age_out_with_threshold:
if ( ( ( config_ptr->apply_empty_reserve ) &&
( config_ptr->empty_reserve >= (double)1.0f ) ) ||
( ( config_ptr->apply_max_decrement ) &&
( config_ptr->max_decrement <= 0 ) ) ||
( config_ptr->upper_hr_threshold >= (double)1.0f ) ) {
if(((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= (double)1.0f)) ||
((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) ||
(config_ptr->upper_hr_threshold >= (double)1.0f))
cache_ptr->size_decrease_possible = FALSE;
}
break;
default: /* should be unreachable */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?.")
}
if ( config_ptr->max_size == config_ptr->min_size ) {
} /* end switch */
if(config_ptr->max_size == config_ptr->min_size) {
cache_ptr->size_increase_possible = FALSE;
cache_ptr->flash_size_increase_possible = FALSE;
cache_ptr->size_decrease_possible = FALSE;
}
} /* end if */
/* flash_size_increase_possible is intentionally omitted from the
* following:
@ -2754,25 +2659,16 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
* go through the exercise even if the current size is within
* range and an initial size has not been provided.
*/
if ( (cache_ptr->resize_ctl).set_initial_size ) {
new_max_cache_size = (cache_ptr->resize_ctl).initial_size;
}
else if ( cache_ptr->max_cache_size > (cache_ptr->resize_ctl).max_size ) {
new_max_cache_size = (cache_ptr->resize_ctl).max_size;
}
else if ( cache_ptr->max_cache_size < (cache_ptr->resize_ctl).min_size ) {
new_max_cache_size = (cache_ptr->resize_ctl).min_size;
} else {
if(cache_ptr->resize_ctl.set_initial_size)
new_max_cache_size = cache_ptr->resize_ctl.initial_size;
else if(cache_ptr->max_cache_size > cache_ptr->resize_ctl.max_size)
new_max_cache_size = cache_ptr->resize_ctl.max_size;
else if(cache_ptr->max_cache_size < cache_ptr->resize_ctl.min_size)
new_max_cache_size = cache_ptr->resize_ctl.min_size;
else
new_max_cache_size = cache_ptr->max_cache_size;
}
new_min_clean_size = (size_t)
((double)new_max_cache_size *
new_min_clean_size = (size_t)((double)new_max_cache_size *
((cache_ptr->resize_ctl).min_clean_fraction));
@ -2782,50 +2678,30 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
*
* by definition.
*/
HDassert( new_min_clean_size <= new_max_cache_size );
HDassert( (cache_ptr->resize_ctl).min_size <= new_max_cache_size );
HDassert( new_max_cache_size <= (cache_ptr->resize_ctl).max_size );
if ( new_max_cache_size < cache_ptr->max_cache_size ) {
HDassert(new_min_clean_size <= new_max_cache_size);
HDassert(cache_ptr->resize_ctl.min_size <= new_max_cache_size);
HDassert(new_max_cache_size <= cache_ptr->resize_ctl.max_size);
if(new_max_cache_size < cache_ptr->max_cache_size)
cache_ptr->size_decreased = TRUE;
}
cache_ptr->max_cache_size = new_max_cache_size;
cache_ptr->min_clean_size = new_min_clean_size;
if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) {
if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
/* this should be impossible... */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"H5C_reset_cache_hit_rate_stats failed.")
}
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed.")
/* remove excess epoch markers if any */
if ( ( config_ptr->decr_mode == H5C_decr__age_out_with_threshold ) ||
( config_ptr->decr_mode == H5C_decr__age_out ) ) {
if ( cache_ptr->epoch_markers_active >
(cache_ptr->resize_ctl).epochs_before_eviction ) {
result =
H5C__autoadjust__ageout__remove_excess_markers(cache_ptr);
if ( result != SUCCEED ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"can't remove excess epoch markers.")
}
}
} else if ( cache_ptr->epoch_markers_active > 0 ) {
result = H5C__autoadjust__ageout__remove_all_markers(cache_ptr);
if ( result != SUCCEED ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"error removing all epoch markers.")
}
if((config_ptr->decr_mode == H5C_decr__age_out_with_threshold) ||
(config_ptr->decr_mode == H5C_decr__age_out)) {
if(cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction)
if(H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers.")
} /* end if */
else if(cache_ptr->epoch_markers_active > 0) {
if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.")
}
/* configure flash size increase facility. We wait until the
@ -2836,33 +2712,26 @@ H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
* go ahead and configure it.
*/
if ( cache_ptr->flash_size_increase_possible ) {
switch ( config_ptr->flash_incr_mode )
{
if(cache_ptr->flash_size_increase_possible) {
switch(config_ptr->flash_incr_mode) {
case H5C_flash_incr__off:
cache_ptr->flash_size_increase_possible = FALSE;
break;
case H5C_flash_incr__add_space:
cache_ptr->flash_size_increase_possible = TRUE;
cache_ptr->flash_size_increase_threshold =
(size_t)
(((double)(cache_ptr->max_cache_size)) *
cache_ptr->flash_size_increase_threshold = (size_t)(((double)(cache_ptr->max_cache_size)) *
((cache_ptr->resize_ctl).flash_threshold));
break;
default: /* should be unreachable */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
"Unknown flash_incr_mode?!?!?.")
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?.")
break;
}
}
} /* end switch */
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_set_cache_auto_resize_config() */
@ -4470,10 +4339,8 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
next_ptr = entry_ptr->next;
prev_ptr = entry_ptr->prev;
if ( prev_ptr != NULL ) {
if(prev_ptr != NULL)
prev_is_dirty = prev_ptr->is_dirty;
}
/* dirty corked entry is skipped */
if(entry_ptr->is_corked && entry_ptr->is_dirty)
@ -5356,6 +5223,7 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
* slist if we find them. However, best we do some extra
* sanity checking just in case.
*/
HDassert(entry_ptr != NULL);
HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(entry_ptr->in_slist);
HDassert(entry_ptr->is_dirty);
@ -5388,9 +5256,6 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
* flush, we must keep the slist in cannonical form at all
* times.
*/
HDassert(entry_ptr != NULL);
HDassert(entry_ptr->in_slist);
if(((!entry_ptr->flush_me_last) ||
((entry_ptr->flush_me_last) &&
(cache_ptr->num_last_entries >= cache_ptr->slist_len))) &&
@ -5510,7 +5375,7 @@ H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring,
* It used to be that all entries remaining in the cache at
* this point had to be clean, but with the fractal heap mods
* this may not be the case. If so, we will flush entries out
* of increasing address order.
* in increasing address order.
*
* Writes to disk are possible here.
*/
@ -5864,7 +5729,7 @@ H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags)
if(!flush_marked_entries || entry_ptr->flush_marker)
HDassert(entry_ptr->ring >= ring);
/* increment node pointer now, before we delete its target
/* advance node pointer now, before we delete its target
* from the slist.
*/
node_ptr = H5SL_next(node_ptr);
@ -6225,7 +6090,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
* just flushed the entry.
*/
if(entry_ptr->type->notify &&
(entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0 )
(entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0 )
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush")
} /* if ( write_entry ) */
@ -6250,25 +6115,25 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
} /* end else if */
/* Update the cache internal data structures. */
if(destroy) {
/* Sanity checks */
if(take_ownership)
HDassert(!destroy_entry);
else
HDassert(destroy_entry);
HDassert(!entry_ptr->is_pinned);
/* Update stats, while entry is still in the cache */
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
* the entry is still fully integrated in the cache.
*/
if(destroy)
/* 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
* the entry is still fully integrated in the cache.
*/
if(entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict")
/* Update the cache internal data structures. */
if(destroy) {
/* Update the cache internal data structures as appropriate
* for a destroy. Specifically:
*
@ -6326,12 +6191,11 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
* appropriate */
if(was_dirty) {
HDassert(entry_ptr->flush_dep_ndirty_children == 0);
if(entry_ptr->flush_dep_nparents > 0)
if(H5C__mark_flush_dep_clean(entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep clean flag")
} /* end if */
}
} /* end else */
/* reset the flush_in progress flag */
entry_ptr->flush_in_progress = FALSE;
@ -6346,7 +6210,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
* Now discard the entry if appropriate.
*/
if(destroy) {
/* start by freeing the buffer for the on disk image */
/* Sanity check */
HDassert(0 == entry_ptr->flush_dep_nparents);
/* Start by freeing the buffer for the on disk image */
if(entry_ptr->image_ptr != NULL)
entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr);
@ -6360,17 +6227,17 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
HDassert(H5F_addr_defined(entry_ptr->addr));
HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr));
#ifndef NDEBUG
{
hbool_t curr_compressed = FALSE;
size_t curr_len;
size_t curr_compressed_len = 0;
{
hbool_t curr_compressed = FALSE;
size_t curr_len;
size_t curr_compressed_len = 0;
/* Get the actual image size for the thing again */
entry_ptr->type->image_len((void *)entry_ptr, &curr_len, &curr_compressed, &curr_compressed_len);
HDassert(curr_len == entry_ptr->size);
HDassert(curr_compressed == entry_ptr->compressed);
HDassert(curr_compressed_len == entry_ptr->compressed_size);
}
/* Get the actual image size for the thing again */
entry_ptr->type->image_len((void *)entry_ptr, &curr_len, &curr_compressed, &curr_compressed_len);
HDassert(curr_len == entry_ptr->size);
HDassert(curr_compressed == entry_ptr->compressed);
HDassert(curr_compressed_len == entry_ptr->compressed_size);
}
#endif /* NDEBUG */
/* if the file space free size callback is defined, use
@ -6438,7 +6305,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
if(entry_ptr->type->free_icr((void *)entry_ptr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed.")
}
} /* end if */
else {
HDassert(take_ownership);
@ -6447,7 +6314,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
* unless the entry is re-inserted properly
*/
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
}
} /* end else */
} /* if (destroy) */
if(cache_ptr->log_flush)
@ -7020,10 +6887,8 @@ H5C_make_space_in_cache(H5F_t * f,
next_ptr = entry_ptr->next;
prev_ptr = entry_ptr->prev;
if ( prev_ptr != NULL ) {
if(prev_ptr != NULL)
prev_is_dirty = prev_ptr->is_dirty;
}
if (entry_ptr->is_corked && entry_ptr->is_dirty) {
@ -7742,12 +7607,13 @@ done:
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Vailin Choi; January 2014
* Programmer: Vailin Choi
* January 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
{
haddr_t *ptr; /* Points to an address */
herr_t ret_value = SUCCEED; /* Return value */
@ -8171,7 +8037,6 @@ H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_p
HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len,
H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE));
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
entry_ptr->image_up_to_date = TRUE;
} /* end block */

View File

@ -524,21 +524,17 @@ if ( ( (entry_ptr) == NULL ) || \
(cache_ptr)->max_pel_size = (cache_ptr)->pel_size;
#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) \
if ( cache_ptr->flush_in_progress ) { \
if ( cache_ptr->flush_in_progress ) \
((cache_ptr)->cache_flush_moves[(entry_ptr)->type->id])++; \
} \
if ( entry_ptr->flush_in_progress ) { \
if ( entry_ptr->flush_in_progress ) \
((cache_ptr)->entry_flush_moves[(entry_ptr)->type->id])++; \
} \
(((cache_ptr)->moves)[(entry_ptr)->type->id])++;
#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size)\
if ( cache_ptr->flush_in_progress ) { \
if ( cache_ptr->flush_in_progress ) \
((cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id])++; \
} \
if ( entry_ptr->flush_in_progress ) { \
if ( entry_ptr->flush_in_progress ) \
((cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id])++; \
} \
if ( (entry_ptr)->size < (new_size) ) { \
((cache_ptr)->size_increases[(entry_ptr)->type->id])++; \
H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
@ -1002,7 +998,6 @@ if ( ( (cache_ptr) == NULL ) || \
( (cache_ptr)->index_size <= 0 ) || \
( (new_size) <= 0 ) || \
( (old_size) > (cache_ptr)->index_size ) || \
( (new_size) <= 0 ) || \
( ( (cache_ptr)->index_len == 1 ) && \
( (cache_ptr)->index_size != (old_size) ) ) || \
( (cache_ptr)->index_size != \
@ -1175,19 +1170,17 @@ if ( ( (cache_ptr)->index_size != \
int k; \
H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
k = H5C__HASH_FCN((entry_ptr)->addr); \
if ( ((cache_ptr)->index)[k] == NULL ) \
((cache_ptr)->index)[k] = (entry_ptr); \
else { \
if(((cache_ptr)->index)[k] != NULL) { \
(entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
(entry_ptr)->ht_next->ht_prev = (entry_ptr); \
((cache_ptr)->index)[k] = (entry_ptr); \
} \
((cache_ptr)->index)[k] = (entry_ptr); \
(cache_ptr)->index_len++; \
(cache_ptr)->index_size += (entry_ptr)->size; \
((cache_ptr)->index_ring_len[entry_ptr->ring])++; \
((cache_ptr)->index_ring_size[entry_ptr->ring]) \
+= (entry_ptr)->size; \
if ( (entry_ptr)->is_dirty ) { \
+= (entry_ptr)->size; \
if((entry_ptr)->is_dirty) { \
(cache_ptr)->dirty_index_size += (entry_ptr)->size; \
((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
+= (entry_ptr)->size; \
@ -1221,8 +1214,8 @@ if ( ( (cache_ptr)->index_size != \
(cache_ptr)->index_size -= (entry_ptr)->size; \
((cache_ptr)->index_ring_len[entry_ptr->ring])--; \
((cache_ptr)->index_ring_size[entry_ptr->ring]) \
-= (entry_ptr)->size; \
if ( (entry_ptr)->is_dirty ) { \
-= (entry_ptr)->size; \
if((entry_ptr)->is_dirty) { \
(cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \
-= (entry_ptr)->size; \
@ -1231,7 +1224,7 @@ if ( ( (cache_ptr)->index_size != \
((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \
-= (entry_ptr)->size; \
} \
if ((entry_ptr)->flush_me_last) { \
if((entry_ptr)->flush_me_last) { \
(cache_ptr)->num_last_entries--; \
HDassert((cache_ptr)->num_last_entries <= 1); \
} \
@ -1506,31 +1499,6 @@ if ( ( (cache_ptr)->index_size != \
*
* Programmer: John Mainzer, 5/10/04
*
* Modifications:
*
* JRM -- 7/21/04
* Updated function for the addition of the hash table.
*
* JRM - 7/27/04
* Converted from the function H5C_remove_entry_from_tree()
* to the macro H5C__REMOVE_ENTRY_FROM_TREE in the hopes of
* wringing a little more performance out of the cache.
*
* QAK -- 11/27/04
* Switched over to using skip list routines.
*
* JRM -- 3/28/07
* Updated sanity checks for the new is_read_only and
* ro_ref_count fields in H5C_cache_entry_t.
*
* JRM -- 12/13/14
* Added code to set cache_ptr->slist_changed to TRUE
* when an entry is removed from the slist.
*
* JRM -- 9/1/15
* Added code to maintain the cache_ptr->slist_ring_len
* and cache_ptr->slist_ring_size arrays.
*
*-------------------------------------------------------------------------
*/
@ -4240,7 +4208,7 @@ struct H5C_t {
int32_t max_pel_len;
size_t max_pel_size;
/* Fields for tacking 'make space in cache' (msic) operations */
/* Fields for tracking 'make space in cache' (msic) operations */
int64_t calls_to_msic;
int64_t total_entries_skipped_in_msic;
int64_t total_entries_scanned_in_msic;

View File

@ -182,12 +182,10 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr)
* Programmer: Mike McGreevy
* January 14, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry, hid_t dxpl_id)
{
H5P_genplist_t *dxpl; /* dataset transfer property list */
H5C_tag_t tag; /* Tag structure */
@ -196,9 +194,9 @@ H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
FUNC_ENTER_PACKAGE
/* Assertions */
HDassert(cache_ptr != NULL);
HDassert(entry_ptr != NULL);
HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(cache != NULL);
HDassert(entry != NULL);
HDassert(cache->magic == H5C__H5C_T_MAGIC);
/* Get the dataset transfer property list */
if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
@ -208,13 +206,7 @@ H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
if((H5P_get(dxpl, "H5C_tag", &tag)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query property value")
if(cache_ptr->ignore_tags != TRUE) {
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Perform some sanity checks to ensure that a correct tag is being applied */
if(H5C_verify_tag(entry_ptr->type->id, tag.value, tag.globality) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed")
#endif
} else {
if(cache->ignore_tags) {
/* if we're ignoring tags, it's because we're running
tests on internal functions and may not have inserted a tag
value into a given dxpl_id before creating some metadata. Thus,
@ -227,12 +219,19 @@ H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id)
tag.globality = H5C_GLOBALITY_NONE;
} /* end if */
} /* end if */
#if H5C_DO_TAGGING_SANITY_CHECKS
else {
/* Perform some sanity checks to ensure that a correct tag is being applied */
if(H5C_verify_tag(entry->type->id, tag.value, tag.globality) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed")
} /* end else */
#endif
/* Apply the tag to the entry */
entry_ptr->tag = tag.value;
entry->tag = tag.value;
/* Apply the tag globality to the entry */
entry_ptr->globality = tag.globality;
entry->globality = tag.globality;
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -145,7 +145,7 @@ static herr_t H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_
static herr_t H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
static herr_t H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info);
/* Generic extensible array routines */
/* Generic fixed array routines */
static herr_t H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info);
/*********************/

View File

@ -394,6 +394,10 @@ typedef struct H5D_chunk_cached_t {
unsigned filter_mask; /*excluded filters */
} H5D_chunk_cached_t;
/****************************/
/* Virtual dataset typedefs */
/****************************/
/* List of files held open during refresh operations */
typedef struct H5D_virtual_held_file_t {
H5F_t *file; /* Pointer to file held open */
@ -685,6 +689,8 @@ H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t
#ifdef H5D_CHUNK_DEBUG
H5_DLL herr_t H5D__chunk_stats(const H5D_t *dset, hbool_t headers);
#endif /* H5D_CHUNK_DEBUG */
/* format convert */
H5_DLL herr_t H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx_info_t *new_idx_info);
/* Functions that operate on compact dataset storage */

View File

@ -756,8 +756,8 @@ END_FUNC(PRIV) /* end H5EA_get() */
/*-------------------------------------------------------------------------
* Function: H5EA_depend
*
* Purpose: Make a child flush dependency between the extensible array's
* header and another piece of metadata in the file.
* Purpose: Make a child flush dependency between the extensible array
* and another piece of metadata in the file.
*
* Return: SUCCEED/FAIL
*

View File

@ -154,7 +154,7 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent,
haddr_t addr))
/* Local variables */
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
/* Sanity check */
HDassert(hdr);
@ -206,7 +206,7 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent,
haddr_t dblk_page_addr, unsigned flags))
/* Local variables */
H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
/* Sanity check */
HDassert(hdr);

View File

@ -204,9 +204,6 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata))
hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts));
hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits;
hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits);
#ifdef QAK
HDfprintf(stderr, "%s: hdr->nsblks = %Zu\n", FUNC, hdr->nsblks);
#endif /* QAK */
/* Allocate information for each super block */
if(NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks)))
@ -220,9 +217,6 @@ HDfprintf(stderr, "%s: hdr->nsblks = %Zu\n", FUNC, hdr->nsblks);
hdr->sblk_info[u].dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(u, hdr->cparam.data_blk_min_elmts);
hdr->sblk_info[u].start_idx = start_idx;
hdr->sblk_info[u].start_dblk = start_dblk;
#ifdef QAK
HDfprintf(stderr, "%s: hdr->sblk_info[%Zu] = {%Zu, %Zu, %Hu, %Hu}\n", FUNC, u, hdr->sblk_info[u].ndblks, hdr->sblk_info[u].dblk_nelmts, hdr->sblk_info[u].start_idx, hdr->sblk_info[u].start_dblk);
#endif /* QAK */
/* Advance starting indices for next super block */
start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts;
@ -271,9 +265,6 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts))
/* Compute the index of the element buffer factory */
H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t);
idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts);
#ifdef QAK
HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", FUNC, nelmts, (unsigned)hdr->data_blk_min_elmts, idx);
#endif /* QAK */
/* Check for needing to increase size of array of factories */
if(idx >= hdr->elmt_fac.nalloc) {
@ -341,9 +332,6 @@ H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts))
/* Compute the index of the element buffer factory */
H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t);
idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts);
#ifdef QAK
HDfprintf(stderr, "%s: nelmts = %Zu, hdr->data_blk_min_elmts = %u, idx = %u\n", FUNC, nelmts, (unsigned)hdr->data_blk_min_elmts, idx);
#endif /* QAK */
/* Free buffer for elements in index block */
HDassert(idx < hdr->elmt_fac.nalloc);
@ -374,10 +362,6 @@ H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam,
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Extensible array header */
#ifdef QAK
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* QAK */
/* Check arguments */
HDassert(f);
HDassert(cparam);
@ -725,9 +709,6 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr, hid_t dxpl_id))
/* Check for index block */
if(H5F_addr_defined(hdr->idx_blk_addr)) {
#ifdef QAK
HDfprintf(stderr, "%s: hdr->idx_blk_addr = %a\n", FUNC, hdr->idx_blk_addr);
#endif /* QAK */
/* Delete index block */
if(H5EA__iblock_delete(hdr, dxpl_id) < 0)
H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block")

View File

@ -241,11 +241,13 @@ typedef struct H5EA_sblock_t {
/* Internal array information (not stored) */
H5EA_hdr_t *hdr; /* Shared array header info */
hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5EA_iblock_t *parent; /* Parent object for super block (index block) */
haddr_t addr; /* Address of this index block on disk */
size_t size; /* Size of index block on disk */
/* Flush dependency information (not stored) */
hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5EA_iblock_t *parent; /* Parent object for super block (index block) */
/* Computed/cached values (not stored) */
unsigned idx; /* Super block index within the extensible array */
size_t ndblks; /* # of data block addresses that are in super block */
@ -266,11 +268,13 @@ typedef struct H5EA_dblock_t {
/* Internal array information (not stored) */
H5EA_hdr_t *hdr; /* Shared array header info */
hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
void *parent; /* Parent object for data block (index or super block) */
haddr_t addr; /* Address of this data block on disk */
size_t size; /* Size of data block on disk */
/* Flush dependency information (not stored) */
hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
void *parent; /* Parent object for data block (index or super block) */
/* Computed/cached values (not stored) */
size_t nelmts; /* Number of elements in block */
size_t npages; /* Nummber of pages in a block (zero if not paged) */
@ -286,11 +290,13 @@ typedef struct H5EA_dbk_page_t {
/* Internal array information (not stored) */
H5EA_hdr_t *hdr; /* Shared array header info */
hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5EA_sblock_t *parent; /* Parent object for data block page (super block) */
haddr_t addr; /* Address of this data block page on disk */
size_t size; /* Size of data block page on disk */
/* Flush dependency information (not stored) */
hbool_t has_hdr_depend; /* Whether this object has a flush dependency on the header */
H5EA_sblock_t *parent; /* Parent object for data block page (super block) */
/* Computed/cached values (not stored) */
/* <none> */
} H5EA_dblk_page_t;

View File

@ -152,11 +152,11 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
/* Point fixed array wrapper at header and bump it's ref count */
fa->hdr = hdr;
if(H5FA__hdr_incr(fa->hdr) < 0)
H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
/* Increment # of files using this array header */
if(H5FA__hdr_fuse_incr(fa->hdr) < 0)
H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
/* Set file pointer for this array open context */
fa->f = f;
@ -167,7 +167,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
CATCH
if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
if(!ret_value)
if(fa && H5FA_close(fa, dxpl_id) < 0)
H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
@ -261,10 +261,6 @@ H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts))
/* Local variables */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/*
* Check arguments.
*/
@ -295,10 +291,6 @@ H5FA_get_addr(const H5FA_t *fa, haddr_t *addr))
/* Local variables */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/*
* Check arguments.
*/
@ -336,11 +328,6 @@ H5FA_set(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, const void *elmt))
unsigned dblk_page_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting FIxed Array Data block page */
hbool_t hdr_dirty = FALSE; /* Whether header information changed */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
#endif /* H5FA_DEBUG */
/*
* Check arguments.
*/
@ -352,9 +339,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
/* Check if we need to create the fixed array data block */
if(!H5F_addr_defined(hdr->dblk_addr)) {
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx);
#endif /* H5FA_DEBUG */
/* Create the data block */
hdr->dblk_addr = H5FA__dblock_create(hdr, dxpl_id, &hdr_dirty);
if(!H5F_addr_defined(hdr->dblk_addr))
@ -449,11 +433,6 @@ H5FA_get(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, void *elmt))
H5FA_dblock_t *dblock = NULL; /* Pointer to data block for FA */
H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for FA */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
#endif /* H5FA_DEBUG */
/*
* Check arguments.
*/
@ -550,10 +529,6 @@ H5FA_close(H5FA_t *fa, hid_t dxpl_id))
hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
haddr_t fa_addr = HADDR_UNDEF; /* Address of array (for deletion) */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/*
* Check arguments.
*/
@ -657,9 +632,6 @@ H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata))
HDassert(H5F_addr_defined(fa_addr));
/* Lock the array header into memory */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr);
#endif /* H5FA_DEBUG */
if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", (unsigned long long)fa_addr)
@ -760,10 +732,6 @@ H5FA_patch_file(H5FA_t *fa, H5F_t *f))
/* Local variables */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/*
* Check arguments.
*/

View File

@ -152,7 +152,7 @@ herr_t, SUCCEED, FAIL,
H5FA__dblk_page_create(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, size_t nelmts))
/* Local variables */
H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */
H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr);
@ -210,7 +210,7 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_page_addr,
size_t dblk_page_nelmts, unsigned flags))
/* Local variables */
H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);

View File

@ -189,12 +189,8 @@ haddr_t, HADDR_UNDEF, HADDR_UNDEF,
H5FA__dblock_create(H5FA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty))
/* Local variables */
H5FA_dblock_t *dblock = NULL; /* fixed array data block */
haddr_t dblock_addr; /* fixed array data block address */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called, hdr->stats.nelmts = %Zu, nelmts = %Zu\n", FUNC, hdr->stats.nelmts, hdr->cparam.nelmts);
#endif /* H5FA_DEBUG */
H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
haddr_t dblock_addr; /* Fixed array data block address */
/* Sanity check */
HDassert(hdr);
@ -206,10 +202,6 @@ HDfprintf(stderr, "%s: Called, hdr->stats.nelmts = %Zu, nelmts = %Zu\n", FUNC, h
/* Set size of data block on disk */
hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock);
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size);
#endif /* H5FA_DEBUG */
/* Allocate space for the data block on disk */
if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dxpl_id, (hsize_t)dblock->size)))
@ -266,11 +258,7 @@ H5FA__dblock_protect(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr,
unsigned flags))
/* Local variables */
H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */
/* Sanity check */
HDassert(hdr);
@ -310,10 +298,6 @@ H5FA__dblock_unprotect(H5FA_dblock_t *dblock, hid_t dxpl_id, unsigned cache_flag
/* Local variables */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/* Sanity check */
HDassert(dblock);
@ -345,10 +329,6 @@ H5FA__dblock_delete(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr))
/* Local variables */
H5FA_dblock_t *dblock = NULL; /* Pointer to data block */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/* Sanity check */
HDassert(hdr);
HDassert(H5F_addr_defined(dblk_addr));
@ -367,16 +347,10 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
/* Iterate over pages in data block */
for(u = 0; u < dblock->npages; u++) {
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Expunging data block page from cache\n", FUNC);
#endif /* H5FA_DEBUG */
/* Evict the data block page from the metadata cache */
/* (OK to call if it doesn't exist in the cache) */
if(H5AC_expunge_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Done expunging data block page from cache\n", FUNC);
#endif /* H5FA_DEBUG */
/* Advance to next page address */
dblk_page_addr += dblock->dblk_page_size;

View File

@ -184,10 +184,6 @@ H5FA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5FA_create_t *cparam,
/* Local variables */
H5FA_hdr_t *hdr = NULL; /* Fixed array header */
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
/* Check arguments */
HDassert(f);
HDassert(cparam);
@ -505,10 +501,6 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr, hid_t dxpl_id))
/* Check for Fixed Array Data block */
if(H5F_addr_defined(hdr->dblk_addr)) {
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: hdr->dblk_addr = %a\n", FUNC, hdr->dblk_addr);
#endif /* H5FA_DEBUG */
/* Delete Fixed Array Data block */
if(H5FA__dblock_delete(hdr, dxpl_id, hdr->dblk_addr) < 0)
H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block")

View File

@ -483,7 +483,7 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
* Note that while we may alter the contents of the free space
* header in cases 1) and 2), there is no need to mark the header
* as dirty, as the metadata cache would not be attempting to
* serialize the header if it though it was clean.
* serialize the header if it thought it was clean.
*/
if(fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) {
/* Sanity check */

View File

@ -473,9 +473,9 @@
#define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */
#define H5F_ACS_MDC_LOG_LOCATION_NAME "mdc_log_location" /* Name of metadata cache log location */
#define H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME "start_mdc_log_on_access" /* Whether logging starts on file create/open */
#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */
#define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */
#define H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME "evict_on_close_flag" /* Whether or not the metadata cache will evict objects on close */
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */
#define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */
#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */
/* ======================== File Mount properties ====================*/

View File

@ -107,7 +107,7 @@ const H5AC_class_t H5AC_SUPERBLOCK[1] = {{
H5F__cache_superblock_image_len, /* 'image_len' callback */
H5F__cache_superblock_pre_serialize,/* 'pre_serialize' callback */
H5F__cache_superblock_serialize, /* 'serialize' callback */
NULL, /* 'notify' callback */
NULL, /* 'notify' callback */
H5F__cache_superblock_free_icr, /* 'free_icr' callback */
NULL, /* 'clear' callback */
NULL, /* 'fsf_size' callback */

View File

@ -451,14 +451,11 @@ H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
/* destroy flush dependency between direct block and header */
if(H5AC_destroy_flush_dependency(dblock->hdr, dblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, \
"unable to destroy flush dependency")
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
/* create flush dependency between direct block and new root indirect block */
if(H5AC_create_flush_dependency(dblock->parent, dblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, \
"unable to create flush dependency")
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
if(H5HF_man_iblock_attach(iblock, 0, hdr->man_dtable.table_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach root direct block to parent indirect block")

View File

@ -155,7 +155,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
H5_CHECK_OVERFLOW(size, size_t, hsize_t);
if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap")
if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t)))
if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
heap->addr = addr;
heap->size = size;

View File

@ -1388,6 +1388,8 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
/* Cache object header */
if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR, oh_addr, oh, insert_flags) < 0)
HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
/* Reset object header pointer, now that it's been inserted into the cache */
oh = NULL;
/* Reset metadata tag in dxpl_id */
@ -1403,7 +1405,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
done:
if(ret_value < 0 && oh)
if(H5O_free(oh) < 0)
if(H5O__free(oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
FUNC_LEAVE_NOAPI(ret_value)
@ -1978,7 +1980,7 @@ H5O_assert(oh);
done:
if(ret_value == NULL && oh)
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI_TAG(ret_value, NULL)
@ -3627,7 +3629,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5O_free
* Function: H5O__free
*
* Purpose: Destroys an object header.
*
@ -3640,14 +3642,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_free(H5O_t *oh)
H5O__free(H5O_t *oh)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR
/* check args */
HDassert(oh);
HDassert(0 == oh->rc);
/* Destroy chunks */
if(oh->chunk) {
@ -3682,5 +3686,5 @@ H5O_free(H5O_t *oh)
oh = H5FL_FREE(H5O_t, oh);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_free() */
} /* end H5O__free() */

View File

@ -644,9 +644,9 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
old_size = oh->chunk[chunkno].size;
oh->chunk[chunkno].size += delta + extra_prfx_size;
oh->chunk[chunkno].image = H5FL_BLK_REALLOC(chunk_image, old_image, oh->chunk[chunkno].size);
oh->chunk[chunkno].gap = 0;
if(NULL == oh->chunk[chunkno].image)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't reallocate extended object header chunk")
oh->chunk[chunkno].gap = 0;
/* Wipe new space for chunk */
HDmemset(oh->chunk[chunkno].image + old_size, 0, oh->chunk[chunkno].size - old_size);
@ -664,8 +664,8 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
oh->mesg[u].raw = oh->chunk[chunkno].image + extra_prfx_size + (oh->mesg[u].raw - old_image);
/* Find continuation message which points to this chunk and adjust chunk's size */
/* (Chunk 0 doesn't have a continuation message that points to it and
* it's size is directly encoded in the object header) */
/* (Chunk 0 doesn't have a continuation message that points to it,
* its size is directly encoded in the object header) */
if(chunkno > 0 && (H5O_CONT_ID == oh->mesg[u].type->id) &&
(((H5O_cont_t *)(oh->mesg[u].native))->chunkno == chunkno)) {
H5O_chunk_proxy_t *chk_proxy2 = NULL; /* Chunk that continuation message is in */
@ -891,7 +891,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
/*
* The total chunk size must include the requested space plus enough
* for the message header. This must be at least some minimum and
* aligned propertly.
* aligned properly.
*/
size = MAX(H5O_MIN_SIZE, size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
HDassert(size == H5O_ALIGN_OH(oh, size));
@ -903,20 +903,18 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
*/
size += H5O_SIZEOF_CHKHDR_OH(oh);
/* allocate space in file to hold the new chunk */
/* Allocate space in file to hold the new chunk */
new_chunk_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)size);
if(HADDR_UNDEF == new_chunk_addr)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate space for new chunk")
if(!H5F_addr_defined(new_chunk_addr))
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "unable to allocate space for new chunk")
/*
* Create the new chunk giving it a file address.
*/
/* Create the new chunk giving it a file address. */
if(oh->nchunks >= oh->alloc_nchunks) {
size_t na = MAX(H5O_NCHUNKS, oh->alloc_nchunks * 2); /* Double # of chunks allocated */
H5O_chunk_t *x;
if(NULL == (x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, na)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate larger chunk array, na = %zu", na)
oh->alloc_nchunks = na;
oh->chunk = x;
} /* end if */
@ -927,7 +925,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
oh->chunk[chunkno].size = size;
oh->chunk[chunkno].gap = 0;
if(NULL == (oh->chunk[chunkno].image = p = H5FL_BLK_CALLOC(chunk_image, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate image for chunk, size = %zu", size)
/* If this is a later version of the object header format, put the magic
* # at the beginning of the chunk image.
@ -1112,8 +1110,7 @@ done:
*
* Purpose: Allocate enough space in the object header for this message.
*
* Return: Success: Index of message
* Failure: Negative
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* matzke@llnl.gov
@ -1165,7 +1162,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
htri_t tri_result; /* Status from attempting to extend chunk */
if((tri_result = H5O_alloc_extend_chunk(f, dxpl_id, oh, chunkno, raw_size, &idx)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "H5O_alloc_extend_chunk failed unexpectedly")
HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "can't extend existing chunk")
if(tri_result == TRUE)
break;
} /* end for */

View File

@ -376,7 +376,7 @@ H5O__cache_deserialize(const void *_image, size_t len, void *_udata,
done:
/* Release the [possibly partially initialized] object header on errors */
if(!ret_value && oh)
if(H5O_free(oh) < 0)
if(H5O__free(oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data")
FUNC_LEAVE_NOAPI(ret_value)
@ -604,7 +604,7 @@ H5O__cache_free_icr(void *_thing)
HDassert(oh->cache_info.type == H5AC_OHDR);
/* Destroy object header */
if(H5O_free(oh) < 0)
if(H5O__free(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't destroy object header")
done:

View File

@ -858,6 +858,10 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
oh_dst->nlink += (unsigned)addr_map->inc_ref_count;
} /* end if */
/* Retag all copied metadata to apply the destination object's tag */
if(H5AC_retag_copied_metadata(oloc_dst->file, oloc_dst->addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries")
/* Set metadata tag for destination object's object header */
H5_BEGIN_TAG(dxpl_id, oloc_dst->addr, FAIL);
@ -870,10 +874,6 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Reset metadat tag */
H5_END_TAG(FAIL);
/* Retag all copied metadata to apply the destination object's tag */
if(H5AC_retag_copied_metadata(oloc_dst->file, oloc_dst->addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries")
/* Set obj_type and udata, if requested */
if(obj_type) {
HDassert(udata);
@ -892,7 +892,7 @@ done:
/* Free destination object header on failure */
if(ret_value < 0 && oh_dst && !inserted) {
if(H5O_free(oh_dst) < 0)
if(H5O__free(oh_dst) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
if(H5O_loc_reset(oloc_dst) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")

View File

@ -535,7 +535,7 @@ H5_DLL const H5O_obj_class_t * H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id
H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted);
H5_DLL herr_t H5O_inc_rc(H5O_t *oh);
H5_DLL herr_t H5O_dec_rc(H5O_t *oh);
H5_DLL herr_t H5O_free(H5O_t *oh);
H5_DLL herr_t H5O__free(H5O_t *oh);
/* Object header message routines */
H5_DLL herr_t H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh,

View File

@ -148,7 +148,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d
HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value")
/* Initialize master table */
if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t)))
if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table")
table->num_indexes = H5F_SOHM_NINDEXES(f);
table->table_size = H5SM_TABLE_SIZE(f);
@ -657,7 +657,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
num_entries = header->list_max;
/* Allocate list in memory */
if(NULL == (list = H5FL_MALLOC(H5SM_list_t)))
if(NULL == (list = H5FL_CALLOC(H5SM_list_t)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")
if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries)))
HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list")

View File

@ -298,7 +298,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Check arguments */
if (cd_nelmts!=4)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level")
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid number of filter parameters")
/* Copy the filter parameters into the szip parameter block */
H5_CHECKED_ASSIGN(sz_param.options_mask, int, cd_values[H5Z_SZIP_PARM_MASK], unsigned);

View File

@ -1106,5 +1106,5 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5_combine_name() */
} /* end H5_combine_path() */

File diff suppressed because it is too large Load Diff

View File

@ -3076,57 +3076,46 @@ setup_cache(size_t max_cache_size,
haddr_t actual_base_addr;
hid_t fapl_id = H5P_DEFAULT;
if ( show_progress ) /* 1 */
if(show_progress) /* 1 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
saved_fid = -1;
/* setup the file name */
if ( pass ) {
if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
== NULL ) {
if(pass) {
if(NULL == h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))) {
pass = FALSE;
failure_mssg = "h5_fixname() failed.\n";
}
}
if ( show_progress ) /* 2 */
if(show_progress) /* 2 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( ( pass ) && ( try_core_file_driver ) ) {
if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL ) {
if(pass && try_core_file_driver) {
if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) {
pass = FALSE;
failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
}
else if ( H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0 ) {
else if(H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) {
H5Pclose(fapl_id);
fapl_id = H5P_DEFAULT;
pass = FALSE;
failure_mssg = "H5P_set_fapl_core() failed.\n";
}
else if ( (fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))
< 0 ) {
else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) {
core_file_driver_failed = TRUE;
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC);
}
} else {
saved_fapl_id = fapl_id;
}
}
if ( show_progress ) /* 3 */
if(show_progress) /* 3 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
@ -3134,63 +3123,49 @@ setup_cache(size_t max_cache_size,
* with the core file driver failed, try again with a regular file.
* If this fails, we are cooked.
*/
if ( ( pass ) && ( fid < 0 ) ) {
if(pass && fid < 0) {
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
saved_fid = fid;
if ( fid < 0 ) {
if(fid < 0) {
pass = FALSE;
failure_mssg = "H5Fcreate() failed.";
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC);
}
}
}
if ( show_progress ) /* 4 */
if(show_progress) /* 4 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
HDassert( fid >= 0 );
if(pass) {
HDassert(fid >= 0);
saved_fid = fid;
if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
pass = FALSE;
failure_mssg = "H5Fflush() failed.";
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
}
} else {
file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE);
if ( file_ptr == NULL ) {
if(file_ptr == NULL) {
pass = FALSE;
failure_mssg = "Can't get file_ptr.";
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
}
}
}
}
if ( show_progress ) /* 5 */
if(show_progress) /* 5 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
if(pass) {
/* A bit of fancy footwork here:
*
@ -3220,10 +3195,8 @@ setup_cache(size_t max_cache_size,
* instance, and then close the file normally.
*/
HDassert( saved_cache == NULL );
HDassert(saved_cache == NULL);
saved_cache = file_ptr->shared->cache;
file_ptr->shared->cache = NULL;
cache_ptr = H5C_create(max_cache_size,
@ -3238,52 +3211,41 @@ setup_cache(size_t max_cache_size,
file_ptr->shared->cache = cache_ptr;
}
if ( show_progress ) /* 6 */
if(show_progress) /* 6 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
if ( cache_ptr == NULL ) {
if(pass) {
if(cache_ptr == NULL) {
pass = FALSE;
failure_mssg = "H5C_create() failed.";
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC);
}
} else if ( cache_ptr->magic != H5C__H5C_T_MAGIC ) {
} else if(cache_ptr->magic != H5C__H5C_T_MAGIC) {
pass = FALSE;
failure_mssg = "Bad cache_ptr magic.";
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC);
}
}
}
if ( show_progress ) /* 7 */
if(show_progress) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) { /* allocate space for test entries */
if(pass) { /* allocate space for test entries */
actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5AC_ind_read_dxpl_id,
(hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
if ( actual_base_addr == HADDR_UNDEF ) {
if(actual_base_addr == HADDR_UNDEF) {
pass = FALSE;
failure_mssg = "H5MF_alloc() failed.";
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC);
}
} else if ( actual_base_addr > BASE_ADDR ) {
} else if(actual_base_addr > BASE_ADDR) {
/* If this happens, must increase BASE_ADDR so that the
* actual_base_addr is <= BASE_ADDR. This should only happen
* if the size of the superblock is increase.
@ -3291,21 +3253,18 @@ setup_cache(size_t max_cache_size,
pass = FALSE;
failure_mssg = "actual_base_addr > BASE_ADDR";
if ( verbose ) {
HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n",
FUNC);
}
if(verbose)
HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", FUNC);
}
saved_actual_base_addr = actual_base_addr;
}
if ( show_progress ) /* 8 */
if(show_progress) /* 8 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
if ( pass ) {
if(pass) {
/* Need to set this else all cache tests will fail */
cache_ptr->ignore_tags = TRUE;
@ -3313,7 +3272,7 @@ setup_cache(size_t max_cache_size,
ret_val = file_ptr;
}
if ( show_progress ) /* 9 */
if(show_progress) /* 9 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
FUNC, mile_stone++, (int)pass);
@ -3568,14 +3527,15 @@ flush_cache(H5F_t * file_ptr,
*
* Return: void
*
* Programmer: Vailin Choi; Jan 2014
* Programmer: Vailin Choi
* Jan 2014
*
*-------------------------------------------------------------------------
*/
void
cork_entry_type(H5F_t * file_ptr, int32_t type)
cork_entry_type(H5F_t *file_ptr, int32_t type)
{
H5C_t * cache_ptr;
H5C_t *cache_ptr;
haddr_t baddrs;
herr_t result;
@ -3592,9 +3552,9 @@ cork_entry_type(H5F_t * file_ptr, int32_t type)
pass = FALSE;
failure_mssg = "error in H5C_cork().";
}
}
return;
} /* end if */
} /* end if */
} /* cork_entry_type() */
@ -3607,14 +3567,15 @@ cork_entry_type(H5F_t * file_ptr, int32_t type)
*
* Return: void
*
* Programmer: Vailin Choi; Jan 2014
* Programmer: Vailin Choi
* Jan 2014
*
*-------------------------------------------------------------------------
*/
void
uncork_entry_type(H5F_t * file_ptr, int32_t type)
uncork_entry_type(H5F_t *file_ptr, int32_t type)
{
H5C_t * cache_ptr;
H5C_t *cache_ptr;
haddr_t baddrs;
herr_t result;
@ -3631,9 +3592,9 @@ uncork_entry_type(H5F_t * file_ptr, int32_t type)
pass = FALSE;
failure_mssg = "error in H5C_cork().";
}
}
return;
} /* end if */
} /* end if */
} /* uncork_entry_type() */
@ -3934,11 +3895,8 @@ move_entry(H5C_t * cache_ptr,
*
*-------------------------------------------------------------------------
*/
void
protect_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx)
protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx)
{
H5C_t * cache_ptr;
test_entry_t * base_addr;
@ -3947,29 +3905,28 @@ protect_entry(H5F_t * file_ptr,
hid_t xfer = H5AC_ind_read_dxpl_id;
H5C_cache_entry_t * cache_entry_ptr;
if ( pass ) {
if(pass) {
cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
HDassert(cache_ptr);
HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
HDassert((0 <= idx) && (idx <= max_indices[type]));
base_addr = entries[type];
entry_ptr = &(base_addr[idx]);
baddrs = base_addrs[type];
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
HDassert( !(entry_ptr->is_protected) );
HDassert(entry_ptr->index == idx);
HDassert(entry_ptr->type == type);
HDassert(entry_ptr == entry_ptr->self);
HDassert(!(entry_ptr->is_protected));
/* Set the base address of the entry type into the property list as tag */
/* Use to cork entries for the object */
if(H5AC_tag(xfer, baddrs, NULL) < 0) {
pass = FALSE;
failure_mssg = "error in H5P_set().";
}
} /* end if */
cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, xfer,
&(types[type]), entry_ptr->addr, &entry_ptr->addr,
@ -4006,7 +3963,8 @@ protect_entry(H5F_t * file_ptr,
pass = FALSE;
failure_mssg = "error in H5C_protect().";
} else {
} /* end if */
else {
HDassert( ( entry_ptr->cache_ptr == NULL ) ||
( entry_ptr->cache_ptr == cache_ptr ) );
@ -4015,15 +3973,13 @@ protect_entry(H5F_t * file_ptr,
entry_ptr->file_ptr = file_ptr;
entry_ptr->is_protected = TRUE;
}
} /* end else */
if(entry_ptr->header.is_corked)
entry_ptr->is_corked = TRUE;
HDassert( ((entry_ptr->header).type)->id == type );
}
return;
HDassert(((entry_ptr->header).type)->id == type);
} /* end if */
} /* protect_entry() */
@ -4369,7 +4325,6 @@ unprotect_entry(H5F_t * file_ptr,
*
*-------------------------------------------------------------------------
*/
void
row_major_scan_forward(H5F_t * file_ptr,
int32_t max_index,
@ -4391,343 +4346,274 @@ row_major_scan_forward(H5F_t * file_ptr,
int32_t idx;
int32_t local_max_index;
if ( verbose )
if(verbose)
HDfprintf(stdout, "%s(): entering.\n", FUNC);
if ( pass ) {
if(pass) {
cache_ptr = file_ptr->shared->cache;
HDassert(cache_ptr != NULL);
HDassert(lag >= 10);
HDassert( cache_ptr != NULL );
HDassert( lag >= 10 );
if ( reset_stats ) {
if(reset_stats)
H5C_stats__reset(cache_ptr);
}
}
} /* end if */
while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
{
while(pass && type < NUMBER_OF_ENTRY_TYPES) {
idx = -lag;
local_max_index = MIN(max_index, max_indices[type]);
while ( ( pass ) && ( idx <= (local_max_index + lag) ) )
{
while(pass && idx <= (local_max_index + lag)) {
int32_t tmp_idx;
if ( verbose ) {
if(verbose)
HDfprintf(stdout, "%d:%d: ", type, idx);
}
tmp_idx = idx + lag;
if ( ( pass ) && ( do_inserts ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( (tmp_idx % 2) == 0 ) &&
( ! entry_in_cache(cache_ptr, type, tmp_idx) ) ) {
if(pass && do_inserts && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
((tmp_idx % 2) == 0 ) && !entry_in_cache(cache_ptr, type, tmp_idx)) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx);
insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 3 ) == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 3) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 3 ) == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 3) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
/* (don't decrement tmp_idx) */
if ( ( pass ) && ( do_moves ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 3 ) == 0 ) ) {
if(pass && do_moves && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 3) == 0) {
if ( verbose )
HDfprintf(stdout, "4(r, %d, %d, %d) ",
type, tmp_idx, (int)move_to_main_addr);
if(verbose)
HDfprintf(stdout, "4(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr);
move_entry(cache_ptr, type, tmp_idx, move_to_main_addr);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 5 ) == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 5) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx -= 2;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 5 ) == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 5) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
if ( do_mult_ro_protects )
{
if(do_mult_ro_protects) {
/* (don't decrement tmp_idx) */
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx < local_max_index ) &&
( tmp_idx % 9 == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
(tmp_idx % 9) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx);
protect_entry_ro(file_ptr, type, tmp_idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx < local_max_index ) &&
( tmp_idx % 11 == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
(tmp_idx % 11) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx);
protect_entry_ro(file_ptr, type, tmp_idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx < local_max_index ) &&
( tmp_idx % 13 == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
(tmp_idx % 13) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx);
protect_entry_ro(file_ptr, type, tmp_idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
/* (don't decrement tmp_idx) */
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx < local_max_index ) &&
( tmp_idx % 9 == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
(tmp_idx % 9) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx < local_max_index ) &&
( tmp_idx % 11 == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
(tmp_idx % 11) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx < local_max_index ) &&
( tmp_idx % 13 == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) &&
(tmp_idx % 13) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
} /* if ( do_mult_ro_protects ) */
if ( ( pass ) && ( idx >= 0 ) && ( idx <= local_max_index ) ) {
if ( verbose )
if(pass && (idx >= 0) && (idx <= local_max_index)) {
if(verbose)
HDfprintf(stdout, "13(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx = idx - lag + 2;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 7 ) == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 7) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end if */
tmp_idx--;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) &&
( ( tmp_idx % 7 ) == 0 ) ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index) &&
(tmp_idx % 7) == 0) {
if ( verbose )
if(verbose)
HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
if ( do_destroys ) {
} /* end if */
if(do_destroys) {
tmp_idx = idx - lag;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) ) {
switch ( tmp_idx %4 ) {
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index)) {
switch(tmp_idx % 4) {
case 0: /* we just did an insert */
if ( verbose )
if(verbose)
HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
break;
case 1:
if ( (entries[type])[tmp_idx].is_dirty ) {
if ( verbose )
if((entries[type])[tmp_idx].is_dirty) {
if(verbose)
HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
} else {
if ( verbose )
} /* end if */
else {
if(verbose)
HDfprintf(stdout, "18(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx,
(dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end else */
break;
case 2: /* we just did an insert */
if ( verbose )
if(verbose)
HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
break;
case 3:
if ( (entries[type])[tmp_idx].is_dirty ) {
if ( verbose )
if((entries[type])[tmp_idx].is_dirty) {
if(verbose)
HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
} else {
if ( verbose )
} /* end if */
else {
if(verbose)
HDfprintf(stdout, "21(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx,
(dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)
| H5C__DELETED_FLAG);
unprotect_entry(file_ptr, type, tmp_idx, (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | H5C__DELETED_FLAG);
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* end else */
break;
default:
HDassert(0); /* this can't happen... */
break;
}
}
} else {
} /* end switch */
} /* end if */
} /* end if */
else {
tmp_idx = idx - lag;
if ( ( pass ) && ( tmp_idx >= 0 ) &&
( tmp_idx <= local_max_index ) ) {
if ( verbose )
if(pass && (tmp_idx >= 0) && (tmp_idx <= local_max_index)) {
if(verbose)
HDfprintf(stdout, "22(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx,
(dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
}
} /* end if */
} /* end elsef */
if ( verbose )
if(verbose)
HDfprintf(stdout, "\n");
idx++;
}
} /* end while */
type++;
}
if ( ( pass ) && ( display_stats ) ) {
} /* end while */
if(pass && display_stats)
H5C_stats(cache_ptr, "test cache", display_detailed_stats);
}
return;
} /* row_major_scan_forward() */

View File

@ -115,7 +115,6 @@ print_entry_type_to_screen(int id)
HDfprintf(stdout, "Type = ");
switch (id) {
case H5AC_BT_ID:
HDfprintf(stdout, "v1 B-tree Node");
break;
@ -206,11 +205,9 @@ print_entry_type_to_screen(int id)
default:
HDfprintf(stdout, "BADNESS: *Unknown*");
break;
} /* end switch */
HDfprintf(stdout, " (%d)", id);
} /* print_entry_type_to_screen */
@ -229,20 +226,21 @@ print_entry_type_to_screen(int id)
*
*-------------------------------------------------------------------------
*/
static int print_index(hid_t fid) {
H5F_t * f = NULL; /* File Pointer */
H5C_t * cache_ptr = NULL; /* Cache Pointer */
int i = 0; /* Iterator */
static int print_index(hid_t fid)
{
H5F_t *f; /* File Pointer */
H5C_t *cache_ptr; /* Cache Pointer */
int i; /* Iterator */
H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */
/* Get Internal File / Cache Pointers */
if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR;
if(NULL == (f = (H5F_t *)H5I_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
/* Initial (debugging) loop */
printf("CACHE SNAPSHOT:\n");
for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
next_entry_ptr = cache_ptr->index[i];
while (next_entry_ptr != NULL) {
@ -252,18 +250,16 @@ static int print_index(hid_t fid) {
printf("Protected = %d, ", (int)next_entry_ptr->is_protected);
print_entry_type_to_screen(next_entry_ptr->type->id);
printf("\n");
next_entry_ptr = next_entry_ptr->ht_next;
} /* end if */
next_entry_ptr = next_entry_ptr->ht_next;
} /* end while */
} /* end for */
printf("\n");
return 0;
error:
return -1;
} /* print_index */
@ -281,23 +277,23 @@ error:
* Programmer: Mike McGreevy
* January 25, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int verify_no_unknown_tags(hid_t fid)
static int
verify_no_unknown_tags(hid_t fid)
{
H5F_t * f = NULL; /* File Pointer */
H5C_t * cache_ptr = NULL; /* Cache Pointer */
int i = 0; /* Iterator */
H5F_t *f; /* File Pointer */
H5C_t *cache_ptr; /* Cache Pointer */
int i; /* Iterator */
H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */
/* Get Internal File / Cache Pointers */
if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR;
if(NULL == (f = (H5F_t *)H5I_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
next_entry_ptr = cache_ptr->index[i];
@ -306,10 +302,8 @@ static int verify_no_unknown_tags(hid_t fid)
if ( next_entry_ptr->tag != H5AC__IGNORE_TAG ) TEST_ERROR;
next_entry_ptr = next_entry_ptr->ht_next;
} /* end if */
} /* for */
} /* end while */
} /* end for */
return 0;
@ -333,23 +327,22 @@ error:
* Programmer: Mike McGreevy
* February 3, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int mark_all_entries_investigated(hid_t fid)
static int
mark_all_entries_investigated(hid_t fid)
{
H5F_t * f = NULL; /* File Pointer */
H5C_t * cache_ptr = NULL; /* Cache Pointer */
int i = 0; /* Iterator */
H5F_t *f; /* File Pointer */
H5C_t *cache_ptr; /* Cache Pointer */
int i; /* Iterator */
H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */
/* Get Internal File / Cache Pointers */
if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR;
if(NULL == (f = (H5F_t *)H5I_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
next_entry_ptr = cache_ptr->index[i];
@ -362,9 +355,7 @@ static int mark_all_entries_investigated(hid_t fid)
} /* end if */
next_entry_ptr = next_entry_ptr->ht_next;
} /* end if */
} /* end while */
} /* for */
return 0;
@ -390,23 +381,23 @@ error:
* Programmer: Mike McGreevy
* January 25, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int verify_tag(hid_t fid, int id, haddr_t tag)
static int
verify_tag(hid_t fid, int id, haddr_t tag)
{
int i = 0; /* Iterator */
int found = FALSE; /* If Entry Found */
H5F_t * f = NULL; /* File Pointer */
H5C_t * cache_ptr = NULL; /* Cache Pointer */
H5F_t *f; /* File Pointer */
H5C_t *cache_ptr; /* Cache Pointer */
int i; /* Iterator */
H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */
/* Get Internal File / Cache Pointers */
if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR;
if(NULL == (f = (H5F_t *)H5I_object(fid)))
TEST_ERROR;
cache_ptr = f->shared->cache;
for (i = 0; i < H5C__HASH_TABLE_LEN; i++) {
for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
next_entry_ptr = cache_ptr->index[i];
@ -443,13 +434,14 @@ error:
return -1;
} /* verify_tag */
static int evict_entries(hid_t fid)
static int
evict_entries(hid_t fid)
{
H5F_t * f = NULL; /* File Pointer */
H5F_t *f; /* File Pointer */
/* Get Internal File / Cache Pointers */
if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR;
if(NULL == (f = (H5F_t *)H5I_object(fid)))
TEST_ERROR;
/* Mark all entries investigated */
mark_all_entries_investigated(fid);
@ -462,9 +454,7 @@ static int evict_entries(hid_t fid)
return 0;
error:
return -1;
} /* evict entries */
@ -481,8 +471,6 @@ error:
* Programmer: Mike McGreevy
* January 25, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int get_new_object_header_tag(hid_t fid, haddr_t *tag)
@ -544,8 +532,6 @@ error:
* Programmer: Mike McGreevy
* January 25, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -607,7 +593,6 @@ check_file_creation_tags(hid_t fcpl_id, int type)
error:
return 1;
} /* check_file_creation_tags */
@ -622,8 +607,6 @@ error:
* Programmer: Mike McGreevy
* January 25, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -730,8 +713,6 @@ error:
* Programmer: Mike McGreevy
* January 27, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -835,8 +816,6 @@ error:
* Programmer: Mike McGreevy
* March 2, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -849,8 +828,8 @@ check_multi_group_creation_tags(hid_t fcpl, int type)
char gname[10]; /* group name buffer */
int i = 0; /* iterator */
hid_t fapl = -1; /* File access prop list */
haddr_t g_tag = 0; /* Group tag value */
haddr_t root_tag = 0; /* Root group tag value */
haddr_t g_tag = 0; /* Group tag value */
haddr_t root_tag = 0; /* Root group tag value */
haddr_t sbe_tag = 0; /* Root group tag value */
/* Testing Macro */
@ -887,9 +866,9 @@ check_multi_group_creation_tags(hid_t fcpl, int type)
/* Clear Metadata Tags (don't care about them for this test */
mark_all_entries_investigated(fid);
/* ============ */
/* Create Group */
/* ============ */
/* ============= */
/* Create Groups */
/* ============= */
for (i = 0; i < MULTIGROUPS; i++) {
@ -959,8 +938,6 @@ error:
* Programmer: Mike McGreevy
* March 2, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1027,14 +1004,12 @@ check_link_iteration_tags(void)
if ( verbose ) print_index(fid);
/* Verify 112 symbol table nodes belonging to the root group */
for (i = 0; i < 112; i++) {
for (i = 0; i < 112; i++)
if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR;
}
/* Verify 9 b-tree nodes belonging to the root group */
for (i = 0; i < 9; i++) {
for (i = 0; i < 9; i++)
if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
}
/* verify no other entries present */
if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
@ -1070,8 +1045,6 @@ error:
* Programmer: Mike McGreevy
* March 2, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1240,8 +1213,6 @@ error:
* Programmer: Mike McGreevy
* January 27, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1352,8 +1323,6 @@ error:
* Programmer: Mike McGreevy
* February 24, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1492,8 +1461,6 @@ error:
* Programmer: Mike McGreevy
* February 24, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1634,10 +1601,6 @@ error:
* Programmer: Mike McGreevy
* March 3, 2010
*
* Modifications:
* Vailin Choi; July 2012
* Add verify_tag() calls because H5FD_FLMAP_DICHOTOMY is now the default free-list mapping.
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1699,12 +1662,9 @@ check_attribute_rename_tags(hid_t fcpl, int type)
if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0; j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to attribute */
if ( H5Awrite(aid, H5T_NATIVE_INT, data) < 0 ) TEST_ERROR;
@ -1814,10 +1774,6 @@ error:
* Programmer: Mike McGreevy
* March 3, 2010
*
* Modifications:
* Vailin Choi; July 2012
* Add verify_tag() call because H5FD_FLMAP_DICHOTOMY is now the default free-list mapping.
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -1879,12 +1835,9 @@ check_attribute_delete_tags(hid_t fcpl, int type)
if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0;i < DIMS; i++) {
for(j = 0;j < DIMS; j++) {
for(i = 0;i < DIMS; i++)
for(j = 0;j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to attribute */
if ( (H5Awrite(aid, H5T_NATIVE_INT, data)) < 0 ) TEST_ERROR;
@ -1969,8 +1922,6 @@ error:
* Programmer: Mike McGreevy
* February 10, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2104,8 +2055,6 @@ error:
* Programmer: Mike McGreevy
* March 1, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2243,8 +2192,6 @@ error:
* Programmer: Mike McGreevy
* February 10, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2374,8 +2321,6 @@ error:
* Programmer: Mike McGreevy
* February 10, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2520,8 +2465,6 @@ error:
* Programmer: Mike McGreevy
* March 3, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2598,12 +2541,9 @@ check_attribute_write_tags(hid_t fcpl, int type)
/* =========================== */
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0;j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0;j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write attribute */
if ( (H5Awrite(aid, H5T_NATIVE_INT, data)) < 0 ) TEST_ERROR;
@ -2682,8 +2622,6 @@ error:
* Programmer: Mike McGreevy
* February 10, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2754,12 +2692,9 @@ check_dataset_read_tags(hid_t fcpl, int type)
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0; j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to dataset */
if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
@ -2827,8 +2762,6 @@ error:
* Programmer: Mike McGreevy
* February 24, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -2900,12 +2833,9 @@ check_dataset_size_retrieval(hid_t fcpl, int type)
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0; j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to dataset */
if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
@ -2973,8 +2903,6 @@ error:
* Programmer: Mike McGreevy
* February 24, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3047,12 +2975,9 @@ check_dataset_extend_tags(hid_t fcpl, int type)
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0; j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to dataset */
if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
@ -3120,8 +3045,6 @@ error:
* Programmer: Mike McGreevy
* March 1, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3234,8 +3157,6 @@ error:
* Programmer: Mike McGreevy
* March 3, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3311,12 +3232,12 @@ check_object_copy_tags(hid_t fcpl, int type)
if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR;
/* Verify dataset's tagged metadata */
/* Verify group's tagged metadata */
if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR;
/* Verify copied dataset's tagged metadata */
/* Verify copied group's tagged metadata */
if ( get_new_object_header_tag(fid, &copy_tag) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_BT_ID, copy_tag) < 0 ) TEST_ERROR;
if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, copy_tag) < 0 ) TEST_ERROR;
@ -3353,8 +3274,6 @@ error:
* Programmer: Mike McGreevy
* March 1, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3436,12 +3355,9 @@ check_link_removal_tags(hid_t fcpl, int type)
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0; j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to dataset */
if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
@ -3519,8 +3435,6 @@ error:
* Programmer: Mike McGreevy
* March 2, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3603,12 +3517,9 @@ check_link_getname_tags(hid_t fcpl, int type)
if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR;
/* fill out data buffer */
for(i = 0; i < DIMS; i++) {
for(j = 0; j < DIMS; j++) {
for(i = 0; i < DIMS; i++)
for(j = 0; j < DIMS; j++)
data[(DIMS * i) + j] = k++;
} /* end for */
} /* end for */
/* Write to dataset */
if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR;
@ -3678,8 +3589,6 @@ error:
* Programmer: Mike McGreevy
* February 24, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3787,8 +3696,6 @@ error:
* Programmer: Mike McGreevy
* February 24, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3901,8 +3808,6 @@ error:
* Programmer: Mike McGreevy
* May 27, 2010
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static unsigned
@ -3917,7 +3822,7 @@ check_invalid_tag_application(void)
/* Testing Macro */
TESTING("failure on invalid tag application");
#if H5C_DO_TAGGING_SANITY_CHECKS
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
@ -3958,10 +3863,10 @@ check_invalid_tag_application(void)
/* Finished Test. Print status and return. */
PASSED();
#else
#else
SKIPPED();
printf(" test skipped because sanity checking on tag value is disabled.\n");
#endif
#endif
return 0;
@ -3982,11 +3887,8 @@ error:
* Programmer: Mike McGreevy
* January 15, 2009
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main(void)
{

View File

@ -91,26 +91,23 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag)
{
H5C_t *cache_ptr = NULL; /* cache pointer */
int i = 0; /* iterator */
H5C_cache_entry_t *entry_ptr = NULL; /* entry pointer */
/* Get Internal Cache Pointers */
cache_ptr = f->shared->cache;
for(i = 0; i < H5C__HASH_TABLE_LEN; i++) {
H5C_cache_entry_t *entry_ptr; /* entry pointer */
entry_ptr = cache_ptr->index[i];
while(entry_ptr != NULL) {
if(tag == entry_ptr->tag)
return TRUE;
else
entry_ptr = entry_ptr->ht_next;
} /* end while */
} /* end for */
return FALSE;
} /* end verify_tag_not_in_cache() */

View File

@ -466,7 +466,7 @@ static void test_misc2_write_attribute(void)
CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Aclose(att1);
CHECK(ret, FAIL, "HAclose");
CHECK(ret, FAIL, "H5Aclose");
ret = H5Gclose(root1);
CHECK(ret, FAIL, "H5Gclose");
@ -492,7 +492,7 @@ static void test_misc2_write_attribute(void)
CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Aclose(att2);
CHECK(ret, FAIL, "HAclose");
CHECK(ret, FAIL, "H5Aclose");
ret = H5Gclose(root2);
CHECK(ret, FAIL, "H5Gclose");
@ -2928,18 +2928,18 @@ test_misc18(void)
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "HAclose");
CHECK(ret, FAIL, "H5Aclose");
/* Create & close attribute on second dataset */
aid = H5Acreate2(did2, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "HAclose");
CHECK(ret, FAIL, "H5Aclose");
/* Flush file, to 'fix' size of dataset object headers */
ret = H5Fflush(fid,H5F_SCOPE_GLOBAL);
CHECK(ret, FAIL, "HAclose");
CHECK(ret, FAIL, "H5Fflush");
} /* end for */
/* Get object information for dataset #1 now */

View File

@ -106,11 +106,9 @@ static void table_attrs_free( table_attrs_t *table )
*------------------------------------------------------------------------*/
static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *table)
{
size_t curr_val;
match_attr_t *new_attrs;
if(table->nattrs == table->size) {
match_attr_t *new_attrs;
table->size = MAX(1, table->size * 2);
new_attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t));
if(new_attrs)
@ -118,6 +116,8 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
} /* end if */
if(table->nattrs < table->size) {
size_t curr_val;
curr_val = table->nattrs;
table->attrs[curr_val].exist[0] = exist[0];
table->attrs[curr_val].exist[1] = exist[1];
@ -168,36 +168,34 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/*--------------------------------------------------
* build the list
*/
while (curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
/*------------------
* open attribute1 */
if ((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC,
(hsize_t) curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* get name */
if (H5Aget_name(attr1_id, (size_t) ATTR_NAME_MAX, name1) < 0)
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
goto error;
/*------------------
* open attribute2 */
if ((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC,
(hsize_t) curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* get name */
if (H5Aget_name(attr2_id, (size_t) ATTR_NAME_MAX, name2) < 0)
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
goto error;
/* criteria is string compare */
cmp = HDstrcmp(name1, name2);
if (cmp == 0) {
if(cmp == 0) {
infile[0] = 1;
infile[1] = 1;
table_attr_mark_exist(infile, name1, table_lp);
curr1++;
curr2++;
}
else if (cmp < 0) {
else if(cmp < 0) {
infile[0] = 1;
infile[1] = 0;
table_attr_mark_exist(infile, name1, table_lp);
@ -222,14 +220,13 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* list1 did not end */
infile[0] = 1;
infile[1] = 0;
while (curr1 < oinfo1.num_attrs) {
while(curr1 < oinfo1.num_attrs) {
/*------------------
* open attribute1 */
if ((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC,
(hsize_t) curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* get name */
if (H5Aget_name(attr1_id, (size_t) ATTR_NAME_MAX, name1) < 0)
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
goto error;
table_attr_mark_exist(infile, name1, table_lp);
@ -244,14 +241,13 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* list2 did not end */
infile[0] = 0;
infile[1] = 1;
while (curr2 < oinfo2.num_attrs) {
while(curr2 < oinfo2.num_attrs) {
/*------------------
* open attribute2 */
if ((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC,
(hsize_t) curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* get name */
if (H5Aget_name(attr2_id, (size_t) ATTR_NAME_MAX, name2) < 0)
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
goto error;
table_attr_mark_exist(infile, name2, table_lp);
@ -265,25 +261,22 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/*------------------------------------------------------
* print the list
*/
if (options->m_verbose_level == 2) {
if(options->m_verbose_level == 2) {
/* if '-v2' is detected */
parallel_print(" obj1 obj2\n");
parallel_print(" --------------------------------------\n");
for (i = 0; i < (unsigned int) table_lp->nattrs; i++) {
for(i = 0; i < (unsigned int) table_lp->nattrs; i++) {
char c1, c2;
c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' ';
c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' ';
parallel_print("%5c %6c %-15s\n", c1, c2,
table_lp->attrs[i].name);
parallel_print("%5c %6c %-15s\n", c1, c2, table_lp->attrs[i].name);
} /* end for */
}
if (options->m_verbose_level >= 1) {
parallel_print(
"Attributes status: %d common, %d only in obj1, %d only in obj2\n",
if(options->m_verbose_level >= 1)
parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n",
table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2,
table_lp->nattrs_only1, table_lp->nattrs_only2);
}
*table_out = table_lp;
@ -331,8 +324,8 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t space2_id=-1; /* space ID */
hid_t ftype1_id=-1; /* file data type ID */
hid_t ftype2_id=-1; /* file data type ID */
int vstrtype1=0; /* ftype1 is a variable string */
int vstrtype2=0; /* ftype2 is a variable string */
int vstrtype1=0; /* ftype1 is a variable string */
int vstrtype2=0; /* ftype2 is a variable string */
hid_t mtype1_id=-1; /* memory data type ID */
hid_t mtype2_id=-1; /* memory data type ID */
size_t msize1; /* memory size of memory type */
@ -356,39 +349,39 @@ hsize_t diff_attr(hid_t loc1_id,
int j;
table_attrs_t * match_list_attrs = NULL;
if (build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, options) < 0)
if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, options) < 0)
goto error;
/* if detect any unique extra attr */
if (match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
/* exit will be 1 */
options->contents = 0;
}
for (u = 0; u < (unsigned) match_list_attrs->nattrs; u++) {
if ((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
name1 = name2 = match_list_attrs->attrs[u].name;
/*--------------
* attribute 1 */
if ((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0)
if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0)
goto error;
/*--------------
* attribute 2 */
if ((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
goto error;
/* get the datatypes */
if ((ftype1_id = H5Aget_type(attr1_id)) < 0)
if((ftype1_id = H5Aget_type(attr1_id)) < 0)
goto error;
vstrtype1 = H5Tis_variable_str(ftype1_id);
if ((ftype2_id = H5Aget_type(attr2_id)) < 0)
if((ftype2_id = H5Aget_type(attr2_id)) < 0)
goto error;
vstrtype2 = H5Tis_variable_str(ftype2_id);
/* no compare if either one but not both are variable string type */
if (vstrtype1 != vstrtype2) {
if ((options->m_verbose || options->m_list_not_cmp))
if((options->m_verbose || options->m_list_not_cmp))
parallel_print("Not comparable: one of attribute <%s/%s> or <%s/%s> is of variable length type\n",
path1, name1, path2, name2);
options->not_cmp = 1;
@ -404,25 +397,25 @@ hsize_t diff_attr(hid_t loc1_id,
continue;
}
if ((mtype1_id = h5tools_get_native_type(ftype1_id)) < 0)
if((mtype1_id = h5tools_get_native_type(ftype1_id)) < 0)
goto error;
if ((mtype2_id = h5tools_get_native_type(ftype2_id)) < 0)
if((mtype2_id = h5tools_get_native_type(ftype2_id)) < 0)
goto error;
if ((msize1 = H5Tget_size(mtype1_id)) == 0)
if((msize1 = H5Tget_size(mtype1_id)) == 0)
goto error;
if ((msize2 = H5Tget_size(mtype2_id)) == 0)
if((msize2 = H5Tget_size(mtype2_id)) == 0)
goto error;
/* get the dataspace */
if ((space1_id = H5Aget_space(attr1_id)) < 0)
if((space1_id = H5Aget_space(attr1_id)) < 0)
goto error;
if ((space2_id = H5Aget_space(attr2_id)) < 0)
if((space2_id = H5Aget_space(attr2_id)) < 0)
goto error;
/* get dimensions */
if ((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
goto error;
if ((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
goto error;
/*----------------------------------------------------------------------
@ -432,23 +425,23 @@ hsize_t diff_attr(hid_t loc1_id,
/* pass dims1 and dims2 for maxdims as well since attribute's maxdims
* are always same */
if (diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2,
if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2,
dims1, dims2, name1, name2, options, 0) != 1) {
if (H5Tclose(ftype1_id) < 0)
if(H5Tclose(ftype1_id) < 0)
goto error;
if (H5Tclose(ftype2_id) < 0)
if(H5Tclose(ftype2_id) < 0)
goto error;
if (H5Sclose(space1_id) < 0)
if(H5Sclose(space1_id) < 0)
goto error;
if (H5Sclose(space2_id) < 0)
if(H5Sclose(space2_id) < 0)
goto error;
if (H5Aclose(attr1_id) < 0)
if(H5Aclose(attr1_id) < 0)
goto error;
if (H5Aclose(attr2_id) < 0)
if(H5Aclose(attr2_id) < 0)
goto error;
if (H5Tclose(mtype1_id) < 0)
if(H5Tclose(mtype1_id) < 0)
goto error;
if (H5Tclose(mtype2_id) < 0)
if(H5Tclose(mtype2_id) < 0)
goto error;
continue;
@ -458,7 +451,7 @@ hsize_t diff_attr(hid_t loc1_id,
* "upgrade" the smaller memory size
*------------------------------------------------------------------
*/
if (FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id,
if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id,
&mtype2_id, &msize1, &msize2))
goto error;
@ -467,26 +460,24 @@ hsize_t diff_attr(hid_t loc1_id,
*----------------------------------------------------------------------
*/
nelmts1 = 1;
for (j = 0; j < rank1; j++)
for(j = 0; j < rank1; j++)
nelmts1 *= dims1[j];
buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1));
buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2));
if (buf1 == NULL || buf2 == NULL) {
if(buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
goto error;
}
if (H5Aread(attr1_id, mtype1_id, buf1) < 0) {
parallel_print("Failed reading attribute1 %s/%s\n", path1,
name1);
if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
parallel_print("Failed reading attribute1 %s/%s\n", path1, name1);
goto error;
}
else
buf1hasdata = TRUE;
if (H5Aread(attr2_id, mtype2_id, buf2) < 0) {
parallel_print("Failed reading attribute2 %s/%s\n", path2,
name2);
if(H5Aread(attr2_id, mtype2_id, buf2) < 0) {
parallel_print("Failed reading attribute2 %s/%s\n", path2, name2);
goto error;
}
else
@ -503,7 +494,7 @@ hsize_t diff_attr(hid_t loc1_id,
/* always print name */
/* verbose (-v) and report (-r) mode */
if (options->m_verbose || options->m_report) {
if(options->m_verbose || options->m_report) {
do_print_attrname("attribute", np1, np2);
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
@ -511,7 +502,7 @@ hsize_t diff_attr(hid_t loc1_id,
print_found(nfound);
}
/* quiet mode (-q), just count differences */
else if (options->m_quiet) {
else if(options->m_quiet) {
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
}
@ -534,31 +525,31 @@ hsize_t diff_attr(hid_t loc1_id,
/* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
* VLEN memory first */
if (TRUE == h5tools_detect_vlen(mtype1_id))
if(TRUE == h5tools_detect_vlen(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
buf1 = NULL;
if (TRUE == h5tools_detect_vlen(mtype2_id))
if(TRUE == h5tools_detect_vlen(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
buf2 = NULL;
if (H5Tclose(ftype1_id) < 0)
if(H5Tclose(ftype1_id) < 0)
goto error;
if (H5Tclose(ftype2_id) < 0)
if(H5Tclose(ftype2_id) < 0)
goto error;
if (H5Sclose(space1_id) < 0)
if(H5Sclose(space1_id) < 0)
goto error;
if (H5Sclose(space2_id) < 0)
if(H5Sclose(space2_id) < 0)
goto error;
if (H5Aclose(attr1_id) < 0)
if(H5Aclose(attr1_id) < 0)
goto error;
if (H5Aclose(attr2_id) < 0)
if(H5Aclose(attr2_id) < 0)
goto error;
if (H5Tclose(mtype1_id) < 0)
if(H5Tclose(mtype1_id) < 0)
goto error;
if (H5Tclose(mtype2_id) < 0)
if(H5Tclose(mtype2_id) < 0)
goto error;
nfound_total += nfound;

View File

@ -737,6 +737,7 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
* 32-bit or more. For every kind of native integers, I changed the code
* to make it zero if PACKED_DATA_OFFSET is greater than or equal to the
* size of integer.
*
*-------------------------------------------------------------------------
*/
char *