diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-11-20 10:50:18 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-11-20 10:50:18 (GMT) |
commit | 6a5559be99224fd6693f0b11fe31ad61e211f6cb (patch) | |
tree | c6694dca77b05351824312d5fbd3ddf9d37520dd | |
parent | b4f4670c811cae49e08f1799b6ea69a8bb1345f3 (diff) | |
download | hdf5-6a5559be99224fd6693f0b11fe31ad61e211f6cb.zip hdf5-6a5559be99224fd6693f0b11fe31ad61e211f6cb.tar.gz hdf5-6a5559be99224fd6693f0b11fe31ad61e211f6cb.tar.bz2 |
[svn-r14271] Description:
Avoid copying maximum dimensions for temporary dataspaces used for
describing chunks during raw data I/O.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
-rw-r--r-- | src/H5A.c | 6 | ||||
-rw-r--r-- | src/H5D.c | 6 | ||||
-rw-r--r-- | src/H5Dio.c | 8 | ||||
-rw-r--r-- | src/H5Oattr.c | 2 | ||||
-rw-r--r-- | src/H5Osdspace.c | 4 | ||||
-rw-r--r-- | src/H5S.c | 24 | ||||
-rw-r--r-- | src/H5Shyper.c | 4 | ||||
-rw-r--r-- | src/H5Spkg.h | 3 | ||||
-rw-r--r-- | src/H5Sprivate.h | 2 |
9 files changed, 30 insertions, 29 deletions
@@ -420,7 +420,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype") /* Copy the dataspace for the attribute */ - attr->ds = H5S_copy(space, FALSE); + attr->ds = H5S_copy(space, FALSE, TRUE); /* Set the latest format for dataspace, if requested */ if(H5F_USE_LATEST_FORMAT(loc->oloc->file)) @@ -1214,7 +1214,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Copy the attribute's dataspace */ - if(NULL == (ds = H5S_copy (attr->ds, FALSE))) + if(NULL == (ds = H5S_copy(attr->ds, FALSE, TRUE))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to copy dataspace") /* Atomize */ @@ -2284,7 +2284,7 @@ H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy attribute name") if(NULL == (new_attr->dt = H5T_copy(old_attr->dt, H5T_COPY_ALL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy attribute datatype") - if(NULL == (new_attr->ds = H5S_copy(old_attr->ds, FALSE))) + if(NULL == (new_attr->ds = H5S_copy(old_attr->ds, FALSE, TRUE))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy attribute dataspace") #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) @@ -417,15 +417,15 @@ H5Dget_space(hid_t dset_id) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL==(dset=(H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Read the data space message and return a data space object */ - if(NULL==(space=H5S_copy (dset->shared->space, FALSE))) + if(NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get data space") /* Create an atom */ - if((ret_value=H5I_register (H5I_DATASPACE, space)) < 0) + if((ret_value = H5I_register (H5I_DATASPACE, space)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space") done: diff --git a/src/H5Dio.c b/src/H5Dio.c index a058d23..5b79ace 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -2482,7 +2482,7 @@ H5D_create_chunk_map(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info, size_t elmt_size; /* Memory datatype size */ /* Make a copy of equivalent memory space */ - if((tmp_mspace = H5S_copy(mem_space, TRUE)) == NULL) + if((tmp_mspace = H5S_copy(mem_space, TRUE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") /* De-select the mem space copy */ @@ -2709,7 +2709,7 @@ H5D_create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_inf hssize_t schunk_points; /* Number of elements in chunk selection */ /* Create "temporary" chunk for selection operations (copy file space) */ - if((tmp_fchunk = H5S_copy(fm->file_space,TRUE))==NULL) + if((tmp_fchunk = H5S_copy(fm->file_space, TRUE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") /* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */ @@ -2905,7 +2905,7 @@ H5D_create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) /* Copy the information */ /* Copy the memory dataspace */ - if((chunk_info->mspace = H5S_copy(fm->mem_space,TRUE))==NULL) + if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") /* Release the current selection */ @@ -3094,7 +3094,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const /* Check if the chunk already has a memory space */ if(chunk_info->mspace==NULL) { /* Copy the template memory chunk dataspace */ - if((chunk_info->mspace = H5S_copy(fm->mchunk_tmpl,FALSE))==NULL) + if((chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space") } /* end else */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 3e0b757..adca14c 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -700,7 +700,7 @@ H5O_attr_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *mesg_ty } /* end else */ /* Copy the dataspace for the attribute */ - attr_dst->ds = H5S_copy(attr_src->ds, FALSE); + attr_dst->ds = H5S_copy(attr_src->ds, FALSE, FALSE); HDassert(attr_dst->ds); /* Reset the dataspace's sharing in the source file before trying to share diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index c97498a..414aa98 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -309,7 +309,7 @@ H5O_sdspace_copy(const void *mesg, void *dest) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy extent information */ - if(H5S_extent_copy(dst, src) < 0) + if(H5S_extent_copy(dst, src, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") /* Set return value */ @@ -460,7 +460,7 @@ H5O_sdspace_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src, HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed") /* Create a copy of the dataspace extent */ - if(H5S_extent_copy(udata->src_space_extent, src_space_extent) < 0) + if(H5S_extent_copy(udata->src_space_extent, src_space_extent, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") } /* end if */ @@ -542,7 +542,7 @@ H5Scopy(hid_t space_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Copy */ - if (NULL==(dst=H5S_copy (src, FALSE))) + if (NULL == (dst = H5S_copy(src, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy data space") /* Atomize */ @@ -580,22 +580,22 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id) H5S_t *dst; hid_t ret_value = SUCCEED; - FUNC_ENTER_API(H5Sextent_copy, FAIL); + FUNC_ENTER_API(H5Sextent_copy, FAIL) H5TRACE2("e", "ii", dst_id, src_id); /* Check args */ - if (NULL==(src=(H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE))) + if(NULL == (src = (H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - if (NULL==(dst=(H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE))) + if(NULL == (dst = (H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Copy */ - if (H5S_extent_copy(&(dst->extent),&(src->extent))<0) + if(H5S_extent_copy(&(dst->extent), &(src->extent), TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Sextent_copy() */ /*------------------------------------------------------------------------- @@ -613,7 +613,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) +H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max) { unsigned u; herr_t ret_value = SUCCEED; /* Return value */ @@ -641,13 +641,13 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) } /* end if */ else dst->size = NULL; - if(src->max) { + if(copy_max && src->max) { dst->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)src->rank); for(u = 0; u < src->rank; u++) dst->max[u] = src->max[u]; } /* end if */ else - dst->max=NULL; + dst->max = NULL; break; default: @@ -686,7 +686,7 @@ done: *------------------------------------------------------------------------- */ H5S_t * -H5S_copy(const H5S_t *src, hbool_t share_selection) +H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) { H5S_t *dst = NULL; H5S_t *ret_value; /* Return value */ @@ -697,7 +697,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the source dataspace's extent */ - if(H5S_extent_copy(&(dst->extent), &(src->extent)) < 0) + if(H5S_extent_copy(&(dst->extent), &(src->extent), copy_max) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") /* Copy the source dataspace's selection */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index ffb03d2..7b851c6 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -6791,7 +6791,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); /* Copy the first dataspace */ - if (NULL==(new_space=H5S_copy (space, TRUE))) + if (NULL == (new_space = H5S_copy (space, TRUE, TRUE))) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space"); /* Go modify the selection in the new dataspace */ @@ -6847,7 +6847,7 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree"); /* Copy the first dataspace */ - if (NULL==(new_space=H5S_copy (space1, TRUE))) + if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE))) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space"); /* Free the current selection for the new dataspace */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 8dc2991..667be62 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -232,7 +232,8 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]; /* Extent functions */ H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); -H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); +H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, + hbool_t copy_max); /* Operations on selections */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index c6f2ce5..49b1df8 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -191,7 +191,7 @@ typedef struct H5S_iostats_t { /* Operations on dataspaces */ -H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection); +H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max); H5_DLL herr_t H5S_close(H5S_t *ds); #ifdef H5S_DEBUG H5_DLL H5S_iostats_t *H5S_find(const H5S_t *mem_space, const H5S_t *file_space); |