summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-12-11 08:28:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-12-11 08:28:05 (GMT)
commitfeb9d1f6761b541a388100d04ec56a9b88a7e462 (patch)
treec79f3b73f886cb9c7c27926c77d4f951bc460ef7
parentcc6eb939f4dec06e234835acbb5b3bc269b228c5 (diff)
downloadhdf5-feb9d1f6761b541a388100d04ec56a9b88a7e462.zip
hdf5-feb9d1f6761b541a388100d04ec56a9b88a7e462.tar.gz
hdf5-feb9d1f6761b541a388100d04ec56a9b88a7e462.tar.bz2
Bring over changes from revise_chunks that cleanup recent SWMR changes from
code review feedback.
-rw-r--r--src/H5ACproxy_entry.c162
-rw-r--r--src/H5C.c43
-rw-r--r--test/cache.c408
-rw-r--r--test/cache_common.c8
-rw-r--r--test/cache_common.h6
5 files changed, 279 insertions, 348 deletions
diff --git a/src/H5ACproxy_entry.c b/src/H5ACproxy_entry.c
index ab5edb9..66aacb3 100644
--- a/src/H5ACproxy_entry.c
+++ b/src/H5ACproxy_entry.c
@@ -632,165 +632,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC__proxy_entry_free_icr() */
-#ifdef OLD_CODE
-
-/*-------------------------------------------------------------------------
- * Function: H5AC_virt_entry_dirty_parent
- *
- * Purpose: Indicate that a virtual entry's parent became dirty
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * July 23, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC_virt_entry_dirty_parent(H5AC_virt_entry_t *ventry)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(ventry);
- HDassert(ventry->track_parents);
- HDassert(ventry->nparents > 0);
-
- /* If this is the first dirty parent or child, mark the virtual entry dirty */
- if(ventry->in_cache && 0 == ventry->ndirty_parents && 0 == ventry->ndirty_children)
- if(H5AC_mark_entry_dirty(ventry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDIRTY, FAIL, "can't mark virtual entry dirty")
-
- /* Increment the number of dirty parents */
- ventry->ndirty_parents++;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5AC_virt_entry_dirty_parent() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC_virt_entry_clean_parent
- *
- * Purpose: Indicate that a virtual entry's parent became clean
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * July 23, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC_virt_entry_clean_parent(H5AC_virt_entry_t *ventry)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(ventry);
- HDassert(ventry->track_parents);
-// HDassert(ventry->nparents > 0);
- HDassert(ventry->ndirty_parents > 0);
-
- /* Decrement the number of dirty parents */
- ventry->ndirty_parents--;
-
- /* If this is the last dirty parent or child, mark the virtual entry clean */
- if(ventry->in_cache && 0 == ventry->ndirty_parents && 0 == ventry->ndirty_children)
- if(H5AC_mark_entry_clean(ventry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark virtual entry clean")
-
- /* Destroy the skip list, if no more parents */
- if(0 == ventry->nparents && 0 == ventry->ndirty_parents) {
-// /* Sanity check */
-// HDassert(0 == ventry->ndirty_parents);
-
- if(H5SL_close(ventry->parents) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CLOSEERROR, FAIL, "can't close parent list")
- ventry->parents = NULL;
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5AC_virt_entry_clean_parent() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC_virt_entry_dirty_child
- *
- * Purpose: Indicate that a virtual entry's child became dirty
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * July 24, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC_virt_entry_dirty_child(H5AC_virt_entry_t *ventry)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(ventry);
- HDassert(ventry->nchildren > 0);
-
- /* If this is the first dirty parent or child, mark the virtual entry dirty */
- if(ventry->in_cache && 0 == ventry->ndirty_parents && 0 == ventry->ndirty_children)
- if(H5AC_mark_entry_dirty(ventry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTDIRTY, FAIL, "can't mark virtual entry dirty")
-
- /* Increment the number of dirty children */
- ventry->ndirty_children++;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5AC_virt_entry_dirty_child() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC_virt_entry_clean_child
- *
- * Purpose: Indicate that a virtual entry's child became clean
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * July 24, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC_virt_entry_clean_child(H5AC_virt_entry_t *ventry)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity check */
- HDassert(ventry);
- HDassert(ventry->nchildren > 0);
- HDassert(ventry->ndirty_children > 0);
-
- /* Decrement the number of dirty children */
- ventry->ndirty_children--;
-
- /* If this is the last dirty parent or child, mark the virtual entry clean */
- if(ventry->in_cache && 0 == ventry->ndirty_parents && 0 == ventry->ndirty_children)
- if(H5AC_mark_entry_clean(ventry) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark virtual entry clean")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5AC_virt_entry_clean_child() */
-
-#endif /* OLD_CODE */
-
-
diff --git a/src/H5C.c b/src/H5C.c
index 9a60049..faf99ff 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1702,6 +1702,13 @@ H5C_move_entry(H5C_t * cache_ptr,
HDassert(entry_ptr->addr == old_addr);
HDassert(entry_ptr->type == type);
+ /* Check for R/W status, otherwise error */
+ /* (Moving a R/O entry would mark it dirty, which shouldn't
+ * happen. QAK - 2016/12/02)
+ */
+ if(entry_ptr->is_read_only)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "can't move R/O entry")
+
H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL)
if(test_entry_ptr != NULL) { /* we are hosed */
@@ -5066,16 +5073,38 @@ H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags)
if(!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) {
HDassert(cache_ptr->index_size == 0);
HDassert(cache_ptr->clean_index_size == 0);
- HDassert(cache_ptr->dirty_index_size == 0);
- HDassert(cache_ptr->slist_len == 0);
- HDassert(cache_ptr->slist_size == 0);
HDassert(cache_ptr->pel_len == 0);
HDassert(cache_ptr->pel_size == 0);
- HDassert(cache_ptr->pl_len == 0);
- HDassert(cache_ptr->pl_size == 0);
- HDassert(cache_ptr->LRU_list_len == 0);
- HDassert(cache_ptr->LRU_list_size == 0);
} /* end if */
+ else {
+ H5C_cache_entry_t *entry_ptr; /* Cache entry */
+ unsigned u; /* Local index variable */
+
+ /* All rings except ring 4 should be empty now */
+ /* (Ring 4 has the superblock) */
+ for(u = H5C_RING_USER; u < H5C_RING_SB; u++) {
+ HDassert(cache_ptr->index_ring_len[u] == 0);
+ HDassert(cache_ptr->index_ring_size[u] == 0);
+ HDassert(cache_ptr->clean_index_ring_size[u] == 0);
+ } /* end for */
+
+ /* Check that any remaining pinned entries are in the superblock ring */
+ entry_ptr = cache_ptr->pel_head_ptr;
+ while(entry_ptr) {
+ /* Check ring */
+ HDassert(entry_ptr->ring == H5C_RING_SB);
+
+ /* Advance to next entry in pinned entry list */
+ entry_ptr = entry_ptr->next;
+ } /* end while */
+ } /* end else */
+ HDassert(cache_ptr->dirty_index_size == 0);
+ HDassert(cache_ptr->slist_len == 0);
+ HDassert(cache_ptr->slist_size == 0);
+ HDassert(cache_ptr->pl_len == 0);
+ HDassert(cache_ptr->pl_size == 0);
+ HDassert(cache_ptr->LRU_list_len == 0);
+ HDassert(cache_ptr->LRU_list_size == 0);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/test/cache.c b/test/cache.c
index 3c2cf5c..5c42dfd 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -93,8 +93,8 @@ struct move_entry_test_spec
{
int entry_type;
int entry_index;
- hbool_t is_dirty;
hbool_t is_pinned;
+ hbool_t is_protected;
};
@@ -154,7 +154,7 @@ static void check_flush_cache__flush_op_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
- struct fo_flush_cache_test_spec spec[],
+ const struct fo_flush_cache_test_spec spec[],
int init_expected_index_len,
size_t init_expected_index_size,
int expected_index_len,
@@ -166,8 +166,8 @@ static unsigned check_get_entry_status(void);
static unsigned check_expunge_entry(void);
static unsigned check_multiple_read_protect(void);
static unsigned check_move_entry(void);
-static void check_move_entry__run_test(H5F_t * file_ptr, int test_num,
- struct move_entry_test_spec * spec_ptr);
+static void check_move_entry__run_test(H5F_t * file_ptr, unsigned test_num,
+ struct move_entry_test_spec * spec_ptr);
static unsigned check_pin_protected_entry(void);
static unsigned check_resize_entry(void);
static unsigned check_evictions_enabled(void);
@@ -175,7 +175,6 @@ static unsigned check_flush_protected_err(void);
static unsigned check_destroy_pinned_err(void);
static unsigned check_destroy_protected_err(void);
static unsigned check_duplicate_insert_err(void);
-static unsigned check_move_err(void);
static unsigned check_double_pin_err(void);
static unsigned check_double_unpin_err(void);
static unsigned check_pin_entry_errs(void);
@@ -183,6 +182,7 @@ static unsigned check_double_protect_err(void);
static unsigned check_double_unprotect_err(void);
static unsigned check_mark_entry_dirty_errs(void);
static unsigned check_expunge_entry_errs(void);
+static unsigned check_move_entry_errs(void);
static unsigned check_resize_entry_errs(void);
static unsigned check_unprotect_ro_dirty_err(void);
static unsigned check_protect_ro_rw_err(void);
@@ -9069,7 +9069,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
int test_num,
unsigned int flush_flags,
int spec_size,
- struct fo_flush_cache_test_spec spec[],
+ const struct fo_flush_cache_test_spec spec[],
int init_expected_index_len,
size_t init_expected_index_size,
int expected_index_len,
@@ -13692,42 +13692,40 @@ check_multiple_read_protect(void)
* Programmer: John Mainzer
* 4/26/06
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static unsigned
check_move_entry(void)
{
- int i;
+ unsigned u;
H5F_t * file_ptr = NULL;
- struct move_entry_test_spec test_specs[4] =
+ struct move_entry_test_spec test_specs[8] =
{
{
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 10,
- /* hbool_t is_dirty = */ FALSE,
- /* hbool_t is_pinned = */ FALSE
+ /* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 10,
+ /* hbool_t is_pinned = */ FALSE,
+ /* hbool_t is_protected = */ FALSE
},
{
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 20,
- /* hbool_t is_dirty = */ TRUE,
- /* hbool_t is_pinned = */ FALSE
+ /* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 20,
+ /* hbool_t is_pinned = */ TRUE,
+ /* hbool_t is_protected = */ FALSE
},
{
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 30,
- /* hbool_t is_dirty = */ FALSE,
- /* hbool_t is_pinned = */ TRUE
+ /* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 30,
+ /* hbool_t is_pinned = */ FALSE,
+ /* hbool_t is_protected = */ TRUE
},
{
- /* int entry_type = */ PICO_ENTRY_TYPE,
- /* int entry_index = */ 40,
- /* hbool_t is_dirty = */ TRUE,
- /* hbool_t is_pinned = */ TRUE
- }
+ /* int entry_type = */ PICO_ENTRY_TYPE,
+ /* int entry_index = */ 40,
+ /* hbool_t is_pinned = */ TRUE,
+ /* hbool_t is_protected = */ TRUE
+ },
};
TESTING("H5C_move_entry() functionality");
@@ -13740,13 +13738,13 @@ check_move_entry(void)
*
* At present, we should do the following tests:
*
- * 1) Move a clean, unprotected, unpinned entry.
+ * 1) Move an unprotected, unpinned entry.
*
- * 2) Move a dirty, unprotected, unpinned entry.
+ * 2) Move an unprotected, pinned entry.
*
- * 3) Move a clean, unprotected, pinned entry.
+ * 3) Move a protected, unpinned entry.
*
- * 4) Move a dirty, unprotected, pinned entry.
+ * 4) Move a protected, pinned entry.
*
* In all cases, the entry should have moved to its
* new location, and have been marked dirty if it wasn't
@@ -13767,28 +13765,26 @@ check_move_entry(void)
(size_t)(1 * 1024 * 1024));
}
- i = 0;
- while(pass && (i < 4))
+ u = 0;
+ while(pass && (u < NELMTS(test_specs)))
{
- check_move_entry__run_test(file_ptr, i, &(test_specs[i]));
- i++;
+ check_move_entry__run_test(file_ptr, u, &(test_specs[u]));
+ u++;
}
- if(pass) {
-
+ if(pass)
takedown_cache(file_ptr, FALSE, FALSE);
- }
-
- if(pass) { PASSED(); } else { H5_FAILED(); }
- if(!pass) {
+ if(pass)
+ PASSED()
+ else
+ H5_FAILED()
+ if(!pass)
HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n",
FUNC, failure_mssg);
- }
return (unsigned)!pass;
-
} /* check_move_entry() */
@@ -13813,7 +13809,7 @@ check_move_entry(void)
static void
check_move_entry__run_test(H5F_t * file_ptr,
- int test_num,
+ unsigned test_num,
struct move_entry_test_spec * spec_ptr)
{
H5C_t * cache_ptr = file_ptr->shared->cache;
@@ -13827,7 +13823,7 @@ check_move_entry__run_test(H5F_t * file_ptr,
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "cache_ptr NULL on entry to move test #%d.",
+ "cache_ptr NULL on entry to move test #%u.",
test_num);
failure_mssg = msg;
@@ -13835,7 +13831,7 @@ check_move_entry__run_test(H5F_t * file_ptr,
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "spec_ptr NULL on entry to move test #%d.",
+ "spec_ptr NULL on entry to move test #%u.",
test_num);
failure_mssg = msg;
@@ -13854,13 +13850,10 @@ check_move_entry__run_test(H5F_t * file_ptr,
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "bad entry_ptr in move test #%d.",
+ "bad entry_ptr in move test #%u.",
test_num);
failure_mssg = msg;
- } else if(spec_ptr->is_pinned) {
-
- flags |= H5C__PIN_ENTRY_FLAG;
}
}
@@ -13868,10 +13861,11 @@ check_move_entry__run_test(H5F_t * file_ptr,
protect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index);
- if(spec_ptr->is_dirty)
- flags |= H5C__DIRTIED_FLAG;
+ if(spec_ptr->is_pinned)
+ pin_entry(spec_ptr->entry_type, spec_ptr->entry_index);
- unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags);
+ if(!spec_ptr->is_protected)
+ unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags);
move_entry(cache_ptr, spec_ptr->entry_type, spec_ptr->entry_index, FALSE);
@@ -13890,54 +13884,84 @@ check_move_entry__run_test(H5F_t * file_ptr,
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Pinned entry not pinned after move in test #%d.",
+ "Pinned entry not pinned after move in test #%u.",
test_num);
failure_mssg = msg;
}
if(pass) {
- test_ptr = cache_ptr->pel_head_ptr;
+ if(spec_ptr->is_protected) {
+ } /* end if */
+ else {
+ /* Scan through the pinned entry list, looking for the entry */
+ test_ptr = cache_ptr->pel_head_ptr;
+ while((test_ptr != NULL) &&
+ (test_ptr != (H5C_cache_entry_t *)entry_ptr))
+ test_ptr = test_ptr->next;
+
+ if(test_ptr == NULL) {
+
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Pinned entry not in pel after move in test #%u.",
+ test_num);
+ failure_mssg = msg;
+ }
+ } /* end else */
+ }
- while((test_ptr != NULL) &&
- (test_ptr != (H5C_cache_entry_t *)entry_ptr))
- {
- test_ptr = test_ptr->next;
- }
+ unpin_entry(spec_ptr->entry_type, spec_ptr->entry_index);
- if(test_ptr == NULL) {
+ } else {
+
+ if(entry_ptr->header.is_pinned) {
+ pass = FALSE;
+ HDsnprintf(msg, (size_t)128,
+ "Unpinned entry pinned after move in test #%u.",
+ test_num);
+ failure_mssg = msg;
+ }
+
+ if(spec_ptr->is_protected) {
+ } /* end if */
+ else {
+ if((entry_ptr->header.prev != NULL) ||
+ (cache_ptr->LRU_head_ptr != (H5C_cache_entry_t *)entry_ptr))
+ {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Pinned entry not in pel after move in test #%d.",
- test_num);
+ "Entry not at head of LRU after move in test #%u.",
+ test_num);
failure_mssg = msg;
}
- }
-
- unpin_entry(spec_ptr->entry_type, spec_ptr->entry_index);
-
- } else {
+ } /* end else */
+ }
- if(entry_ptr->header.is_pinned) {
+ if(spec_ptr->is_protected) {
+ if(!(entry_ptr->header.is_protected)) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Unpinned entry pinned after move in test #%d.",
+ "Protected entry not protected after move in test #%u.",
test_num);
failure_mssg = msg;
}
- if((entry_ptr->header.prev != NULL) ||
- (cache_ptr->LRU_head_ptr != (H5C_cache_entry_t *)entry_ptr))
- {
+ unprotect_entry(file_ptr, spec_ptr->entry_type, spec_ptr->entry_index, flags);
+
+ } /* end if */
+ else {
+ if(entry_ptr->header.is_protected) {
+
pass = FALSE;
HDsnprintf(msg, (size_t)128,
- "Entry not at head of LRU after move in test #%d.",
+ "Unprotected entry not unprotected after move in test #%u.",
test_num);
failure_mssg = msg;
}
- }
+ } /* end else */
}
/* put the entry back where it started from */
@@ -16100,100 +16124,6 @@ check_duplicate_insert_err(void)
/*-------------------------------------------------------------------------
- * Function: check_move_err()
- *
- * Purpose: Verify that an attempt to move an entry to the address
- * of an existing entry will generate an error.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 6/24/04
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-static unsigned
-check_move_err(void)
-{
- herr_t result;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- test_entry_t * entry_0_0_ptr;
- test_entry_t * entry_0_1_ptr;
- test_entry_t * entry_1_0_ptr;
-
- TESTING("move to existing entry errors");
-
- pass = TRUE;
-
- /* allocate a cache, and insert several entries. Try to move
- * entries to other entries resident in the cache. This should
- * fail. Destroy the cache -- should succeed.
- */
-
- if(pass) {
-
- reset_entries();
-
- file_ptr = setup_cache((size_t)(2 * 1024),
- (size_t)(1 * 1024));
- cache_ptr = file_ptr->shared->cache;
-
- insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
- insert_entry(file_ptr, 0, 1, H5C__NO_FLAGS_SET);
- insert_entry(file_ptr, 1, 0, H5C__NO_FLAGS_SET);
-
- entry_0_0_ptr = &((entries[0])[0]);
- entry_0_1_ptr = &((entries[0])[1]);
- entry_1_0_ptr = &((entries[1])[0]);
- }
-
- if(pass) {
-
- result = H5C_move_entry(cache_ptr, &(types[0]),
- entry_0_0_ptr->addr, entry_0_1_ptr->addr);
-
- if(result >= 0) {
-
- pass = FALSE;
- failure_mssg = "move to addr of same type succeeded.\n";
- }
- }
-
- if(pass) {
-
- result = H5C_move_entry(cache_ptr, &(types[0]),
- entry_0_0_ptr->addr, entry_1_0_ptr->addr);
-
- if(result >= 0) {
-
- pass = FALSE;
- failure_mssg = "move to addr of different type succeeded.\n";
- }
- }
-
- if(pass) {
-
- takedown_cache(file_ptr, FALSE, FALSE);
- }
-
- if(pass) { PASSED(); } else { H5_FAILED(); }
-
- if(!pass) {
-
- HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
- FUNC, failure_mssg);
- }
-
- return (unsigned)!pass;
-
-} /* check_move_err() */
-
-
-/*-------------------------------------------------------------------------
* Function: check_double_pin_err()
*
* Purpose: Verify that an attempt to pin an entry that is already
@@ -16750,7 +16680,7 @@ check_expunge_entry_errs(void)
/* Allocate a cache, protect an entry, and then call H5C_expunge_entry()
* to expunge it -- this should fail
*
- * Unprotect the the entry with the pinned flag, and then call
+ * Unprotect the entry with the pinned flag, and then call
* H5C_expunge_entry() again. This should fail too.
*
* Finally, unpin the entry and call H5C_expunge_entry() yet again.
@@ -16842,6 +16772,140 @@ check_expunge_entry_errs(void)
/*-------------------------------------------------------------------------
+ * Function: check_move_entry_errs()
+ *
+ * Purpose: Verify that invalid calls to H5C_move_entry()
+ * generates errors as expected.
+ *
+ * Return: void
+ *
+ * Programmer: Quincey Koziol
+ * 12/10/16
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static unsigned
+check_move_entry_errs(void)
+{
+ herr_t result;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ test_entry_t * entry_ptr = NULL;
+ test_entry_t * entry_0_0_ptr;
+ test_entry_t * entry_0_1_ptr;
+ test_entry_t * entry_1_0_ptr;
+
+ TESTING("move entry related errors");
+
+ pass = TRUE;
+
+ /* allocate a cache, and insert several entries. Try to move
+ * entries to other entries resident in the cache. This should
+ * fail. Destroy the cache -- should succeed.
+ */
+
+ if(pass) {
+
+ reset_entries();
+
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+ cache_ptr = file_ptr->shared->cache;
+
+ insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+ insert_entry(file_ptr, 0, 1, H5C__NO_FLAGS_SET);
+ insert_entry(file_ptr, 1, 0, H5C__NO_FLAGS_SET);
+
+ entry_0_0_ptr = &((entries[0])[0]);
+ entry_0_1_ptr = &((entries[0])[1]);
+ entry_1_0_ptr = &((entries[1])[0]);
+ }
+
+ if(pass) {
+
+ result = H5C_move_entry(cache_ptr, &(types[0]),
+ entry_0_0_ptr->addr, entry_0_1_ptr->addr);
+
+ if(result >= 0) {
+
+ pass = FALSE;
+ failure_mssg = "move to addr of same type succeeded.\n";
+ }
+ }
+
+ if(pass) {
+
+ result = H5C_move_entry(cache_ptr, &(types[0]),
+ entry_0_0_ptr->addr, entry_1_0_ptr->addr);
+
+ if(result >= 0) {
+
+ pass = FALSE;
+ failure_mssg = "move to addr of different type succeeded.\n";
+ }
+ }
+
+ if(pass)
+ takedown_cache(file_ptr, FALSE, FALSE);
+
+
+ /* Allocate a cache, protect an entry R/O, and then call
+ * H5C_move_entry() to move it -- this should fail.
+ *
+ * Finally, unprotect the entry and destroy the cache.
+ * This should succeed.
+ */
+
+ if(pass) {
+
+ reset_entries();
+
+ file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024));
+
+ cache_ptr = file_ptr->shared->cache;
+
+ insert_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+
+ protect_entry_ro(file_ptr, 0, 0);
+
+ entry_ptr = &((entries[0])[0]);
+
+ }
+
+ if(pass) {
+
+ result = H5C_move_entry(cache_ptr, &(types[0]), entry_ptr->header.addr, entry_ptr->header.addr + 10);
+
+ if(result >= 0) {
+
+ pass = FALSE;
+ failure_mssg =
+ "Call to H5C_move_entry on a R/O protected entry succeeded.\n";
+
+ } else {
+
+ unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET);
+
+ }
+ }
+
+ if(pass)
+ takedown_cache(file_ptr, FALSE, FALSE);
+
+ if(pass)
+ PASSED()
+ else {
+ H5_FAILED()
+
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
+ FUNC, failure_mssg);
+ } /* end else */
+
+ return (unsigned)!pass;
+} /* check_move_entry_errs() */
+
+
+/*-------------------------------------------------------------------------
* Function: check_resize_entry_errs()
*
* Purpose: Verify that invalid calls to H5C_resize_entry()
@@ -16869,7 +16933,7 @@ check_resize_entry_errs(void)
/* Allocate a cache, protect an entry, and then call
* H5C_resize_entry() to resize it -- this should succeed.
*
- * Unprotect the the entry with the pinned flag, and then call
+ * Unprotect the entry with the pinned flag, and then call
* H5C_resize_entry() again with new size of zero.
* This should fail.
*
@@ -36308,7 +36372,6 @@ main(void)
nerrs += check_destroy_pinned_err();
nerrs += check_destroy_protected_err();
nerrs += check_duplicate_insert_err();
- nerrs += check_move_err();
nerrs += check_double_pin_err();
nerrs += check_double_unpin_err();
nerrs += check_pin_entry_errs();
@@ -36316,6 +36379,7 @@ main(void)
nerrs += check_double_unprotect_err();
nerrs += check_mark_entry_dirty_errs();
nerrs += check_expunge_entry_errs();
+ nerrs += check_move_entry_errs();
nerrs += check_resize_entry_errs();
nerrs += check_unprotect_ro_dirty_err();
nerrs += check_protect_ro_rw_err();
diff --git a/test/cache_common.c b/test/cache_common.c
index c0bee24..f387f05 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -721,8 +721,8 @@ notify_get_initial_load_size(void *udata, size_t *image_length)
*-------------------------------------------------------------------------
*/
static herr_t
-get_final_load_size(const void *image, size_t image_len, void *udata,
- size_t *actual_len, int32_t entry_type)
+get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED image_len,
+ void *udata, size_t *actual_len, int32_t entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
@@ -3906,8 +3906,8 @@ move_entry(H5C_t * cache_ptr,
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
HDassert( entry_ptr->cache_ptr == cache_ptr );
- HDassert( !(entry_ptr->is_protected) );
- HDassert( !(entry_ptr->header.is_protected) );
+ HDassert( !entry_ptr->is_read_only );
+ HDassert( !entry_ptr->header.is_read_only );
if ( entry_ptr->at_main_addr && !main_addr ) {
diff --git a/test/cache_common.h b/test/cache_common.h
index 3abcab5..1ab04cb 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -360,9 +360,9 @@ typedef struct test_entry_t
unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */
unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */
- unsigned actual_len; /* Simulate the entry's actual size for a speculative load */
- unsigned max_verify_ct; /* Maximum # of times to verify an entry's checksum */
- unsigned verify_ct; /* Count the # of checksum verification for an entry */
+ size_t actual_len; /* Simulate the entry's actual size for a speculative load */
+ unsigned max_verify_ct; /* Maximum # of times to verify an entry's checksum */
+ unsigned verify_ct; /* Count the # of checksum verification for an entry */
} test_entry_t;
/* The following are cut down test versions of the hash table manipulation