diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-08-31 20:14:57 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-08-31 20:14:57 (GMT) |
commit | 2c91cbecc6460d1a319bfb2303e228ea6f6d6e4d (patch) | |
tree | 3d69591861803060012eed0be300427f4c261fc8 /src/H5Dcontig.c | |
parent | 1d3a7ec6515f26f13cb5d8e5c65fd848fd235d8f (diff) | |
parent | 81ca9e4c79a125cfcea9e426e1e91d94cdf6a2aa (diff) | |
download | hdf5-2c91cbecc6460d1a319bfb2303e228ea6f6d6e4d.zip hdf5-2c91cbecc6460d1a319bfb2303e228ea6f6d6e4d.tar.gz hdf5-2c91cbecc6460d1a319bfb2303e228ea6f6d6e4d.tar.bz2 |
[svn-r27630] Description:
Bring in changes from the trunk, through r27628.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial
(h5committest not required on this branch)
Diffstat (limited to 'src/H5Dcontig.c')
-rw-r--r-- | src/H5Dcontig.c | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 29ab1ff..fb3ac85 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -96,6 +96,8 @@ typedef struct H5D_contig_writevv_ud_t { /* Layout operation callbacks */ static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset); +static herr_t H5D__contig_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, + hid_t dapl_id); 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); @@ -119,7 +121,7 @@ static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, /* Contiguous storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D__contig_construct, - NULL, + H5D__contig_init, H5D__contig_is_space_alloc, H5D__contig_io_init, H5D__contig_read, @@ -451,6 +453,78 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__contig_init + * + * Purpose: Initialize the contiguous info for a dataset. This is + * called when the dataset is initialized. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, August 28, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__contig_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) +{ + hsize_t tmp_size; /* Temporary holder for raw data size */ + size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + HDassert(dset); + + /* Compute the size of the contiguous storage for versions of the + * layout message less than version 3 because versions 1 & 2 would + * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 + */ + if(dset->shared->layout.version < 3) { + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ + + /* Retrieve the number of elements in the dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + nelmts = (hsize_t)snelmts; + + /* Get the datatype's size */ + if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") + + /* Compute the size of the dataset's contiguous storage */ + tmp_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if(nelmts != (tmp_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") + + /* Assign the dataset's contiguous storage size */ + dset->shared->layout.storage.u.contig.size = tmp_size; + } /* end if */ + else + tmp_size = dset->shared->layout.storage.u.contig.size; + + /* Get the sieve buffer size for the file */ + tmp_sieve_buf_size = H5F_SIEVE_BUF_SIZE(dset->oloc.file); + + /* Adjust the sieve buffer size to the smaller one between the dataset size and the buffer size + * from the file access property. (SLU - 2012/3/30) */ + if(tmp_size < tmp_sieve_buf_size) + dset->shared->cache.contig.sieve_buf_size = tmp_size; + else + dset->shared->cache.contig.sieve_buf_size = tmp_sieve_buf_size; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__contig_init() */ + + +/*------------------------------------------------------------------------- * Function: H5D__contig_is_space_alloc * * Purpose: Query if space is allocated for layout |