diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-27 20:26:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-27 20:26:32 (GMT) |
commit | 6e6760216bd2dc64bba0976cdf1a1fed5a8fa114 (patch) | |
tree | 13235c92a1c3d9be4a8dc988788cb2e383e264eb /src/H5Dcontig.c | |
parent | 66be6f05d417671d1ef202931d769743ad8a83d9 (diff) | |
download | hdf5-6e6760216bd2dc64bba0976cdf1a1fed5a8fa114.zip hdf5-6e6760216bd2dc64bba0976cdf1a1fed5a8fa114.tar.gz hdf5-6e6760216bd2dc64bba0976cdf1a1fed5a8fa114.tar.bz2 |
[svn-r8592] Purpose:
Code optimization & bug fix
Description:
When dimension information is being stored in the storage layout message
on disk, it is stored as 32-bit quantities, possibly truncating the dimension
information, if a dimension is greater than 32-bits in size.
Solution:
Fix the storage layout message problem by revising file format to not store
dimension information, since it is already available in the dataspace.
Also revise the storage layout data structures to be more compartmentalized
for the information for contiguous, chunked and compact storage.
Platforms tested:
FreeBSD 4.9 (sleipnir) w/parallel
Solaris 2.7 (arabica)
h5committest
Diffstat (limited to 'src/H5Dcontig.c')
-rw-r--r-- | src/H5Dcontig.c | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 9b1ad40..35b9700 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -31,10 +31,10 @@ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" -#include "H5FDprivate.h" /*file driver */ -#include "H5FLprivate.h" /*Free Lists */ -#include "H5MFprivate.h" /*file memory management */ +#include "H5Fpkg.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Sprivate.h" /* Dataspace functions */ @@ -46,8 +46,7 @@ #include "H5FDmpiposix.h" /* Private prototypes */ -static herr_t -H5F_contig_write(H5F_t *f, hsize_t max_data, haddr_t addr, +static herr_t H5F_contig_write(H5F_t *f, hsize_t max_data, haddr_t addr, const size_t size, hid_t dxpl_id, const void *buf); /* Interface initialization */ @@ -81,8 +80,6 @@ H5FL_BLK_DEFINE_STATIC(zero_fill); herr_t H5F_contig_create(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout) { - hsize_t size; /* Size of contiguous block of data */ - unsigned u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_contig_create, FAIL); @@ -91,14 +88,8 @@ H5F_contig_create(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout) assert(f); assert(layout); - /* Compute size */ - size=layout->dim[0]; - for (u = 1; u < layout->ndims; u++) - size *= layout->dim[u]; - assert (size>0); - /* Allocate space for the contiguous data */ - if (HADDR_UNDEF==(layout->addr=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, size))) + if (HADDR_UNDEF==(layout->u.contig.addr=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size))) HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space"); done: @@ -151,8 +142,8 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, assert(f); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); assert(layout && H5D_CONTIGUOUS==layout->type); - assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); - assert(H5F_addr_defined(layout->addr)); + assert(H5F_addr_defined(layout->u.contig.addr)); + assert(layout->u.contig.size>0); assert(space); assert(elmt_size>0); @@ -199,7 +190,7 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, #endif /* H5_HAVE_PARALLEL */ /* Get the number of elements in the dataset's dataspace */ - snpoints = H5S_get_simple_extent_npoints(space); + snpoints = H5S_GET_SIMPLE_EXTENT_NPOINTS(space); assert(snpoints>=0); H5_ASSIGN_OVERFLOW(npoints,snpoints,hssize_t,size_t); @@ -246,7 +237,7 @@ H5F_contig_fill(H5F_t *f, hid_t dxpl_id, struct H5O_layout_t *layout, } /* end else */ /* Start at the beginning of the dataset */ - addr = layout->addr; + addr = layout->u.contig.addr; /* Loop through writing the fill value to the dataset */ while (npoints>0) { @@ -322,8 +313,6 @@ done: herr_t H5F_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) { - hsize_t size; /* Size of contiguous block of data */ - unsigned u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_contig_delete, FAIL); @@ -332,17 +321,12 @@ H5F_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) assert(f); assert(layout); - /* Compute size */ - size=layout->dim[0]; - for (u = 1; u < layout->ndims; u++) - size *= layout->dim[u]; - /* Check for overlap with the sieve buffer and reset it */ - if (H5F_sieve_overlap_clear(f, dxpl_id, layout->addr, size)<0) + if (H5F_sieve_overlap_clear(f, dxpl_id, layout->u.contig.addr, layout->u.contig.size)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to clear sieve buffer"); /* Free the file space for the chunk */ - if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->addr, size)<0) + if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.addr, layout->u.contig.size)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header"); done: |