diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Fint.c | 6 | ||||
-rw-r--r-- | src/H5Fio.c | 4 | ||||
-rw-r--r-- | src/H5MF.c | 2 | ||||
-rw-r--r-- | src/H5MFsection.c | 2 | ||||
-rw-r--r-- | src/H5PB.c | 81 | ||||
-rw-r--r-- | src/H5PBprivate.h | 10 |
6 files changed, 54 insertions, 51 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 1c67cea..4a0c397 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1325,7 +1325,7 @@ H5F__dest(H5F_t *f, hbool_t flush) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") /* Shutdown the page buffer cache */ - if(H5PB_dest(f) < 0) + if(H5PB_dest(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache") @@ -1675,7 +1675,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer before initializing the superblock */ if(page_buf_size) - if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) + if(H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer") /* Initialize information about the superblock and allocate space for it */ @@ -1697,7 +1697,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer before initializing the superblock */ if(page_buf_size) - if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) + if(H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer") /* Open the root group */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 63b033f..a4a6e01 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -113,7 +113,7 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/* map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ - if(H5PB_read(f, map_type, addr, size, buf) < 0) + if(H5PB_read(f->shared, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") done: @@ -170,7 +170,7 @@ done: /*------------------------------------------------------------------------- * Function: H5F_flush_tagged_metadata * - * Purpose: Flushes metadata with specified tag in the metadata cache + * Purpose: Flushes metadata with specified tag in the metadata cache * to disk. * * Return: Non-negative on success/Negative on failure @@ -982,7 +982,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* Insert the new page into the Page Buffer list of new pages so we don't read an empty page from disk */ - if(f->shared->page_buf != NULL && H5PB_add_new_page(f, alloc_type, new_page) < 0) + if(f->shared->page_buf != NULL && H5PB_add_new_page(f->shared, alloc_type, new_page) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't add new page to Page Buffer new page list") ret_value = new_page; diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 3ebc5c8..f661ef9 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -776,7 +776,7 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 /* 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->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW) - if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0) + if(H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0) @@ -289,7 +289,7 @@ H5PB_print_stats(const H5PB_t *page_buf) *------------------------------------------------------------------------- */ herr_t -H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) +H5PB_create(H5F_file_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) { H5PB_t *page_buf = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -297,20 +297,19 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); /* Check args */ - if(f->shared->fs_strategy != H5F_FSPACE_STRATEGY_PAGE) + if(f_sh->fs_strategy != H5F_FSPACE_STRATEGY_PAGE) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "Enabling Page Buffering requires PAGE file space strategy") /* round down the size if it is larger than the page size */ - else if(size > f->shared->fs_page_size) { + else if(size > f_sh->fs_page_size) { hsize_t temp_size; - temp_size = (size / f->shared->fs_page_size) * f->shared->fs_page_size; + temp_size = (size / f_sh->fs_page_size) * f_sh->fs_page_size; H5_CHECKED_ASSIGN(size, size_t, temp_size, hsize_t); } /* end if */ - else if(0 != size % f->shared->fs_page_size) + else if(0 != size % f_sh->fs_page_size) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "Page Buffer size must be >= to the page size") /* Allocate the new page buffering structure */ @@ -318,15 +317,15 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed") page_buf->max_size = size; - H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f->shared->fs_page_size, hsize_t); + H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f_sh->fs_page_size, hsize_t); page_buf->min_meta_perc = page_buf_min_meta_perc; page_buf->min_raw_perc = page_buf_min_raw_perc; /* Calculate the minimum page count for metadata and raw data - * based on the fractions provided + * based on the fractions provided */ - page_buf->min_meta_count = (unsigned)((size * page_buf_min_meta_perc) / (f->shared->fs_page_size * 100)); - page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f->shared->fs_page_size * 100)); + page_buf->min_meta_count = (unsigned)((size * page_buf_min_meta_perc) / (f_sh->fs_page_size * 100)); + page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f_sh->fs_page_size * 100)); if(NULL == (page_buf->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list") @@ -336,7 +335,7 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag if(NULL == (page_buf->page_fac = H5FL_fac_init(page_buf->page_size))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "can't create page factory") - f->shared->page_buf = page_buf; + f_sh->page_buf = page_buf; done: if(ret_value < 0) { @@ -473,21 +472,21 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) *------------------------------------------------------------------------- */ herr_t -H5PB_dest(H5F_t *f) +H5PB_dest(H5F_file_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* flush and destroy the page buffer, if it exists */ - if(f->shared->page_buf) { - H5PB_t *page_buf = f->shared->page_buf; + if(f_sh->page_buf) { + H5PB_t *page_buf = f_sh->page_buf; H5PB_ud1_t op_data; /* Iteration context */ - if(H5PB_flush(f->shared) < 0) + if(H5PB_flush(f_sh) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer") /* Set up context info */ @@ -507,7 +506,7 @@ H5PB_dest(H5F_t *f) if(H5FL_fac_term(page_buf->page_fac) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTRELEASE, FAIL, "can't destroy page buffer page factory") - f->shared->page_buf = H5FL_FREE(H5PB_t, page_buf); + f_sh->page_buf = H5FL_FREE(H5PB_t, page_buf); } /* end if */ done: @@ -529,16 +528,18 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr) +herr_t +H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr) { - H5PB_t *page_buf = f->shared->page_buf; - H5PB_entry_t *page_entry = NULL; /* pointer to the corresponding page entry */ - herr_t ret_value = SUCCEED; /* Return value */ + H5PB_t *page_buf; /* Page buffer to operate on */ + H5PB_entry_t *page_entry = NULL; /* Pointer to the corresponding page entry */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ + HDassert(f_sh); + page_buf = f_sh->page_buf; HDassert(page_buf); /* If there is an existing page, this means that at some point the @@ -624,7 +625,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) * Function: H5PB_remove_entry * * Purpose: Remove possible metadata entry with ADDR from the PB cache. - * This is in response to the data corruption bug from fheap.c + * 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. @@ -636,15 +637,17 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) *------------------------------------------------------------------------- */ herr_t -H5PB_remove_entry(const H5F_t *f, haddr_t addr) +H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr) { - H5PB_t *page_buf = f->shared->page_buf; - H5PB_entry_t *page_entry = NULL; /* pointer to the page entry being searched */ - herr_t ret_value = SUCCEED; /* Return value */ + H5PB_t *page_buf; /* Page buffer to operate on */ + H5PB_entry_t *page_entry = NULL; /* Pointer to the page entry being searched */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ + HDassert(f_sh); + page_buf = f_sh->page_buf; HDassert(page_buf); /* Search for address in the skip list */ @@ -674,7 +677,7 @@ done: /*------------------------------------------------------------------------- * Function: H5PB_read * - * Purpose: Reads in the data from the page containing it if it exists + * Purpose: Reads in the data from the page containing it if it exists * in the PB cache; otherwise reads in the page through the VFD. * * Return: Non-negative on success/Negative on failure @@ -684,7 +687,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5PB_t *page_buf; /* Page buffering info for this file */ H5PB_entry_t *page_entry; /* Pointer to the corresponding page entry */ @@ -701,21 +704,21 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); HDassert(type != H5FD_MEM_GHEAP); /* Get pointer to page buffer info for this file */ - page_buf = f->shared->page_buf; + page_buf = f_sh->page_buf; #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) { #if 1 bypass_pb = TRUE; #else /* MSC - why this stopped working ? */ int mpi_size; - if((mpi_size = H5F_mpi_get_size(f)) < 0) + if((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") if(1 != mpi_size) bypass_pb = TRUE; @@ -729,7 +732,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ */ if(NULL == page_buf || size >= page_buf->page_size || (bypass_pb && H5FD_MEM_DRAW == type)) { - if(H5F__accum_read(f->shared, type, addr, size, buf) < 0) + if(H5F__accum_read(f_sh, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed") /* Update statistics */ @@ -780,7 +783,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ } /* end else */ /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; /* Copy raw data from dirty pages into the read buffer if the read request spans pages in the page buffer*/ @@ -884,7 +887,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ else page_buf->hits[0]++; } /* end if */ - /* if not found */ + /* if not found */ else { void *new_page_buf = NULL; size_t page_size = page_buf->page_size; @@ -895,7 +898,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ htri_t can_make_space; /* check if we can make space in page buffer */ - if((can_make_space = H5PB__make_space(f->shared, page_buf, type)) < 0) + if((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed") /* if make_space returns 0, then we can't use the page @@ -920,7 +923,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ /* Read page through the VFD layer, but make sure we don't read past the EOA. */ /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* If the entire page falls outside the EOA, then fail */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index efa9550..8bca219 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -85,13 +85,13 @@ typedef struct H5PB_t { /***************************************/ /* General routines */ -H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); +H5_DLL herr_t H5PB_create(H5F_file_t *f_sh, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); H5_DLL herr_t H5PB_flush(H5F_file_t *f_sh); -H5_DLL herr_t H5PB_dest(H5F_t *f); -H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); +H5_DLL herr_t H5PB_dest(H5F_file_t *f_sh); +H5_DLL herr_t H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); -H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr); +H5_DLL herr_t H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ |