From f0ce4df67f82ee7308ad812a1772079fcb141182 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 29 Jul 2009 22:27:41 -0500 Subject: [svn-r17272] Description: Finish pushing contiguous storage size from 'layout' into 'storage" data structure. Tested on: FreeBSD/32 6.3 (duty) w/debug Too minor to require h5committest --- src/H5Dcontig.c | 14 +++++++------- src/H5Defl.c | 2 +- src/H5Dint.c | 2 +- src/H5Dlayout.c | 2 +- src/H5Dtest.c | 4 ++-- src/H5Olayout.c | 8 ++++---- src/H5Oprivate.h | 6 +----- src/H5Pdcpl.c | 17 ++++++++--------- 8 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index a2b1f59..66427a3 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -132,7 +132,7 @@ H5D_contig_alloc(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) HDassert(layout); /* Allocate space for the contiguous data */ - if(HADDR_UNDEF == (layout->store.u.contig.addr = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size))) + if(HADDR_UNDEF == (layout->store.u.contig.addr = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->store.u.contig.size))) HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space") done: @@ -180,7 +180,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); HDassert(dset && H5D_CONTIGUOUS == dset->shared->layout.type); HDassert(H5F_addr_defined(dset->shared->layout.store.u.contig.addr)); - HDassert(dset->shared->layout.u.contig.size > 0); + HDassert(dset->shared->layout.store.u.contig.size > 0); HDassert(dset->shared->space); HDassert(dset->shared->type); @@ -215,7 +215,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) /* Initialize storage info for this dataset */ store.contig.dset_addr = dset->shared->layout.store.u.contig.addr; - store.contig.dset_size = dset->shared->layout.u.contig.size; + store.contig.dset_size = dset->shared->layout.store.u.contig.size; /* Get the number of elements in the dataset's dataspace */ snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space); @@ -328,7 +328,7 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) HDassert(layout); /* Free the file space for the chunk */ - if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->store.u.contig.addr, layout->u.contig.size) < 0) + if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->store.u.contig.addr, layout->store.u.contig.size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header") done: @@ -423,7 +423,7 @@ H5D_contig_construct(H5F_t *f, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Assign the dataset's contiguous storage size */ - dset->shared->layout.u.contig.size = tmp_size; + dset->shared->layout.store.u.contig.size = tmp_size; /* Get the sieve buffer size for this dataset */ dset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(f); @@ -482,7 +482,7 @@ H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t UNUSED *t FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_contig_io_init) io_info->store->contig.dset_addr = io_info->dset->shared->layout.store.u.contig.addr; - io_info->store->contig.dset_size = io_info->dset->shared->layout.u.contig.size; + io_info->store->contig.dset_size = io_info->dset->shared->layout.store.u.contig.size; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_contig_io_init() */ @@ -1267,7 +1267,7 @@ H5D_contig_copy(H5F_t *f_src, const H5O_layout_t *layout_src, H5F_t *f_dst, /* Set up number of bytes to copy, and initial buffer size */ /* (actually use the destination size, which has been fixed up, if necessary) */ - total_src_nbytes = layout_dst->u.contig.size; + total_src_nbytes = layout_dst->store.u.contig.size; H5_CHECK_OVERFLOW(total_src_nbytes, hsize_t, size_t); buf_size = MIN(H5D_TEMP_BUF_SIZE, (size_t)total_src_nbytes); diff --git a/src/H5Defl.c b/src/H5Defl.c index b9a8345..c884fd0 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -159,7 +159,7 @@ H5D_efl_construct(H5F_t *f, H5D_t *dset) /* Compute the total size of dataset */ tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * dt_size; - H5_ASSIGN_OVERFLOW(dset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t); + H5_ASSIGN_OVERFLOW(dset->shared->layout.store.u.contig.size, tmp_size, hssize_t, hsize_t); /* Get the sieve buffer size for this dataset */ dset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(f); diff --git a/src/H5Dint.c b/src/H5Dint.c index 77050e4..c8a75b1 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1784,7 +1784,7 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) case H5D_CONTIGUOUS: /* Datasets which are not allocated yet are using no space on disk */ if((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout)) - ret_value = dset->shared->layout.u.contig.size; + ret_value = dset->shared->layout.store.u.contig.size; else ret_value = 0; break; diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 1c74a66..6e7686b 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -407,7 +407,7 @@ H5D_layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Assign the dataset's contiguous storage size */ - dataset->shared->layout.u.contig.size = tmp_size; + dataset->shared->layout.store.u.contig.size = tmp_size; } /* end if */ /* Get the sieve buffer size for this dataset */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index d9a418e..79568fe 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -128,7 +128,7 @@ H5D_layout_contig_size_test(hid_t did, hsize_t *size) if(size) { HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); - *size = dset->shared->layout.u.contig.size; + *size = dset->shared->layout.store.u.contig.size; } /* end if */ done: @@ -142,7 +142,7 @@ done: PURPOSE Determine current the size of the dataset's chunk cache USAGE - herr_t H5D_layout_contig_size_test(did, size) + herr_t H5D_current_cache_size_test(did, size) hid_t did; IN: Dataset to query hsize_t *size; OUT: Pointer to location to place size info RETURNS diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 8c3e266..919dceb 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -206,7 +206,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, case H5D_CONTIGUOUS: H5F_addr_decode(f, &p, &(mesg->store.u.contig.addr)); - H5F_DECODE_LENGTH(f, p, mesg->u.contig.size); + H5F_DECODE_LENGTH(f, p, mesg->store.u.contig.size); /* Set the layout operations */ mesg->ops = H5D_LOPS_CONTIG; @@ -323,7 +323,7 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi case H5D_CONTIGUOUS: H5F_addr_encode(f, &p, mesg->store.u.contig.addr); - H5F_ENCODE_LENGTH(f, p, mesg->u.contig.size); + H5F_ENCODE_LENGTH(f, p, mesg->store.u.contig.size); break; case H5D_CHUNKED: @@ -616,7 +616,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 */ if(layout_src->version < 3) - layout_dst->u.contig.size = H5S_extent_nelem(udata->src_space_extent) * + layout_dst->store.u.contig.size = H5S_extent_nelem(udata->src_space_extent) * H5T_get_size(udata->src_dtype); if(H5F_addr_defined(layout_src->store.u.contig.addr)) { @@ -721,7 +721,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Data address:", mesg->store.u.contig.addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Data Size:", mesg->u.contig.size); + "Data Size:", mesg->store.u.contig.size); break; case H5D_COMPACT: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 085557b..d6b3cd0 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -355,6 +355,7 @@ struct H5D_chunk_ops_t; /* Defined in H5Dpkg.h */ typedef struct H5O_storage_contig_t { haddr_t addr; /* File address of data */ + hsize_t size; /* Size of data in bytes */ } H5O_storage_contig_t; typedef struct H5O_storage_chunk_t { @@ -376,10 +377,6 @@ typedef struct H5O_storage_t { } u; } H5O_storage_t; -typedef struct H5O_layout_contig_t { - hsize_t size; /* Size of data in bytes */ -} H5O_layout_contig_t; - typedef struct H5O_layout_chunk_btree_t { H5RC_t *shared; /* Ref-counted shared info for B-tree nodes */ } H5O_layout_chunk_btree_t; @@ -403,7 +400,6 @@ typedef struct H5O_layout_t { unsigned version; /* Version of message */ const struct H5D_layout_ops_t *ops; /* Pointer to data layout I/O operations */ union { - H5O_layout_contig_t contig; /* Information for contiguous layout */ H5O_layout_chunk_t chunk; /* Information for chunked layout */ } u; H5O_storage_t store; /* Information for storing dataset elements */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 317b9c3..92f2475 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -49,26 +49,25 @@ /* Define default layout information */ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} -#define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF} +#define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} #define H5D_DEF_STORAGE_CHUNK_INIT {HADDR_UNDEF} -#define H5D_DEF_LAYOUT_CONTIG_INIT {(hsize_t)0} #define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_BTREE, (unsigned)1, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL, {{NULL}}} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} #define H5D_DEF_STORAGE_CONTIG {H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT }} #define H5D_DEF_STORAGE_CHUNK {H5D_CHUNKED, { .chunk = H5D_DEF_STORAGE_CHUNK_INIT }} -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, { .contig = H5D_DEF_LAYOUT_CONTIG_INIT }, H5D_DEF_STORAGE_COMPACT} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, { .contig = H5D_DEF_LAYOUT_CONTIG_INIT }, H5D_DEF_STORAGE_CONTIG} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, { .chunk = H5D_DEF_LAYOUT_CHUNK_INIT }, H5D_DEF_STORAGE_CHUNK} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_COMPACT} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CONTIG} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CHUNK} #else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Note that the compact & chunked layout initialization values are using the * contiguous layout initialization in the union, because the contiguous * layout is first in the union. These values are overridden in the * H5P_init_def_layout() routine. -QAK */ -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* ======== Dataset creation properties ======== */ @@ -275,7 +274,7 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) case H5D_CONTIGUOUS: dst_layout.store.u.contig.addr = HADDR_UNDEF; - dst_layout.u.contig.size = 0; + dst_layout.store.u.contig.size = 0; break; case H5D_CHUNKED: -- cgit v0.12