summaryrefslogtreecommitdiffstats
path: root/src/H5Dcontig.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2018-05-04 21:37:14 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2018-05-04 21:37:14 (GMT)
commit2ad049a6411923653365962c826cf59cf801d0d7 (patch)
treee8f8441cf03001362edf75bae862ab5b4b93a658 /src/H5Dcontig.c
parent5f702f40b719a05bf2d271797179b368c5fd39c5 (diff)
parentcc2eea14f6a6532a201dde13af13353d4d73fd92 (diff)
downloadhdf5-2ad049a6411923653365962c826cf59cf801d0d7.zip
hdf5-2ad049a6411923653365962c826cf59cf801d0d7.tar.gz
hdf5-2ad049a6411923653365962c826cf59cf801d0d7.tar.bz2
Merge pull request #1045 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:1.10/master to 1.10/masterhdf5-1_10_2
* commit 'cc2eea14f6a6532a201dde13af13353d4d73fd92': (1014 commits) Commit release date changes. Fix typo in INSTALL_Cygwin.txt Update references and merge from 1_10 Corrected email address Commit Barbara's INSTALL* file updates. Commit Elena's RELEASE.txt edits and Les'/Lori's README.txt revision. ommit Elena's RELEASE.txt edits and Les'/Lori's README.txt revision. Remove stray '/'. Add subdirectory for CMake-HDF5-1.10.2.zip. Correct name of hl compile script Add directory in release CMake...tar.gz file. Minor edits in RELEASE.txt. Set version for HDF5 1.10.2 release. release branch should not generate headers Switch default build mode to production. Set version to 1.10.2-pre2.. HDFF5-1.10.2-pre1 releaseed. Add links for security bug fixes to RELEASE.txt. Fix VS2017 binary readme Couple fixes to the test routine for HDFFV-10425. Add test and release info for the fix to HDFFV-10425 test failure with H5DOwrite_chunk. Updated RELEASE.txt Remove known probelem that was fixed. ...
Diffstat (limited to 'src/H5Dcontig.c')
-rw-r--r--src/H5Dcontig.c55
1 files changed, 38 insertions, 17 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 0ee4d28..aab4901 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -31,17 +31,18 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MFprivate.h" /* File memory management */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5VMprivate.h" /* Vector and array functions */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Dataset functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5VMprivate.h" /* Vector and array functions */
/****************/
@@ -1362,6 +1363,10 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
hsize_t buf_dim[1] = {0}; /* Dimension for buffer */
hbool_t is_vlen = FALSE; /* Flag to indicate that VL type conversion should occur */
hbool_t fix_ref = FALSE; /* Flag to indicate that ref values should be fixed */
+ H5D_shared_t *shared_fo = (H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
+ hbool_t try_sieve = FALSE; /* Try to get data from the sieve buffer */
+ haddr_t sieve_start = HADDR_UNDEF; /* Start location of sieve buffer */
+ haddr_t sieve_end = HADDR_UNDEF; /* End locations of sieve buffer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1485,6 +1490,16 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* Loop over copying data */
addr_src = storage_src->addr;
addr_dst = storage_dst->addr;
+
+ /* If data sieving is enabled and the dataset is open in the file,
+ set up to copy data out of the sieve buffer if deemed possible later */
+ if(H5F_HAS_FEATURE(f_src, H5FD_FEAT_DATA_SIEVE) &&
+ shared_fo && shared_fo->cache.contig.sieve_buf) {
+ try_sieve = TRUE;
+ sieve_start = shared_fo->cache.contig.sieve_loc;
+ sieve_end = sieve_start + shared_fo->cache.contig.sieve_size;
+ }
+
while(total_src_nbytes > 0) {
/* Check if we should reduce the number of bytes to transfer */
if(total_src_nbytes < src_nbytes) {
@@ -1510,14 +1525,20 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
dst_nbytes = mem_nbytes = src_nbytes;
} /* end if */
- /* Read raw data from source file - use raw dxpl because passed in one is metadata */
- if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
+ /* If the entire copy is within the sieve buffer, copy data from the sieve buffer */
+ if(try_sieve && (addr_src >= sieve_start) && ((addr_src + src_nbytes -1) < sieve_end)) {
+ unsigned char *base_sieve_buf = shared_fo->cache.contig.sieve_buf + (addr_src - sieve_start);
+
+ HDmemcpy(buf, base_sieve_buf, src_nbytes);
+ } else
+ /* Read raw data from source file - use raw dxpl because passed in one is metadata */
+ if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5AC_rawdata_dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data")
/* Perform datatype conversion, if necessary */
if(is_vlen) {
/* Convert from source file to memory */
- if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
+ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Copy into another buffer, to reclaim memory later */
@@ -1527,13 +1548,13 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
HDmemset(bkg, 0, buf_size);
/* Convert from memory to destination file */
- if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
+ if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Reclaim space from variable length data */
if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
- } /* end if */
+ } /* end if */
else if(fix_ref) {
/* Check for expanding references */
if(cpy_info->expand_ref) {