summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-08-14 14:34:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-08-14 14:34:01 (GMT)
commit841ee1c05a6845e1bba815747f79c68a02125edd (patch)
tree3243120f12cb925a710a622d0de531432d8513ef /src/H5D.c
parentc85063bfad5a6ca624afe59be8cf26c241523eeb (diff)
downloadhdf5-841ee1c05a6845e1bba815747f79c68a02125edd.zip
hdf5-841ee1c05a6845e1bba815747f79c68a02125edd.tar.gz
hdf5-841ee1c05a6845e1bba815747f79c68a02125edd.tar.bz2
[svn-r5875] Purpose:
Additional regression tests & bug fixes Description: There was no testing for the H5Dget_storage_size function and it seemed to be having problems with compressed, chunked datasets, so write some tests to verify that its working correctly. Also, fix case for allocating storage early for chunked datasets Platforms tested: FreeBSD 4.6 (sleipnir) serial & parallel
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/H5D.c b/src/H5D.c
index d4f28db..b033e48 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3196,10 +3196,12 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
hsize_t addr; /* Offset in dataset */
void *buf = NULL; /* Buffer for fill value writing */
H5O_fill_t fill; /* Fill value information */
+ H5D_space_time_t space_time; /* When to allocate space */
H5P_genplist_t *plist; /* Property list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOINIT(H5D_init_storage);
+
assert(dset);
assert(space);
@@ -3208,6 +3210,8 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value");
+ if(H5P_get(plist, H5D_CRT_SPACE_TIME_NAME, &space_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve space allocation time");
switch (dset->layout.type) {
case H5D_CONTIGUOUS:
@@ -3252,12 +3256,15 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
break;
case H5D_CHUNKED:
-#ifdef H5_HAVE_PARALLEL
/*
* If the dataset is accessed via parallel I/O, allocate file space
* for all chunks now and initialize each chunk with the fill value.
*/
- if (IS_H5FD_MPIO(dset->ent.file) || IS_H5FD_MPIPOSIX(dset->ent.file)) {
+ if (space_time==H5D_SPACE_ALLOC_EARLY
+#ifdef H5_HAVE_PARALLEL
+ || (IS_H5FD_MPIO(dset->ent.file) || IS_H5FD_MPIPOSIX(dset->ent.file))
+#endif /*H5_HAVE_PARALLEL*/
+ ) {
/* We only handle simple data spaces so far */
int ndims;
hsize_t dim[H5O_LAYOUT_NDIMS];
@@ -3271,13 +3278,13 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
&(dset->layout), dim, plist)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset");
} /* end if */
-#endif /*H5_HAVE_PARALLEL*/
break;
} /* end switch */
done:
if (buf)
H5FL_BLK_FREE(type_conv,buf);
+
FUNC_LEAVE(ret_value);
}