summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hl/test/test_dset_opt.c221
-rw-r--r--release_docs/RELEASE.txt6
-rw-r--r--src/H5Dchunk.c37
-rw-r--r--src/H5Dcompact.c1
-rw-r--r--src/H5Dcontig.c25
-rw-r--r--src/H5Defl.c1
-rw-r--r--src/H5Dint.c3
-rw-r--r--src/H5Dio.c4
-rw-r--r--src/H5Dpkg.h9
-rw-r--r--src/H5Olayout.c9
10 files changed, 300 insertions, 16 deletions
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c
index 179e068..f2ad57e 100644
--- a/hl/test/test_dset_opt.c
+++ b/hl/test/test_dset_opt.c
@@ -64,6 +64,22 @@
#define OVERWRITE_CHUNK_NY 2
#define OVERWRITE_VALUE 42
+/* Test configurations */
+#define CONFIG_LATEST 0x01
+#define CONFIG_REOPEN_FILE 0x02
+#define CONFIG_REOPEN_DSET 0x04
+#define CONFIG_DIRECT_WRITE 0x08
+#define CONFIG_DIRECT_READ 0x10
+#define CONFIG_END 0x20
+
+/* Defines used in test_single_chunk() */
+#define SINGLE_FILE "single.h5"
+#define DATASET "dataset"
+#define DIM0 4
+#define DIM1 32
+#define CHUNK0 DIM0
+#define CHUNK1 DIM1
+
/* Local prototypes for filter functions */
static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
@@ -1972,15 +1988,160 @@ error:
} /* test_read_unallocated_chunk() */
/*-------------------------------------------------------------------------
- * Function: Main function
+ * Function: test_single_chunk
*
- * Purpose: Test direct chunk write function H5DOwrite_chunk
+ * Purpose: Tests direct chunk I/O with a dataset containing a single
+ * chunk using different combinations of configuration
+ * parameters. Simple create-write-read-verify pattern.
*
- * Return: Success: 0
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_single_chunk(unsigned config)
+{
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
+ hid_t dcpl; /* Dataset creation property list */
+ hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */
+ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */
+ hsize_t offset[2] = {0,0}; /* Offset for writing */
+ uint32_t filters; /* Filter mask out */
+ int wdata[DIM0][DIM1]; /* Write buffer */
+ int rdata[DIM0][DIM1]; /* Read buffer */
+ int i, j; /* Local index variable */
+
+ TESTING("Single chunk I/O");
+
+ /* Initialize data */
+ for (i=0; i<DIM0; i++) {
+ for (j=0; j< DIM1; j++)
+ wdata[i][j] = j/CHUNK0;
+ }
+
+ /* Create a new file with the latest format */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(config & CONFIG_LATEST)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+ if((fid = H5Fcreate(SINGLE_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset creation property list and set the chunk size */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, chunk) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if(config & CONFIG_DIRECT_WRITE) {
+ /* Write the data directly to the dataset */
+ if(H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0*CHUNK1*4, (void *)wdata) < 0)
+ goto error;
+ } /* end if */
+ else
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0)
+ goto error;
+
+ /*
+ * Close and release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(config & CONFIG_REOPEN_FILE)
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+ /* Open the file and dataset with default properties */
+ if(config & CONFIG_REOPEN_FILE)
+ if((fid = H5Fopen(SINGLE_FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto error;
+ if(config & CONFIG_REOPEN_DSET)
+ if((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Retrieve dataset creation property list */
+ if((dcpl = H5Dget_create_plist(did)) < 0)
+ goto error;
+
+ if(config & CONFIG_DIRECT_READ) {
+ /* Read the data directly */
+ if(H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0)
+ goto error;
+
+ /* Verify returned filter mask */
+ if(filters != 0)
+ goto error;
+ } /* end if */
+ else
+ /* Read the data */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
+ goto error;
+
+ /* Verify that the data read was correct. */
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++) {
+ if(rdata[i][j] != wdata[i][j])
+ goto error;
+ }
+ }
+
+ /*
+ * Close and release resources
+ */
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(dcpl);
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return 1;
+} /* test_single_chunk_latest() */
+
+/*-------------------------------------------------------------------------
+ * Function: Main function
*
- * Failure: 1
+ * Purpose: Test direct chunk write function H5Dwrite_chunk and
+ * chunk direct read function H5Dread_chunk
*
- * Programmer: Raymond Lu
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -1988,6 +2149,7 @@ error:
int main( void )
{
hid_t file_id;
+ unsigned config;
int nerrors=0;
/*
@@ -2016,6 +2178,54 @@ int main( void )
nerrors += test_read_unfiltered_dset(file_id);
nerrors += test_read_unallocated_chunk(file_id);
+ /* Loop over test configurations */
+ for(config = 0; config < CONFIG_END; config++) {
+ hbool_t need_comma = FALSE;
+
+ /* Check for invalid combinations */
+ if((config & CONFIG_REOPEN_FILE) && !(config & CONFIG_REOPEN_DSET))
+ continue;
+
+ /* Print configuration */
+ printf("Configuration: ");
+ if(config == 0)
+ printf("<empty>");
+ if(config & CONFIG_LATEST) {
+ if(need_comma)
+ printf(", ");
+ printf("latest format");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_REOPEN_FILE) {
+ if(need_comma)
+ printf(", ");
+ printf("reopen file");
+ need_comma = TRUE;
+ } /* end if */
+ else if(config & CONFIG_REOPEN_DSET) {
+ if(need_comma)
+ printf(", ");
+ printf("reopen dataset");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_WRITE) {
+ if(need_comma)
+ printf(", ");
+ printf("direct write");
+ need_comma = TRUE;
+ } /* end if */
+ if(config & CONFIG_DIRECT_READ) {
+ if(need_comma)
+ printf(", ");
+ printf("direct read");
+ need_comma = TRUE;
+ } /* end if */
+ printf(":\n");
+ fflush(stdout);
+
+ nerrors += test_single_chunk(config);
+ } /* end for */
+
if(H5Fclose(file_id) < 0)
goto error;
@@ -2030,3 +2240,4 @@ error:
HDputs("*** TESTS FAILED ***");
return EXIT_FAILURE;
}
+
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 5556253..471e936 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -139,6 +139,12 @@ Bug Fixes since HDF5-1.8.20
Library
-------
+ - Fixed a bug that could cause an error or cause fill values to be
+ incorrectly read from a dataset that was written to using H5Dwrite_chunk
+ if the dataset was not closed after writing.
+
+ (NAF - 2019/03/06, HDFFV-10716)
+
- Fixed a potential invalid memory access and failure that could occur when
decoding an unknown object header message (from a future version of the
library).
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 4cabd72..8a475b9 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -256,6 +256,7 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{
H5D__chunk_construct,
H5D__chunk_init,
H5D__chunk_is_space_alloc,
+ H5D__chunk_is_data_cached,
H5D__chunk_io_init,
H5D__chunk_read,
H5D__chunk_write,
@@ -282,6 +283,7 @@ const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{
NULL,
NULL,
NULL,
+ NULL,
#ifdef H5_HAVE_PARALLEL
NULL,
NULL,
@@ -332,8 +334,11 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz
FUNC_ENTER_STATIC
+ /* Sanity checks */
+ HDassert(layout->type == H5D_CHUNKED);
+
/* Allocate data space and initialize it if it hasn't been. */
- if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
+ if(!H5D__chunk_is_space_alloc(&dset->shared->layout.storage))
/* Allocate storage */
if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_WRITE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
@@ -374,6 +379,9 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz
if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk")
+ /* Cache the new chunk information */
+ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata);
+
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.addr))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined")
@@ -437,7 +445,8 @@ H5D__chunk_direct_read(const H5D_t *dset, hid_t dxpl_id, hsize_t *offset,
space_ndims = dset->shared->layout.u.chunk.ndims - 1;
/* Check if chunk storage is allocated for dataset */
- if(H5D__chunk_is_space_alloc(&(layout->storage)) == FALSE)
+ if((H5D__chunk_is_space_alloc(&(layout->storage)) == FALSE)
+ && !H5D__chunk_is_data_cached(dset->shared))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized")
/* Initialize the chunk offset */
@@ -899,6 +908,30 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+
+ FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0)
+} /* end H5D__chunk_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_io_init
*
* Purpose: Performs initialization before any sort of I/O on the raw data
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 4b61442..71866c3 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -79,6 +79,7 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
H5D__compact_construct,
NULL,
H5D__compact_is_space_alloc,
+ NULL,
H5D__compact_io_init,
H5D__contig_read,
H5D__contig_write,
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 9516d53..49e769b 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -119,6 +119,7 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{
H5D__contig_construct,
NULL,
H5D__contig_is_space_alloc,
+ H5D__contig_is_data_cached,
H5D__contig_io_init,
H5D__contig_read,
H5D__contig_write,
@@ -483,6 +484,30 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage)
/*-------------------------------------------------------------------------
+ * Function: H5D__contig_is_data_cached
+ *
+ * Purpose: Query if raw data is cached for dataset
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Neil Fortner
+ * Wednessday, March 6, 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(shared_dset);
+
+ FUNC_LEAVE_NOAPI(shared_dset->cache.contig.sieve_size > 0)
+} /* end H5D__contig_is_data_cached() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__contig_io_init
*
* Purpose: Performs initialization before any sort of I/O on the raw data
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 3ebcefb..cda841a 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -91,6 +91,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
H5D__efl_construct,
NULL,
H5D__efl_is_space_alloc,
+ NULL,
H5D__efl_io_init,
H5D__contig_read,
H5D__contig_write,
diff --git a/src/H5Dint.c b/src/H5Dint.c
index c34c9a9..1093e13 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2333,7 +2333,8 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
*-------------------------------------------------------------------------
*/
if(shrink && H5D_CHUNKED == dset->shared->layout.type &&
- (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
+ ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)
+ || (dset->shared->layout.ops->is_data_cached && (*dset->shared->layout.ops->is_data_cached)(dset->shared))))
/* Remove excess chunks */
if(H5D__chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
diff --git a/src/H5Dio.c b/src/H5Dio.c
index cb72437..1973b54 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -550,7 +550,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* has been overwritten. So just proceed in reading.
*/
if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 &&
- !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) {
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
+ !(dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) {
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
@@ -585,6 +586,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Sanity check that space is allocated, if there are elements */
if(nelmts > 0)
HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)
+ || (dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))
|| dataset->shared->dcpl_cache.efl.nused > 0
|| dataset->shared->layout.type == H5D_COMPACT);
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 8eaa1a4..b985de1 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -96,12 +96,14 @@ typedef struct H5D_type_info_t {
/* Forward declaration of structs used below */
struct H5D_io_info_t;
struct H5D_chunk_map_t;
+typedef struct H5D_shared_t H5D_shared_t;
/* Function pointers for I/O on particular types of dataset layouts */
typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset);
typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, hid_t dxpl_id, const H5D_t *dset,
hid_t dapl_id);
typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage);
+typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset);
typedef herr_t (*H5D_layout_io_init_func_t)(const struct 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,
@@ -126,6 +128,7 @@ typedef struct H5D_layout_ops_t {
H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */
H5D_layout_init_func_t init; /* Layout initializer for dataset */
H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */
+ H5D_layout_is_data_cached_func_t is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present then the layout type never caches raw data. */
H5D_layout_io_init_func_t io_init; /* I/O initialization routine */
H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */
H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */
@@ -405,7 +408,7 @@ typedef struct H5D_rdcdc_t {
* created once for a given dataset. Thus, if a dataset is opened twice,
* there will be two IDs and two H5D_t structs, both sharing one H5D_shared_t.
*/
-typedef struct H5D_shared_t {
+struct H5D_shared_t {
size_t fo_count; /* Reference count */
hid_t type_id; /* ID for dataset's datatype */
H5T_t *type; /* Datatype for this dataset */
@@ -428,7 +431,7 @@ typedef struct H5D_shared_t {
} cache;
char *extfile_prefix; /* expanded external file prefix */
-} H5D_shared_t;
+};
struct H5D_t {
H5O_loc_t oloc; /* Object header location */
@@ -587,6 +590,7 @@ H5_DLL herr_t H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh,
H5_DLL herr_t H5D__contig_alloc(H5F_t *f, hid_t dxpl_id,
H5O_storage_contig_t *storage);
H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id);
H5_DLL herr_t H5D__contig_read(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,
@@ -609,6 +613,7 @@ H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset);
H5_DLL herr_t H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset,
hid_t dapl_id);
H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage);
+H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id,
const hsize_t *chunk_offset, hsize_t chunk_idx, H5D_chunk_ud_t *udata);
H5_DLL void *H5D__chunk_lock(const H5D_io_info_t *io_info,
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 3f5076c..c22a1ba 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -630,9 +630,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
H5T_get_size(udata->src_dtype);
- if(H5D__contig_is_space_alloc(&layout_src->storage) ||
- (H5F_HAS_FEATURE(file_src, H5FD_FEAT_DATA_SIEVE) &&
- shared_fo && shared_fo->cache.contig.sieve_buf)) {
+ if(H5D__contig_is_space_alloc(&layout_src->storage)
+ || (cpy_info->shared_fo && H5D__contig_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) {
/* copy contiguous raw data */
if(H5D__contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage")
@@ -641,8 +640,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
break;
case H5D_CHUNKED:
- if(H5D__chunk_is_space_alloc(&layout_src->storage) ||
- (shared_fo && H5D__chunk_is_space_alloc(&shared_fo->layout.storage))) {
+ if(H5D__chunk_is_space_alloc(&layout_src->storage)
+ || (cpy_info->shared_fo && H5D__chunk_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo)))
/* Create chunked layout */
if(H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")