diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2017-12-01 18:41:26 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2017-12-01 18:41:26 (GMT) |
commit | b8c6b68c35fa2be23ef488a1d81097ff3ed55000 (patch) | |
tree | c3429ee577e454526c8704d66a84f0c45b7959a1 /src/H5Dcontig.c | |
parent | 23a702e7bad93fc4f14eab07678c75d276e2d0ad (diff) | |
parent | 60f76980aab92f0e0730170b99a2363acd3c97fa (diff) | |
download | hdf5-hdf5-1_8_20.zip hdf5-hdf5-1_8_20.tar.gz hdf5-hdf5-1_8_20.tar.bz2 |
Merge pull request #811 in HDFFV/hdf5 from hdf5_1_8_20 to 1.8/masterhdf5-1_8_20
* commit '60f76980aab92f0e0730170b99a2363acd3c97fa': (108 commits)
Update version numbers and remove empty sections in RELEASE.txt.
Restore line 1154: C2Cppfunction_map.mht to HTML_EXTRA_FILES.
Update version for 1.8.20 release.
Fixed documentation warnings
HDFFV-10329 Correct LINK INTERFACE and VS20013 compile
Switch default build mode from development to production. Increment version string to pre2.
Add RELEASE.txt note for HDFFV-10274. (cherry picked from commit f7a7d0a00613cba997212fa8032091629a678797)
Initialize hid_t variables in test_Attr_bug9. (cherry picked from commit 97bc393449f3fe02c5992872ab2842e12f611ef0)
Fix HDFFV-10274. When deleting all (or almost all) of the messages in an object header chunk, where the total amount deleted was greater than 64K, an error would occur due to an off by one error in the code that handled that case. Fixed this and added a test case. (cherry picked from commit 1b2c2ca9a6a7d7e1fcd5c3302e203f2e2dabf0af)
Fix linking of libs
Changed file path to relative.
iAdd NAG to supported compilers in RELEASE.txt.
Add description to RELEASE.txt for HDFFV-10323
Correct issue number
Set version to 1.8.20-pre1
Update supported and tested platforms in RELEASE.txt.
HDFFV-10321 Merge from 1.8
Incremented lib file .so numbers: revision for all except c++ for code change; current incremented, revision and age set to 0 for c++ due to symbols added and removed.
updated issues related to Fortran
Incremented lib file .so numbers: revision for all except c++ for dcode change; current incremented, revision and age set to 0 for c++ due to symbols added and removed.
...
Diffstat (limited to 'src/H5Dcontig.c')
-rw-r--r-- | src/H5Dcontig.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index c6cef57..9516d53 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1298,6 +1298,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 = 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 @@ -1418,9 +1422,32 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") } /* end if */ - /* 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; + /* + * It is possble for addr_src to be undefined when: + * (a) The dataset is created and data is written to it. + * (b) The dataset is then copied via H5Ocopy(). + * H5D_mark() in H5Dint.c is different between + * 1.8 and develop branches: + * 1.8--it just sets dataset->shared->layout_dirty as TRUE + * to be flushed later. + * develop--it will flush the layout message if it has been changed. + */ + if(!H5F_addr_defined(addr_src)) + addr_src = sieve_start; + } + + HDassert(H5F_addr_defined(addr_src)); + /* Loop over copying data */ while(total_src_nbytes > 0) { /* Check if we should reduce the number of bytes to transfer */ if(total_src_nbytes < src_nbytes) { @@ -1446,14 +1473,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 */ - if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5P_DATASET_XFER_DEFAULT, 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 */ + if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5P_DATASET_XFER_DEFAULT, 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 */ @@ -1463,13 +1496,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, H5P_DATASET_XFER_DEFAULT, 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) { |