summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c833
1 files changed, 599 insertions, 234 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index c4e4fe9..335704d 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -19,18 +19,49 @@
* This file contains common code for tests of the cache
* implemented in H5C.c
*/
+#include "H5private.h" /* Put this first, so H5open() isn't invoked in public macros */
#include "h5test.h"
+#include "H5Cprivate.h"
#include "H5Iprivate.h"
-#include "H5ACprivate.h"
+#include "H5MFprivate.h"
#include "cache_common.h"
/* global variable declarations: */
+const char *FILENAME[] = {
+ "cache_test",
+ "cache_api_test",
+ NULL
+};
+
+hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
+ * cache setup and takedown. Note
+ * that if saved_fapl_id == H5P_DEFAULT,
+ * we assume that there is no fapl to
+ * close.
+ */
+
+hid_t saved_fid = -1; /* store the file id here between cache setup
+ * and takedown.
+ */
+
+H5C_t * saved_cache = NULL; /* store the pointer to the instance of
+ * of H5C_t created by H5Fcreate()
+ * here between test cache setup and
+ * shutdown.
+ */
+
+haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the
+ space allocated for cache items in the file between
+ cache setup & takedown */
+
hbool_t write_permitted = TRUE;
hbool_t pass = TRUE; /* set to false on error */
hbool_t skip_long_tests = TRUE;
hbool_t run_full_test = TRUE;
+hbool_t try_core_file_driver = FALSE;
+hbool_t core_file_driver_failed = FALSE;
const char *failure_mssg = NULL;
test_entry_t pico_entries[NUM_PICO_ENTRIES], orig_pico_entries[NUM_PICO_ENTRIES];
@@ -266,6 +297,9 @@ static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
const void *udata1, void *udata2);
static herr_t size(H5F_t * f, void * thing, size_t * size_ptr);
static herr_t notify(H5C_notify_action_t action, void *thing);
+static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
+ struct flush_op *op_ptr, unsigned *flags_ptr);
+
@@ -647,8 +681,7 @@ destroy(H5F_t UNUSED * f,
if ( pinned_entry_ptr->pinning_ref_count <= 0 ) {
- unpin_entry(pinned_entry_ptr->cache_ptr,
- pinned_entry_ptr->type,
+ unpin_entry(pinned_entry_ptr->type,
pinned_entry_ptr->index);
}
@@ -806,7 +839,7 @@ flush(H5F_t *f,
for ( i = 0; i < entry_ptr->num_flush_ops; i++ )
{
- execute_flush_op(entry_ptr->cache_ptr,
+ execute_flush_op(f,
entry_ptr,
&((entry_ptr->flush_ops)[i]),
flags_ptr);
@@ -1363,7 +1396,7 @@ add_flush_op(int target_type,
*/
void
-create_pinned_entry_dependency(H5C_t * cache_ptr,
+create_pinned_entry_dependency(H5F_t * file_ptr,
int pinning_type,
int pinning_idx,
int pinned_type,
@@ -1407,8 +1440,8 @@ create_pinned_entry_dependency(H5C_t * cache_ptr,
if ( pinned_entry_ptr->pinning_ref_count == 0 ) {
- protect_entry(cache_ptr, pinned_type, pinned_idx);
- unprotect_entry(cache_ptr, pinned_type, pinned_idx, FALSE,
+ protect_entry(file_ptr, pinned_type, pinned_idx);
+ unprotect_entry(file_ptr, pinned_type, pinned_idx, FALSE,
H5C__PIN_ENTRY_FLAG);
}
@@ -1446,7 +1479,7 @@ create_pinned_entry_dependency(H5C_t * cache_ptr,
*/
void
-dirty_entry(H5C_t * cache_ptr,
+dirty_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx,
hbool_t dirty_pin)
@@ -1454,13 +1487,16 @@ dirty_entry(H5C_t * cache_ptr,
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- HDassert( cache_ptr );
+ HDassert( file_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
if ( pass ) {
if ( dirty_pin ) {
+ H5C_t *cache_ptr = file_ptr->shared->cache;
+
+ HDassert(cache_ptr);
if ( ! entry_in_cache(cache_ptr, type, idx) ) {
@@ -1483,14 +1519,14 @@ dirty_entry(H5C_t * cache_ptr,
} else {
- mark_pinned_entry_dirty(cache_ptr, type, idx, FALSE, (size_t)0);
+ mark_pinned_entry_dirty(type, idx, FALSE, (size_t)0);
}
}
} else {
- protect_entry(cache_ptr, type, idx);
- unprotect_entry(cache_ptr, type, idx, TRUE, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, type, idx);
+ unprotect_entry(file_ptr, type, idx, TRUE, H5C__NO_FLAGS_SET);
}
}
@@ -1520,11 +1556,15 @@ dirty_entry(H5C_t * cache_ptr,
*/
void
-execute_flush_op(H5C_t * cache_ptr,
+execute_flush_op(H5F_t * file_ptr,
struct test_entry_t * entry_ptr,
struct flush_op * op_ptr,
unsigned * flags_ptr)
{
+ H5C_t * cache_ptr;
+
+ HDassert( file_ptr ) ;
+ cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( entry_ptr != NULL );
@@ -1555,7 +1595,7 @@ execute_flush_op(H5C_t * cache_ptr,
HDassert( ( entry_ptr->type != op_ptr->type ) ||
( entry_ptr->index != op_ptr->idx ) );
- dirty_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
+ dirty_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
break;
case FLUSH_OP__RESIZE:
@@ -1586,7 +1626,7 @@ execute_flush_op(H5C_t * cache_ptr,
/* change the size of some other entry */
- resize_entry(cache_ptr, op_ptr->type, op_ptr->idx,
+ resize_entry(file_ptr, op_ptr->type, op_ptr->idx,
op_ptr->size, op_ptr->flag);
}
break;
@@ -1697,22 +1737,22 @@ reset_entries(void)
{
int i;
+ int32_t max_index;
+ test_entry_t * base_addr;
+ test_entry_t * orig_base_addr;
if( !orig_entry_arrays_init)
{
- haddr_t addr = 0;
+ haddr_t addr = PICO_BASE_ADDR;
haddr_t alt_addr = PICO_ALT_BASE_ADDR;
+ size_t entry_size;
for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
{
- int32_t max_index;
- size_t entry_size;
- test_entry_t * base_addr;
- test_entry_t * orig_base_addr;
int j;
- entry_size = entry_sizes[i];
max_index = max_indices[i];
+ entry_size = entry_sizes[i];
base_addr = entries[i];
orig_base_addr = orig_entries[i];
@@ -1809,9 +1849,9 @@ reset_entries(void)
else {
for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
{
- int32_t max_index = max_indices[i];
- test_entry_t * base_addr = entries[i];
- test_entry_t * orig_base_addr = orig_entries[i];
+ max_index = max_indices[i];
+ base_addr = entries[i];
+ orig_base_addr = orig_entries[i];
/* Make copy of entries in base_addr for later */
HDmemcpy(base_addr, orig_base_addr, (size_t)(max_index + 1) * sizeof( *base_addr ));
@@ -1851,7 +1891,7 @@ reset_entries(void)
*/
void
-resize_entry(H5C_t * cache_ptr,
+resize_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx,
size_t new_size,
@@ -1860,7 +1900,6 @@ resize_entry(H5C_t * cache_ptr,
test_entry_t * base_addr;
test_entry_t * entry_ptr;
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( type == VARIABLE_ENTRY_TYPE );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -1876,6 +1915,9 @@ resize_entry(H5C_t * cache_ptr,
HDassert( entry_ptr == entry_ptr->self );
if ( resize_pin ) {
+ H5C_t *cache_ptr = file_ptr->shared->cache;
+
+ HDassert( cache_ptr );
if ( ! entry_in_cache(cache_ptr, type, idx) ) {
@@ -1891,14 +1933,13 @@ resize_entry(H5C_t * cache_ptr,
} else {
- mark_pinned_entry_dirty(cache_ptr, type, idx,
- TRUE, new_size);
+ mark_pinned_entry_dirty(type, idx, TRUE, new_size);
}
}
} else {
- protect_entry(cache_ptr, type, idx);
- unprotect_entry_with_size_change(cache_ptr, type, idx,
+ protect_entry(file_ptr, type, idx);
+ unprotect_entry_with_size_change(file_ptr, type, idx,
H5C__SIZE_CHANGED_FLAG, new_size);
}
}
@@ -1970,8 +2011,7 @@ resize_pinned_entry(H5C_t * cache_ptr,
entry_ptr->size = new_size;
- result = H5C_resize_pinned_entry(cache_ptr,
- (void *)entry_ptr,
+ result = H5C_resize_pinned_entry((void *)entry_ptr,
new_size);
if ( result != SUCCEED ) {
@@ -2488,38 +2528,267 @@ verify_unprotected(void)
* Programmer: John Mainzer
* 6/11/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-H5C_t *
+H5F_t *
setup_cache(size_t max_cache_size,
size_t min_clean_size)
{
+ const char * fcn_name = "setup_cache()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hbool_t verbose = TRUE;
+ int mile_stone = 1;
+ hid_t fid = -1;
+ haddr_t actual_base_addr;
+ H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
+ H5F_t * ret_val = NULL;
+ hid_t fapl_id = H5P_DEFAULT;
- cache_ptr = H5C_create(max_cache_size,
- min_clean_size,
- (NUMBER_OF_ENTRY_TYPES - 1),
- (const char **)entry_type_names,
- check_write_permitted,
- TRUE,
- NULL,
- NULL);
+ if ( show_progress ) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
- if ( cache_ptr == NULL ) {
+ saved_fid = -1;
- pass = FALSE;
- failure_mssg = "H5C_create() returned NULL.";
+ /* setup the file name */
+ if ( pass ) {
- } else {
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
+ == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname() failed.\n";
+ }
+ }
+
+ if ( show_progress ) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ 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 ) {
+
+ 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 ) {
+
+ core_file_driver_failed = TRUE;
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", fcn_name);
+ }
+
+ } else {
+
+ saved_fapl_id = fapl_id;
+ }
+ }
+
+ if ( show_progress ) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ /* if we either aren't using the core file driver, or a create
+ * with the core file driver failed, try again with a regular file.
+ * If this fails, we are cooked.
+ */
+ if ( ( pass ) && ( fid < 0 ) ) {
+
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+
+ saved_fid = fid;
+
+ if ( fid < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fcreate() failed.";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: H5Fcreate() failed.\n", fcn_name);
+ }
+ }
+ }
+
+ if ( show_progress ) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ if ( pass ) {
+
+ HDassert( fid >= 0 );
+
+ saved_fid = fid;
+
+ if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fflush() failed.";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name);
+ }
+
+ } else {
+
+ file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE);
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "Can't get file_ptr.";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name);
+ }
+ }
+ }
+ }
+
+ if ( show_progress ) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ if ( pass ) {
+
+ /* A bit of fancy footwork here:
+ *
+ * The call to H5Fcreate() allocates an instance of H5C_t,
+ * initializes it, and stores its address in f->shared->cache.
+ *
+ * We don't want to use this cache, as it has a bunch of extra
+ * initialization that may change over time, and in any case
+ * it will not in general be configured the way we want it.
+ *
+ * We used to deal with this problem by storing the file pointer
+ * in another instance of H5C_t, and then ignoring the original
+ * version. However, this strategy doesn't work any more, as
+ * we can't store the file pointer in the instance of H5C_t,
+ * and we have modified many cache routines to use a file
+ * pointer to look up the target cache.
+ *
+ * Thus we now make note of the address of the instance of
+ * H5C_t created by the call to H5Fcreate(), set
+ * file_ptr->shared->cache to NULL, call H5C_create()
+ * to allocate a new instance of H5C_t for test purposes,
+ * and store than new instance's address in
+ * file_ptr->shared->cache.
+ *
+ * On shut down, we call H5C_dest on our instance of H5C_t,
+ * set file_ptr->shared->cache to point to the original
+ * instance, and then close the file normally.
+ */
+
+ HDassert( saved_cache == NULL );
+
+ saved_cache = file_ptr->shared->cache;
+
+ file_ptr->shared->cache = NULL;
+
+ cache_ptr = H5C_create(max_cache_size,
+ min_clean_size,
+ (NUMBER_OF_ENTRY_TYPES - 1),
+ (const char **)entry_type_names,
+ check_write_permitted,
+ TRUE,
+ NULL,
+ NULL);
+
+ file_ptr->shared->cache = cache_ptr;
+ }
+
+ if ( show_progress ) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ if ( pass ) {
+
+ if ( cache_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "H5C_create() failed.";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: H5C_create() failed.\n", fcn_name);
+ }
+
+ } else if ( cache_ptr->magic != H5C__H5C_T_MAGIC ) {
+
+ pass = FALSE;
+ failure_mssg = "Bad cache_ptr magic.";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", fcn_name);
+ }
+ }
+ }
+
+ if ( show_progress ) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ if ( pass ) { /* allocate space for test entries */
+
+ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT,
+ (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
+
+ if ( actual_base_addr == HADDR_UNDEF ) {
+
+ pass = FALSE;
+ failure_mssg = "H5MF_alloc() failed.";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", fcn_name);
+ }
+
+ } 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.
+ */
+ pass = FALSE;
+ failure_mssg = "actual_base_addr > BASE_ADDR";
+
+ if ( verbose ) {
+ HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n",
+ fcn_name);
+ }
+ }
+
+ saved_actual_base_addr = actual_base_addr;
+ }
+
+ if ( show_progress ) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+
+ if ( pass ) {
+
+ H5C_stats__reset(cache_ptr);
H5C_set_skip_flags(cache_ptr, TRUE, TRUE);
+
+ ret_val = file_ptr;
}
- return(cache_ptr);
+ if ( show_progress ) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ fcn_name, mile_stone++, (int)pass);
+ return(ret_val);
} /* setup_cache() */
@@ -2534,26 +2803,83 @@ setup_cache(size_t max_cache_size,
* Programmer: John Mainzer
* 6/11/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
-takedown_cache(H5C_t * cache_ptr,
+takedown_cache(H5F_t * file_ptr,
hbool_t dump_stats,
hbool_t dump_detailed_stats)
{
- HDassert(cache_ptr);
+ char filename[512];
- if ( pass ) {
+ if ( file_ptr != NULL ) {
+ H5C_t * cache_ptr = file_ptr->shared->cache;
if ( dump_stats ) {
H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
}
+
+ flush_cache(file_ptr, TRUE, FALSE, FALSE);
+
+ H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT);
+
+ if ( saved_cache != NULL ) {
+
+ file_ptr->shared->cache = saved_cache;
+ saved_cache = NULL;
+ }
+
+ }
- H5C_dest(NULL, -1, -1, cache_ptr);
+ if ( saved_fapl_id != H5P_DEFAULT ) {
+
+ H5Pclose(saved_fapl_id);
+ saved_fapl_id = H5P_DEFAULT;
+ }
+
+ if ( saved_fid != -1 ) {
+
+ if ( H5F_addr_defined(saved_actual_base_addr) ) {
+
+ if ( NULL == file_ptr ) {
+ file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE);
+ HDassert ( file_ptr );
+ }
+
+ H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr,
+ (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
+ saved_actual_base_addr = HADDR_UNDEF;
+ }
+
+ if ( H5Fclose(saved_fid) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "couldn't close test file.";
+
+ } else {
+
+ saved_fid = -1;
+
+ }
+
+ if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) {
+
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
+ == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname() failed.\n";
+ }
+
+ if ( HDremove(filename) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "couldn't delete test file.";
+
+ }
+ }
}
return;
@@ -2581,7 +2907,7 @@ takedown_cache(H5C_t * cache_ptr,
*/
void
-expunge_entry(H5C_t * cache_ptr,
+expunge_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
@@ -2591,8 +2917,12 @@ expunge_entry(H5C_t * cache_ptr,
test_entry_t * entry_ptr;
if ( pass ) {
+#ifndef NDEBUG
+ H5C_t * cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr );
+#endif /* NDEBUG */
+
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -2608,8 +2938,8 @@ expunge_entry(H5C_t * cache_ptr,
HDassert( ! ( entry_ptr->header.is_pinned ) );
HDassert( ! ( entry_ptr->is_pinned ) );
- result = H5C_expunge_entry(NULL, -1, -1, cache_ptr, &(types[type]),
- entry_ptr->addr, H5AC__NO_FLAGS_SET);
+ result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( result < 0 ) {
@@ -2641,29 +2971,32 @@ expunge_entry(H5C_t * cache_ptr,
*/
void
-flush_cache(H5C_t * cache_ptr,
+flush_cache(H5F_t * file_ptr,
hbool_t destroy_entries,
hbool_t dump_stats,
hbool_t dump_detailed_stats)
{
const char * fcn_name = "flush_cache()";
+ H5C_t * cache_ptr;
herr_t result = 0;
hbool_t verbose = FALSE;
- HDassert(cache_ptr);
-
verify_unprotected();
if ( pass ) {
+ HDassert(file_ptr);
+
+ cache_ptr = file_ptr->shared->cache;
+
if ( destroy_entries ) {
- result = H5C_flush_cache(NULL, -1, -1, cache_ptr,
+ result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
H5C__FLUSH_INVALIDATE_FLAG);
} else {
- result = H5C_flush_cache(NULL, -1, -1, cache_ptr,
+ result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
H5C__NO_FLAGS_SET);
}
}
@@ -2743,12 +3076,13 @@ flush_cache(H5C_t * cache_ptr,
*/
void
-insert_entry(H5C_t * cache_ptr,
+insert_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx,
hbool_t UNUSED dirty,
unsigned int flags)
{
+ H5C_t * cache_ptr;
herr_t result;
hbool_t insert_pinned;
test_entry_t * base_addr;
@@ -2756,6 +3090,8 @@ insert_entry(H5C_t * cache_ptr,
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] ) );
@@ -2772,8 +3108,8 @@ insert_entry(H5C_t * cache_ptr,
entry_ptr->is_dirty = TRUE;
- result = H5C_insert_entry(NULL, -1, -1, cache_ptr, &(types[type]),
- entry_ptr->addr, (void *)entry_ptr, flags);
+ result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||
@@ -2845,8 +3181,7 @@ insert_entry(H5C_t * cache_ptr,
*/
void
-mark_pinned_entry_dirty(H5C_t * cache_ptr,
- int32_t type,
+mark_pinned_entry_dirty(int32_t type,
int32_t idx,
hbool_t size_changed,
size_t new_size)
@@ -2858,7 +3193,6 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr,
if ( pass ) {
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -2868,7 +3202,6 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr,
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
HDassert( ! (entry_ptr->header.is_protected) );
HDassert( entry_ptr->header.is_pinned );
HDassert( entry_ptr->is_pinned );
@@ -2881,8 +3214,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr,
entry_ptr->size = new_size;
}
- result = H5C_mark_pinned_entry_dirty(cache_ptr,
- (void *)entry_ptr,
+ result = H5C_mark_pinned_entry_dirty((void *)entry_ptr,
size_changed,
new_size);
@@ -2943,8 +3275,7 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr,
*/
void
-mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
- int32_t type,
+mark_pinned_or_protected_entry_dirty(int32_t type,
int32_t idx)
{
/* const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; */
@@ -2954,7 +3285,6 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
if ( pass ) {
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -2964,14 +3294,12 @@ mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
HDassert( entry_ptr->header.is_protected ||
entry_ptr->header.is_pinned );
entry_ptr->is_dirty = TRUE;
- result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr,
- (void *)entry_ptr);
+ result = H5C_mark_pinned_or_protected_entry_dirty((void *)entry_ptr);
if ( ( result < 0 )
||
@@ -3137,17 +3465,20 @@ rename_entry(H5C_t * cache_ptr,
*/
void
-protect_entry(H5C_t * cache_ptr,
+protect_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
/* const char * fcn_name = "protect_entry()"; */
+ H5C_t * cache_ptr;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
H5C_cache_entry_t * cache_entry_ptr;
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] ) );
@@ -3160,9 +3491,8 @@ protect_entry(H5C_t * cache_ptr,
HDassert( entry_ptr == entry_ptr->self );
HDassert( !(entry_ptr->is_protected) );
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(NULL, -1, -1, cache_ptr, &(types[type]),
- entry_ptr->addr, NULL, NULL,
- H5C__NO_FLAGS_SET);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, NULL, NULL, H5C__NO_FLAGS_SET);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
@@ -3234,17 +3564,20 @@ protect_entry(H5C_t * cache_ptr,
*/
void
-protect_entry_ro(H5C_t * cache_ptr,
+protect_entry_ro(H5F_t * file_ptr,
int32_t type,
int32_t idx)
{
/* const char * fcn_name = "protect_entry_ro()"; */
+ H5C_t *cache_ptr;
test_entry_t * base_addr;
test_entry_t * entry_ptr;
H5C_cache_entry_t * cache_entry_ptr;
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] ) );
@@ -3259,9 +3592,8 @@ protect_entry_ro(H5C_t * cache_ptr,
( ( entry_ptr->is_read_only ) &&
( entry_ptr->ro_ref_count > 0 ) ) );
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(NULL, -1, -1, cache_ptr, &(types[type]),
- entry_ptr->addr, NULL, NULL,
- H5C__READ_ONLY_FLAG);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, NULL, NULL, H5C__READ_ONLY_FLAG);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
@@ -3309,11 +3641,9 @@ protect_entry_ro(H5C_t * cache_ptr,
*/
void
-pin_entry(H5C_t * cache_ptr,
- int32_t type,
+pin_entry(int32_t type,
int32_t idx)
{
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -3331,7 +3661,7 @@ pin_entry(H5C_t * cache_ptr,
HDassert( entry_ptr->is_protected );
HDassert( !(entry_ptr->pinned_from_client) );
- result = H5C_pin_protected_entry(cache_ptr, (void *)entry_ptr);
+ result = H5C_pin_protected_entry((void *)entry_ptr);
if ( result < 0 ) {
@@ -3376,8 +3706,7 @@ pin_entry(H5C_t * cache_ptr,
*/
void
-unpin_entry(H5C_t * cache_ptr,
- int32_t type,
+unpin_entry(int32_t type,
int32_t idx)
{
/* const char * fcn_name = "unpin_entry()"; */
@@ -3387,7 +3716,6 @@ unpin_entry(H5C_t * cache_ptr,
if ( pass ) {
- HDassert( cache_ptr );
HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) );
@@ -3397,13 +3725,12 @@ unpin_entry(H5C_t * cache_ptr,
HDassert( entry_ptr->index == idx );
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr == cache_ptr );
HDassert( entry_ptr->header.is_pinned );
HDassert( entry_ptr->header.pinned_from_client );
HDassert( entry_ptr->is_pinned );
HDassert( entry_ptr->pinned_from_client );
- result = H5C_unpin_entry(cache_ptr, (void *)entry_ptr);
+ result = H5C_unpin_entry((void *)entry_ptr);
if ( ( result < 0 ) ||
( entry_ptr->header.pinned_from_client ) ||
@@ -3466,13 +3793,14 @@ unpin_entry(H5C_t * cache_ptr,
*/
void
-unprotect_entry(H5C_t * cache_ptr,
+unprotect_entry(H5F_t * file_ptr,
int32_t type,
int32_t idx,
int dirty,
unsigned int flags)
{
/* const char * fcn_name = "unprotect_entry()"; */
+ H5C_t *cache_ptr;
herr_t result;
hbool_t pin_flag_set;
hbool_t unpin_flag_set;
@@ -3481,6 +3809,8 @@ unprotect_entry(H5C_t * cache_ptr,
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] ) );
@@ -3508,9 +3838,9 @@ unprotect_entry(H5C_t * cache_ptr,
entry_ptr->is_dirty = (hbool_t)(entry_ptr->is_dirty || dirty);
}
- result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]),
- entry_ptr->addr, (void *)entry_ptr,
- flags, (size_t)0);
+ result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags,
+ (size_t)0);
if ( ( result < 0 ) ||
( ( entry_ptr->header.is_protected ) &&
@@ -3622,13 +3952,14 @@ unprotect_entry(H5C_t * cache_ptr,
*/
void
-unprotect_entry_with_size_change(H5C_t * cache_ptr,
+unprotect_entry_with_size_change(H5F_t * file_ptr,
int32_t type,
int32_t idx,
unsigned int flags,
size_t new_size)
{
const char * fcn_name = "unprotect_entry_with_size_change()";
+ H5C_t *cache_ptr;
herr_t result;
hbool_t dirty_flag_set;
hbool_t pin_flag_set;
@@ -3639,6 +3970,8 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr,
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] ) );
@@ -3674,9 +4007,9 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr,
entry_ptr->size = new_size;
}
- result = H5C_unprotect(NULL, -1, -1, cache_ptr, &(types[type]),
- entry_ptr->addr, (void *)entry_ptr,
- flags, new_size);
+ result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags,
+ new_size);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||
@@ -3763,7 +4096,7 @@ unprotect_entry_with_size_change(H5C_t * cache_ptr,
*/
void
-row_major_scan_forward(H5C_t * cache_ptr,
+row_major_scan_forward(H5F_t * file_ptr,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -3779,19 +4112,25 @@ row_major_scan_forward(H5C_t * cache_ptr,
int dirty_unprotects)
{
const char * fcn_name = "row_major_scan_forward";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = 0;
int32_t idx;
if ( verbose )
HDfprintf(stdout, "%s(): entering.\n", fcn_name);
- HDassert( lag >= 10 );
+ if ( pass ) {
- type = 0;
+ cache_ptr = file_ptr->shared->cache;
- if ( ( pass ) && ( reset_stats ) ) {
+ HDassert( cache_ptr != NULL );
- H5C_stats__reset(cache_ptr);
+ HDassert( lag >= 10 );
+
+ if ( reset_stats ) {
+
+ H5C_stats__reset(cache_ptr);
+ }
}
while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
@@ -3813,7 +4152,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
- insert_entry(cache_ptr, type, (idx + lag), dirty_inserts,
+ insert_entry(file_ptr, type, (idx + lag), dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -3825,7 +4164,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1));
- protect_entry(cache_ptr, type, (idx + lag - 1));
+ protect_entry(file_ptr, type, (idx + lag - 1));
}
if ( ( pass ) && ( (idx + lag - 2) >= 0 ) &&
@@ -3835,7 +4174,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2));
- unprotect_entry(cache_ptr, type, idx+lag-2, NO_CHANGE,
+ unprotect_entry(file_ptr, type, idx+lag-2, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
@@ -3856,7 +4195,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 3));
- protect_entry(cache_ptr, type, (idx + lag - 3));
+ protect_entry(file_ptr, type, (idx + lag - 3));
}
if ( ( pass ) && ( (idx + lag - 5) >= 0 ) &&
@@ -3866,7 +4205,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 5));
- unprotect_entry(cache_ptr, type, idx+lag-5, NO_CHANGE,
+ unprotect_entry(file_ptr, type, idx+lag-5, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
@@ -3880,7 +4219,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
HDfprintf(stdout, "(p-ro, %d, %d) ", type,
(idx + lag - 5));
- protect_entry_ro(cache_ptr, type, (idx + lag - 5));
+ protect_entry_ro(file_ptr, type, (idx + lag - 5));
}
if ( ( pass ) && ( (idx + lag - 6) >= 0 ) &&
@@ -3891,7 +4230,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
HDfprintf(stdout, "(p-ro, %d, %d) ", type,
(idx + lag - 6));
- protect_entry_ro(cache_ptr, type, (idx + lag - 6));
+ protect_entry_ro(file_ptr, type, (idx + lag - 6));
}
if ( ( pass ) && ( (idx + lag - 7) >= 0 ) &&
@@ -3902,7 +4241,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
HDfprintf(stdout, "(p-ro, %d, %d) ", type,
(idx + lag - 7));
- protect_entry_ro(cache_ptr, type, (idx + lag - 7));
+ protect_entry_ro(file_ptr, type, (idx + lag - 7));
}
if ( ( pass ) && ( (idx + lag - 7) >= 0 ) &&
@@ -3913,7 +4252,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
HDfprintf(stdout, "(u-ro, %d, %d) ", type,
(idx + lag - 7));
- unprotect_entry(cache_ptr, type, (idx + lag - 7),
+ unprotect_entry(file_ptr, type, (idx + lag - 7),
FALSE, H5C__NO_FLAGS_SET);
}
@@ -3925,7 +4264,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
HDfprintf(stdout, "(u-ro, %d, %d) ", type,
(idx + lag - 8));
- unprotect_entry(cache_ptr, type, (idx + lag - 8),
+ unprotect_entry(file_ptr, type, (idx + lag - 8),
FALSE, H5C__NO_FLAGS_SET);
}
@@ -3937,7 +4276,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
HDfprintf(stdout, "(u-ro, %d, %d) ", type,
(idx + lag - 9));
- unprotect_entry(cache_ptr, type, (idx + lag - 9),
+ unprotect_entry(file_ptr, type, (idx + lag - 9),
FALSE, H5C__NO_FLAGS_SET);
}
} /* if ( do_mult_ro_protects ) */
@@ -3947,7 +4286,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
- protect_entry(cache_ptr, type, idx);
+ protect_entry(file_ptr, type, idx);
}
if ( ( pass ) && ( (idx - lag + 2) >= 0 ) &&
@@ -3957,7 +4296,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2));
- unprotect_entry(cache_ptr, type, idx-lag+2, NO_CHANGE,
+ unprotect_entry(file_ptr, type, idx-lag+2, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
@@ -3968,7 +4307,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1));
- protect_entry(cache_ptr, type, (idx - lag + 1));
+ protect_entry(file_ptr, type, (idx - lag + 1));
}
@@ -3980,36 +4319,36 @@ row_major_scan_forward(H5C_t * cache_ptr,
switch ( (idx - lag) %4 ) {
case 0: /* we just did an insert */
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
NO_CHANGE, H5C__NO_FLAGS_SET);
break;
case 1:
if ( (entries[type])[idx-lag].is_dirty ) {
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
NO_CHANGE, H5C__NO_FLAGS_SET);
} else {
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
dirty_unprotects,
H5C__NO_FLAGS_SET);
}
break;
case 2: /* we just did an insrt */
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
NO_CHANGE, H5C__DELETED_FLAG);
break;
case 3:
if ( (entries[type])[idx-lag].is_dirty ) {
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
NO_CHANGE, H5C__DELETED_FLAG);
} else {
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
dirty_destroys,
H5C__DELETED_FLAG);
}
@@ -4029,7 +4368,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag));
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
dirty_unprotects, H5C__NO_FLAGS_SET);
}
}
@@ -4075,7 +4414,7 @@ row_major_scan_forward(H5C_t * cache_ptr,
*/
void
-hl_row_major_scan_forward(H5C_t * cache_ptr,
+hl_row_major_scan_forward(H5F_t * file_ptr,
int32_t max_index,
hbool_t verbose,
hbool_t reset_stats,
@@ -4085,7 +4424,8 @@ hl_row_major_scan_forward(H5C_t * cache_ptr,
hbool_t dirty_inserts)
{
const char * fcn_name = "hl_row_major_scan_forward";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = 0;
int32_t idx;
int32_t i;
int32_t lag = 100;
@@ -4094,15 +4434,19 @@ hl_row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "%s(): entering.\n", fcn_name);
- HDassert( lag > 5 );
- HDassert( max_index >= 200 );
- HDassert( max_index <= MAX_ENTRIES );
+ if ( pass ) {
- type = 0;
+ cache_ptr = file_ptr->shared->cache;
- if ( ( pass ) && ( reset_stats ) ) {
+ HDassert( cache_ptr != NULL );
+ HDassert( lag > 5 );
+ HDassert( max_index >= 200 );
+ HDassert( max_index <= MAX_ENTRIES );
- H5C_stats__reset(cache_ptr);
+ if ( reset_stats ) {
+
+ H5C_stats__reset(cache_ptr);
+ }
}
while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
@@ -4121,7 +4465,7 @@ hl_row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
- insert_entry(cache_ptr, type, (idx + lag), dirty_inserts,
+ insert_entry(file_ptr, type, (idx + lag), dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4134,12 +4478,12 @@ hl_row_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, i);
- protect_entry(cache_ptr, type, i);
+ protect_entry(file_ptr, type, i);
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, i);
- unprotect_entry(cache_ptr, type, i, NO_CHANGE,
+ unprotect_entry(file_ptr, type, i, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
i--;
@@ -4175,17 +4519,11 @@ hl_row_major_scan_forward(H5C_t * cache_ptr,
* Programmer: John Mainzer
* 6/12/04
*
- * Modifications:
- *
- * JRM -- 4/4/07
- * Added code supporting multiple read only protects.
- * Note that this increased the minimum lag to 10.
- *
*-------------------------------------------------------------------------
*/
void
-row_major_scan_backward(H5C_t * cache_ptr,
+row_major_scan_backward(H5F_t * file_ptr,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -4201,19 +4539,24 @@ row_major_scan_backward(H5C_t * cache_ptr,
int dirty_unprotects)
{
const char * fcn_name = "row_major_scan_backward";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
if ( verbose )
HDfprintf(stdout, "%s(): Entering.\n", fcn_name);
- HDassert( lag >= 10 );
+ if ( pass ) {
- type = NUMBER_OF_ENTRY_TYPES - 1;
+ cache_ptr = file_ptr->shared->cache;
+
+ HDassert( cache_ptr != NULL );
+ HDassert( lag >= 10 );
- if ( ( pass ) && ( reset_stats ) ) {
+ if ( reset_stats ) {
- H5C_stats__reset(cache_ptr);
+ H5C_stats__reset(cache_ptr);
+ }
}
while ( ( pass ) && ( type >= 0 ) )
@@ -4230,7 +4573,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag));
- insert_entry(cache_ptr, type, (idx - lag), dirty_inserts,
+ insert_entry(file_ptr, type, (idx - lag), dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4242,7 +4585,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1));
- protect_entry(cache_ptr, type, (idx - lag + 1));
+ protect_entry(file_ptr, type, (idx - lag + 1));
}
if ( ( pass ) && ( (idx - lag + 2) >= 0 ) &&
@@ -4252,7 +4595,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2));
- unprotect_entry(cache_ptr, type, idx-lag+2, NO_CHANGE,
+ unprotect_entry(file_ptr, type, idx-lag+2, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
@@ -4273,7 +4616,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 3));
- protect_entry(cache_ptr, type, (idx - lag + 3));
+ protect_entry(file_ptr, type, (idx - lag + 3));
}
if ( ( pass ) && ( (idx - lag + 5) >= 0 ) &&
@@ -4283,7 +4626,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 5));
- unprotect_entry(cache_ptr, type, idx-lag+5, NO_CHANGE,
+ unprotect_entry(file_ptr, type, idx-lag+5, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
@@ -4297,7 +4640,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
HDfprintf(stdout, "(p-ro, %d, %d) ", type,
(idx - lag + 5));
- protect_entry_ro(cache_ptr, type, (idx - lag + 5));
+ protect_entry_ro(file_ptr, type, (idx - lag + 5));
}
if ( ( pass ) && ( (idx - lag + 6) >= 0 ) &&
@@ -4308,7 +4651,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
HDfprintf(stdout, "(p-ro, %d, %d) ", type,
(idx - lag + 6));
- protect_entry_ro(cache_ptr, type, (idx - lag + 6));
+ protect_entry_ro(file_ptr, type, (idx - lag + 6));
}
if ( ( pass ) && ( (idx - lag + 7) >= 0 ) &&
@@ -4319,7 +4662,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
HDfprintf(stdout, "(p-ro, %d, %d) ", type,
(idx - lag + 7));
- protect_entry_ro(cache_ptr, type, (idx - lag + 7));
+ protect_entry_ro(file_ptr, type, (idx - lag + 7));
}
if ( ( pass ) && ( (idx - lag + 7) >= 0 ) &&
@@ -4330,7 +4673,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
HDfprintf(stdout, "(u-ro, %d, %d) ", type,
(idx - lag + 7));
- unprotect_entry(cache_ptr, type, (idx - lag + 7),
+ unprotect_entry(file_ptr, type, (idx - lag + 7),
FALSE, H5C__NO_FLAGS_SET);
}
@@ -4342,7 +4685,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
HDfprintf(stdout, "(u-ro, %d, %d) ", type,
(idx - lag + 8));
- unprotect_entry(cache_ptr, type, (idx - lag + 8),
+ unprotect_entry(file_ptr, type, (idx - lag + 8),
FALSE, H5C__NO_FLAGS_SET);
}
@@ -4354,7 +4697,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
HDfprintf(stdout, "(u-ro, %d, %d) ", type,
(idx - lag + 9));
- unprotect_entry(cache_ptr, type, (idx - lag + 9),
+ unprotect_entry(file_ptr, type, (idx - lag + 9),
FALSE, H5C__NO_FLAGS_SET);
}
} /* if ( do_mult_ro_protects ) */
@@ -4364,7 +4707,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
- protect_entry(cache_ptr, type, idx);
+ protect_entry(file_ptr, type, idx);
}
@@ -4375,7 +4718,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2));
- unprotect_entry(cache_ptr, type, idx+lag-2, NO_CHANGE,
+ unprotect_entry(file_ptr, type, idx+lag-2, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
@@ -4386,7 +4729,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1));
- protect_entry(cache_ptr, type, (idx + lag - 1));
+ protect_entry(file_ptr, type, (idx + lag - 1));
}
@@ -4400,36 +4743,36 @@ row_major_scan_backward(H5C_t * cache_ptr,
case 0:
if ( (entries[type])[idx+lag].is_dirty ) {
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
NO_CHANGE, H5C__NO_FLAGS_SET);
} else {
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
dirty_unprotects,
H5C__NO_FLAGS_SET);
}
break;
case 1: /* we just did an insert */
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
NO_CHANGE, H5C__NO_FLAGS_SET);
break;
case 2:
if ( (entries[type])[idx + lag].is_dirty ) {
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
NO_CHANGE, H5C__DELETED_FLAG);
} else {
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
dirty_destroys,
H5C__DELETED_FLAG);
}
break;
case 3: /* we just did an insrt */
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
NO_CHANGE, H5C__DELETED_FLAG);
break;
@@ -4446,7 +4789,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag));
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
dirty_unprotects, H5C__NO_FLAGS_SET);
}
}
@@ -4492,7 +4835,7 @@ row_major_scan_backward(H5C_t * cache_ptr,
*/
void
-hl_row_major_scan_backward(H5C_t * cache_ptr,
+hl_row_major_scan_backward(H5F_t * file_ptr,
int32_t max_index,
hbool_t verbose,
hbool_t reset_stats,
@@ -4502,7 +4845,8 @@ hl_row_major_scan_backward(H5C_t * cache_ptr,
hbool_t dirty_inserts)
{
const char * fcn_name = "hl_row_major_scan_backward";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
int32_t i;
int32_t lag = 100;
@@ -4511,15 +4855,19 @@ hl_row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "%s(): entering.\n", fcn_name);
- HDassert( lag > 5 );
- HDassert( max_index >= 200 );
- HDassert( max_index <= MAX_ENTRIES );
+ if ( pass ) {
- type = NUMBER_OF_ENTRY_TYPES - 1;
+ cache_ptr = file_ptr->shared->cache;
- if ( ( pass ) && ( reset_stats ) ) {
+ HDassert( cache_ptr != NULL );
+ HDassert( lag > 5 );
+ HDassert( max_index >= 200 );
+ HDassert( max_index <= MAX_ENTRIES );
- H5C_stats__reset(cache_ptr);
+ if ( reset_stats ) {
+
+ H5C_stats__reset(cache_ptr);
+ }
}
while ( ( pass ) && ( type >= 0 ) )
@@ -4538,7 +4886,7 @@ hl_row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
- insert_entry(cache_ptr, type, (idx + lag), dirty_inserts,
+ insert_entry(file_ptr, type, (idx + lag), dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4551,12 +4899,12 @@ hl_row_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, i);
- protect_entry(cache_ptr, type, i);
+ protect_entry(file_ptr, type, i);
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, i);
- unprotect_entry(cache_ptr, type, i, NO_CHANGE,
+ unprotect_entry(file_ptr, type, i, NO_CHANGE,
H5C__NO_FLAGS_SET);
}
i--;
@@ -4598,7 +4946,7 @@ hl_row_major_scan_backward(H5C_t * cache_ptr,
*/
void
-col_major_scan_forward(H5C_t * cache_ptr,
+col_major_scan_forward(H5F_t * file_ptr,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -4609,19 +4957,23 @@ col_major_scan_forward(H5C_t * cache_ptr,
int dirty_unprotects)
{
const char * fcn_name = "col_major_scan_forward()";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = 0;
int32_t idx;
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", fcn_name);
- HDassert( lag > 5 );
+ if ( pass ) {
- type = 0;
+ cache_ptr = file_ptr->shared->cache;
- if ( ( pass ) && ( reset_stats ) ) {
+ HDassert( lag > 5 );
- H5C_stats__reset(cache_ptr);
+ if ( reset_stats ) {
+
+ H5C_stats__reset(cache_ptr);
+ }
}
idx = -lag;
@@ -4640,7 +4992,7 @@ col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
- insert_entry(cache_ptr, type, (idx + lag), dirty_inserts,
+ insert_entry(file_ptr, type, (idx + lag), dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4649,7 +5001,7 @@ col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
- protect_entry(cache_ptr, type, idx);
+ protect_entry(file_ptr, type, idx);
}
if ( ( pass ) && ( (idx - lag) >= 0 ) &&
@@ -4658,7 +5010,7 @@ col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag));
- unprotect_entry(cache_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, idx - lag,
dirty_unprotects, H5C__NO_FLAGS_SET);
}
@@ -4704,7 +5056,7 @@ col_major_scan_forward(H5C_t * cache_ptr,
*/
void
-hl_col_major_scan_forward(H5C_t * cache_ptr,
+hl_col_major_scan_forward(H5F_t * file_ptr,
int32_t max_index,
hbool_t verbose,
hbool_t reset_stats,
@@ -4715,7 +5067,8 @@ hl_col_major_scan_forward(H5C_t * cache_ptr,
int dirty_unprotects)
{
const char * fcn_name = "hl_col_major_scan_forward()";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = 0;
int32_t idx;
int32_t lag = 200;
int32_t i;
@@ -4724,15 +5077,19 @@ hl_col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", fcn_name);
- HDassert( lag > 5 );
- HDassert( max_index >= 500 );
- HDassert( max_index <= MAX_ENTRIES );
+ if ( pass ) {
+
+ cache_ptr = file_ptr->shared->cache;
- type = 0;
+ HDassert( cache_ptr != NULL );
+ HDassert( lag > 5 );
+ HDassert( max_index >= 500 );
+ HDassert( max_index <= MAX_ENTRIES );
- if ( ( pass ) && ( reset_stats ) ) {
+ if ( reset_stats ) {
- H5C_stats__reset(cache_ptr);
+ H5C_stats__reset(cache_ptr);
+ }
}
idx = 0;
@@ -4758,7 +5115,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, i);
- insert_entry(cache_ptr, type, i, dirty_inserts,
+ insert_entry(file_ptr, type, i, dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4767,7 +5124,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, i);
- protect_entry(cache_ptr, type, i);
+ protect_entry(file_ptr, type, i);
}
if ( ( pass ) && ( i >= 0 ) &&
@@ -4776,7 +5133,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, i);
- unprotect_entry(cache_ptr, type, i,
+ unprotect_entry(file_ptr, type, i,
dirty_unprotects, H5C__NO_FLAGS_SET);
}
@@ -4820,7 +5177,7 @@ hl_col_major_scan_forward(H5C_t * cache_ptr,
*/
void
-col_major_scan_backward(H5C_t * cache_ptr,
+col_major_scan_backward(H5F_t * file_ptr,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -4831,6 +5188,7 @@ col_major_scan_backward(H5C_t * cache_ptr,
int dirty_unprotects)
{
const char * fcn_name = "col_major_scan_backward()";
+ H5C_t * cache_ptr;
int mile_stone = 1;
int32_t type;
int32_t idx;
@@ -4838,11 +5196,18 @@ col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", fcn_name);
- HDassert( lag > 5 );
+ if ( pass ) {
- if ( ( pass ) && ( reset_stats ) ) {
+ cache_ptr = file_ptr->shared->cache;
- H5C_stats__reset(cache_ptr);
+ HDassert( cache_ptr != NULL );
+
+ HDassert( lag > 5 );
+
+ if ( reset_stats ) {
+
+ H5C_stats__reset(cache_ptr);
+ }
}
idx = MAX_ENTRIES + lag;
@@ -4865,7 +5230,7 @@ col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag));
- insert_entry(cache_ptr, type, (idx - lag), dirty_inserts,
+ insert_entry(file_ptr, type, (idx - lag), dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4874,7 +5239,7 @@ col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
- protect_entry(cache_ptr, type, idx);
+ protect_entry(file_ptr, type, idx);
}
if ( ( pass ) && ( (idx + lag) >= 0 ) &&
@@ -4883,7 +5248,7 @@ col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag));
- unprotect_entry(cache_ptr, type, idx + lag,
+ unprotect_entry(file_ptr, type, idx + lag,
dirty_unprotects, H5C__NO_FLAGS_SET);
}
@@ -4935,7 +5300,7 @@ col_major_scan_backward(H5C_t * cache_ptr,
*/
void
-hl_col_major_scan_backward(H5C_t * cache_ptr,
+hl_col_major_scan_backward(H5F_t * file_ptr,
int32_t max_index,
hbool_t verbose,
hbool_t reset_stats,
@@ -4946,7 +5311,8 @@ hl_col_major_scan_backward(H5C_t * cache_ptr,
int dirty_unprotects)
{
const char * fcn_name = "hl_col_major_scan_backward()";
- int32_t type;
+ H5C_t * cache_ptr;
+ int32_t type = 0;
int32_t idx;
int32_t lag = 50;
int32_t i;
@@ -4955,20 +5321,24 @@ hl_col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", fcn_name);
- HDassert( lag > 5 );
- HDassert( max_index >= 500 );
- HDassert( max_index <= MAX_ENTRIES );
+ if ( pass ) {
- type = 0;
+ cache_ptr = file_ptr->shared->cache;
+
+ HDassert( cache_ptr != NULL );
+ HDassert( lag > 5 );
+ HDassert( max_index >= 500 );
+ HDassert( max_index <= MAX_ENTRIES );
- local_max_index = MIN(max_index, MAX_ENTRIES);
+ local_max_index = MIN(max_index, MAX_ENTRIES);
- if ( ( pass ) && ( reset_stats ) ) {
+ if ( reset_stats ) {
- H5C_stats__reset(cache_ptr);
- }
+ H5C_stats__reset(cache_ptr);
+ }
- idx = local_max_index;
+ idx = local_max_index;
+ }
while ( ( pass ) && ( idx >= 0 ) )
{
@@ -4988,7 +5358,7 @@ hl_col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(i, %d, %d) ", type, i);
- insert_entry(cache_ptr, type, i, dirty_inserts,
+ insert_entry(file_ptr, type, i, dirty_inserts,
H5C__NO_FLAGS_SET);
}
@@ -4997,7 +5367,7 @@ hl_col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, i);
- protect_entry(cache_ptr, type, i);
+ protect_entry(file_ptr, type, i);
}
if ( ( pass ) && ( i >= 0 ) &&
@@ -5006,7 +5376,7 @@ hl_col_major_scan_backward(H5C_t * cache_ptr,
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, i);
- unprotect_entry(cache_ptr, type, i,
+ unprotect_entry(file_ptr, type, i,
dirty_unprotects, H5C__NO_FLAGS_SET);
}
@@ -5048,13 +5418,11 @@ hl_col_major_scan_backward(H5C_t * cache_ptr,
*/
void
-create_flush_dependency(H5C_t * cache_ptr,
- int32_t par_type,
+create_flush_dependency(int32_t par_type,
int32_t par_idx,
int32_t chd_type,
int32_t chd_idx)
{
- HDassert( cache_ptr );
HDassert( ( 0 <= par_type ) && ( par_type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= par_idx ) && ( par_idx <= max_indices[par_type] ) );
HDassert( ( 0 <= chd_type ) && ( chd_type < NUMBER_OF_ENTRY_TYPES ) );
@@ -5088,8 +5456,7 @@ create_flush_dependency(H5C_t * cache_ptr,
HDassert( chd_entry_ptr->type == chd_type );
HDassert( chd_entry_ptr == chd_entry_ptr->self );
- result = H5C_create_flush_dependency(cache_ptr, par_entry_ptr,
- chd_entry_ptr);
+ result = H5C_create_flush_dependency(par_entry_ptr, chd_entry_ptr);
if ( ( result < 0 ) ||
( !par_entry_ptr->header.is_pinned ) ||
@@ -5149,13 +5516,11 @@ create_flush_dependency(H5C_t * cache_ptr,
*/
void
-destroy_flush_dependency(H5C_t * cache_ptr,
- int32_t par_type,
+destroy_flush_dependency(int32_t par_type,
int32_t par_idx,
int32_t chd_type,
int32_t chd_idx)
{
- HDassert( cache_ptr );
HDassert( ( 0 <= par_type ) && ( par_type < NUMBER_OF_ENTRY_TYPES ) );
HDassert( ( 0 <= par_idx ) && ( par_idx <= max_indices[par_type] ) );
HDassert( ( 0 <= chd_type ) && ( chd_type < NUMBER_OF_ENTRY_TYPES ) );
@@ -5190,7 +5555,7 @@ destroy_flush_dependency(H5C_t * cache_ptr,
HDassert( chd_entry_ptr->flush_dep_height < par_entry_ptr->flush_dep_height );
HDassert( chd_entry_ptr == chd_entry_ptr->self );
- if ( H5C_destroy_flush_dependency(cache_ptr, par_entry_ptr, chd_entry_ptr) < 0 ) {
+ if ( H5C_destroy_flush_dependency(par_entry_ptr, chd_entry_ptr) < 0 ) {
pass = FALSE;
failure_mssg = "error in H5C_destroy_flush_dependency().";
} /* end if */