summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dio.c58
-rw-r--r--src/H5Distore.c28
-rw-r--r--src/H5Fistore.c28
3 files changed, 29 insertions, 85 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 452663a..5b2c44b 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -110,8 +110,6 @@ static herr_t H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type,
const H5S_t *file_space, const H5S_t *mem_space, fm_map *fm);
static herr_t H5D_destroy_chunk_map(fm_map *fm);
static void H5D_free_chunk_info(void *chunk_info);
-static herr_t H5D_chunk_coords_assist(hssize_t *coords, size_t ndims,
- const hsize_t chunks[], hsize_t chunk_idx);
static herr_t H5D_create_chunk_file_map_hyper(const fm_map *fm);
static herr_t H5D_create_chunk_mem_map_hyper(const fm_map *fm);
static herr_t H5D_chunk_file_cb(void *elem, hid_t type_id, hsize_t ndims,
@@ -2235,44 +2233,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_chunk_coords_assist
- *
- * Purpose: Compute the coords for a particular chunk (in CHUNK_IDX),
- * based on the size of the dataset's dataspace (given in
- * NDIMS and CHUNKS), putting the resulting chunk's coordinate
- * offsets in the COORDS array.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Thursday, April 10, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5D_chunk_coords_assist(hssize_t *coords, size_t ndims, const hsize_t chunks[], hsize_t chunk_idx)
-{
- hsize_t tmp; /* Size of "down elements" in each dimension */
- size_t i, j; /* Local index variables */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_chunk_coords_assist);
-
- for(i=0; i<ndims; i++) {
- tmp=1;
- for(j=i+1; j<ndims; j++)
- tmp *= chunks[j];
- coords[i] = (hssize_t)(chunk_idx / tmp);
- chunk_idx = chunk_idx % tmp;
- }
- coords[ndims] = 0;
-
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5D_create_chunk_map
*
* Purpose: Creates the mapping between elements selected in each chunk
@@ -2752,10 +2712,8 @@ H5D_create_chunk_file_map_hyper(const fm_map *fm)
new_chunk_info->mspace_shared=0;
/* Compute the chunk's coordinates */
- if(H5D_chunk_coords_assist(new_chunk_info->coords, fm->f_ndims, fm->chunks, chunk_index)<0) {
- H5D_free_chunk_info(new_chunk_info);
- HGOTO_ERROR(H5E_DATASPACE,H5E_CANTCOUNT,FAIL,"can't compute chunk info")
- } /* end if */
+ HDmemcpy(new_chunk_info->coords,coords,fm->f_ndims*sizeof(new_chunk_info->coords[0]));
+ new_chunk_info->coords[fm->f_ndims]=0;
/* Insert the new chunk into the TBBT tree */
if(H5TB_dins(fm->fsel,new_chunk_info,new_chunk_info)==NULL) {
@@ -2941,7 +2899,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
/* Compensate for the chunk offset */
for(u=0; u<fm->f_ndims; u++) {
H5_CHECK_OVERFLOW(fm->layout->dim[u],hsize_t,hssize_t);
- chunk_adjust[u]=adjust[u]-(chunk_info->coords[u]*(hssize_t)fm->layout->dim[u]); /*lint !e771 The adjust array will always be initialized */
+ chunk_adjust[u]=adjust[u]-chunk_info->coords[u]; /*lint !e771 The adjust array will always be initialized */
} /* end for */
#ifdef QAK
{
@@ -3071,12 +3029,14 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize
/* Set the memory chunk dataspace */
new_chunk_info->mspace=NULL;
+ new_chunk_info->mspace_shared=0;
/* Compute the chunk's coordinates */
- if(H5D_chunk_coords_assist(new_chunk_info->coords, fm->f_ndims, fm->chunks, chunk_index)<0) {
- H5D_free_chunk_info(new_chunk_info);
- HGOTO_ERROR(H5E_DATASPACE,H5E_CANTCOUNT,FAIL,"can't compute chunk info")
- } /* end if */
+ for(u=0; u<fm->f_ndims; u++) {
+ H5_CHECK_OVERFLOW(fm->layout->dim[u],hsize_t,hssize_t);
+ new_chunk_info->coords[u]=(coords[u]/(hssize_t)fm->layout->dim[u])*(hssize_t)fm->layout->dim[u];
+ } /* end for */
+ new_chunk_info->coords[fm->f_ndims]=0;
/* Insert the new chunk into the TBBT tree */
if(H5TB_dins(fm->fsel,new_chunk_info,new_chunk_info)==NULL) {
diff --git a/src/H5Distore.c b/src/H5Distore.c
index b88f089..7853abd 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -1699,7 +1699,6 @@ H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxp
void *buf)
{
haddr_t chunk_addr; /* Chunk address on disk */
- hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS];
size_t u; /* Local index variables */
ssize_t ret_value; /* Return value */
@@ -1722,16 +1721,13 @@ H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxp
assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */
#endif
- for (u=0; u<layout->ndims; u++)
- chunk_coords_in_elmts[u] = chunk_coords[u] * (hssize_t)(layout->dim[u]);
-
/* Get the address of this chunk on disk */
#ifdef QAK
-HDfprintf(stderr,"%s: chunk_coords_in_elmts={",FUNC);
+HDfprintf(stderr,"%s: chunk_coords={",FUNC);
for(u=0; u<layout->ndims; u++)
- HDfprintf(stderr,"%Hd%s",chunk_coords_in_elmts[u],(u<(layout->ndims-1) ? ", " : "}\n"));
+ HDfprintf(stderr,"%Hd%s",chunk_coords[u],(u<(layout->ndims-1) ? ", " : "}\n"));
#endif /* QAK */
- chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords_in_elmts, NULL);
+ chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords, NULL);
#ifdef QAK
HDfprintf(stderr,"%s: chunk_addr=%a, chunk_size=%Hu\n",FUNC,chunk_addr,layout->chunk_size);
HDfprintf(stderr,"%s: chunk_len_arr[%Zu]=%Zu\n",FUNC,*chunk_curr_seq,chunk_len_arr[*chunk_curr_seq]);
@@ -1761,7 +1757,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
* chunk.
*/
if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time,
- chunk_coords_in_elmts, FALSE, &idx_hint)))
+ chunk_coords, FALSE, &idx_hint)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk");
/* Use the vectorized memory copy routine to do actual work */
@@ -1770,7 +1766,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, FALSE,
- chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0)
+ chunk_coords, &idx_hint, chunk, (size_t)naccessed)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk");
/* Set return value */
@@ -1806,7 +1802,6 @@ H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache,
const void *buf)
{
haddr_t chunk_addr; /* Chunk address on disk */
- hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS];
size_t u; /* Local index variables */
ssize_t ret_value; /* Return value */
@@ -1829,16 +1824,13 @@ H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache,
assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */
#endif
- for (u=0; u<layout->ndims; u++)
- chunk_coords_in_elmts[u] = chunk_coords[u] * (hssize_t)(layout->dim[u]);
-
/* Get the address of this chunk on disk */
#ifdef QAK
-HDfprintf(stderr,"%s: chunk_coords_in_elmts={",FUNC);
+HDfprintf(stderr,"%s: chunk_coords={",FUNC);
for(u=0; u<layout->ndims; u++)
- HDfprintf(stderr,"%Hd%s",chunk_coords_in_elmts[u],(u<(layout->ndims-1) ? ", " : "}\n"));
+ HDfprintf(stderr,"%Hd%s",chunk_coords[u],(u<(layout->ndims-1) ? ", " : "}\n"));
#endif /* QAK */
- chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords_in_elmts, NULL);
+ chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords, NULL);
#ifdef QAK
HDfprintf(stderr,"%s: chunk_addr=%a, chunk_size=%Hu\n",FUNC,chunk_addr,layout->chunk_size);
HDfprintf(stderr,"%s: chunk_len_arr[%Zu]=%Zu\n",FUNC,*chunk_curr_seq,chunk_len_arr[*chunk_curr_seq]);
@@ -1886,7 +1878,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
relax = FALSE;
if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time,
- chunk_coords_in_elmts, relax, &idx_hint)))
+ chunk_coords, relax, &idx_hint)))
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk");
/* Use the vectorized memory copy routine to do actual work */
@@ -1895,7 +1887,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, TRUE,
- chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0)
+ chunk_coords, &idx_hint, chunk, (size_t)naccessed)<0)
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk");
/* Set return value */
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index b88f089..7853abd 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -1699,7 +1699,6 @@ H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxp
void *buf)
{
haddr_t chunk_addr; /* Chunk address on disk */
- hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS];
size_t u; /* Local index variables */
ssize_t ret_value; /* Return value */
@@ -1722,16 +1721,13 @@ H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxp
assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */
#endif
- for (u=0; u<layout->ndims; u++)
- chunk_coords_in_elmts[u] = chunk_coords[u] * (hssize_t)(layout->dim[u]);
-
/* Get the address of this chunk on disk */
#ifdef QAK
-HDfprintf(stderr,"%s: chunk_coords_in_elmts={",FUNC);
+HDfprintf(stderr,"%s: chunk_coords={",FUNC);
for(u=0; u<layout->ndims; u++)
- HDfprintf(stderr,"%Hd%s",chunk_coords_in_elmts[u],(u<(layout->ndims-1) ? ", " : "}\n"));
+ HDfprintf(stderr,"%Hd%s",chunk_coords[u],(u<(layout->ndims-1) ? ", " : "}\n"));
#endif /* QAK */
- chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords_in_elmts, NULL);
+ chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords, NULL);
#ifdef QAK
HDfprintf(stderr,"%s: chunk_addr=%a, chunk_size=%Hu\n",FUNC,chunk_addr,layout->chunk_size);
HDfprintf(stderr,"%s: chunk_len_arr[%Zu]=%Zu\n",FUNC,*chunk_curr_seq,chunk_len_arr[*chunk_curr_seq]);
@@ -1761,7 +1757,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
* chunk.
*/
if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time,
- chunk_coords_in_elmts, FALSE, &idx_hint)))
+ chunk_coords, FALSE, &idx_hint)))
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk");
/* Use the vectorized memory copy routine to do actual work */
@@ -1770,7 +1766,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, FALSE,
- chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0)
+ chunk_coords, &idx_hint, chunk, (size_t)naccessed)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk");
/* Set return value */
@@ -1806,7 +1802,6 @@ H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache,
const void *buf)
{
haddr_t chunk_addr; /* Chunk address on disk */
- hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS];
size_t u; /* Local index variables */
ssize_t ret_value; /* Return value */
@@ -1829,16 +1824,13 @@ H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache,
assert(chunk_coords[u]>=0); /*negative coordinates not supported (yet) */
#endif
- for (u=0; u<layout->ndims; u++)
- chunk_coords_in_elmts[u] = chunk_coords[u] * (hssize_t)(layout->dim[u]);
-
/* Get the address of this chunk on disk */
#ifdef QAK
-HDfprintf(stderr,"%s: chunk_coords_in_elmts={",FUNC);
+HDfprintf(stderr,"%s: chunk_coords={",FUNC);
for(u=0; u<layout->ndims; u++)
- HDfprintf(stderr,"%Hd%s",chunk_coords_in_elmts[u],(u<(layout->ndims-1) ? ", " : "}\n"));
+ HDfprintf(stderr,"%Hd%s",chunk_coords[u],(u<(layout->ndims-1) ? ", " : "}\n"));
#endif /* QAK */
- chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords_in_elmts, NULL);
+ chunk_addr=H5F_istore_get_addr(f, dxpl_id, layout, chunk_coords, NULL);
#ifdef QAK
HDfprintf(stderr,"%s: chunk_addr=%a, chunk_size=%Hu\n",FUNC,chunk_addr,layout->chunk_size);
HDfprintf(stderr,"%s: chunk_len_arr[%Zu]=%Zu\n",FUNC,*chunk_curr_seq,chunk_len_arr[*chunk_curr_seq]);
@@ -1886,7 +1878,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
relax = FALSE;
if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time,
- chunk_coords_in_elmts, relax, &idx_hint)))
+ chunk_coords, relax, &idx_hint)))
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk");
/* Use the vectorized memory copy routine to do actual work */
@@ -1895,7 +1887,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a
H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t);
if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, TRUE,
- chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0)
+ chunk_coords, &idx_hint, chunk, (size_t)naccessed)<0)
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk");
/* Set return value */