summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2019-08-19 22:47:28 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2019-08-19 22:47:28 (GMT)
commit85a56a9c4f9629bb92b4b16a1dada30ae30b5b21 (patch)
treeaf6a389ea4450e69baa04bd7d7b1d28262074c56 /src
parentdcf084aff42d3abafaa82b356493a2d1585afb85 (diff)
downloadhdf5-85a56a9c4f9629bb92b4b16a1dada30ae30b5b21.zip
hdf5-85a56a9c4f9629bb92b4b16a1dada30ae30b5b21.tar.gz
hdf5-85a56a9c4f9629bb92b4b16a1dada30ae30b5b21.tar.bz2
Partial H5F__accum_* routines.
Diffstat (limited to 'src')
-rw-r--r--src/H5Faccum.c53
-rw-r--r--src/H5Fint.c6
-rw-r--r--src/H5Fio.c2
-rw-r--r--src/H5Fpkg.h6
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5PB.c2
6 files changed, 34 insertions, 36 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 */