summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dchunk.c18
-rw-r--r--src/H5Dcompact.c4
-rw-r--r--src/H5Dcontig.c4
-rw-r--r--src/H5Defl.c8
-rw-r--r--src/H5Dint.c14
-rw-r--r--src/H5Dpkg.h3
-rw-r--r--src/H5Dprivate.h2
-rw-r--r--src/H5F.c32
8 files changed, 42 insertions, 43 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index d90f705..62a3941 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -181,7 +181,7 @@ static herr_t H5D_chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type
static herr_t H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *fm);
-static herr_t H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, hbool_t closing);
+static herr_t H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id);
static herr_t H5D_chunk_io_term(const H5D_chunk_map_t *fm);
/* "Nonexistent" layout operation callback */
@@ -1944,14 +1944,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, hbool_t closing)
+H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id)
{
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
- unsigned nerrors = 0;
H5D_rdcc_ent_t *ent, *next;
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned nerrors = 0; /* Count of any errors encountered when flushing chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_flush)
@@ -1969,14 +1969,8 @@ H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, hbool_t closing)
/* Loop over all entries in the chunk cache */
for(ent = rdcc->head; ent; ent = next) {
next = ent->next;
- if(closing) {
- if(H5D_chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0)
- nerrors++;
- } /* end if */
- else {
- if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0)
- nerrors++;
- } /* end else */
+ if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0)
+ nerrors++;
} /* end for */
if(nerrors)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 252e0dc..b52bd2c 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -69,7 +69,7 @@ static ssize_t H5D_compact_readvv(const H5D_io_info_t *io_info,
static ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
-static herr_t H5D_compact_flush(H5D_t *dset, hid_t dxpl_id, hbool_t closing);
+static herr_t H5D_compact_flush(H5D_t *dset, hid_t dxpl_id);
/*********************/
@@ -347,7 +347,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_compact_flush(H5D_t *dset, hid_t dxpl_id, hbool_t UNUSED closing)
+H5D_compact_flush(H5D_t *dset, hid_t dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 09075f4..0ff3964 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -65,7 +65,7 @@ static herr_t H5D_contig_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
-static herr_t H5D_contig_flush(H5D_t *dset, hid_t dxpl_id, hbool_t closing);
+static herr_t H5D_contig_flush(H5D_t *dset, hid_t dxpl_id);
/* Helper routines */
static herr_t H5D_contig_write_one(H5D_io_info_t *io_info, hsize_t offset,
@@ -1186,7 +1186,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_contig_flush(H5D_t *dset, hid_t dxpl_id, hbool_t UNUSED closing)
+H5D_contig_flush(H5D_t *dset, hid_t dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index af57eff..7ce0c67 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -50,7 +50,7 @@
/* Layout operation callbacks */
static herr_t H5D_efl_construct(H5F_t *f, H5D_t *dset);
-static hbool_t H5D_efl_is_space_alloc(const H5O_layout_t *layout);
+static hbool_t H5D_efl_is_space_alloc(const H5O_storage_t *storage);
static herr_t H5D_efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
@@ -182,14 +182,14 @@ done:
*-------------------------------------------------------------------------
*/
static hbool_t
-H5D_efl_is_space_alloc(const H5O_layout_t UNUSED *layout)
+H5D_efl_is_space_alloc(const H5O_storage_t UNUSED *storage)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_efl_is_space_alloc)
/* Sanity checks */
- HDassert(layout);
+ HDassert(storage);
- /* EFL storage is currently treated as allocated */
+ /* EFL storage is currently always treated as allocated */
FUNC_LEAVE_NOAPI(TRUE)
} /* end H5D_efl_is_space_alloc() */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 8789289..7395fba 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -48,7 +48,6 @@
typedef struct {
const H5F_t *f; /* Pointer to file being flushed */
hid_t dxpl_id; /* DXPL for I/O operations */
- hbool_t closing; /* Whether the file is closing */
} H5D_flush_ud_t;
@@ -66,7 +65,7 @@ static herr_t H5D_init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
static herr_t H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset,
hid_t dapl_id);
static herr_t H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id);
-static herr_t H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, hbool_t closing);
+static herr_t H5D_flush_real(H5D_t *dataset, hid_t dxpl_id);
/*********************/
@@ -1361,7 +1360,7 @@ H5D_close(H5D_t *dataset)
dataset->shared->fo_count--;
if(dataset->shared->fo_count == 0) {
/* Flush the dataset's information */
- if(H5D_flush_real(dataset, H5AC_dxpl_id, FALSE) < 0)
+ if(H5D_flush_real(dataset, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
/* Free the data sieve buffer, if it's been allocated */
@@ -2234,7 +2233,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, hbool_t closing)
+H5D_flush_real(H5D_t *dataset, hid_t dxpl_id)
{
H5O_t *oh = NULL; /* Pointer to dataset's object header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2278,7 +2277,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id, hbool_t closing)
/* Flush cached raw data for each kind of dataset layout */
if(dataset->shared->layout.ops->flush &&
- (dataset->shared->layout.ops->flush)(dataset, dxpl_id, closing) < 0)
+ (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data")
done:
@@ -2319,7 +2318,7 @@ H5D_flush_cb(void *_dataset, hid_t UNUSED id, void *_udata)
/* Check for dataset in same file */
if(udata->f == dataset->oloc.file) {
/* Flush the dataset's information */
- if(H5D_flush_real(dataset, udata->dxpl_id, udata->closing) < 0)
+ if(H5D_flush_real(dataset, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to flush cached dataset info")
} /* end if */
@@ -2342,7 +2341,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_flush(const H5F_t *f, hid_t dxpl_id, hbool_t closing)
+H5D_flush(const H5F_t *f, hid_t dxpl_id)
{
H5D_flush_ud_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2355,7 +2354,6 @@ H5D_flush(const H5F_t *f, hid_t dxpl_id, hbool_t closing)
/* Set user data for callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
- udata.closing = closing;
/* Iterate over all the open datasets */
H5I_search(H5I_DATASET, H5D_flush_cb, &udata, FALSE);
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 4eb565c..aa5a359 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -118,8 +118,7 @@ typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info,
typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info,
size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
-typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset, hid_t dxpl_id,
- hbool_t closing);
+typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset, hid_t dxpl_id);
typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm);
/* Typedef for grouping layout I/O routines */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index ba8048c..1c6a0d5 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -162,7 +162,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
H5_DLL H5T_t *H5D_typeof(const H5D_t *dset);
-H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id, hbool_t closing);
+H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id);
/* Functions that operate on vlen data */
H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id,
diff --git a/src/H5F.c b/src/H5F.c
index 353c0fc..4212d6e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1619,9 +1619,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F_flush
*
- * Purpose: Flushes (and optionally invalidates) cached data plus the
- * file superblock. If the logical file size field is zero
- * then it is updated to be the length of the superblock.
+ * Purpose: Flushes (and optionally invalidates) cached data, possibly
+ * in all mounted files, depending on the SCOPE.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1697,9 +1696,12 @@ H5F_flush_real(H5F_t *f, hid_t dxpl_id, hbool_t closing)
/* Sanity check arguments */
HDassert(f);
- /* Flush any cached dataset storage raw data */
- if(H5D_flush(f, dxpl_id, closing) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache")
+ /* If we will be closing the file, we don't need to flush the dataset info */
+ if(!closing) {
+ /* Flush any cached dataset storage raw data */
+ if(H5D_flush(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache")
+ } /* end if */
/* If we will be closing the file, we should release the free space
* information now (needs to happen before truncating the file and
@@ -1736,13 +1738,19 @@ H5F_flush_real(H5F_t *f, hid_t dxpl_id, hbool_t closing)
if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache")
- /* Flush out the metadata accumulator */
- if(H5F_accum_flush(f, dxpl_id) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator")
+ /* If we will be closing the file, we don't need to flush the accumulator info */
+ if(!closing) {
+ /* Flush out the metadata accumulator */
+ if(H5F_accum_flush(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator")
+ } /* end if */
- /* Flush file buffers to disk. */
- if(H5FD_flush(f->shared->lf, dxpl_id, closing) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed")
+ /* If we will be closing the file, we don't need to flush file buffers */
+ if(!closing) {
+ /* Flush file buffers to disk. */
+ if(H5FD_flush(f->shared->lf, dxpl_id, closing) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)