summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2012-08-08 16:08:27 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2012-08-08 16:08:27 (GMT)
commitfaba610060cb168d97a7b9c01d95688542e2cf28 (patch)
treee37bba310e7129ae110f7f0e4ec5eb653601e8da /src/H5Dchunk.c
parent8a0b4729cdc7b9edb18e84b2b9182228bd6eaa2e (diff)
downloadhdf5-faba610060cb168d97a7b9c01d95688542e2cf28.zip
hdf5-faba610060cb168d97a7b9c01d95688542e2cf28.tar.gz
hdf5-faba610060cb168d97a7b9c01d95688542e2cf28.tar.bz2
[svn-r22641] Dectris project: I revised the code per Quincey's and Neil's comments. I added a performance benchmark program dectris_perf.c in the test/ directory.
Tested on koala and jam.
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index e9a50ef..7cde7b6 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -60,8 +60,6 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Vprivate.h" /* Vector and array functions */
-#include "H5Fprivate.h"
-#include "H5FDprivate.h"
/****************/
@@ -298,8 +296,8 @@ H5FL_BLK_DEFINE_STATIC(chunk);
*-------------------------------------------------------------------------
*/
herr_t
-H5D__direct_write(const H5D_t *dset, hid_t dxpl_id, size_t *offset, size_t buf_size,
- const void *buf)
+H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, unsigned filters, hsize_t *offset,
+ size_t data_size, const void *buf)
{
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
H5D_chunk_ud_t udata; /* User data for querying chunk info */
@@ -337,8 +335,12 @@ H5D__direct_write(const H5D_t *dset, hid_t dxpl_id, size_t *offset, size_t buf_s
&udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- /* If the chunk hasn't been allocated on disk, do so now. */
- if(!H5F_addr_defined(udata.addr)) {
+ udata.filter_mask = filters;
+
+ /* Check if the chunk needs to be 'inserted' (could exist already and
+ * the 'insert' operation could resize it)
+ */
+ {
H5D_chk_idx_info_t idx_info; /* Chunked index info */
/* Compose chunked index info struct */
@@ -349,9 +351,11 @@ H5D__direct_write(const H5D_t *dset, hid_t dxpl_id, size_t *offset, size_t buf_s
idx_info.storage = &(dset->shared->layout.storage.u.chunk);
/* Set up the size of chunk for user data */
- udata.nbytes = buf_size;
+ udata.nbytes = data_size;
- /* Create the chunk */
+ /* Create the chunk it if it doesn't exist, or reallocate the chunk
+ * if its size changed.
+ */
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")
@@ -372,10 +376,10 @@ H5D__direct_write(const H5D_t *dset, hid_t dxpl_id, size_t *offset, size_t buf_s
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk")
} /* end if */
- /* Write the data to the file driver, instead of H5F_block_write */
- lf = H5F_DRIVER(dset->oloc.file);
- if(H5FD_write(lf, dxpl_id, H5FD_MEM_DRAW, udata.addr, buf_size, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
+ /* Write the data to the file */
+ if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, data_size, dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file")
+
done:
/*FUNC_LEAVE_NOAPI(ret_value)*/