From 85a56a9c4f9629bb92b4b16a1dada30ae30b5b21 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 19 Aug 2019 17:47:28 -0500 Subject: Partial H5F__accum_* routines. --- src/H5Faccum.c | 53 +++++++++++++++++++++++++---------------------------- src/H5Fint.c | 6 +++--- src/H5Fio.c | 2 +- src/H5Fpkg.h | 6 +++--- src/H5Fprivate.h | 1 + src/H5PB.c | 2 +- test/accum.c | 4 ++-- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 8d7852b..c2f6732 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -419,7 +419,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, const void *buf) { H5FD_t *file; /* File driver pointer */ @@ -428,19 +428,19 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); + HDassert(f_sh); + HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); HDassert(buf); /* Translate to file driver pointer */ - file = f->shared->lf; + file = f_sh->lf; /* Check for accumulating metadata */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ /* Set up alias for file's metadata accumulator info */ - accum = &f->shared->accum; + accum = &f_sh->accum; if(size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ @@ -732,9 +732,9 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end if */ else { /* Make certain that data in accumulator is visible before new write */ - if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0) + if((H5F_SHARED_INTENT(f_sh) & H5F_ACC_SWMR_WRITE) > 0) /* Flush if dirty and reset accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f_sh, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Write the data */ @@ -783,7 +783,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end if */ else { /* Access covers whole accumulator */ /* Reset accumulator, but don't flush */ - if(H5F__accum_reset(f, FALSE) < 0) + if(H5F__accum_reset(f_sh, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") } /* end else */ } /* end if */ @@ -1013,28 +1013,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_flush(H5F_t *f) +H5F__accum_flush(H5F_file_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* Check if we need to flush out the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f->shared->accum.dirty) { + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f_sh->accum.dirty) { H5FD_t *file; /* File driver pointer */ /* Translate to file driver pointer */ - file = f->shared->lf; + file = f_sh->lf; /* Flush the metadata contents */ - if(H5FD_write(file, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0) + if(H5FD_write(file, H5FD_MEM_DEFAULT, f_sh->accum.loc + f_sh->accum.dirty_off, f_sh->accum.dirty_len, f_sh->accum.buf + f_sh->accum.dirty_off) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") /* Reset the dirty flag */ - f->shared->accum.dirty = FALSE; + f_sh->accum.dirty = FALSE; } /* end if */ done: @@ -1056,34 +1056,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_reset(H5F_t *f, hbool_t flush) +H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* Flush any dirty data in accumulator, if requested */ if(flush) - if(H5F__accum_flush(f) < 0) + if(H5F__accum_flush(f_sh) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator") /* Check if we need to reset the metadata accumulator information */ - if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { - /* Sanity check */ - HDassert(!f->closing || FALSE == f->shared->accum.dirty); - + if(f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { /* Free the buffer */ - if(f->shared->accum.buf) - f->shared->accum.buf = H5FL_BLK_FREE(meta_accum, f->shared->accum.buf); + if(f_sh->accum.buf) + f_sh->accum.buf = H5FL_BLK_FREE(meta_accum, f_sh->accum.buf); /* Reset the buffer sizes & location */ - f->shared->accum.alloc_size = f->shared->accum.size = 0; - f->shared->accum.loc = HADDR_UNDEF; - f->shared->accum.dirty = FALSE; - f->shared->accum.dirty_len = 0; + f_sh->accum.alloc_size = f_sh->accum.size = 0; + f_sh->accum.loc = HADDR_UNDEF; + f_sh->accum.dirty = FALSE; + f_sh->accum.dirty_len = 0; } /* end if */ done: diff --git a/src/H5Fint.c b/src/H5Fint.c index 29f017e..afedeb9 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1346,7 +1346,7 @@ H5F__dest(H5F_t *f, hbool_t flush) } /* end if */ /* Destroy other components of the file */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") if(H5FO_dest(f) < 0) @@ -1905,7 +1905,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) #endif /* H5_HAVE_PARALLEL */ /* Flush out the metadata accumulator */ - if(H5F__accum_flush(f) < 0) + if(H5F__accum_flush(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") @@ -3416,7 +3416,7 @@ H5F__start_swmr_write(H5F_t *f) } /* end if */ /* Flush and reset the accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Turn on SWMR write in shared file open flags */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 69e6bb2..402db36 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -192,7 +192,7 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Flush and reset the accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Flush file buffers to disk. */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index dbf68c3..7af08a2 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -430,10 +430,10 @@ H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_cre /* Metadata accumulator routines */ H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); -H5_DLL herr_t H5F__accum_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL herr_t H5F__accum_flush(H5F_t *f); -H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); +H5_DLL herr_t H5F__accum_flush(H5F_file_t *f_sh); +H5_DLL herr_t H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush); /* Shared file list related routines */ H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 838fa28..a551495 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -278,6 +278,7 @@ typedef struct H5F_t H5F_t; #ifdef H5F_MODULE #define H5F_LOW_BOUND(F) ((F)->shared->low_bound) #define H5F_HIGH_BOUND(F) ((F)->shared->high_bound) +#define H5F_SHARED_INTENT(F_SH) ((F_SH)->flags) #define H5F_INTENT(F) ((F)->shared->flags) #define H5F_OPEN_NAME(F) ((F)->open_name) #define H5F_ACTUAL_NAME(F) ((F)->actual_name) diff --git a/src/H5PB.c b/src/H5PB.c index 25c5f43..088e25d 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -1025,7 +1025,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, * buffering. */ if(NULL == page_buf || size >= page_buf->page_size || bypass_pb) { - if(H5F__accum_write(f, type, addr, size, buf) < 0) + if(H5F__accum_write(f->shared, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") /* Update statistics */ diff --git a/test/accum.c b/test/accum.c index da90995..a5ef9e6 100644 --- a/test/accum.c +++ b/test/accum.c @@ -67,8 +67,8 @@ void accum_printf(const H5F_t *f); #define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_free(f,a,s) H5F__accum_free(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) -#define accum_flush(f) H5F__accum_flush(f) -#define accum_reset(f) H5F__accum_reset(f, TRUE) +#define accum_flush(f) H5F__accum_flush(f->shared) +#define accum_reset(f) H5F__accum_reset(f->shared, TRUE) /* ================= */ /* Main Test Routine */ -- cgit v0.12 From df36318b5f338d469db0086151d86601236e922a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 19 Aug 2019 18:00:05 -0500 Subject: Rest of changes for 'top' file pointer to 'shared' file pointer for H5F__accum routines. --- src/H5Faccum.c | 20 ++++++++++---------- src/H5Fpkg.h | 4 ++-- src/H5MF.c | 5 ++--- src/H5PB.c | 2 +- test/accum.c | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/H5Faccum.c b/src/H5Faccum.c index c2f6732..c2724b1 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -111,7 +111,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); *------------------------------------------------------------------------- */ herr_t -H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_t *file; /* File driver pointer */ @@ -120,18 +120,18 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); + HDassert(f_sh); HDassert(buf); /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; /* Check if this information is in the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ /* Set up alias for file's metadata accumulator info */ - accum = &f->shared->accum; + accum = &f_sh->accum; if(size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ @@ -847,7 +847,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_free(H5F_t *f, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, +H5F__accum_free(H5F_file_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, hsize_t size) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ @@ -857,16 +857,16 @@ H5F__accum_free(H5F_t *f, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); + HDassert(f_sh); /* Set up alias for file's metadata accumulator info */ - accum = &f->shared->accum; + accum = &f_sh->accum; /* Translate to file driver pointer */ - file = f->shared->lf; + file = f_sh->lf; /* Adjust the metadata accumulator to remove the freed block, if it overlaps */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && H5F_addr_overlap(addr, size, accum->loc, accum->size)) { size_t overlap_size; /* Size of overlap with accumulator */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7af08a2..7e7eca3 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -429,9 +429,9 @@ H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); /* Metadata accumulator routines */ -H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); +H5_DLL herr_t H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); H5_DLL herr_t H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); +H5_DLL herr_t H5F__accum_free(H5F_file_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5F__accum_flush(H5F_file_t *f_sh); H5_DLL herr_t H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush); diff --git a/src/H5MF.c b/src/H5MF.c index 3d9ddb0..e91fa14 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1133,11 +1133,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN /* If it's metadata, check if the space to free intersects with the file's * metadata accumulator */ - if(H5FD_MEM_DRAW != alloc_type) { + if(H5FD_MEM_DRAW != alloc_type) /* Check if the space to free intersects with the file's metadata accumulator */ - if(H5F__accum_free(f, alloc_type, addr, size) < 0) + if(H5F__accum_free(f->shared, alloc_type, addr, size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't check free space intersection w/metadata accumulator") - } /* end if */ /* Check if the free space manager for the file has been initialized */ if(!f->shared->fs_man[fs_type]) { diff --git a/src/H5PB.c b/src/H5PB.c index 088e25d..6acc0cc 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -729,7 +729,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, type, addr, size, buf) < 0) + if(H5F__accum_read(f->shared, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed") /* Update statistics */ diff --git a/test/accum.c b/test/accum.c index a5ef9e6..91acf0f 100644 --- a/test/accum.c +++ b/test/accum.c @@ -66,7 +66,7 @@ void accum_printf(const H5F_t *f); /* Private Test H5Faccum Function Wrappers */ #define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) -#define accum_free(f,a,s) H5F__accum_free(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) +#define accum_free(f,a,s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) #define accum_flush(f) H5F__accum_flush(f->shared) #define accum_reset(f) H5F__accum_reset(f->shared, TRUE) -- cgit v0.12 From f285c76ef25366e889d25ac8c223c91c080cf3b7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 19 Aug 2019 18:48:06 -0500 Subject: First pass of converting H5PB_* routines to use shared file pointers. --- src/H5Fint.c | 2 +- src/H5Fio.c | 2 +- src/H5Fmpi.c | 32 +++++++++++++++++++++ src/H5Fprivate.h | 7 +++++ src/H5Fquery.c | 69 +++++++++++++++++++++++++++++++++++++++++++++ src/H5PB.c | 83 +++++++++++++++++++++++++------------------------------ src/H5PBprivate.h | 4 +-- testpar/t_file.c | 2 +- 8 files changed, 151 insertions(+), 50 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index afedeb9..1c67cea 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1910,7 +1910,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") /* Flush the page buffer */ - if(H5PB_flush(f) < 0) + if(H5PB_flush(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "page buffer flush failed") diff --git a/src/H5Fio.c b/src/H5Fio.c index 402db36..63b033f 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -159,7 +159,7 @@ H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ - if(H5PB_write(f, map_type, addr, size, buf) < 0) + if(H5PB_write(f->shared, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") done: diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 12bcbc0..56f9547 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -170,6 +170,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_mpi_get_size + * + * Purpose: Retrieves the size of an MPI process. + * + * Return: Success: The size (positive) + * + * Failure: Negative + * + * Programmer: John Mainzer + * Friday, May 6, 2005 + * + *------------------------------------------------------------------------- + */ +int +H5F_shared_mpi_get_size(const H5F_file_t *f_sh) +{ + int ret_value = -1; + + FUNC_ENTER_NOAPI((-1)) + + HDassert(f_sh); + + /* Dispatch to driver */ + if((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_mpi_get_size() */ + + +/*------------------------------------------------------------------------- * Function: H5F_mpi_get_size * * Purpose: Retrieves the size of an MPI process. diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index a551495..cd38202 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -294,6 +294,7 @@ typedef struct H5F_t H5F_t; #define H5F_GET_READ_ATTEMPTS(F) ((F)->shared->read_attempts) #define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id) #define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno) +#define H5F_SHARED_HAS_FEATURE(F_SH,FL) ((F_SH)->lf->feature_flags & (FL)) #define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL)) #define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr) #define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k) @@ -337,6 +338,7 @@ typedef struct H5F_t H5F_t; #else /* H5F_MODULE */ #define H5F_LOW_BOUND(F) (H5F_get_low_bound(F)) #define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F)) +#define H5F_SHARED_INTENT(F_SH) (H5F_shared_get_intent(F_SH)) #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_OPEN_NAME(F) (H5F_get_open_name(F)) #define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F)) @@ -352,6 +354,7 @@ typedef struct H5F_t H5F_t; #define H5F_GET_READ_ATTEMPTS(F) (H5F_get_read_attempts(F)) #define H5F_DRIVER_ID(F) (H5F_get_driver_id(F)) #define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM))) +#define H5F_SHARED_HAS_FEATURE(F_SH,FL) (H5F_shared_has_feature(F_SH,FL)) #define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL)) #define H5F_BASE_ADDR(F) (H5F_get_base_addr(F)) #define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F)) @@ -724,6 +727,7 @@ H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f); +H5_DLL unsigned H5F_shared_get_intent(const H5F_file_t *f); H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL char *H5F_get_open_name(const H5F_t *f); H5_DLL char *H5F_get_actual_name(const H5F_t *f); @@ -787,7 +791,9 @@ H5_DLL char *H5F_mdc_log_location(const H5F_t *f); /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); +H5_DLL hbool_t H5F_shared_has_feature(const H5F_file_t *f, unsigned feature); H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); +H5_DLL haddr_t H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type); H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type); H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle); @@ -838,6 +844,7 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f); H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); +H5_DLL int H5F_shared_mpi_get_size(const H5F_file_t *f_sh); H5_DLL int H5F_mpi_get_size(const H5F_t *f); H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index c168535..5b5f748 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -75,6 +75,28 @@ /*------------------------------------------------------------------------- + * Function: H5F_shared_get_intent + * + * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags + * (Mainly added to stop non-file routines from poking about in the + * H5F_file_t data structure) + * + * Return: 'intent' on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +unsigned +H5F_shared_get_intent(const H5F_file_t *f_sh) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + + FUNC_LEAVE_NOAPI(f_sh->flags) +} /* end H5F_shared_get_intent() */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_intent * * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags @@ -827,6 +849,27 @@ H5F_store_msg_crt_idx(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_shared_has_feature + * + * Purpose: Check if a file has a particular feature enabled + * + * Return: Success: Non-negative - TRUE or FALSE + * Failure: Negative (should not happen) + *------------------------------------------------------------------------- + */ +hbool_t +H5F_shared_has_feature(const H5F_file_t *f_sh, unsigned feature) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + + FUNC_LEAVE_NOAPI((hbool_t)(f_sh->lf->feature_flags & feature)) +} /* end H5F_shared_has_feature() */ + + +/*------------------------------------------------------------------------- * Function: H5F_has_feature * * Purpose: Check if a file has a particular feature enabled @@ -904,6 +947,32 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_get_eoa + * + * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +haddr_t +H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type) +{ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ + + FUNC_ENTER_NOAPI(HADDR_UNDEF) + + HDassert(f_sh); + + /* Dispatch to driver */ + if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f_sh->lf, type))) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_get_eoa() */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_eoa * * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value diff --git a/src/H5PB.c b/src/H5PB.c index 6acc0cc..89f80dd 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -124,8 +124,8 @@ typedef struct { /* Local Prototypes */ /********************/ static herr_t H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry); -static htri_t H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type); -static herr_t H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry); +static htri_t H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type); +static herr_t H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry); /*********************/ @@ -370,18 +370,18 @@ static herr_t H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) { H5PB_entry_t *page_entry = (H5PB_entry_t *)item; /* Pointer to page entry node */ - H5F_t *f = (H5F_t *)_op_data; + H5F_file_t *f_sh = (H5F_file_t *)_op_data; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ HDassert(page_entry); - HDassert(f); + HDassert(f_sh); /* Flush the page if it's dirty */ if(page_entry->is_dirty) - if(H5PB__write_entry(f, page_entry) < 0) + if(H5PB__write_entry(f_sh, page_entry) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") done: @@ -401,21 +401,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_flush(H5F_t *f) +H5PB_flush(H5F_file_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); + HDassert(f_sh); /* Flush all the entries in the PB skiplist, if we have write access on the file */ - if(f->shared->page_buf && (H5F_ACC_RDWR & H5F_INTENT(f))) { - H5PB_t *page_buf = f->shared->page_buf; + if(f_sh->page_buf && (H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh))) { + H5PB_t *page_buf = f_sh->page_buf; /* Iterate over all entries in page buffer skip list */ - if(H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, (void *)f)) + if(H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, f_sh)) HGOTO_ERROR(H5E_PAGEBUF, H5E_BADITER, FAIL, "can't flush page buffer skip list") } /* end if */ @@ -487,7 +487,7 @@ H5PB_dest(H5F_t *f) H5PB_t *page_buf = f->shared->page_buf; H5PB_ud1_t op_data; /* Iteration context */ - if(H5PB_flush(f) < 0) + if(H5PB_flush(f->shared) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer") /* Set up context info */ @@ -895,7 +895,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, page_buf, type)) < 0) + if((can_make_space = H5PB__make_space(f->shared, 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 @@ -981,7 +981,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, +H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5PB_t *page_buf; /* Page buffering info for this file */ @@ -999,20 +999,20 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* 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; @@ -1025,7 +1025,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, * buffering. */ if(NULL == page_buf || size >= page_buf->page_size || bypass_pb) { - if(H5F__accum_write(f->shared, type, addr, size, buf) < 0) + if(H5F__accum_write(f_sh, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") /* Update statistics */ @@ -1084,7 +1084,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, } /* end else */ /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; /* Check if existing pages for raw data need to be updated since raw data access is not atomic */ if(H5FD_MEM_DRAW == type && size >= page_buf->page_size) { @@ -1186,7 +1186,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, else page_buf->hits[0]++; } /* end if */ - /* If not found */ + /* If not found */ else { void *new_page_buf; size_t page_size = page_buf->page_size; @@ -1196,7 +1196,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, htri_t can_make_space; /* Check if we can make space in page buffer */ - if((can_make_space = H5PB__make_space(f, 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 @@ -1208,14 +1208,14 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, /* Write to VFD and return */ if(H5FD_write(file, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "driver write request failed") - + /* Break out of loop */ break; } /* end if */ } /* end if */ /* Don't bother searching if there is no write access */ - if(H5F_ACC_RDWR & H5F_INTENT(f)) + if(H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh)) /* Lookup & remove the page from the new skip list page if * it exists to see if this is a new page from the MF layer */ @@ -1258,7 +1258,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, page_entry->type = (H5F_mem_page_t)type; /* 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 */ @@ -1269,8 +1269,8 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, * returned will most likely be HADDR_UNDEF, so skip * that check. */ - if(!H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) - if(HADDR_UNDEF == (eof = H5FD_get_eof(f->shared->lf, H5FD_MEM_DEFAULT))) + if(!H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) + if(HADDR_UNDEF == (eof = H5FD_get_eof(f_sh->lf, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eof request failed") /* Adjust the read size to not go beyond the EOA */ @@ -1360,26 +1360,19 @@ done: /*------------------------------------------------------------------------- * Function: H5PB__make_space() * - * Purpose: ??? - * - * This function was created without documentation. - * What follows is my best understanding of Mohamad's intent. - * - * If necessary and if possible, evict a page from the page - * buffer to make space for the supplied page. Depending on - * the page buffer configuration and contents, and the page + * Purpose: If necessary and if possible, evict a page from the page + * buffer to make space for the supplied page. Depending on + * the page buffer configuration and contents, and the page * supplied this may or may not be possible. * - * JRM -- 12/22/16 - * * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi * *------------------------------------------------------------------------- */ -static htri_t -H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type) +static htri_t +H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) { H5PB_entry_t *page_entry; /* Pointer to page eviction candidate */ htri_t ret_value = TRUE; /* Return value */ @@ -1387,7 +1380,7 @@ H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(f); + HDassert(f_sh); HDassert(page_buf); /* Get oldest entry */ @@ -1444,7 +1437,7 @@ H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type) /* Flush page if dirty */ if(page_entry->is_dirty) - if(H5PB__write_entry(f, page_entry) < 0) + if(H5PB__write_entry(f_sh, page_entry) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") /* Update statistics */ @@ -1478,7 +1471,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry) +H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry) { haddr_t eoa; /* Current EOA for the file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1486,11 +1479,11 @@ H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(f); + HDassert(f_sh); HDassert(page_entry); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, (H5FD_mem_t)page_entry->type))) + if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, (H5FD_mem_t)page_entry->type))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* If the starting address of the page is larger than @@ -1498,14 +1491,14 @@ H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry) */ if(page_entry->addr <= eoa) { H5FD_t *file; /* File driver I/O info */ - size_t page_size = f->shared->page_buf->page_size; + size_t page_size = f_sh->page_buf->page_size; /* Adjust the page length if it exceeds the EOA */ if((page_entry->addr + page_size) > eoa) page_size = (size_t)(eoa - page_entry->addr); /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; if(H5FD_write(file, (H5FD_mem_t)page_entry->type, page_entry->addr, page_size, page_entry->page_buf_ptr) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index b94b845..efa9550 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -86,13 +86,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_flush(H5F_t *f); +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_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_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +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 */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); diff --git a/testpar/t_file.c b/testpar/t_file.c index 4ecfc30..a3c007d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -250,7 +250,7 @@ test_page_buffer_access(void) VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); - ret = H5PB_flush(f); + ret = H5PB_flush(f->shared); VRFY((ret == 0), ""); /* read elements 0 - 200 */ -- cgit v0.12 From 25f982abbd5f0dddf0315f994171cd9c9f037cb9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 17:26:10 -0500 Subject: Finish converting H5PB_* routines to use shared file pointer, instead of top file pointer. --- src/H5Fint.c | 6 ++--- src/H5Fio.c | 4 +-- src/H5MF.c | 2 +- src/H5MFsection.c | 2 +- src/H5PB.c | 81 ++++++++++++++++++++++++++++--------------------------- 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 diff --git a/src/H5MF.c b/src/H5MF.c index e91fa14..b1467ff 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -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) diff --git a/src/H5PB.c b/src/H5PB.c index 89f80dd..42c1cba 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -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 */ -- cgit v0.12 From 67d7d28c038fb027feed570d6e6b25fdab4865dc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 18:21:53 -0500 Subject: Begin converting dataset code to use shared file pointer instead of top file pointer. --- src/H5Dcontig.c | 60 +++++++++++++++++++------------------- src/H5Dio.c | 1 + src/H5Dpkg.h | 4 +++ src/H5Fio.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Fprivate.h | 2 ++ 5 files changed, 126 insertions(+), 30 deletions(-) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 8733633..8f7a7ca 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -58,7 +58,7 @@ /* Callback info for sieve buffer readvv operation */ typedef struct H5D_contig_readvv_sieve_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *rbuf; /* Pointer to buffer to fill */ @@ -66,14 +66,14 @@ typedef struct H5D_contig_readvv_sieve_ud_t { /* Callback info for [plain] readvv operation */ typedef struct H5D_contig_readvv_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ unsigned char *rbuf; /* Pointer to buffer to fill */ } H5D_contig_readvv_ud_t; /* Callback info for sieve buffer writevv operation */ typedef struct H5D_contig_writevv_sieve_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *wbuf; /* Pointer to buffer to write */ @@ -81,7 +81,7 @@ typedef struct H5D_contig_writevv_sieve_ud_t { /* Callback info for [plain] writevv operation */ typedef struct H5D_contig_writevv_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ const unsigned char *wbuf; /* Pointer to buffer to write */ } H5D_contig_writevv_ud_t; @@ -718,7 +718,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_t *file = udata->file; /* File for dataset */ + H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *buf; /* Pointer to buffer to fill */ @@ -750,7 +750,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == dset_contig->sieve_buf) { /* Check if we can actually hold the I/O request in the sieve buffer */ if(len > dset_contig->sieve_buf_size) { - if(H5F_block_read(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ else { @@ -762,7 +762,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Set up the buffer parameters */ @@ -773,7 +773,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t); /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -804,7 +804,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer, if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -813,7 +813,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ /* Read directly into the user's buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ /* Element size fits within the buffer size */ @@ -821,7 +821,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -832,7 +832,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Only need this when resizing sieve buffer */ @@ -847,7 +847,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t); /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -885,7 +885,7 @@ H5D__contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata FUNC_ENTER_STATIC /* Write data */ - if(H5F_block_read(udata->file, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), + if(H5F_shared_block_read(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->rbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") @@ -931,11 +931,11 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, HDassert(mem_off_arr); /* Check if data sieving is enabled */ - if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) { + if(H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) { H5D_contig_readvv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); udata.rbuf = (unsigned char *)io_info->u.rbuf; @@ -950,7 +950,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, H5D_contig_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_addr = io_info->store->contig.dset_addr; udata.rbuf = (unsigned char *)io_info->u.rbuf; @@ -983,7 +983,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_t *file = udata->file; /* File for dataset */ + H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *buf; /* Pointer to buffer to fill */ @@ -1015,7 +1015,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == dset_contig->sieve_buf) { /* Check if we can actually hold the I/O request in the sieve buffer */ if(len > dset_contig->sieve_buf_size) { - if(H5F_block_write(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") } /* end if */ else { @@ -1031,7 +1031,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Set up the buffer parameters */ @@ -1044,7 +1044,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Check if there is any point in reading the data from the file */ if(dset_contig->sieve_size > len) { /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ @@ -1084,7 +1084,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer, if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -1097,7 +1097,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ /* Write directly from the user's buffer */ - if(H5F_block_write(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") } /* end if */ /* Element size fits within the buffer size */ @@ -1132,7 +1132,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -1143,7 +1143,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Only need this when resizing sieve buffer */ @@ -1160,7 +1160,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Check if there is any point in reading the data from the file */ if(dset_contig->sieve_size > len) { /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ @@ -1200,7 +1200,7 @@ H5D__contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udat FUNC_ENTER_STATIC /* Write data */ - if(H5F_block_write(udata->file, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->wbuf + src_off)) < 0) + if(H5F_shared_block_write(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->wbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") done: @@ -1245,11 +1245,11 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, HDassert(mem_off_arr); /* Check if data sieving is enabled */ - if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) { + if(H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) { H5D_contig_writevv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); udata.wbuf = (const unsigned char *)io_info->u.wbuf; @@ -1264,7 +1264,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, H5D_contig_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_addr = io_info->store->contig.dset_addr; udata.wbuf = (const unsigned char *)io_info->u.wbuf; diff --git a/src/H5Dio.c b/src/H5Dio.c index cdb73e3..1e6e70d 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -857,6 +857,7 @@ H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, /* Set up "normal" I/O fields */ io_info->dset = dset; + io_info->f_sh = H5F_SHARED(dset->oloc.file); io_info->store = store; /* Set I/O operations to initial values */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 638c8a5..878fda3 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -47,11 +47,13 @@ /* [Simple] Macro to construct a H5D_io_info_t from it's components */ #define H5D_BUILD_IO_INFO_WRT(io_info, ds, str, buf) \ (io_info)->dset = ds; \ + (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_WRITE; \ (io_info)->u.wbuf = buf #define H5D_BUILD_IO_INFO_RD(io_info, ds, str, buf) \ (io_info)->dset = ds; \ + (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_READ; \ (io_info)->u.rbuf = buf @@ -207,6 +209,8 @@ typedef enum H5D_io_op_type_t { typedef struct H5D_io_info_t { const H5D_t *dset; /* Pointer to dataset being operated on */ +/* QAK: Delete the f_sh field when oloc has a shared file pointer? */ + H5F_file_t *f_sh; /* Pointer to shared file struct that dataset is within */ #ifdef H5_HAVE_PARALLEL MPI_Comm comm; /* MPI communicator for file */ hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ diff --git a/src/H5Fio.c b/src/H5Fio.c index a4a6e01..d2d0dba 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -77,6 +77,50 @@ /*------------------------------------------------------------------------- + * Function: H5F_shared_block_read + * + * Purpose: Reads some data from a file/server/etc into a buffer. + * The data is contiguous. The address is relative to the base + * address for the file. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +{ + H5FD_mem_t map_type; /* Mapped memory type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f_sh); + HDassert(buf); + HDassert(H5F_addr_defined(addr)); + + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + + /* Pass through page buffer layer */ + if(H5PB_read(f_sh, map_type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_block_read() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. @@ -122,6 +166,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_block_write + * + * Purpose: Writes some data from memory to a file/server/etc. The + * data is contiguous. The address is relative to the base + * address. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) +{ + H5FD_mem_t map_type; /* Mapped memory type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f_sh); + HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); + HDassert(buf); + HDassert(H5F_addr_defined(addr)); + + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + + /* Pass through page buffer layer */ + if(H5PB_write(f_sh, map_type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_block_write() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_write * * Purpose: Writes some data from memory to a file/server/etc. The diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index cd38202..1b8d07c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -804,7 +804,9 @@ H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/); H5_DLL herr_t H5F_flush_mounts(H5F_t *f); /* Functions that operate on blocks of bytes wrt super block */ +H5_DLL herr_t H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Functions that flush or evict */ -- cgit v0.12 From 2ef7eb51b99a3e015efdecedd64c0be1ad77615c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 20:38:10 -0500 Subject: Progress toward moving the dataset routines to using the 'shared' file pointer instead of the 'top' file pointer. --- src/H5Dchunk.c | 25 ++++++++++++++----------- src/H5Dint.c | 2 +- src/H5Dmpio.c | 6 +++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ec8ea4d..082aac3 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -393,7 +393,6 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, H5D_chk_idx_info_t idx_info; /* Chunked index info */ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - H5D_io_info_t io_info; /* to hold the dset info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -401,13 +400,17 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, /* Sanity checks */ HDassert(layout->type == H5D_CHUNKED); - io_info.dset = dset; - /* Allocate dataspace and initialize it if it hasn't been. */ - if(!H5D__chunk_is_space_alloc(&layout->storage)) + if(!H5D__chunk_is_space_alloc(&layout->storage)) { + H5D_io_info_t io_info; /* to hold the dset info */ + + io_info.dset = dset; + io_info.f_sh = H5F_SHARED(dset->oloc.file); + /* Allocate storage */ if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") + } /* end if */ /* Calculate the index of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); @@ -467,7 +470,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, } /* end if */ /* Write the data to the file */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ @@ -570,9 +573,9 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") /* Read the chunk data into the supplied buffer */ - if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, buf) < 0) + if(H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") - + /* Return the filter mask */ *filters = udata.filter_mask; @@ -3332,7 +3335,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) /* Write the data to the file */ HDassert(H5F_addr_defined(udata.chunk_block.offset)); H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t); - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ @@ -3803,7 +3806,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, * size in memory, so allocate memory big enough. */ if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, (udata->new_unfilt_chunk ? old_pline : pline)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, chunk) < 0) + if(H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, chunk) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") if(old_pline && old_pline->nused) { @@ -4533,7 +4536,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, *fill_buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, *fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -4918,7 +4921,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* Low-level write (collective) */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Barrier so processes don't race ahead */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 1e9c6ff..ada542e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2932,7 +2932,7 @@ H5D__flush_sieve_buf(H5D_t *dataset) HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */ /* Write dirty data sieve buffer to file */ - if(H5F_block_write(dataset->oloc.file, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc, + if(H5F_shared_block_write(H5F_SHARED(dataset->oloc.file), H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc, dataset->shared->cache.contig.sieve_size, dataset->shared->cache.contig.sieve_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 467b1b7..0dbbe9f 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -457,7 +457,7 @@ H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATT FUNC_ENTER_PACKAGE H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.rbuf) < 0) + if(H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.rbuf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read") done: @@ -487,7 +487,7 @@ H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_AT /*OKAY: CAST DISCARDS CONST QUALIFIER*/ H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if(H5F_block_write(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.wbuf) < 0) + if(H5F_shared_block_write(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.wbuf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write") done: @@ -3153,7 +3153,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk if(H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") - if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, chunk_entry->chunk_states.chunk_current.offset, + if(H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, chunk_entry->chunk_states.chunk_current.offset, chunk_entry->chunk_states.new_chunk.length, chunk_entry->buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data chunk") -- cgit v0.12 From 53eaeff26af649a1947f1b2889c3bf185b285112 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 21:07:13 -0500 Subject: Begin converting the H5MF interface to use shared file pointers instead of top file pointers. --- src/H5Fint.c | 2 +- src/H5Fprivate.h | 1 + src/H5MF.c | 104 ++++++++++++++++++++++++++++-------------------------- src/H5MFpkg.h | 17 ++++----- src/H5MFprivate.h | 2 +- test/mf.c | 39 ++++++++++---------- 6 files changed, 82 insertions(+), 83 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 4a0c397..f27a263 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1041,7 +1041,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ if(H5FD_get_fs_type_map(lf, f->shared->fs_type_map) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get free space type mapping from VFD") - if(H5MF_init_merge_flags(f) < 0) + if(H5MF_init_merge_flags(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "problem initializing free space merge flags") f->shared->tmp_addr = f->shared->maxaddr; /* Disable temp. space allocation for parallel I/O (for now) */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1b8d07c..f196ec0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -579,6 +579,7 @@ typedef struct H5F_t H5F_t; #define H5F_SDATA_BLOCK_SIZE_DEF 2048 /* Check for file using paged aggregation */ +#define H5F_SHARED_PAGED_AGGR(F_SH) ((F_SH)->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && (F_SH)->fs_page_size) #define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size) /* Metadata read attempt values */ diff --git a/src/H5MF.c b/src/H5MF.c index b1467ff..626b0ec 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -55,6 +55,11 @@ if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ *CF = TRUE; +/* For non-paged aggregation: map allocation request type to tracked free-space type */ +/* F_SH -- pointer to H5F_file_t; T -- H5FD_mem_t */ +#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F_SH, T) \ + ((H5FD_MEM_DEFAULT == (F_SH)->fs_type_map[T]) ? (T) : (F_SH)->fs_type_map[T]) + /******************/ /* Local Typedefs */ /******************/ @@ -141,7 +146,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; *------------------------------------------------------------------------- */ herr_t -H5MF_init_merge_flags(H5F_t *f) +H5MF_init_merge_flags(H5F_file_t *f_sh) { H5MF_aggr_merge_t mapping_type; /* Type of free list mapping */ H5FD_mem_t type; /* Memory type for iteration */ @@ -151,9 +156,8 @@ H5MF_init_merge_flags(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + HDassert(f_sh); + HDassert(f_sh->lf); /* Iterate over all the free space types to determine if sections of that type * can merge with the metadata or small 'raw' data aggregator @@ -161,21 +165,21 @@ H5MF_init_merge_flags(H5F_t *f) all_same = TRUE; for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) /* Check for any different type mappings */ - if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_DEFAULT]) { + if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_DEFAULT]) { all_same = FALSE; break; } /* end if */ /* Check for all allocation types mapping to the same free list type */ if(all_same) { - if(f->shared->fs_type_map[H5FD_MEM_DEFAULT] == H5FD_MEM_DEFAULT) + if(f_sh->fs_type_map[H5FD_MEM_DEFAULT] == H5FD_MEM_DEFAULT) mapping_type = H5MF_AGGR_MERGE_SEPARATE; else mapping_type = H5MF_AGGR_MERGE_TOGETHER; } /* end if */ else { /* Check for raw data mapping into same list as metadata */ - if(f->shared->fs_type_map[H5FD_MEM_DRAW] == f->shared->fs_type_map[H5FD_MEM_SUPER]) + if(f_sh->fs_type_map[H5FD_MEM_DRAW] == f_sh->fs_type_map[H5FD_MEM_SUPER]) mapping_type = H5MF_AGGR_MERGE_SEPARATE; else { hbool_t all_metadata_same; /* Whether all metadata go in same free list */ @@ -188,7 +192,7 @@ H5MF_init_merge_flags(H5F_t *f) /* (global heap is treated as raw data) */ if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { /* Check for any different type mappings */ - if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_SUPER]) { + if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_SUPER]) { all_metadata_same = FALSE; break; } /* end if */ @@ -206,30 +210,30 @@ H5MF_init_merge_flags(H5F_t *f) switch(mapping_type) { case H5MF_AGGR_MERGE_SEPARATE: /* Don't merge any metadata together */ - HDmemset(f->shared->fs_aggr_merge, 0, sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, 0, sizeof(f_sh->fs_aggr_merge)); /* Check if merging raw data should be allowed */ /* (treat global heaps as raw data) */ - if(H5FD_MEM_DRAW == f->shared->fs_type_map[H5FD_MEM_DRAW] || - H5FD_MEM_DEFAULT == f->shared->fs_type_map[H5FD_MEM_DRAW]) { - f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; - f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + if(H5FD_MEM_DRAW == f_sh->fs_type_map[H5FD_MEM_DRAW] || + H5FD_MEM_DEFAULT == f_sh->fs_type_map[H5FD_MEM_DRAW]) { + f_sh->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; } /* end if */ break; case H5MF_AGGR_MERGE_DICHOTOMY: /* Merge all metadata together (but not raw data) */ - HDmemset(f->shared->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f_sh->fs_aggr_merge)); /* Allow merging raw data allocations together */ /* (treat global heaps as raw data) */ - f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; - f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; break; case H5MF_AGGR_MERGE_TOGETHER: /* Merge all allocation types together */ - HDmemset(f->shared->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), sizeof(f_sh->fs_aggr_merge)); break; default: @@ -254,31 +258,32 @@ done: *------------------------------------------------------------------------- */ void -H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { FUNC_ENTER_PACKAGE_NOERR - HDassert(f); + /* Check arguments */ + HDassert(f_sh); HDassert(fs_type); - if(H5F_PAGED_AGGR(f)) { /* paged aggregation */ - if(size >= f->shared->fs_page_size) { - if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR)) { /* multi or split driver */ + if(H5F_SHARED_PAGED_AGGR(f_sh)) { /* paged aggregation */ + if(size >= f_sh->fs_page_size) { + if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_PAGED_AGGR)) { /* multi or split driver */ /* For non-contiguous address space, map to large size free-space manager for each alloc_type */ - if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[alloc_type]) - *fs_type = (H5F_mem_page_t) (alloc_type + (H5FD_MEM_NTYPES - 1)); + if(H5FD_MEM_DEFAULT == f_sh->fs_type_map[alloc_type]) + *fs_type = (H5F_mem_page_t)(alloc_type + (H5FD_MEM_NTYPES - 1)); else - *fs_type = (H5F_mem_page_t) (f->shared->fs_type_map[alloc_type] + (H5FD_MEM_NTYPES - 1)); + *fs_type = (H5F_mem_page_t)(f_sh->fs_type_map[alloc_type] + (H5FD_MEM_NTYPES - 1)); } /* end if */ else /* For contiguous address space, map to generic large size free-space manager */ *fs_type = H5F_MEM_PAGE_GENERIC; /* H5F_MEM_PAGE_SUPER */ } /* end if */ else - *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); + *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f_sh, alloc_type); } /* end if */ else /* non-paged aggregation */ - *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); + *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f_sh, alloc_type); FUNC_LEAVE_NOAPI_VOID } /* end H5MF__alloc_to_fs_type() */ @@ -620,7 +625,6 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__close_fstype() */ - /*------------------------------------------------------------------------- * Function: H5MF__add_sect @@ -649,7 +653,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio HDassert(fspace); HDassert(node); - H5MF__alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, node->sect_info.size, &fs_type); /* Construct user data for callbacks */ udata.f = f; @@ -801,7 +805,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HDassert(f->shared->lf); HDassert(size > 0); - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.0\n", FUNC); @@ -907,10 +911,10 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); switch(ptype) { - case H5F_MEM_PAGE_GENERIC: + case H5F_MEM_PAGE_GENERIC: case H5F_MEM_PAGE_LARGE_BTREE: case H5F_MEM_PAGE_LARGE_DRAW: case H5F_MEM_PAGE_LARGE_GHEAP: @@ -1108,7 +1112,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_DONE(SUCCEED) HDassert(addr != 0); /* Can't deallocate the superblock :-) */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1325,7 +1329,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ /* Get free space type from allocation type */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1476,7 +1480,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(sect_cls); /* Get free space type from allocation type */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -2730,7 +2734,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2875,7 +2879,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -3119,8 +3123,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* should only be called if file is opened R/W */ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3136,8 +3140,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type]; if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); @@ -3398,18 +3402,18 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); } /* end if */ else { - /* In principle, fsm_type should always be less than + /* In principle, fsm_type should always be less than * H5F_MEM_PAGE_LARGE_SUPER whenever paged aggregation * is not enabled. However, since there is code that does * not observe this principle, force the result to FALSE if @@ -3452,15 +3456,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) HDassert(f->shared); HDassert(fspace); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index ec4aab4..47ebc5c 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -55,11 +55,6 @@ #define H5MF_FSPACE_SECT_SMALL 1 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */ #define H5MF_FSPACE_SECT_LARGE 2 /* For paged aggregation: "large" Section which is >= fsp_size) */ -/* For non-paged aggregation: map allocation request type to tracked free-space type */ -/* F -- pointer to H5F_t; T -- H5FD_mem_t */ -#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F, T) \ - ((H5FD_MEM_DEFAULT == (F)->shared->fs_type_map[T]) ? (T) : (F)->shared->fs_type_map[T]) - /* Get section class type based on size */ #define H5MF_SECT_CLASS_TYPE(F, S) \ ((H5F_PAGED_AGGR(F)) ? \ @@ -182,13 +177,10 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]; /* Allocator routines */ H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); - H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); - -H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); - -H5_DLL void H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); +H5_DLL void H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, + hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, @@ -206,6 +198,11 @@ H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size); +/* Debugging routines */ +#ifdef H5MF_ALLOC_DEBUG_DUMP +H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); +#endif /* H5MF_ALLOC_DEBUG_DUMP */ + /* Testing routines */ #ifdef H5MF_TESTING #endif /* H5MF_TESTING */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index bd57f05..3569615 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -48,7 +48,7 @@ /***************************************/ /* File space manager routines */ -H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f); +H5_DLL herr_t H5MF_init_merge_flags(H5F_file_t *f_sh); H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f); H5_DLL herr_t H5MF_try_close(H5F_t *f); diff --git a/test/mf.c b/test/mf.c index fe98000..9317bd8 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6816,7 +6816,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Verify that H5FD_MEM_SUPER free-space manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[tt])) @@ -6966,7 +6966,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4))) FAIL_STACK_ERROR - + /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -6990,7 +6990,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); /* Verify that the H5FD_MEM_SUPER free-space manager is not there */ if(H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7163,7 +7163,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - + /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -7185,7 +7185,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(file))) @@ -7195,7 +7195,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for hssize_t nsects; /* # of free-space sections */ int i; /* local index variable */ H5F_sect_info_t *sect_info; /* array to hold the free-space information */ - + /* Get the # of free-space sections in the file */ if((nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL)) < 0) FAIL_STACK_ERROR @@ -7210,7 +7210,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)); H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); - + /* Verify the size of free-space sections */ for(i = 0; i < nsects; i++) if(sect_info[i].size < fs_threshold) @@ -7336,13 +7336,12 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* For paged aggregation, the section in the page at EOF for small meta fs is not shrunk away */ - if(fs_type == H5F_FSPACE_STRATEGY_PAGE) { + if(fs_type == H5F_FSPACE_STRATEGY_PAGE) if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0) FAIL_STACK_ERROR - } /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0) @@ -7637,7 +7636,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); @@ -7647,8 +7646,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF_xfree(f, H5FD_MEM_OHDR, addr2, (hsize_t)TBLOCK_SIZE1034); if(!fs_persist) { - - H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7680,8 +7678,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF_xfree(f, H5FD_MEM_DRAW, gaddr1, (hsize_t)TBLOCK_SIZE5000); if(!fs_persist) { - - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with gaddr1 is found from the large data manager */ if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7702,18 +7699,18 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Re-open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) TEST_ERROR - + /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Verify that the large generic manager is there */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR /* Verify that the small metadata manager is there */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7732,7 +7729,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Verify that the small raw data manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[H5F_MEM_PAGE_DRAW])) TEST_ERROR - + /* Set up to use the small raw data manager */ if(!(f->shared->fs_man[H5F_MEM_PAGE_DRAW])) if(H5MF__open_fstype(f, H5F_MEM_PAGE_DRAW) < 0) @@ -7744,7 +7741,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(found_addr != saddr1) TEST_ERROR - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!(f->shared->fs_man[fs_type])) /* Set up to use the large data manager */ @@ -7756,7 +7753,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR if(found_addr != gaddr1) TEST_ERROR - + /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR -- cgit v0.12 From 901c42640ffc3439af2cfd3ed756216f967f8a67 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 21:32:13 -0500 Subject: Progress on moving the H5MF* interface to using shared file pointers instead of top file pointers. --- src/H5MF.c | 77 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/src/H5MF.c b/src/H5MF.c index 626b0ec..40e954a 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -98,7 +98,7 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); /* General routines */ static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); -static hbool_t H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type); +static hbool_t H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type); static hbool_t H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace); static herr_t H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); @@ -345,7 +345,7 @@ H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type) } /* end else */ /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, type)) + if(H5MF__fsm_type_is_self_referential(f->shared, type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -433,7 +433,7 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) } /* end else */ /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, type)) + if(H5MF__fsm_type_is_self_referential(f->shared, type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -549,7 +549,7 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) f->shared->fs_state[type] = H5F_FS_STATE_DELETING; /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, type)) + if(H5MF__fsm_type_is_self_referential(f->shared, type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -812,7 +812,7 @@ HDfprintf(stderr, "%s: Check 1.0\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1115,7 +1115,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1332,7 +1332,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1483,7 +1483,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1666,10 +1666,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * * The situation is further complicated if a cache image exists * and had not yet been loaded into the metadata cache. In this - * case, call H5AC_force_cache_image_load() instead of + * case, call H5AC_force_cache_image_load() instead of * H5MF_tidy_self_referential_fsm_hack(). H5AC_force_cache_image_load() - * will load the cache image, and then call - * H5MF_tidy_self_referential_fsm_hack() to discard the cache image + * will load the cache image, and then call + * H5MF_tidy_self_referential_fsm_hack() to discard the cache image * block. */ @@ -1683,12 +1683,12 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t ptype; /* Memory type for iteration */ - /* Iterate over all the free space types that have managers and - * get each free list's space + /* Iterate over all the free space types that have managers and + * get each free list's space */ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ptype)) + if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -1705,12 +1705,12 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); else { H5FD_mem_t type; /* Memory type for iteration */ - /* Iterate over all the free space types that have managers and - * get each free list's space + /* Iterate over all the free space types that have managers and + * get each free list's space */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -1827,9 +1827,9 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; - else + else needed_ring = H5AC_RING_RDFSM; if(needed_ring != curr_ring) { @@ -1977,7 +1977,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* gather data for the free space manager superblock extension message. * Only need addresses of FSMs and eoa prior to allocation of - * file space for the self referential free space managers. Other + * file space for the self referential free space managers. Other * data was gathered above. */ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) @@ -1993,7 +1993,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ptype)) + if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2128,7 +2128,7 @@ H5MF__close_shrink_eoa(H5F_t *f) for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ptype)) + if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2152,7 +2152,7 @@ H5MF__close_shrink_eoa(H5F_t *f) for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2272,7 +2272,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end if */ /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2302,7 +2302,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Close the free-space managers if they were opened earlier in this routine */ for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2408,7 +2408,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t size_t nums = 0; /* The number of free-space sections */ /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ty)) + if(H5MF__fsm_type_is_self_referential(f->shared, ty)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2767,7 +2767,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) if(f->shared->fs_man[fsm_type]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, fsm_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2893,7 +2893,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(FALSE); /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, fsm_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2916,7 +2916,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * that this is also the deciding factor as to whether a FSM * in in the raw data FSM ring. */ - if(!H5MF__fsm_type_is_self_referential(f, fsm_type)) { + if(!H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) { /* The current ring should be H5AC_RING_RDFSM */ HDassert(curr_ring == H5AC_RING_RDFSM); @@ -3385,8 +3385,8 @@ H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspac * *------------------------------------------------------------------------- */ -hbool_t -H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) +static hbool_t +H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; @@ -3394,20 +3394,19 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) H5F_mem_page_t lg_fssinfo_fsm; hbool_t result = FALSE; - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); - if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + if(H5F_SHARED_PAGED_AGGR(f_sh)) { + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, f_sh->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, f_sh->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); -- cgit v0.12 From d3545afbc5dc1c81616ff87d6667a45bbb6ce7a8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 21:55:16 -0500 Subject: Progress toward movig H5MF* API to use shared file pointers instead of top file pointers. --- src/H5MF.c | 71 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/src/H5MF.c b/src/H5MF.c index 40e954a..a197979 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -99,8 +99,8 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); /* General routines */ static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); static hbool_t H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type); -static hbool_t H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace); -static herr_t H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +static hbool_t H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace); +static herr_t H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); /* Free-space type manager routines */ @@ -662,7 +662,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio udata.allow_eoa_shrink_only = FALSE; /* Set the ring type in the API context */ - if(H5MF__fsm_is_self_referential(f, fspace)) + if(H5MF__fsm_is_self_referential(f->shared, fspace)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -712,7 +712,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, HDassert(fspace); /* Set the ring type in the API context */ - if(H5MF__fsm_is_self_referential(f, fspace)) + if(H5MF__fsm_is_self_referential(f->shared, fspace)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -914,12 +914,12 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); switch(ptype) { - case H5F_MEM_PAGE_GENERIC: - case H5F_MEM_PAGE_LARGE_BTREE: - case H5F_MEM_PAGE_LARGE_DRAW: - case H5F_MEM_PAGE_LARGE_GHEAP: - case H5F_MEM_PAGE_LARGE_LHEAP: - case H5F_MEM_PAGE_LARGE_OHDR: + case H5F_MEM_PAGE_GENERIC: + case H5F_MEM_PAGE_LARGE_BTREE: + case H5F_MEM_PAGE_LARGE_DRAW: + case H5F_MEM_PAGE_LARGE_GHEAP: + case H5F_MEM_PAGE_LARGE_LHEAP: + case H5F_MEM_PAGE_LARGE_OHDR: { haddr_t eoa; /* EOA for the file */ hsize_t frag_size = 0; /* Fragment size */ @@ -956,7 +956,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ } break; - case H5F_MEM_PAGE_META: + case H5F_MEM_PAGE_META: case H5F_MEM_PAGE_DRAW: case H5F_MEM_PAGE_BTREE: case H5F_MEM_PAGE_GHEAP: @@ -984,13 +984,13 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ node = NULL; - /* Insert the new page into the Page Buffer list of new pages so + /* 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->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; - } + } break; case H5F_MEM_PAGE_NTYPES: @@ -1556,11 +1556,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { if((ret_value = H5MF__close_pagefs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") - } + } /* end if */ else { if((ret_value = H5MF__close_aggrfs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space") - } + } /* end else */ done: #ifdef H5MF_ALLOC_DEBUG @@ -3281,14 +3281,13 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) lg_sinfo_fspace = f->shared->fs_man[lg_fssinfo_fs_type]; } - if(H5MF__continue_alloc_fsm(f, sm_hdr_fspace, sm_sinfo_fspace, lg_hdr_fspace, lg_sinfo_fspace, &continue_alloc_fsm) < 0) + if(H5MF__continue_alloc_fsm(f->shared, sm_hdr_fspace, sm_sinfo_fspace, lg_hdr_fspace, lg_sinfo_fspace, &continue_alloc_fsm) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space") - } while(continue_alloc_fsm); /* All free space managers should have file space allocated for them - * now, and should see no further allocations / deallocations. + * now, and should see no further allocations / deallocations. * For backward compatibility, store the eoa in f->shared->eoa_fsm_fsalloc * which will be set to fsinfo.eoa_pre_fsm_fsalloc when we actually write * the free-space info message to the superblock extension. @@ -3296,7 +3295,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * the new solution. */ /* Get the eoa after allocation of file space for the self referential - * free space managers. Assuming no cache image, this should be the + * free space managers. Assuming no cache image, this should be the * final EOA of the file. */ if(HADDR_UNDEF == (eoa_fsm_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) @@ -3331,14 +3330,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); HDassert(continue_alloc_fsm); /* Check sm_hdr_fspace */ @@ -3353,7 +3351,7 @@ H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspac } } - if(H5F_PAGED_AGGR(f) && !(*continue_alloc_fsm)) { + if(H5F_SHARED_PAGED_AGGR(f_sh) && !(*continue_alloc_fsm)) { /* Check lg_hdr_fspace */ if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); @@ -3442,7 +3440,7 @@ H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) *------------------------------------------------------------------------- */ static hbool_t -H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) +H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; @@ -3451,28 +3449,27 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) FUNC_ENTER_STATIC_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); HDassert(fspace); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); - if(H5F_PAGED_AGGR(f)) { + if(H5F_SHARED_PAGED_AGGR(f_sh)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, f_sh->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, f_sh->fs_page_size + 1, &lg_fssinfo_fsm); - result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || - (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || - (fspace == f->shared->fs_man[lg_fshdr_fsm]) || - (fspace == f->shared->fs_man[lg_fssinfo_fsm]); + result = (fspace == f_sh->fs_man[sm_fshdr_fsm]) || + (fspace == f_sh->fs_man[sm_fssinfo_fsm]) || + (fspace == f_sh->fs_man[lg_fshdr_fsm]) || + (fspace == f_sh->fs_man[lg_fssinfo_fsm]); } /* end if */ else - result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || - (fspace == f->shared->fs_man[sm_fssinfo_fsm]); + result = (fspace == f_sh->fs_man[sm_fshdr_fsm]) || + (fspace == f_sh->fs_man[sm_fssinfo_fsm]); FUNC_LEAVE_NOAPI(result) } /* H5MF__fsm_is_self_referential() */ -- cgit v0.12 From 0b85fa6004cb96d222329614fa446b98cfcc06ea Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 21 Aug 2019 15:34:43 -0500 Subject: Small tidy up. --- src/H5MF.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/H5MF.c b/src/H5MF.c index a197979..0ee26c1 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -3342,29 +3342,27 @@ H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sin /* Check sm_hdr_fspace */ if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) { H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } + } /* end if */ - if(!(*continue_alloc_fsm)) { + if(!(*continue_alloc_fsm)) if(sm_sinfo_fspace && sm_sinfo_fspace != sm_hdr_fspace && sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) { H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } - } + } /* end if */ if(H5F_SHARED_PAGED_AGGR(f_sh) && !(*continue_alloc_fsm)) { /* Check lg_hdr_fspace */ if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); - } + } /* end if */ /* Check lg_sinfo_fspace */ - if(!(*continue_alloc_fsm)) { + if(!(*continue_alloc_fsm)) if(lg_sinfo_fspace && lg_sinfo_fspace != lg_hdr_fspace && - lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { + lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { H5MF_CHECK_FSM(lg_sinfo_fspace, continue_alloc_fsm); - } - } - } + } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5MF__continue_alloc_fsm() */ -- cgit v0.12 From c36d2eeae7eac6012b2061e308040ea260f4f392 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 22 Aug 2019 13:28:20 -0500 Subject: Switch shared file struct name from 'H5F_file_t' to 'H5F_shared_t', to match naming convention for shared structs in rest of library data structures. --- src/.indent.pro | 2 +- src/H5Dcontig.c | 12 ++++++------ src/H5Dpkg.h | 2 +- src/H5Faccum.c | 10 +++++----- src/H5Fcwfs.c | 2 +- src/H5Fefc.c | 24 ++++++++++++------------ src/H5Ffake.c | 4 ++-- src/H5Fint.c | 20 ++++++++++---------- src/H5Fio.c | 4 ++-- src/H5Fmpi.c | 2 +- src/H5Fpkg.h | 36 ++++++++++++++++++------------------ src/H5Fprivate.h | 18 +++++++++--------- src/H5Fquery.c | 10 +++++----- src/H5Fsfile.c | 12 ++++++------ src/H5HGpkg.h | 4 ++-- src/H5MF.c | 18 +++++++++--------- src/H5MFpkg.h | 2 +- src/H5MFprivate.h | 2 +- src/H5PB.c | 24 ++++++++++++------------ src/H5PBprivate.h | 14 +++++++------- 20 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/.indent.pro b/src/.indent.pro index e0fda85..fa375f0 100644 --- a/src/.indent.pro +++ b/src/.indent.pro @@ -68,7 +68,7 @@ -T H5E_minor_t -T H5E_t -T H5F_create_t --T H5F_file_t +-T H5F_shared_t -T H5F_isop_t -T H5F_istore_key_t -T H5F_istore_ud1_t diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 8f7a7ca..c9f9fc2 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -58,7 +58,7 @@ /* Callback info for sieve buffer readvv operation */ typedef struct H5D_contig_readvv_sieve_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *rbuf; /* Pointer to buffer to fill */ @@ -66,14 +66,14 @@ typedef struct H5D_contig_readvv_sieve_ud_t { /* Callback info for [plain] readvv operation */ typedef struct H5D_contig_readvv_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ unsigned char *rbuf; /* Pointer to buffer to fill */ } H5D_contig_readvv_ud_t; /* Callback info for sieve buffer writevv operation */ typedef struct H5D_contig_writevv_sieve_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *wbuf; /* Pointer to buffer to write */ @@ -81,7 +81,7 @@ typedef struct H5D_contig_writevv_sieve_ud_t { /* Callback info for [plain] writevv operation */ typedef struct H5D_contig_writevv_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ const unsigned char *wbuf; /* Pointer to buffer to write */ } H5D_contig_writevv_ud_t; @@ -718,7 +718,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *buf; /* Pointer to buffer to fill */ @@ -983,7 +983,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *buf; /* Pointer to buffer to fill */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 878fda3..ed3bc12 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -210,7 +210,7 @@ typedef enum H5D_io_op_type_t { typedef struct H5D_io_info_t { const H5D_t *dset; /* Pointer to dataset being operated on */ /* QAK: Delete the f_sh field when oloc has a shared file pointer? */ - H5F_file_t *f_sh; /* Pointer to shared file struct that dataset is within */ + H5F_shared_t *f_sh; /* Pointer to shared file struct that dataset is within */ #ifdef H5_HAVE_PARALLEL MPI_Comm comm; /* MPI communicator for file */ hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index c2724b1..74a170b 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -111,7 +111,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); *------------------------------------------------------------------------- */ herr_t -H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_t *file; /* File driver pointer */ @@ -419,7 +419,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, const void *buf) { H5FD_t *file; /* File driver pointer */ @@ -847,7 +847,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_free(H5F_file_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, +H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, hsize_t size) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ @@ -1013,7 +1013,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_flush(H5F_file_t *f_sh) +H5F__accum_flush(H5F_shared_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1056,7 +1056,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush) +H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index aa5f8ab..26452b6 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -299,7 +299,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap) +H5F_cwfs_remove_heap(H5F_shared_t *shared, H5HG_heap_t *heap) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fefc.c b/src/H5Fefc.c index f3881d4..66d68b2 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -60,14 +60,14 @@ struct H5F_efc_t { unsigned max_nfiles; /* Maximum size of the external file cache */ unsigned nrefs; /* Number of times this file appears in another file's EFC */ int tag; /* Temporary variable used by H5F__efc_try_close() */ - H5F_file_t *tmp_next; /* Next file in temporary list used by H5F__efc_try_close() */ + H5F_shared_t *tmp_next; /* Next file in temporary list used by H5F__efc_try_close() */ }; /* Private prototypes */ static herr_t H5F__efc_release_real(H5F_efc_t *efc); static herr_t H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent); -static void H5F__efc_try_close_tag1(H5F_file_t *sf, H5F_file_t **tail); -static void H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail); +static void H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail); +static void H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail); /* Free lists */ H5FL_DEFINE_STATIC(H5F_efc_ent_t); @@ -644,10 +644,10 @@ done: *------------------------------------------------------------------------- */ static void -H5F__efc_try_close_tag1(H5F_file_t *sf, H5F_file_t **tail) +H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail) { H5F_efc_ent_t *ent = NULL; /* EFC entry */ - H5F_file_t *esf; /* Convenience pointer to ent->file->shared */ + H5F_shared_t *esf; /* Convenience pointer to ent->file->shared */ FUNC_ENTER_STATIC_NOERR @@ -718,10 +718,10 @@ H5F__efc_try_close_tag1(H5F_file_t *sf, H5F_file_t **tail) *------------------------------------------------------------------------- */ static void -H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail) +H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail) { H5F_efc_ent_t *ent = NULL; /* EFC entry */ - H5F_file_t *esf; /* Convenience pointer to ent->file->shared */ + H5F_shared_t *esf; /* Convenience pointer to ent->file->shared */ FUNC_ENTER_STATIC_NOERR @@ -827,11 +827,11 @@ H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail) herr_t H5F__efc_try_close(H5F_t *f) { - H5F_file_t *tail; /* Tail of linked list of found files. Head will be f->shared. */ - H5F_file_t *uncloseable_head = NULL; /* Head of linked list of files found to be uncloseable by the first pass */ - H5F_file_t *uncloseable_tail = NULL; /* Tail of linked list of files found to be uncloseable by the first pass */ - H5F_file_t *sf; /* Temporary file pointer */ - H5F_file_t *next; /* Temporary file pointer */ + H5F_shared_t *tail; /* Tail of linked list of found files. Head will be f->shared. */ + H5F_shared_t *uncloseable_head = NULL; /* Head of linked list of files found to be uncloseable by the first pass */ + H5F_shared_t *uncloseable_tail = NULL; /* Tail of linked list of files found to be uncloseable by the first pass */ + H5F_shared_t *sf; /* Temporary file pointer */ + H5F_shared_t *next; /* Temporary file pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 6072f2e..67bd180 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -50,7 +50,7 @@ H5F_fake_alloc(uint8_t sizeof_size) /* Allocate faked file struct */ if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - if(NULL == (f->shared = H5FL_CALLOC(H5F_file_t))) + if(NULL == (f->shared = H5FL_CALLOC(H5F_shared_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") /* Only set fields necessary for clients */ @@ -93,7 +93,7 @@ H5F_fake_free(H5F_t *f) if(f) { /* Destroy shared file struct */ if(f->shared) - f->shared = H5FL_FREE(H5F_file_t, f->shared); + f->shared = H5FL_FREE(H5F_shared_t, f->shared); f = H5FL_FREE(H5F_t, f); } /* end if */ diff --git a/src/H5Fint.c b/src/H5Fint.c index f27a263..9b31d7e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -58,7 +58,7 @@ typedef struct H5F_olist_t { struct { hbool_t local; /* Set flag for "local" file searches */ union { - H5F_file_t *shared; /* Pointer to shared file to look inside */ + H5F_shared_t *shared; /* Pointer to shared file to look inside */ const H5F_t *file; /* Pointer to file to look inside */ } ptr; } file_info; @@ -81,7 +81,7 @@ static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); +static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -104,8 +104,8 @@ static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); /* Declare a free list to manage the H5F_t struct */ H5FL_DEFINE(H5F_t); -/* Declare a free list to manage the H5F_file_t struct */ -H5FL_DEFINE(H5F_file_t); +/* Declare a free list to manage the H5F_shared_t struct */ +H5FL_DEFINE(H5F_shared_t); @@ -901,7 +901,7 @@ done: *------------------------------------------------------------------------- */ static H5F_t * -H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) +H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { H5F_t *f = NULL; H5F_t *ret_value = NULL; @@ -922,7 +922,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ size_t u; /* Local index variable */ HDassert(lf != NULL); - if(NULL == (f->shared = H5FL_CALLOC(H5F_file_t))) + if(NULL == (f->shared = H5FL_CALLOC(H5F_shared_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") f->shared->flags = flags; @@ -1141,7 +1141,7 @@ done: if(H5I_dec_ref(f->shared->fcpl_id) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list") - f->shared = H5FL_FREE(H5F_file_t, f->shared); + f->shared = H5FL_FREE(H5F_shared_t, f->shared); } f = H5FL_FREE(H5F_t, f); } @@ -1390,7 +1390,7 @@ H5F__dest(H5F_t *f, hbool_t flush) f->shared->retries[actype] = (uint32_t *)H5MM_xfree(f->shared->retries[actype]); /* Destroy shared file struct */ - f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared); + f->shared = (H5F_shared_t *)H5FL_FREE(H5F_shared_t, f->shared); } else if(f->shared->nrefs > 0) { @@ -1491,7 +1491,7 @@ H5F_t * H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *file = NULL; /*the success return value */ - H5F_file_t *shared = NULL; /*shared part of `file' */ + H5F_shared_t *shared = NULL; /*shared part of `file' */ H5FD_t *lf = NULL; /*file driver part of `shared' */ unsigned tent_flags; /*tentative flags */ H5FD_class_t *drvr; /*file driver class info */ @@ -2181,7 +2181,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) */ /* Destroy the H5F_t struct and decrement the reference count for the - * shared H5F_file_t struct. If the reference count for the H5F_file_t + * shared H5F_shared_t struct. If the reference count for the H5F_shared_t * struct reaches zero then destroy it also. */ if(H5F__dest(f, TRUE) < 0) diff --git a/src/H5Fio.c b/src/H5Fio.c index d2d0dba..34dd0d6 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -92,7 +92,7 @@ *------------------------------------------------------------------------- */ herr_t -H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ @@ -181,7 +181,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) +H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 56f9547..4c0104a 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -184,7 +184,7 @@ done: *------------------------------------------------------------------------- */ int -H5F_shared_mpi_get_size(const H5F_file_t *f_sh) +H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) { int ret_value = -1; diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e7eca3..42c9a828 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -217,7 +217,7 @@ typedef struct H5F_mtab_t { } H5F_mtab_t; /* Structure specifically to store superblock. This was originally - * maintained entirely within H5F_file_t, but is now extracted + * maintained entirely within H5F_shared_t, but is now extracted * here because the superblock is now handled by the cache */ typedef struct H5F_super_t { H5AC_info_t cache_info; /* Cache entry information structure */ @@ -238,11 +238,11 @@ typedef struct H5F_super_t { /* * Define the structure to store the file information for HDF5 files. One of * these structures is allocated per file, not per H5Fopen(). That is, set of - * H5F_t structs can all point to the same H5F_file_t struct. The `nrefs' + * H5F_t structs can all point to the same H5F_shared_t struct. The `nrefs' * count in this struct indicates the number of H5F_t structs which are * pointing to this struct. */ -struct H5F_file_t { +struct H5F_shared_t { H5FD_t *lf; /* Lower level file handle for I/O */ H5F_super_t *sblock; /* Pointer to (pinned) superblock for file */ H5O_drvinfo_t *drvinfo; /* Pointer to the (pinned) driver info @@ -362,14 +362,14 @@ struct H5F_file_t { /* * This is the top-level file descriptor. One of these structures is * allocated every time H5Fopen() is called although they may contain pointers - * to shared H5F_file_t structs. + * to shared H5F_shared_t structs. */ struct H5F_t { - char *open_name; /* Name used to open file */ - char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ + char *open_name; /* Name used to open file */ + char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ char *extpath; /* Path for searching target external link file */ - H5F_file_t *shared; /* The shared file info */ - unsigned nopen_objs; /* Number of open object headers */ + H5F_shared_t *shared; /* The shared file info */ + unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ hbool_t id_exists; /* Whether an ID for this struct exists */ hbool_t closing; /* File is in the process of being closed */ @@ -388,8 +388,8 @@ struct H5F_t { /* Declare a free list to manage the H5F_t struct */ H5FL_EXTERN(H5F_t); -/* Declare a free list to manage the H5F_file_t struct */ -H5FL_EXTERN(H5F_file_t); +/* Declare a free list to manage the H5F_shared_t struct */ +H5FL_EXTERN(H5F_shared_t); /******************************/ @@ -429,16 +429,16 @@ H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); /* Metadata accumulator routines */ -H5_DLL herr_t H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); -H5_DLL herr_t H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5F__accum_free(H5F_file_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL herr_t H5F__accum_flush(H5F_file_t *f_sh); -H5_DLL herr_t H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush); +H5_DLL herr_t H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); +H5_DLL herr_t H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F__accum_free(H5F_shared_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); +H5_DLL herr_t H5F__accum_flush(H5F_shared_t *f_sh); +H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush); /* Shared file list related routines */ -H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); -H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf); -H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared); +H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared); +H5_DLL H5F_shared_t *H5F__sfile_search(H5FD_t *lf); +H5_DLL herr_t H5F__sfile_remove(H5F_shared_t *shared); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index f196ec0..867db84 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -656,7 +656,7 @@ struct H5P_genplist_t; /* Forward declarations for anonymous H5F objects */ /* Main file structures */ -typedef struct H5F_file_t H5F_file_t; +typedef struct H5F_shared_t H5F_shared_t; /* Block aggregation structure */ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; @@ -728,12 +728,12 @@ H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f); -H5_DLL unsigned H5F_shared_get_intent(const H5F_file_t *f); +H5_DLL unsigned H5F_shared_get_intent(const H5F_shared_t *f); H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL char *H5F_get_open_name(const H5F_t *f); H5_DLL char *H5F_get_actual_name(const H5F_t *f); H5_DLL char *H5F_get_extpath(const H5F_t *f); -H5_DLL H5F_file_t *H5F_get_shared(const H5F_t *f); +H5_DLL H5F_shared_t *H5F_get_shared(const H5F_t *f); H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2); H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f); H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f); @@ -792,9 +792,9 @@ H5_DLL char *H5F_mdc_log_location(const H5F_t *f); /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); -H5_DLL hbool_t H5F_shared_has_feature(const H5F_file_t *f, unsigned feature); +H5_DLL hbool_t H5F_shared_has_feature(const H5F_shared_t *f, unsigned feature); H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); -H5_DLL haddr_t H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type); +H5_DLL haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type); H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type); H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle); @@ -805,9 +805,9 @@ H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/); H5_DLL herr_t H5F_flush_mounts(H5F_t *f); /* Functions that operate on blocks of bytes wrt super block */ -H5_DLL herr_t H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); -H5_DLL herr_t H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Functions that flush or evict */ @@ -847,7 +847,7 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f); H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); -H5_DLL int H5F_shared_mpi_get_size(const H5F_file_t *f_sh); +H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh); H5_DLL int H5F_mpi_get_size(const H5F_t *f); H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info); @@ -864,7 +864,7 @@ H5_DLL H5F_t *H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix H5_DLL herr_t H5F_cwfs_add(H5F_t *f, struct H5HG_heap_t *heap); H5_DLL herr_t H5F_cwfs_find_free_heap(H5F_t *f, size_t need, haddr_t *addr); H5_DLL herr_t H5F_cwfs_advance_heap(H5F_t *f, struct H5HG_heap_t *heap, hbool_t add_heap); -H5_DLL herr_t H5F_cwfs_remove_heap(H5F_file_t *shared, struct H5HG_heap_t *heap); +H5_DLL herr_t H5F_cwfs_remove_heap(H5F_shared_t *shared, struct H5HG_heap_t *heap); /* Debugging functions */ H5_DLL herr_t H5F_debug(H5F_t *f, FILE * stream, int indent, int fwidth); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 5b5f748..c885561 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -79,13 +79,13 @@ * * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags * (Mainly added to stop non-file routines from poking about in the - * H5F_file_t data structure) + * H5F_shared_t data structure) * * Return: 'intent' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned -H5F_shared_get_intent(const H5F_file_t *f_sh) +H5F_shared_get_intent(const H5F_shared_t *f_sh) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -243,7 +243,7 @@ H5F_get_extpath(const H5F_t *f) * Return: 'shared' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ -H5F_file_t * +H5F_shared_t * H5F_get_shared(const H5F_t *f) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ @@ -858,7 +858,7 @@ H5F_store_msg_crt_idx(const H5F_t *f) *------------------------------------------------------------------------- */ hbool_t -H5F_shared_has_feature(const H5F_file_t *f_sh, unsigned feature) +H5F_shared_has_feature(const H5F_shared_t *f_sh, unsigned feature) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -955,7 +955,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type) +H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type) { haddr_t ret_value = HADDR_UNDEF; /* Return value */ diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index ebc2ab2..9a9bbab 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -24,7 +24,7 @@ /* Struct for tracking "shared" file structs */ typedef struct H5F_sfile_node_t { - H5F_file_t *shared; /* Pointer to "shared" file struct */ + H5F_shared_t *shared; /* Pointer to "shared" file struct */ struct H5F_sfile_node_t *next; /* Pointer to next node */ } H5F_sfile_node_t; @@ -96,9 +96,9 @@ H5F_sfile_assert_num(unsigned n) *------------------------------------------------------------------------- */ herr_t -H5F__sfile_add(H5F_file_t *shared) +H5F__sfile_add(H5F_shared_t *shared) { - H5F_sfile_node_t *new_shared; /* New shared file node */ + H5F_sfile_node_t *new_shared; /* New shared file node */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -135,11 +135,11 @@ done: * *------------------------------------------------------------------------- */ -H5F_file_t * +H5F_shared_t * H5F__sfile_search(H5FD_t *lf) { H5F_sfile_node_t *curr; /* Current shared file node */ - H5F_file_t *ret_value = NULL; /* Return value */ + H5F_shared_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -175,7 +175,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__sfile_remove(H5F_file_t *shared) +H5F__sfile_remove(H5F_shared_t *shared) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_sfile_node_t *last; /* Last shared file node */ diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 4ed9b10..3119de4 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -117,7 +117,7 @@ typedef struct H5HG_obj_t { } H5HG_obj_t; /* Forward declarations for fields */ -struct H5F_file_t; +struct H5F_shared_t; struct H5HG_heap_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ @@ -130,7 +130,7 @@ struct H5HG_heap_t { /* If this value is >65535 then all indices */ /* have been used at some time and the */ /* correct new index should be searched for */ - struct H5F_file_t *shared; /* shared file */ + struct H5F_shared_t *shared; /* shared file */ H5HG_obj_t *obj; /*array of object descriptions */ }; diff --git a/src/H5MF.c b/src/H5MF.c index 0ee26c1..14be37a 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -56,7 +56,7 @@ *CF = TRUE; /* For non-paged aggregation: map allocation request type to tracked free-space type */ -/* F_SH -- pointer to H5F_file_t; T -- H5FD_mem_t */ +/* F_SH -- pointer to H5F_shared_t; T -- H5FD_mem_t */ #define H5MF_ALLOC_TO_FS_AGGR_TYPE(F_SH, T) \ ((H5FD_MEM_DEFAULT == (F_SH)->fs_type_map[T]) ? (T) : (F_SH)->fs_type_map[T]) @@ -98,9 +98,9 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); /* General routines */ static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); -static hbool_t H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type); -static hbool_t H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace); -static herr_t H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +static hbool_t H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type); +static hbool_t H5MF__fsm_is_self_referential(H5F_shared_t *f_sh, H5FS_t *fspace); +static herr_t H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); /* Free-space type manager routines */ @@ -146,7 +146,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; *------------------------------------------------------------------------- */ herr_t -H5MF_init_merge_flags(H5F_file_t *f_sh) +H5MF_init_merge_flags(H5F_shared_t *f_sh) { H5MF_aggr_merge_t mapping_type; /* Type of free list mapping */ H5FD_mem_t type; /* Memory type for iteration */ @@ -258,7 +258,7 @@ done: *------------------------------------------------------------------------- */ void -H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { FUNC_ENTER_PACKAGE_NOERR @@ -3330,7 +3330,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -3382,7 +3382,7 @@ H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sin *------------------------------------------------------------------------- */ static hbool_t -H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) +H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; @@ -3438,7 +3438,7 @@ H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) *------------------------------------------------------------------------- */ static hbool_t -H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace) +H5MF__fsm_is_self_referential(H5F_shared_t *f_sh, H5FS_t *fspace) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 47ebc5c..fc398db 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -179,7 +179,7 @@ H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); -H5_DLL void H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, +H5_DLL void H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 3569615..de1bdfb 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -48,7 +48,7 @@ /***************************************/ /* File space manager routines */ -H5_DLL herr_t H5MF_init_merge_flags(H5F_file_t *f_sh); +H5_DLL herr_t H5MF_init_merge_flags(H5F_shared_t *f_sh); H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f); H5_DLL herr_t H5MF_try_close(H5F_t *f); diff --git a/src/H5PB.c b/src/H5PB.c index 42c1cba..6c83217 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -124,8 +124,8 @@ typedef struct { /* Local Prototypes */ /********************/ static herr_t H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry); -static htri_t H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type); -static herr_t H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry); +static htri_t H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type); +static herr_t H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry); /*********************/ @@ -289,7 +289,7 @@ H5PB_print_stats(const H5PB_t *page_buf) *------------------------------------------------------------------------- */ herr_t -H5PB_create(H5F_file_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) +H5PB_create(H5F_shared_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 */ @@ -369,7 +369,7 @@ static herr_t H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) { H5PB_entry_t *page_entry = (H5PB_entry_t *)item; /* Pointer to page entry node */ - H5F_file_t *f_sh = (H5F_file_t *)_op_data; + H5F_shared_t *f_sh = (H5F_shared_t *)_op_data; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -400,7 +400,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_flush(H5F_file_t *f_sh) +H5PB_flush(H5F_shared_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ @@ -472,7 +472,7 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) *------------------------------------------------------------------------- */ herr_t -H5PB_dest(H5F_file_t *f_sh) +H5PB_dest(H5F_shared_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ @@ -529,7 +529,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr) +H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr) { H5PB_t *page_buf; /* Page buffer to operate on */ H5PB_entry_t *page_entry = NULL; /* Pointer to the corresponding page entry */ @@ -637,7 +637,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) *------------------------------------------------------------------------- */ herr_t -H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr) +H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr) { H5PB_t *page_buf; /* Page buffer to operate on */ H5PB_entry_t *page_entry = NULL; /* Pointer to the page entry being searched */ @@ -687,7 +687,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +H5PB_read(H5F_shared_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 */ @@ -984,7 +984,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, +H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5PB_t *page_buf; /* Page buffering info for this file */ @@ -1375,7 +1375,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) +H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) { H5PB_entry_t *page_entry; /* Pointer to page eviction candidate */ htri_t ret_value = TRUE; /* Return value */ @@ -1474,7 +1474,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry) +H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry) { haddr_t eoa; /* Current EOA for the file */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index 8bca219..82d010d 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -85,14 +85,14 @@ typedef struct H5PB_t { /***************************************/ /* General routines */ -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_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_create(H5F_shared_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_shared_t *f_sh); +H5_DLL herr_t H5PB_dest(H5F_shared_t *f_sh); +H5_DLL herr_t H5PB_add_new_page(H5F_shared_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_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); +H5_DLL herr_t H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr); +H5_DLL herr_t H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); -- cgit v0.12 From f42c7cc0d85cc5b232afd621711fdbd64f6e19d9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 22 Aug 2019 17:06:00 -0500 Subject: Fix major error codes --- src/H5Fmpi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 4c0104a..470241b 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -130,7 +130,7 @@ H5F_mpi_get_rank(const H5F_t *f) /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_rank(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_rank request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_rank request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -162,7 +162,7 @@ H5F_mpi_get_comm(const H5F_t *f) /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_comm(f->shared->lf)) == MPI_COMM_NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -194,7 +194,7 @@ H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) /* Dispatch to driver */ if((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -226,7 +226,7 @@ H5F_mpi_get_size(const H5F_t *f) /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12