summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-09-24 19:23:41 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-09-24 19:23:41 (GMT)
commita56b4db4ae25d30e6e7eb96f27d7b91e35148591 (patch)
tree7738d08a9734103fd12242eb5ff0244dd74c214d /src/H5Dchunk.c
parent37309c1bd98b3d810f09569c72ac375e75117a91 (diff)
downloadhdf5-a56b4db4ae25d30e6e7eb96f27d7b91e35148591.zip
hdf5-a56b4db4ae25d30e6e7eb96f27d7b91e35148591.tar.gz
hdf5-a56b4db4ae25d30e6e7eb96f27d7b91e35148591.tar.bz2
Remainder of vol_normalization changes (dataset, attribute, files, objects).
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 16d7530..30a9a3b 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -648,8 +648,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
/* Get the new file address / chunk size after flushing */
if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
- } /* end if */
- } /* end if */
+ }
+ }
/* Make sure the address of the chunk is returned. */
if(!H5F_addr_defined(udata.chunk_block.offset))
@@ -1300,11 +1300,9 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
if(file_type && (H5T_close_real(file_type) < 0))
HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype")
- if(file_space_normalized == TRUE) {
- /* (Casting away const OK -QAK) */
- if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0)
+ if(file_space_normalized == TRUE)
+ if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_io_init() */
@@ -1503,7 +1501,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection")
/* Move selection back to have correct offset in chunk */
- H5S_SELECT_ADJUST_U(fm->single_space, coords);
+ if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
#ifdef H5_HAVE_PARALLEL
/* store chunk selection information */
@@ -1615,7 +1614,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
} /* end if */
/* Move selection back to have correct offset in chunk */
- H5S_SELECT_ADJUST_U(tmp_fchunk, coords);
+ if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) {
+ (void)H5S_close(tmp_fchunk);
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection")
+ }
/* Add temporary chunk to the list of chunks */
@@ -1814,7 +1816,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
} /* end for */
/* Adjust the selection */
- if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */
+ if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection")
/* Get the next chunk node in the skip list */
@@ -3183,8 +3185,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent,
- hbool_t flush)
+H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush)
{
H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk);
herr_t ret_value = SUCCEED; /* Return value */
@@ -4199,13 +4200,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
while(!carry) {
hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */
- /* Look up this chunk */
- if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
+ /* Look up this chunk */
+ if(H5D__chunk_lookup(dset, scaled, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address")
#ifndef NDEBUG
/* None of the chunks should be allocated */
- if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type)
- HDassert(!H5F_addr_defined(udata.chunk_block.offset));
+ if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) {
+ HDassert(!H5F_addr_defined(udata.chunk_block.offset));
+ }
/* Make sure the chunk is really in the dataset and outside the
* original dimensions */
@@ -4233,7 +4235,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* Check to make sure the buffer is large enough. It is
* possible (though ill-advised) for the filter to shrink the
- * buffer. */
+ * buffer.
+ */
if(fb_info.fill_buf_size < orig_chunk_size) {
if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk")
@@ -4467,10 +4470,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
HGOTO_DONE(SUCCEED)
} /* end if */
- /*
- * Initialize structures needed to lock chunks into cache
- */
-
/* Set up chunked I/O info object, for operations on chunks (in callback).
* Note that we only need to set chunk_offset once, as the array's address
* will never change. */
@@ -6517,31 +6516,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded")
} /* end block */
- if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
- /* Sanity check */
+ if(old_chunk && H5F_addr_defined(old_chunk->offset)) {
+ /* Sanity check */
HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset));
/* Check for chunk being same size */
- if(new_chunk->length != old_chunk->length) {
- /* Release previous chunk */
- /* Only free the old location if not doing SWMR writes - otherwise
+ if(new_chunk->length != old_chunk->length) {
+ /* Release previous chunk */
+ /* Only free the old location if not doing SWMR writes - otherwise
* we must keep the old chunk around in case a reader has an
* outdated version of the B-tree node
*/
- if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
- alloc_chunk = TRUE;
- } /* end if */
+ if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE))
+ if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
+ alloc_chunk = TRUE;
+ } /* end if */
else {
- /* Don't need to reallocate chunk, but send its address back up */
+ /* Don't need to reallocate chunk, but send its address back up */
if(!H5F_addr_defined(new_chunk->offset))
new_chunk->offset = old_chunk->offset;
- } /* end else */
- } /* end if */
+ } /* end else */
+ } /* end if */
else {
HDassert(!H5F_addr_defined(new_chunk->offset));
- alloc_chunk = TRUE;
+ alloc_chunk = TRUE;
} /* end else */
} /* end if */
else {
@@ -6646,7 +6645,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk")
/* Read the non-filtered edge chunk */
- if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
+ if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk")
/* Pass the chunk through the pipeline */