summaryrefslogtreecommitdiffstats
path: root/src/H5Dcontig.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-05-27 20:24:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-05-27 20:24:08 (GMT)
commit2ce06c39120fe3d89c0faa1c948b5a0399e968e2 (patch)
treee00c2829682ffc6d5830e97726ed8c5563278bcb /src/H5Dcontig.c
parent71fba25e6ea0d7cacb19928af43af6874a4008c2 (diff)
downloadhdf5-2ce06c39120fe3d89c0faa1c948b5a0399e968e2.zip
hdf5-2ce06c39120fe3d89c0faa1c948b5a0399e968e2.tar.gz
hdf5-2ce06c39120fe3d89c0faa1c948b5a0399e968e2.tar.bz2
[svn-r8590] 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.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 09be560..1255922 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -75,8 +75,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);
@@ -85,14 +83,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:
@@ -145,8 +137,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);
@@ -167,7 +159,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);
@@ -214,7 +206,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) {
@@ -290,8 +282,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);
@@ -300,17 +290,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: