diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-12-11 08:28:05 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-12-11 08:28:05 (GMT) |
commit | feb9d1f6761b541a388100d04ec56a9b88a7e462 (patch) | |
tree | c79f3b73f886cb9c7c27926c77d4f951bc460ef7 /src | |
parent | cc6eb939f4dec06e234835acbb5b3bc269b228c5 (diff) | |
download | hdf5-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5ACproxy_entry.c | 162 | ||||
-rw-r--r-- | src/H5C.c | 43 |
2 files changed, 36 insertions, 169 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 */ - - @@ -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) |