summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-21 11:33:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-21 11:33:44 (GMT)
commitd96910fe93972d48a8cfef0a44a57a803b07f031 (patch)
treec6e26ce08bcd26bf71f4fc75edcbabc42d168e02
parent9316a67a8901daf5e85fc2947c666b4e10c04814 (diff)
downloadhdf5-d96910fe93972d48a8cfef0a44a57a803b07f031.zip
hdf5-d96910fe93972d48a8cfef0a44a57a803b07f031.tar.gz
hdf5-d96910fe93972d48a8cfef0a44a57a803b07f031.tar.bz2
[svn-r17404] Description:
Bring r17402 & r17403 from trunk to 1.8 branch: r17402: Switch from using a 'flags' parameter to the flush routine(s), to just using a single 'closing' boolean parameter, since that's all we're doing with the flags anyway and this makes things more obvious. r17403: Eliminate 'closing' flag to dataset flush routine, since all cached dataset information has already been flushed when a file is closed and the datasets themselves will be closed (and the dataset caches destroyed). Skip calling more flush routines when the file is closing, in preparation for eventual separation of the 'flush' concept from the 'shutdown the cache' concept. Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committest performed on trunk)
-rw-r--r--src/H5Dchunk.c19
-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.c50
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5Fprivate.h10
10 files changed, 53 insertions, 63 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 736f356..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, unsigned flags);
+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, unsigned flags)
+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,16 +1969,11 @@ H5D_chunk_flush(H5D_t *dset, hid_t dxpl_id, unsigned flags)
/* Loop over all entries in the chunk cache */
for(ent = rdcc->head; ent; ent = next) {
next = ent->next;
- if((flags & H5F_FLUSH_CLOSING)) {
- if(H5D_chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0)
- nerrors++;
- } else {
- if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0)
- nerrors++;
- }
+ if(H5D_chunk_flush_entry(dset, dxpl_id, dxpl_cache, ent, FALSE) < 0)
+ nerrors++;
} /* end for */
if(nerrors)
- HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 831ab13..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, unsigned flags);
+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, unsigned UNUSED flags)
+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 712b17c..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, unsigned flags);
+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, unsigned UNUSED flags)
+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 7bdf75d..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 */
- unsigned flags; /* Flags for flush operation */
} 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, unsigned flags);
+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, H5F_FLUSH_NONE) < 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, unsigned flags)
+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, unsigned flags)
/* Flush cached raw data for each kind of dataset layout */
if(dataset->shared->layout.ops->flush &&
- (dataset->shared->layout.ops->flush)(dataset, dxpl_id, flags) < 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->flags) < 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, unsigned flags)
+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, unsigned flags)
/* Set user data for callback */
udata.f = f;
udata.dxpl_id = dxpl_id;
- udata.flags = flags;
/* 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 df7dd51..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,
- unsigned flags);
+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 4c6ed79..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, unsigned flags);
+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 2291a3e..4212d6e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -72,7 +72,7 @@ static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id,
H5FD_t *lf);
static herr_t H5F_dest(H5F_t *f, hid_t dxpl_id);
static herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope);
-static herr_t H5F_flush_real(H5F_t *f, hid_t dxpl_id, unsigned flags);
+static herr_t H5F_flush_real(H5F_t *f, hid_t dxpl_id, hbool_t closing);
static herr_t H5F_close(H5F_t *f);
/* Declare a free list to manage the H5F_t struct */
@@ -1023,7 +1023,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
/* Flush all caches and indicate we are closing the file */
/* (The caches should already be clean and we should just be invalidating objects) */
- if(H5F_flush_real(f, dxpl_id, H5F_FLUSH_CLOSING) < 0)
+ if(H5F_flush_real(f, dxpl_id, TRUE) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
@@ -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
*
@@ -1661,7 +1660,7 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope)
} /* end if */
/* Call the "real" flush routine, for this file */
- if(H5F_flush_real(f, dxpl_id, H5F_FLUSH_NONE) < 0)
+ if(H5F_flush_real(f, dxpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Check flush errors for children - errors are already on the stack */
@@ -1676,9 +1675,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F_flush_real
*
- * 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.
*
* Return: Non-negative on success/Negative on failure
*
@@ -1689,7 +1686,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_flush_real(H5F_t *f, hid_t dxpl_id, unsigned flags)
+H5F_flush_real(H5F_t *f, hid_t dxpl_id, hbool_t closing)
{
unsigned H5AC_flags = H5AC__NO_FLAGS_SET; /* Flags for H5AC_flush() */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1699,9 +1696,12 @@ H5F_flush_real(H5F_t *f, hid_t dxpl_id, unsigned flags)
/* Sanity check arguments */
HDassert(f);
- /* Flush any cached dataset storage raw data */
- if(H5D_flush(f, dxpl_id, flags) < 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
@@ -1709,7 +1709,7 @@ H5F_flush_real(H5F_t *f, hid_t dxpl_id, unsigned flags)
* holding some data structures in memory and also because releasing free
* space can shrink the file's 'eoa' value)
*/
- if(flags & H5F_FLUSH_CLOSING) {
+ if(closing) {
/* Shutdown file free space manager(s) */
if(H5MF_close(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
@@ -1726,7 +1726,7 @@ H5F_flush_real(H5F_t *f, hid_t dxpl_id, unsigned flags)
} /* end else */
/* Flush (and invalidate, if requested) the entire metadata cache */
- if(flags & H5F_FLUSH_CLOSING) {
+ if(closing) {
H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG;
/* Unpin the superblock, since we're about to destroy the cache */
@@ -1738,13 +1738,19 @@ H5F_flush_real(H5F_t *f, hid_t dxpl_id, unsigned flags)
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, (unsigned)((flags & H5F_FLUSH_CLOSING) > 0)) < 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)
@@ -1954,7 +1960,7 @@ H5F_try_close(H5F_t *f)
*/
if(f->intent&H5F_ACC_RDWR) {
/* Flush all caches */
- if(H5F_flush_real(f, H5AC_dxpl_id, H5F_FLUSH_NONE) < 0)
+ if(H5F_flush_real(f, H5AC_dxpl_id, FALSE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 6b2e4fe..fc38566 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -72,7 +72,7 @@ H5_DLL herr_t H5FD_read(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type,
haddr_t addr, size_t size, void *buf/*out*/);
H5_DLL herr_t H5FD_write(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type,
haddr_t addr, size_t size, const void *buf);
-H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing);
+H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index cbe1b12..b85626c 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -28,6 +28,7 @@
/* Private headers needed by this file */
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -38,15 +39,6 @@ typedef struct H5F_t H5F_t;
/* Block aggregation structure */
typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
-/*===----------------------------------------------------------------------===
- * Flush Flags
- *===----------------------------------------------------------------------===
- *
- * Flags passed into the flush routines which indicate what type of
- * flush we want to do. They can be ORed together.
- */
-#define H5F_FLUSH_NONE (0U) /* No flags specified */
-#define H5F_FLUSH_CLOSING (1U << 0) /* Closing the file */
/*
* Encode and decode macros for file meta-data.