summaryrefslogtreecommitdiffstats
path: root/src/H5C.c
diff options
context:
space:
mode:
authormainzer <mainzer#hdfgroup.org>2020-04-29 16:34:46 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-21 14:51:39 (GMT)
commit18dab4e5767fcf9cdad2220d1a89f1ae7b002dd1 (patch)
treeaf43b990d3e5c90591c24974114ac0335df6ae25 /src/H5C.c
parentd5ad503cfe37263c903a2a755c464c42d67530c4 (diff)
downloadhdf5-18dab4e5767fcf9cdad2220d1a89f1ae7b002dd1.zip
hdf5-18dab4e5767fcf9cdad2220d1a89f1ae7b002dd1.tar.gz
hdf5-18dab4e5767fcf9cdad2220d1a89f1ae7b002dd1.tar.bz2
Modified page buffer to split entries only where necessary -- specifically
when handling an I/O request on a metadata entry that has been sub-allocated from a larger file space allocation (i.e. fixed and extensible array), and that crosses at least one page boundary. . This required modifying the metadata cache to provide the type of the metadata cache entry in the current I/O request. For now, this is done with a function call. Once we are sure this works, it may be appropriate to convert this to a macro, or to add a flags parameter to the H5F block read/write calls. Also updated the metadata cache to report whether a read request is speculative -- again via a function call. This allowed me to remove the last address static variable in the H5PB_read() call, which is necessary to support multiple files opened in VFD SWMR mode. Also re-wrote the H5PB_remove_entries() call to handle release of large metadata file space allocations that have been sub-allocated into multiple metadata entries. Also modified the call to H5PB_remove_entries() in H5MF__xfree_impl() to invoke it whenever the page buffer is enabled and the size of the space to be freed is of page size or larger. Tested serial / debug on charis and Jelly. Found a bug in H5MF_xfree_impl(), in which the call to H5PB_remove_entries() is skipped due to HGOTO_DONE calls earlier in the function. While the obvious action is to move the call earlier in the function, best to consult with Vailin first, as there is much going on and it would be best to avoid making the situation worse. If nothing else, there are some error management issues.
Diffstat (limited to 'src/H5C.c')
-rw-r--r--src/H5C.c75
1 files changed, 66 insertions, 9 deletions
diff --git a/src/H5C.c b/src/H5C.c
index abea0d4..aa3428b 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -477,6 +477,10 @@ H5C_create(size_t max_cache_size,
cache_ptr->rdfsm_settled = FALSE;
cache_ptr->mdfsm_settled = FALSE;
+ /* fields supporting page buffer hints */
+ cache_ptr->curr_io_type = NULL;
+ cache_ptr->curr_read_speculative = FALSE;
+
if(H5C_reset_cache_hit_rate_stats(cache_ptr) < 0)
/* this should be impossible... */
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "H5C_reset_cache_hit_rate_stats failed")
@@ -487,6 +491,7 @@ H5C_create(size_t max_cache_size,
#ifndef NDEBUG
cache_ptr->get_entry_ptr_from_addr_counter = 0;
+ cache_ptr->curr_io_type = NULL;
#endif /* NDEBUG */
/* Set return value */
@@ -974,10 +979,13 @@ done:
*
* Programmer: John Mainzer -- 12/16/18
*
- * Changes: None.
+ * Changes: Added macro calls to maintain the page buffer hints.
+ *
+ * JRM -- 3/20/20
*
*-------------------------------------------------------------------------
*/
+
herr_t
H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page,
uint32_t length, uint64_t tick)
@@ -994,7 +1002,7 @@ H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page,
H5C_cache_entry_t * entry_ptr;
H5C_cache_entry_t * follow_ptr = NULL;
herr_t ret_value = SUCCEED; /* Return value */
- bool found = false;
+ hbool_t found = FALSE;
FUNC_ENTER_NOAPI(FAIL)
@@ -1036,7 +1044,7 @@ H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page,
page * cache_ptr->page_size + length <=
entry_ptr->addr + entry_ptr->size);
- found = true;
+ found = TRUE;
/* since end of tick occurs only on API call entry in
* the VFD SWMR reader case, the entry must not be protected.
@@ -1134,12 +1142,17 @@ H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page,
H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ H5C__SET_PB_READ_HINTS(cache_ptr, entry_ptr->type, TRUE)
+
if ( H5F_block_read(f, entry_ptr->type->mem_type,
entry_ptr->addr,
- image_len, image_ptr) < 0 )
+ image_len, image_ptr) < 0 ) {
+ H5C__RESET_PB_READ_HINTS(cache_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, \
"Can't read image (1)")
+ }
+ H5C__RESET_PB_READ_HINTS(cache_ptr)
/* 3) Call the refresh callback. If it doesn't
* request a different image size, goto 6)
@@ -1171,12 +1184,18 @@ H5C_evict_or_refresh_all_entries_in_page(H5F_t * f, uint64_t page,
H5C_IMAGE_EXTRA_SPACE);
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+ H5C__SET_PB_READ_HINTS(cache_ptr, entry_ptr->type, TRUE)
+
if ( H5F_block_read(f, entry_ptr->type->mem_type,
entry_ptr->addr,
- image_len, image_ptr) < 0 )
+ image_len, image_ptr) < 0 ) {
+
+ H5C__RESET_PB_READ_HINTS(cache_ptr)
HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, \
"Can't read image (2)")
+ }
+ H5C__RESET_PB_READ_HINTS(cache_ptr)
/* 5) Call the refresh callback again. Requesting
* a different buffer size again is an error.
@@ -6494,6 +6513,14 @@ done:
*
* Programmer: John Mainzer, 5/5/04
*
+ * Changes: Please maintain the changes list, and do not delete it
+ * unless you have merged it into the header comment
+ * proper.
+ *
+ * Added macro calls to maintain page buffer hints.
+ *
+ * JRM -- 3/20/20
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -6679,8 +6706,18 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags)
else
mem_type = entry_ptr->type->mem_type;
- if(H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file")
+ H5C__SET_PB_WRITE_HINTS(cache_ptr, entry_ptr->type)
+
+ if ( H5F_block_write(f, mem_type, entry_ptr->addr,
+ entry_ptr->size,
+ entry_ptr->image_ptr) < 0 ) {
+
+ H5C__RESET_PB_WRITE_HINTS(cache_ptr)
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "Can't write image to file")
+ }
+ H5C__RESET_PB_WRITE_HINTS(cache_ptr)
#ifdef H5_HAVE_PARALLEL
}
#endif /* H5_HAVE_PARALLEL */
@@ -7082,6 +7119,10 @@ done:
* small.
* JRM -- 3/25/20
*
+ * Added macro calls to maintain the page buffer read hints.
+ *
+ * JRM -- 3/20/20
+ *
*-------------------------------------------------------------------------
*/
static void *
@@ -7233,10 +7274,18 @@ H5C_load_entry(H5F_t * f,
if ( !coll_access || 0 == mpi_rank ) {
#endif /* H5_HAVE_PARALLEL */
- if ( H5F_block_read(f, type->mem_type, addr, len, image) < 0 )
+ H5C__SET_PB_READ_HINTS(f->shared->cache, type, TRUE)
+
+ if ( H5F_block_read(f, type->mem_type, addr, len, image) < 0 ) {
+
+ H5C__RESET_PB_READ_HINTS(f->shared->cache)
HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, \
"Can't read image*")
+ }
+
+ H5C__RESET_PB_READ_HINTS(f->shared->cache)
+
#ifdef H5_HAVE_PARALLEL
} /* end if */
/* if the collective metadata read optimization is turned on,
@@ -7345,11 +7394,19 @@ H5C_load_entry(H5F_t * f,
*
* JRM -- 3/24/20
*/
+
+ H5C__SET_PB_READ_HINTS(f->shared->cache, type, \
+ FALSE);
+
if ( H5F_block_read(f, type->mem_type, addr,
- actual_len, image) < 0)
+ actual_len, image) < 0 ) {
+
+ H5C__RESET_PB_READ_HINTS(f->shared->cache)
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \
"can't read image")
+ }
+ H5C__RESET_PB_READ_HINTS(f->shared->cache)
#endif /* JRM */
#ifdef H5_HAVE_PARALLEL
}