summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_dataset.c
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2019-08-28 15:08:12 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2019-08-28 15:08:12 (GMT)
commite06bf9d263f46360e271569cd59a83786d80d7b6 (patch)
tree4ce0d2a63e6caf3f24c3fa7f34b4baa4c35c4619 /src/H5VLnative_dataset.c
parent506a5069a8b401db52ffe314e53751a0f1027128 (diff)
downloadhdf5-e06bf9d263f46360e271569cd59a83786d80d7b6.zip
hdf5-e06bf9d263f46360e271569cd59a83786d80d7b6.tar.gz
hdf5-e06bf9d263f46360e271569cd59a83786d80d7b6.tar.bz2
HDFFV-10677 and HDFFV-10661
Description: - Added functions to query chunk information: H5Dget_num_chunks(dset_id, fspace_id, *nchunks) Gets the number of written chunks that intersect with the given dataspace. However, in this version, the intersection is not yet completed. Thus, the number of all written chunks will be returned. H5Dget_chunk_info_by_coord(dset_id, *offset, *filter_mask, *addr, *size) Given a chunk's logical coordinates, returns the chunk's filter, address, and size. H5Dget_chunk_info(dset_id, fspace_id, index, *offset, *filter_mask, *addr, *size) Given a chunk's index, returns the chunk's logical coordinates, filter, address, and size. The chunk belongs to a set of chunks that have nonempty intersection with the specified dataspace. However, in this version, the intersection is not yet completed, and the index is of all the written chunks. These functions comply with VOL. - Fixed some oversights found in the library for the tests in chunk_info.c to work correctly. The returned value from a callback function was not checked in H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). This oversight caused a callback function to continue iterating even though it's supposed to stop. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1011test)
Diffstat (limited to 'src/H5VLnative_dataset.c')
-rw-r--r--src/H5VLnative_dataset.c102
1 files changed, 94 insertions, 8 deletions
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index 1e3d263..631eb19 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -339,7 +339,7 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
switch(specific_type) {
/* H5Dspecific_space */
case H5VL_DATASET_SET_EXTENT:
- {
+ { /* H5Dset_extent (H5Dextend - deprecated) */
const hsize_t *size = HDva_arg(arguments, const hsize_t *);
if(H5D__set_extent(dset, size) < 0)
@@ -348,7 +348,7 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
}
case H5VL_DATASET_FLUSH:
- {
+ { /* H5Dflush */
hid_t dset_id = HDva_arg(arguments, hid_t);
/* Flush the dataset */
@@ -359,7 +359,7 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
}
case H5VL_DATASET_REFRESH:
- {
+ { /* H5Drefresh */
hid_t dset_id = HDva_arg(arguments, hid_t);
/* Refresh the dataset */
@@ -399,7 +399,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
switch(optional_type) {
case H5VL_NATIVE_DATASET_FORMAT_CONVERT:
- {
+ { /* H5Dformat_convert */
dset = (H5D_t *)obj;
switch(dset->shared->layout.type) {
@@ -434,7 +434,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
}
case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE:
- {
+ { /* H5Dget_chunk_index_type */
H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *);
dset = (H5D_t *)obj;
@@ -450,7 +450,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
}
case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE:
- {
+ { /* H5Dget_chunk_storage_size */
hsize_t *offset = HDva_arg(arguments, hsize_t *);
hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *);
@@ -467,8 +467,94 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
break;
}
+ case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS:
+ { /* H5Dget_num_chunks */
+ const H5S_t *space = NULL;
+ hid_t space_id = HDva_arg(arguments, hid_t);
+ hsize_t *nchunks = HDva_arg(arguments, hsize_t *);
+
+ dset = (H5D_t *)obj;
+ HDassert(dset);
+ HDassert(dset->shared);
+ HDassert(dset->shared->space);
+
+ /* When default dataspace is given, use the dataset's dataspace */
+ if(space_id == H5S_ALL)
+ space = dset->shared->space;
+ else /* otherwise, use the given space ID */
+ if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID")
+
+ /* Make sure the dataset is chunked */
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if(H5D__get_num_chunks(dset, space, nchunks) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
+
+ break;
+ }
+
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX:
+ { /* H5Dget_chunk_info */
+ const H5S_t *space = NULL;
+ hid_t space_id = HDva_arg(arguments, hid_t);
+ hsize_t chk_index = HDva_arg(arguments, hsize_t);
+ hsize_t *offset = HDva_arg(arguments, hsize_t *);
+ unsigned *filter_mask = HDva_arg(arguments, unsigned *);
+ haddr_t *addr = HDva_arg(arguments, haddr_t *);
+ hsize_t *size = HDva_arg(arguments, hsize_t *);
+
+ dset = (H5D_t *)obj;
+ HDassert(dset);
+ HDassert(dset->shared);
+
+ /* When default dataspace is given, use the dataset's dataspace */
+ if(space_id == H5S_ALL)
+ {
+ space = dset->shared->space;
+ if(NULL == space)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain a dataspace")
+ } /* otherwise, use the given space ID */
+ else
+ if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID")
+
+ /* Make sure the dataset is chunked */
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if(H5D__get_chunk_info(dset, space, chk_index, offset, filter_mask, addr, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index")
+ break;
+ }
+
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR:
+ { /* H5Dget_chunk_info_by_coord */
+ hsize_t *offset = HDva_arg(arguments, hsize_t *);
+ unsigned *filter_mask = HDva_arg(arguments, unsigned *);
+ haddr_t *addr = HDva_arg(arguments, haddr_t *);
+ hsize_t *size = HDva_arg(arguments, hsize_t *);
+
+ dset = (H5D_t *)obj;
+ HDassert(dset);
+ HDassert(dset->shared);
+
+ /* Make sure the dataset is chunked */
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if(H5D__get_chunk_info_by_coord(dset, offset, filter_mask, addr, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates")
+
+ break;
+ }
+
case H5VL_NATIVE_DATASET_CHUNK_READ:
- {
+ { /* H5Dread_chunk */
const hsize_t *offset = HDva_arg(arguments, hsize_t *);
uint32_t *filters = HDva_arg(arguments, uint32_t *);
void *buf = HDva_arg(arguments, void *);
@@ -496,7 +582,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id,
}
case H5VL_NATIVE_DATASET_CHUNK_WRITE:
- {
+ { /* H5Dwrite_chunk */
uint32_t filters = HDva_arg(arguments, uint32_t);
const hsize_t *offset = HDva_arg(arguments, const hsize_t *);
uint32_t data_size_32 = HDva_arg(arguments, uint32_t);