diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2018-11-14 21:35:35 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2018-11-14 21:35:35 (GMT) |
commit | ce2748f0114cb1eae00799f8349a5451152c7fa3 (patch) | |
tree | fd3e39e6de7b37651a2c7047bd3ad128b5c4e204 /src | |
parent | e62f4bd4fab00b0cd03e269a858c21558a9321fa (diff) | |
download | hdf5-ce2748f0114cb1eae00799f8349a5451152c7fa3.zip hdf5-ce2748f0114cb1eae00799f8349a5451152c7fa3.tar.gz hdf5-ce2748f0114cb1eae00799f8349a5451152c7fa3.tar.bz2 |
(A) Fixes for the assertion failures described in issue #2 (see John Mainzer's last checkin message):
--src/H5PB.c: checks for size >= page size
--src/H5MF.c: disable/enable page buffering in H5MF_tidy_self_referential_fsm_hack()
--src/H5MFsection.c: call H5PB_remove_entry() for both raw/metadata pages in H5MF__sect_small_merge()
(B) Port and modify existing concurrent swmr tests to VFD SWMR. Also modify the following:
--remove flushes from VFD SWMR writer tests
--set Nreaders to 0 in test/testvfdswmr.sh.in to test for writers only
Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDvfd_swmr.c | 2 | ||||
-rw-r--r-- | src/H5Fint.c | 22 | ||||
-rw-r--r-- | src/H5MF.c | 19 | ||||
-rw-r--r-- | src/H5MFsection.c | 10 | ||||
-rw-r--r-- | src/H5PB.c | 89 |
5 files changed, 46 insertions, 96 deletions
diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index 09263ed..1eada7d 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -1119,7 +1119,7 @@ H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t reload_hdr_and_index, H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(FAIL) /* Load and decode the header and index as indicated */ if(reload_hdr_and_index) { diff --git a/src/H5Fint.c b/src/H5Fint.c index bca09b2..3cc82d8 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -132,7 +132,7 @@ static herr_t H5F__idx_entry_cmp(const void *_entry1, const void *_entry2); /*********************/ /* VFD SWMR globals */ -H5F_t *vfd_swmr_file_g; /* Points to the file struct */ +H5F_t *vfd_swmr_file_g = NULL; /* Points to the file struct */ hbool_t vfd_swmr_g = FALSE; /* Is this a VFD SWMR configured file */ hbool_t vfd_swmr_writer_g = FALSE; /* Is this the VFD SWMR writer */ uint64_t tick_num_g = 0; /* The current tick_num */ @@ -1370,6 +1370,7 @@ H5F__dest(H5F_t *f, hbool_t flush) if(H5F__vfd_swmr_close_or_flush(f, TRUE) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close the metadata file") } + vfd_swmr_file_g = NULL; /* Close the file */ if(H5FD_close(f->shared->lf) < 0) @@ -3651,6 +3652,7 @@ H5F__vfd_swmr_init(H5F_t *f, hbool_t file_create) } else { /* VFD SWMR reader */ HDassert(!f->shared->vfd_swmr_config.vfd_swmr_writer); + vfd_swmr_writer_g = f->shared->vfd_swmr_writer = FALSE; /* Set tick_num_g to the current tick read from the metadata file */ @@ -3941,8 +3943,6 @@ H5F__vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing) } /* end while */ f->shared->dl_head_ptr = f->shared->dl_tail_ptr = NULL; - vfd_swmr_file_g = NULL; - } else { /* For file flush */ /* Update end_of_tick */ if(H5F__vfd_swmr_update_end_of_tick_and_tick_num(f, TRUE) < 0) @@ -4136,15 +4136,25 @@ done: herr_t H5F_vfd_swmr_reader_end_of_tick(void) { + uint64_t tmp_tick_num = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* construct */ if(vfd_swmr_file_g) { - /* Update end_of_tick */ - if(H5F__vfd_swmr_update_end_of_tick_and_tick_num(vfd_swmr_file_g, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update end of tick") + HDassert(vfd_swmr_file_g->shared); + HDassert(vfd_swmr_file_g->shared->lf); + + if(H5FD_vfd_swmr_get_tick_and_idx(vfd_swmr_file_g->shared->lf, TRUE, &tmp_tick_num, NULL, NULL) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error in retrieving tick_num from driver") + if(tmp_tick_num != tick_num_g) { + vfd_swmr_file_g->shared->tick_num = tick_num_g = tmp_tick_num; + + /* Update end_of_tick */ + if(H5F__vfd_swmr_update_end_of_tick_and_tick_num(vfd_swmr_file_g, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update end of tick") + } } done: @@ -3579,6 +3579,7 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) H5F_mem_page_t sm_fssinfo_fs_type; /* Small fs sinfo fsm */ H5F_mem_page_t lg_fshdr_fs_type; /* Large fs hdr fsm */ H5F_mem_page_t lg_fssinfo_fs_type; /* Large fs sinfo fsm */ + H5PB_t *saved_pb_ptr = NULL; /* Pointer to page buffer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -3636,6 +3637,18 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) HDassert(NULL == f->shared->fs_man[sm_fshdr_fs_type]); HDassert(NULL == f->shared->fs_man[sm_fssinfo_fs_type]); + /* Disable page buffering when paged aggregation strategy with + * persistent FS and page buffering are used. + * This is in response to an assertion failure in H5PB.c when + * running test/fheap.c. + * This is due to header/section info got loaded into the page buffer + * when freeing them via H5FS_free() called in this routine. + */ + if(H5F_PAGED_AGGR(f) && f->shared->pb_ptr) { + saved_pb_ptr = f->shared->pb_ptr; + f->shared->pb_ptr = NULL; + } + if(H5F_addr_defined(f->shared->fs_addr[sm_fshdr_fs_type])) { first_srfsm_hdr = f->shared->fs_addr[sm_fshdr_fs_type]; @@ -3790,6 +3803,12 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) HDassert((!H5F_PAGED_AGGR(f)) || (0 == (eoa % f->shared->fs_page_size))); done: + /* Enable page buffering as needed */ + if(H5F_PAGED_AGGR(f) && saved_pb_ptr) { + HDassert(f->shared->pb_ptr == NULL); + f->shared->pb_ptr = saved_pb_ptr; + } + /* Reset the ring in the API context */ if(orig_ring != H5AC_RING_INV) H5AC_set_ring(orig_ring, NULL); diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 1d217a1..3b0a1c2 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -771,11 +771,11 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 if(H5MF_xfree(udata->f, udata->alloc_type, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") - /* Need to free possible metadata page in the PB cache */ - /* This is in response to the data corruption bug from fheap.c with page buffering + page strategy */ - /* Note: Large metadata page bypasses the PB cache */ - /* Note: Update of raw data page (large or small sized) is handled by the PB cache */ - if(udata->f->shared->pb_ptr != NULL && udata->alloc_type != H5FD_MEM_DRAW) + /* Need to free possible raw/metadata page in the page buffer. + * This is in response to the data corruption bug from test/fheap.c + * when page buffering + page aggregation strategy are used. + * Note: Large raw/metadata page bypasses the page buffer */ + if(udata->f->shared->pb_ptr != NULL) if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") @@ -1344,7 +1344,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, /* case 5) -- page buffer configured for raw data only */ bypass_pb = TRUE; - } else if ( ( size > pb_ptr->page_size ) && + } else if ( ( size >= pb_ptr->page_size ) && ( ! ( pb_ptr->vfd_swmr_writer ) ) ) { /* case 6) -- md read larger than one page and @@ -1566,23 +1566,8 @@ H5PB__create_new_page(H5PB_t *pb_ptr, haddr_t addr, size_t size, if ( entry_ptr != NULL ) { -#if 0 /* JRM */ HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ "page buffer already contains a page at the specified address") -#else /* JRM */ - /* this should be an error, but until we update the page allocation - * code to tell the page buffer to discard the associated entry - * whenever a page is freed, this situation can occur. - * - * For now, just force the eviction of the existing page. - * Delete this code as soon as the paged allocation code is - * updated accordingly - */ - if ( H5PB__evict_entry(pb_ptr, entry_ptr, TRUE) < 0 ) - - HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, "forced eviction failed") - -#endif /* JRM */ } entry_ptr = H5PB__allocate_page(pb_ptr, size, clean_image); @@ -1844,7 +1829,6 @@ H5PB__flush_entry(H5F_t *f, H5PB_t *pb_ptr, H5PB_entry_t *entry_ptr) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, \ "driver get_eoa request failed") -#if 0 /* JRM */ /* TODO: update the free space manager to inform the page buffer when * space is de-allocated so that the following assertions will be * true in all cases. @@ -1862,25 +1846,8 @@ H5PB__flush_entry(H5F_t *f, H5PB_t *pb_ptr, H5PB_entry_t *entry_ptr) * an assertion is adequate here. */ HDassert( eoa >= entry_ptr->addr + entry_ptr->size ); -#else /* JRM */ - if ( eoa < entry_ptr->addr ) { - - skip_write = TRUE; - - } else if ( eoa < entry_ptr->addr + entry_ptr->size ) { - - /* adjust the size of the write so that the write - * will not extend beyond EOA. - */ - write_size = (size_t)(eoa - entry_ptr->addr); - - } else { - - write_size = entry_ptr->size; - } -#endif /* JRM */ - + write_size = entry_ptr->size; /* flush the entry */ if ( ! skip_write ) { @@ -2557,7 +2524,7 @@ H5PB__read_meta(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, HDassert( page_addr == addr ); - if ( size > pb_ptr->page_size ) { + if ( size >= pb_ptr->page_size ) { /* search the page buffer for an entry at page */ H5PB__SEARCH_INDEX(pb_ptr, page, entry_ptr, FAIL) @@ -2965,7 +2932,7 @@ H5PB__read_raw(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, /* first page */ offset = addr - first_page_addr; - if ( (offset + size) < pb_ptr->page_size ) { + if ( (offset + size) <= pb_ptr->page_size ) { HDassert(num_touched_pages == 1); length = size; @@ -3135,7 +3102,7 @@ H5PB__write_meta(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, /* case 7) metadata read of size greater than page size. */ - if ( size > pb_ptr->page_size ) { + if ( size >= pb_ptr->page_size ) { /* The write must be for a multi-page metadata entry, and * we must be running as a VFD SWMR writer. @@ -3226,29 +3193,6 @@ H5PB__write_meta(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, H5PB__UPDATE_PB_HIT_RATE_STATS(pb_ptr, (entry_ptr != NULL), \ TRUE, FALSE) -#if 1 /* JRM */ - /* Since the space allocation code doesn't always tell the page - * buffer when a page is freed, it is possible that the page - * found by the index search is an ophaned raw data page. - * - * Until this is fixed, test to see entry_ptr points to - * a raw data page, and force its eviction if it does. - * - * Remove this code as soon as the space allocation code is - * updated to tell the page buffer to discard pages when - * they are freed. - */ - if ( ( entry_ptr ) && ( ! ( entry_ptr->is_metadata ) ) ) { - - if ( H5PB__evict_entry(pb_ptr, entry_ptr, TRUE) < 0 ) - - HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ - "forced eviction failed") - - entry_ptr = NULL; - } -#endif /* JRM */ - if ( ( NULL == entry_ptr ) && ( H5PB__load_page(f, pb_ptr, page_addr, type, &entry_ptr) < 0 ) ) @@ -3422,29 +3366,6 @@ H5PB__write_raw(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, H5PB__UPDATE_PB_HIT_RATE_STATS(pb_ptr, (entry_ptr != NULL), \ FALSE, FALSE) -#if 1 /* JRM */ - /* Since the space allocation code doesn't always tell the page - * buffer when a page is freed, it is possible that the page - * found by the index search is an ophaned metadata page. - * - * Until this is fixed, test to see entry_ptr points to - * a metadata page, and force its eviction if it does. - * - * Remove this code as soon as the space allocation code is - * updated to tell the page buffer to discard pages when - * they are freed. - */ - if ( ( entry_ptr ) && ( entry_ptr->is_metadata ) ) { - - if ( H5PB__evict_entry(pb_ptr, entry_ptr, TRUE) < 0 ) - - HGOTO_ERROR(H5E_PAGEBUF, H5E_SYSTEM, FAIL, \ - "forced eviction failed") - - entry_ptr = NULL; - } -#endif /* JRM */ - if ( entry_ptr ) { HDassert( entry_ptr->magic == H5PB__H5PB_ENTRY_T_MAGIC ); |