From 52df94498eb662577b47303e8a750d35cc427183 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 30 Jul 2009 14:51:19 -0500 Subject: [svn-r17278] Description: Bring r17272:17276 from trunk to revise_chunks branch. tested on: FreeBSD/32 6.3 (duty) h5committest not required on this branch --- src/H5AC.c | 2 +- src/H5Dbtree.c | 245 ++++++++++++++--------------- src/H5Dchunk.c | 359 +++++++++++++++++++++++------------------- src/H5Dcompact.c | 36 ++--- src/H5Dcontig.c | 34 ++-- src/H5Ddbg.c | 2 +- src/H5Dearray.c | 272 +++++++++++++++++--------------- src/H5Defl.c | 2 +- src/H5Dfarray.c | 185 +++++++++++----------- src/H5Dint.c | 22 +-- src/H5Dlayout.c | 10 +- src/H5Dpkg.h | 22 +-- src/H5Dprivate.h | 6 +- src/H5Dproxy.c | 13 +- src/H5Dtest.c | 2 +- src/H5E.c | 1 - src/H5Olayout.c | 121 +++++++-------- src/H5Oprivate.h | 44 ++++-- src/H5Pdcpl.c | 22 +-- src/H5trace.c | 463 +++++++++++++++++++++++++++++-------------------------- 20 files changed, 984 insertions(+), 879 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 4e505ae..1994603 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -3265,7 +3265,7 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) if ( ( config_ptr->evictions_enabled == FALSE ) && ( ( config_ptr->incr_mode != H5C_incr__off ) || ( config_ptr->flash_incr_mode != H5C_flash_incr__off ) || - ( config_ptr->incr_mode != H5C_decr__off ) ) ) { + ( config_ptr->decr_mode != H5C_decr__off ) ) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ "Can't disable evictions while auto-resize is enabled.") diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 6b8da2f..eaf8230 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -83,16 +83,6 @@ typedef struct H5D_btree_key_t { unsigned filter_mask; /*excluded filters */ } H5D_btree_key_t; -/* - * Data exchange structure for indexed storage nodes. This structure is - * passed through the B-link tree layer to the methods for the objects - * to which the B-link tree points for operations which require no - * additional information. - * - * (Just an alias for the "common" info). - */ -typedef H5D_chunk_common_ud_t H5D_btree_ud0_t; - /* B-tree callback info for iteration over chunks */ typedef struct H5D_btree_it_ud_t { H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */ @@ -105,7 +95,8 @@ typedef struct H5D_btree_it_ud_t { /* Local Prototypes */ /********************/ -static herr_t H5D_btree_shared_create(const H5F_t *f, H5O_layout_t *layout); +static herr_t H5D_btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, + unsigned ndims); /* B-tree iterator callbacks */ static int H5D_btree_idx_iterate_cb(H5F_t *f, hid_t dxpl_id, const void *left_key, @@ -138,7 +129,7 @@ static herr_t H5D_btree_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id, static herr_t H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); static herr_t H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info); -static hbool_t H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout); +static hbool_t H5D_btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage); static herr_t H5D_btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, @@ -150,12 +141,12 @@ static herr_t H5D_btree_idx_remove(const H5D_chk_idx_info_t *idx_info, static herr_t H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info); static herr_t H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); -static herr_t H5D_btree_idx_copy_shutdown(H5O_layout_t *layout_src, - H5O_layout_t *layout_dst, hid_t dxpl_id); +static herr_t H5D_btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); static herr_t H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); -static herr_t H5D_btree_idx_reset(H5O_layout_t *layout, hbool_t reset_addr); -static herr_t H5D_btree_idx_dump(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D_btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D_btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); static herr_t H5D_btree_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -233,20 +224,20 @@ H5B_class_t H5B_BTREE[1] = {{ static H5RC_t * H5D_btree_get_shared(const H5F_t UNUSED *f, const void *_udata) { - const H5D_btree_ud0_t *udata = (const H5D_btree_ud0_t *) _udata; + const H5D_chunk_common_ud_t *udata = (const H5D_chunk_common_ud_t *) _udata; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_get_shared) HDassert(udata); - HDassert(udata->mesg); - HDassert(udata->mesg->u.chunk.idx_type == H5D_CHUNK_IDX_BTREE); - HDassert(udata->mesg->u.chunk.u.btree.shared); + HDassert(udata->storage); + HDassert(udata->storage->idx_type == H5D_CHUNK_IDX_BTREE); + HDassert(udata->storage->u.btree.shared); /* Increment reference count on B-tree info */ - H5RC_INC(udata->mesg->u.chunk.u.btree.shared); + H5RC_INC(udata->storage->u.btree.shared); /* Return the pointer to the ref-count object */ - FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.u.btree.shared) + FUNC_LEAVE_NOAPI(udata->storage->u.btree.shared) } /* end H5D_btree_get_shared() */ @@ -286,7 +277,7 @@ H5D_btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, HDassert(lt_key); HDassert(rt_key); HDassert(udata); - HDassert(udata->common.mesg->u.chunk.ndims > 0 && udata->common.mesg->u.chunk.ndims < H5O_LAYOUT_NDIMS); + HDassert(udata->common.layout->ndims > 0 && udata->common.layout->ndims < H5O_LAYOUT_NDIMS); HDassert(addr_p); /* Allocate new storage */ @@ -302,7 +293,7 @@ H5D_btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, */ lt_key->nbytes = udata->nbytes; lt_key->filter_mask = udata->filter_mask; - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + for(u = 0; u < udata->common.layout->ndims; u++) lt_key->offset[u] = udata->common.offset[u]; /* @@ -312,10 +303,10 @@ H5D_btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, if(H5B_INS_LEFT != op) { rt_key->nbytes = 0; rt_key->filter_mask = 0; - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) { - HDassert(udata->common.offset[u] + udata->common.mesg->u.chunk.dim[u] > + for(u = 0; u < udata->common.layout->ndims; u++) { + HDassert(udata->common.offset[u] + udata->common.layout->dim[u] > udata->common.offset[u]); - rt_key->offset[u] = udata->common.offset[u] + udata->common.mesg->u.chunk.dim[u]; + rt_key->offset[u] = udata->common.offset[u] + udata->common.layout->dim[u]; } /* end if */ } /* end if */ @@ -350,7 +341,7 @@ H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; - H5D_btree_ud0_t *udata = (H5D_btree_ud0_t *) _udata; + H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata; int ret_value; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_cmp2) @@ -358,10 +349,10 @@ H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat HDassert(lt_key); HDassert(rt_key); HDassert(udata); - HDassert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ - ret_value = H5V_vector_cmp_u(udata->mesg->u.chunk.ndims, lt_key->offset, rt_key->offset); + ret_value = H5V_vector_cmp_u(udata->layout->ndims, lt_key->offset, rt_key->offset); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_btree_cmp2() */ @@ -401,7 +392,7 @@ H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; - H5D_btree_ud0_t *udata = (H5D_btree_ud0_t *) _udata; + H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata; int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_cmp3) @@ -409,7 +400,7 @@ H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat HDassert(lt_key); HDassert(rt_key); HDassert(udata); - HDassert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Special case for faster checks on 1-D chunks */ /* (Checking for ndims==2 because last dimension is the datatype size) */ @@ -417,7 +408,7 @@ H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat /* slightly odd way the library initializes the right-most node in the */ /* indexed storage B-tree... */ /* (Dump the B-tree with h5debug to look at it) -QAK */ - if(udata->mesg->u.chunk.ndims == 2) { + if(udata->layout->ndims == 2) { if(udata->offset[0] > rt_key->offset[0]) ret_value = 1; else if(udata->offset[0] == rt_key->offset[0] && @@ -427,9 +418,9 @@ H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat ret_value = (-1); } /* end if */ else { - if(H5V_vector_ge_u(udata->mesg->u.chunk.ndims, udata->offset, rt_key->offset)) + if(H5V_vector_ge_u(udata->layout->ndims, udata->offset, rt_key->offset)) ret_value = 1; - else if(H5V_vector_lt_u(udata->mesg->u.chunk.ndims, udata->offset, lt_key->offset)) + else if(H5V_vector_lt_u(udata->layout->ndims, udata->offset, lt_key->offset)) ret_value = (-1); } /* end else */ @@ -480,8 +471,8 @@ H5D_btree_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void HDassert(lt_key); /* Is this *really* the requested chunk? */ - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) - if(udata->common.offset[u] >= lt_key->offset[u] + udata->common.mesg->u.chunk.dim[u]) + for(u = 0; u < udata->common.layout->ndims; u++) + if(udata->common.offset[u] >= lt_key->offset[u] + udata->common.layout->dim[u]) HGOTO_DONE(FALSE) /* Initialize return values */ @@ -558,7 +549,7 @@ H5D_btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, /* Negative indices not supported yet */ HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") - } else if(H5V_vector_eq_u(udata->common.mesg->u.chunk.ndims, + } else if(H5V_vector_eq_u(udata->common.layout->ndims, udata->common.offset, lt_key->offset) && lt_key->nbytes > 0) { /* @@ -597,20 +588,20 @@ H5D_btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, ret_value = H5B_INS_NOOP; } - } else if (H5V_hyper_disjointp(udata->common.mesg->u.chunk.ndims, - lt_key->offset, udata->common.mesg->u.chunk.dim, - udata->common.offset, udata->common.mesg->u.chunk.dim)) { - HDassert(H5V_hyper_disjointp(udata->common.mesg->u.chunk.ndims, - rt_key->offset, udata->common.mesg->u.chunk.dim, - udata->common.offset, udata->common.mesg->u.chunk.dim)); + } else if (H5V_hyper_disjointp(udata->common.layout->ndims, + lt_key->offset, udata->common.layout->dim, + udata->common.offset, udata->common.layout->dim)) { + HDassert(H5V_hyper_disjointp(udata->common.layout->ndims, + rt_key->offset, udata->common.layout->dim, + udata->common.offset, udata->common.layout->dim)); /* * Split this node, inserting the new new node to the right of the * current node. The MD_KEY is where the split occurs. */ md_key->nbytes = udata->nbytes; md_key->filter_mask = udata->filter_mask; - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) { - HDassert(0 == udata->common.offset[u] % udata->common.mesg->u.chunk.dim[u]); + for(u = 0; u < udata->common.layout->ndims; u++) { + HDassert(0 == udata->common.offset[u] % udata->common.layout->dim[u]); md_key->offset[u] = udata->common.offset[u]; } /* end for */ @@ -774,7 +765,7 @@ H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int ind const void *_key, const void *_udata) { const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key; - const H5D_btree_ud0_t *udata = (const H5D_btree_ud0_t *)_udata; + const unsigned *ndims = (const unsigned *)_udata; unsigned u; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_debug_key) @@ -784,7 +775,7 @@ H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int ind HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)key->nbytes); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); - for(u = 0; u < udata->mesg->u.chunk.ndims; u++) + for(u = 0; u < *ndims; u++) HDfprintf(stream, "%s%Hd", u?", ":"", key->offset[u]); HDfputs("}\n", stream); @@ -805,7 +796,7 @@ H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int ind *------------------------------------------------------------------------- */ static herr_t -H5D_btree_shared_create(const H5F_t *f, H5O_layout_t *layout) +H5D_btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, unsigned ndims) { H5B_shared_t *shared; /* Shared B-tree node info */ size_t sizeof_rkey; /* Size of raw (disk) key */ @@ -814,9 +805,9 @@ H5D_btree_shared_create(const H5F_t *f, H5O_layout_t *layout) FUNC_ENTER_NOAPI_NOINIT(H5D_btree_shared_create) /* Set the raw key size */ - sizeof_rkey = 4 + /*storage size */ - 4 + /*filter mask */ - layout->u.chunk.ndims * 8; /*dimension indices */ + sizeof_rkey = 4 + /*storage size */ + 4 + /*filter mask */ + ndims * 8; /*dimension indices */ /* Allocate & initialize global info for the shared structure */ if(NULL == (shared = H5B_shared_new(f, H5B_BTREE, sizeof_rkey))) @@ -826,7 +817,7 @@ H5D_btree_shared_create(const H5F_t *f, H5O_layout_t *layout) /* */ /* Make shared B-tree info reference counted */ - if(NULL == (layout->u.chunk.u.btree.shared = H5RC_create(shared, H5B_shared_free))) + if(NULL == (store->u.btree.shared = H5RC_create(shared, H5B_shared_free))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: @@ -859,10 +850,11 @@ H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t UNUSED *space HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); HDassert(H5F_addr_defined(dset_ohdr_addr)); /* Allocate the shared structure */ - if(H5D_btree_shared_create(idx_info->f, idx_info->layout) < 0) + if(H5D_btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout->ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") done: @@ -891,7 +883,7 @@ done: static herr_t H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info) { - H5D_btree_ud0_t udata; /* User data for B-tree callback */ + H5D_chunk_common_ud_t udata; /* User data for B-tree callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_btree_idx_create) @@ -901,13 +893,15 @@ H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(!H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); /* Initialize "user" data for B-tree callbacks, etc. */ - udata.mesg = idx_info->layout; + udata.layout = idx_info->layout; + udata.storage = idx_info->storage; /* Create the v1 B-tree for the chunk index */ - if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->layout->store.u.chunk.idx_addr)/*out*/) < 0) + if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: @@ -928,17 +922,17 @@ done: *------------------------------------------------------------------------- */ static hbool_t -H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout) +H5D_btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { hbool_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_idx_is_space_alloc) /* Check args */ - HDassert(layout); + HDassert(storage); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->store.u.chunk.idx_addr); + ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_btree_idx_is_space_alloc() */ @@ -968,14 +962,15 @@ H5D_btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. */ - if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, udata) < 0) + if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") done: @@ -1008,11 +1003,13 @@ H5D_btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(idx_info->layout->u.chunk.ndims > 0); + HDassert(idx_info->layout->ndims > 0); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Go get the chunk information from the B-tree */ - if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, udata) < 0) + if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") done: @@ -1094,18 +1091,20 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(chunk_cb); HDassert(chunk_udata); /* Initialize userdata */ HDmemset(&udata, 0, sizeof udata); - udata.common.mesg = idx_info->layout; + udata.common.layout = idx_info->layout; + udata.common.storage = idx_info->storage; udata.cb = chunk_cb; udata.udata = chunk_udata; /* Iterate over existing chunks */ - if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, H5D_btree_idx_iterate_cb, &udata)) < 0) + if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, H5D_btree_idx_iterate_cb, &udata)) < 0) HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree"); FUNC_LEAVE_NOAPI(ret_value) @@ -1135,13 +1134,14 @@ H5D_btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Remove the chunk from the v1 B-tree index and release the space for the * chunk (in the B-tree callback). */ - if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, udata) < 0) + if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry") done: @@ -1175,29 +1175,33 @@ H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); /* Check if the index data structure has been allocated */ - if(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)) { - H5O_layout_t tmp_layout; /* Local copy of layout info */ - H5D_btree_ud0_t udata; /* User data for B-tree iterator call */ + if(H5F_addr_defined(idx_info->storage->idx_addr)) { + H5O_storage_chunk_t tmp_storage; /* Local copy of storage info */ + H5D_chunk_common_ud_t udata; /* User data for B-tree operations */ - /* Set up user data for B-tree deletion */ - HDmemset(&udata, 0, sizeof udata); - tmp_layout = *idx_info->layout; - udata.mesg = &tmp_layout; + /* Set up temporary chunked storage info */ + tmp_storage = *idx_info->storage; /* Set up the shared structure */ - if(H5D_btree_shared_create(idx_info->f, &tmp_layout) < 0) + if(H5D_btree_shared_create(idx_info->f, &tmp_storage, idx_info->layout->ndims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") + /* Set up B-tree user data */ + HDmemset(&udata, 0, sizeof udata); + udata.layout = idx_info->layout; + udata.storage = &tmp_storage; + /* Delete entire B-tree */ - if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.store.u.chunk.idx_addr, &udata) < 0) + if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_storage.idx_addr, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") - /* Free the raw B-tree node buffer */ - if(NULL == tmp_layout.u.chunk.u.btree.shared) + /* Release the shared B-tree page */ + if(NULL == tmp_storage.u.btree.shared) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(tmp_layout.u.chunk.u.btree.shared) < 0) + if(H5RC_DEC(tmp_storage.u.btree.shared) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") } /* end if */ @@ -1230,22 +1234,24 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(idx_info_src->f); HDassert(idx_info_src->pline); HDassert(idx_info_src->layout); + HDassert(idx_info_src->storage); HDassert(idx_info_dst); HDassert(idx_info_dst->f); HDassert(idx_info_dst->pline); HDassert(idx_info_dst->layout); - HDassert(!H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); + HDassert(idx_info_dst->storage); + HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); /* Create shared B-tree info for each file */ - if(H5D_btree_shared_create(idx_info_src->f, idx_info_src->layout) < 0) + if(H5D_btree_shared_create(idx_info_src->f, idx_info_src->storage, idx_info_src->layout->ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for source shared B-tree info") - if(H5D_btree_shared_create(idx_info_dst->f, idx_info_dst->layout) < 0) + if(H5D_btree_shared_create(idx_info_dst->f, idx_info_dst->storage, idx_info_dst->layout->ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for destination shared B-tree info") /* Create the root of the B-tree that describes chunked storage in the dest. file */ if(H5D_btree_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); + HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1265,20 +1271,21 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_btree_idx_copy_shutdown(H5O_layout_t *layout_src, H5O_layout_t *layout_dst, +H5D_btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t UNUSED dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_btree_idx_copy_shutdown) - HDassert(layout_src); - HDassert(layout_dst); + HDassert(storage_src); + HDassert(storage_dst); /* Decrement refcount on shared B-tree info */ - if(H5RC_DEC(layout_src->u.chunk.u.btree.shared) < 0) + if(H5RC_DEC(storage_src->u.btree.shared) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page") - if(H5RC_DEC(layout_dst->u.chunk.u.btree.shared) < 0) + if(H5RC_DEC(storage_dst->u.btree.shared) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page") done: @@ -1302,7 +1309,7 @@ done: static herr_t H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) { - H5D_btree_ud0_t udata; /* User-data for loading B-tree nodes */ + H5D_chunk_common_ud_t udata; /* User-data for loading B-tree nodes */ H5B_info_t bt_info; /* B-tree info */ hbool_t shared_init = FALSE; /* Whether shared B-tree info is initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1314,19 +1321,21 @@ H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); HDassert(index_size); /* Initialize the shared info for the B-tree traversal */ - if(H5D_btree_shared_create(idx_info->f, idx_info->layout) < 0) + if(H5D_btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout->ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") shared_init = TRUE; /* Initialize B-tree node user-data */ HDmemset(&udata, 0, sizeof udata); - udata.mesg = idx_info->layout; + udata.layout = idx_info->layout; + udata.storage = idx_info->storage; /* Get metadata information for B-tree */ - if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, &bt_info, NULL, &udata) < 0) + if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, &bt_info, NULL, &udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") /* Set the size of the B-tree */ @@ -1334,9 +1343,9 @@ H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) done: if(shared_init) { - if(NULL == idx_info->layout->u.chunk.u.btree.shared) + if(NULL == idx_info->storage->u.btree.shared) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(idx_info->layout->u.chunk.u.btree.shared) < 0) + if(H5RC_DEC(idx_info->storage->u.btree.shared) < 0) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") } /* end if */ @@ -1361,16 +1370,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_btree_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) +H5D_btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_idx_reset) - HDassert(layout); + HDassert(storage); /* Reset index info */ if(reset_addr) - layout->store.u.chunk.idx_addr = HADDR_UNDEF; - layout->u.chunk.u.btree.shared = NULL; + storage->idx_addr = HADDR_UNDEF; + storage->u.btree.shared = NULL; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_btree_idx_reset() */ @@ -1389,17 +1398,14 @@ H5D_btree_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) *------------------------------------------------------------------------- */ static herr_t -H5D_btree_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream) +H5D_btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_btree_idx_dump) - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); + HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", idx_info->layout->store.u.chunk.idx_addr); + HDfprintf(stream, " Address: %a\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_btree_idx_dump() */ @@ -1428,11 +1434,12 @@ H5D_btree_idx_dest(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); /* Free the raw B-tree node buffer */ - if(NULL == idx_info->layout->u.chunk.u.btree.shared) + if(NULL == idx_info->storage->u.btree.shared) HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(idx_info->layout->u.chunk.u.btree.shared) < 0) + if(H5RC_DEC(idx_info->storage->u.btree.shared) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") done: @@ -1456,33 +1463,29 @@ herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, unsigned ndims) { - H5D_btree_ud0_t udata; /* B-tree user data */ - H5O_layout_t layout; /* Layout information for B-tree callback */ + H5O_storage_chunk_t storage; /* Storage information for B-tree callback */ hbool_t shared_init = FALSE; /* Whether B-tree shared info is initialized */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_btree_debug, FAIL) - /* Set up "fake" layout info */ - layout.u.chunk.ndims = ndims; + /* Reset "fake" storage info */ + HDmemset(&storage, 0, sizeof(storage)); /* Allocate the shared structure */ - if(H5D_btree_shared_create(f, &layout) < 0) + if(H5D_btree_shared_create(f, &storage, ndims) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") shared_init = TRUE; - /* Set up B-tree user data */ - HDmemset(&udata, 0, sizeof udata); - udata.mesg = &layout; - - (void)H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_BTREE, &udata); + /* Dump the records for the B-tree */ + (void)H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_BTREE, &ndims); done: if(shared_init) { /* Free the raw B-tree node buffer */ - if(NULL == layout.u.chunk.u.btree.shared) + if(NULL == storage.u.btree.shared) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") - if(H5RC_DEC(layout.u.chunk.u.btree.shared) < 0) + if(H5RC_DEC(storage.u.btree.shared) < 0) HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") } /* end if */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 56e6262..05f1ecc 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -351,7 +351,7 @@ H5D_chunk_set_info(const H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info") /* Call the index's "resize" callback */ - if(dset->shared->layout.u.chunk.ops->resize && (dset->shared->layout.u.chunk.ops->resize)(&dset->shared->layout) < 0) + if(dset->shared->layout.storage.u.chunk.ops->resize && (dset->shared->layout.storage.u.chunk.ops->resize)(&dset->shared->layout.u.chunk) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to resize chunk index information") done: @@ -435,7 +435,7 @@ H5D_chunk_construct(H5F_t *f, H5D_t *dset) H5_ASSIGN_OVERFLOW(dset->shared->layout.u.chunk.size, chunk_size, uint64_t, uint32_t); /* Reset address and pointer of the array struct for the chunked storage index */ - if(H5D_chunk_idx_reset(&dset->shared->layout, TRUE) < 0) + if(H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index") done: @@ -469,12 +469,12 @@ H5D_chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) /* Sanity check */ HDassert(f); HDassert(dset); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID"); @@ -511,10 +511,11 @@ H5D_chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Allocate any indexing structures */ - if(dset->shared->layout.u.chunk.ops->init && (dset->shared->layout.u.chunk.ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0) + if(dset->shared->layout.storage.u.chunk.ops->init && (dset->shared->layout.storage.u.chunk.ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") /* Set the number of chunks in dataset, etc. */ @@ -547,15 +548,15 @@ H5D_chunk_is_space_alloc(const H5O_layout_t *layout) /* Sanity checks */ HDassert(layout); - HDassert((H5D_CHUNK_IDX_EARRAY == layout->u.chunk.idx_type && - H5D_COPS_EARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout->u.chunk.idx_type && - H5D_COPS_FARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout->u.chunk.idx_type && - H5D_COPS_BTREE == layout->u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_EARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_FARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == layout->storage.u.chunk.idx_type && + H5D_COPS_BTREE == layout->storage.u.chunk.ops)); /* Query index layer */ - ret_value = (layout->u.chunk.ops->is_space_alloc)(layout); + ret_value = (layout->storage.u.chunk.ops->is_space_alloc)(&layout->storage.u.chunk); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_chunk_is_space_alloc() */ @@ -1897,13 +1898,14 @@ H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, idx_info.f = io_info->dset->oloc.file; idx_info.dxpl_id = io_info->dxpl_id; idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline); - idx_info.layout = &(io_info->dset->shared->layout); + idx_info.layout = &(io_info->dset->shared->layout.u.chunk); + idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk); /* Set up the size of chunk for user data */ udata.nbytes = io_info->dset->shared->layout.u.chunk.size; /* Create the chunk */ - if((io_info->dset->shared->layout.u.chunk.ops->insert)(&idx_info, &udata) < 0) + if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") /* Make sure the address of the chunk is returned. */ @@ -2065,24 +2067,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_chunk_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) +H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_chunk_idx_reset, FAIL) /* Sanity checks */ - HDassert(layout); - HDassert(layout->u.chunk.ops); - HDassert((H5D_CHUNK_IDX_EARRAY == layout->u.chunk.idx_type && - H5D_COPS_EARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout->u.chunk.idx_type && - H5D_COPS_FARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout->u.chunk.idx_type && - H5D_COPS_BTREE == layout->u.chunk.ops)); + HDassert(storage); + HDassert(storage->ops); + HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && + H5D_COPS_EARRAY == storage->ops) || + (H5D_CHUNK_IDX_FARRAY == storage->idx_type && + H5D_COPS_FARRAY == storage->ops) || + (H5D_CHUNK_IDX_BTREE == storage->idx_type && + H5D_COPS_BTREE == storage->ops)); /* Reset index structures */ - if((layout->u.chunk.ops->reset)(layout, reset_addr) < 0) + if((storage->ops->reset)(storage, reset_addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") done: @@ -2139,11 +2141,12 @@ H5D_chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *uda /* Sanity check */ HDassert(last); HDassert(udata); - HDassert(udata->common.mesg); + HDassert(udata->common.layout); + HDassert(udata->common.storage); HDassert(udata->common.offset); /* Stored the information to cache */ - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + for(u = 0; u < udata->common.layout->ndims; u++) last->offset[u] = udata->common.offset[u]; last->nbytes = udata->nbytes; last->filter_mask = udata->filter_mask; @@ -2178,7 +2181,8 @@ H5D_chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udat /* Sanity check */ HDassert(last); HDassert(udata); - HDassert(udata->common.mesg); + HDassert(udata->common.layout); + HDassert(udata->common.storage); HDassert(udata->common.offset); /* Check if the cached information is what is desired */ @@ -2186,7 +2190,7 @@ H5D_chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udat unsigned u; /* Local index variable */ /* Check that the offset is the same */ - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + for(u = 0; u < udata->common.layout->ndims; u++) if(last->offset[u] != udata->common.offset[u]) HGOTO_DONE(FALSE) @@ -2231,12 +2235,12 @@ H5D_chunk_create(H5D_t *dset /*in,out*/, hid_t dxpl_id) HDassert(dset); HDassert(H5D_CHUNKED == dset->shared->layout.type); HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); #ifndef NDEBUG { unsigned u; /* Local index variable */ @@ -2250,10 +2254,11 @@ H5D_chunk_create(H5D_t *dset /*in,out*/, hid_t dxpl_id) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Create the index for the chunks */ - if((dset->shared->layout.u.chunk.ops->create)(&idx_info) < 0) + if((dset->shared->layout.storage.u.chunk.ops->create)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") done: @@ -2285,17 +2290,18 @@ H5D_chunk_get_info(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset HDassert(dset); HDassert(dset->shared->layout.u.chunk.ndims > 0); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); HDassert(chunk_offset); HDassert(udata); /* Initialize the query information about the chunk we are looking for */ - udata->common.mesg = &(dset->shared->layout); + udata->common.layout = &(dset->shared->layout.u.chunk); + udata->common.storage = &(dset->shared->layout.storage.u.chunk); udata->common.offset = chunk_offset; /* Reset information about the chunk we are looking for */ @@ -2311,10 +2317,11 @@ H5D_chunk_get_info(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Go get the chunk information */ - if((dset->shared->layout.u.chunk.ops->get_addr)(&idx_info, udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") /* Cache the information retrieved */ @@ -2353,12 +2360,12 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * HDassert(dset); HDassert(dset->shared); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); HDassert(dxpl_cache); HDassert(ent); HDassert(!ent->locked); @@ -2369,7 +2376,8 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * hbool_t must_insert = FALSE; /* Whether the chunk must go through the "insert" method */ /* Set up user data for index callbacks */ - udata.common.mesg = &dset->shared->layout; + udata.common.layout = &dset->shared->layout.u.chunk; + udata.common.storage = &dset->shared->layout.storage.u.chunk; udata.common.offset = ent->offset; udata.filter_mask = 0; udata.nbytes = dset->shared->layout.u.chunk.size; @@ -2430,12 +2438,13 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if((dset->shared->layout.u.chunk.ops->insert)(&idx_info, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") /* Update the chunk entry's address, in case it was allocated or relocated */ @@ -2454,7 +2463,7 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * ent->dirty = FALSE; /* Check for SWMR writes to the file */ - if(dset->shared->layout.u.chunk.ops->can_swim && H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE) { + if(dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE) { /* Mark the proxy entry in the cache as clean */ if(H5D_chunk_proxy_mark(dset, ent, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as clean") @@ -2533,7 +2542,7 @@ H5D_chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * } /* end else */ /* Check for SWMR writes to the file */ - if(dset->shared->layout.u.chunk.ops->can_swim && H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE) { + if(dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE) { /* Remove the proxy entry in the cache */ if(H5D_chunk_proxy_remove(dset, dxpl_id, ent) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove proxy for chunk from metadata cache") @@ -2886,7 +2895,7 @@ H5D_chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, } /* end else */ /* Check for SWMR writes to the file */ - if(io_info->dset->shared->layout.u.chunk.ops->can_swim + if(io_info->dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(io_info->dset->oloc.file) & H5F_ACC_SWMR_WRITE) { /* Insert a proxy entry in the cache, to make certain that the * flush dependencies are maintained in the proper way for SWMR @@ -3033,7 +3042,7 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, ent->wr_count -= MIN(ent->wr_count, naccessed); /* Check for SWMR writes to the file */ - if(io_info->dset->shared->layout.u.chunk.ops->can_swim + if(io_info->dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(io_info->dset->oloc.file) & H5F_ACC_SWMR_WRITE) { /* Mark the proxy entry in the cache as dirty */ if(H5D_chunk_proxy_mark(io_info->dset, ent, TRUE) < 0) @@ -3106,12 +3115,12 @@ H5D_chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes) HDassert(dset); HDassert(dset->shared); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); /* Fill the DXPL cache values for later use */ if(H5D_get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) @@ -3128,10 +3137,11 @@ H5D_chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Iterate over the chunks */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_allocated_cb, &chunk_bytes) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_allocated_cb, &chunk_bytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") /* Set number of bytes for caller */ @@ -3160,7 +3170,7 @@ herr_t H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ - const H5D_chunk_ops_t *ops = dset->shared->layout.u.chunk.ops; /* Chunk operations */ + const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */ hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ size_t orig_chunk_size; /* Original size of chunk in bytes */ unsigned filter_mask = 0; /* Filter mask for chunks that have them */ @@ -3191,12 +3201,12 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - HDassert((H5D_CHUNK_IDX_EARRAY == layout->u.chunk.idx_type && - H5D_COPS_EARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout->u.chunk.idx_type && - H5D_COPS_FARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout->u.chunk.idx_type && - H5D_COPS_BTREE == layout->u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_EARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_FARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == layout->storage.u.chunk.idx_type && + H5D_COPS_BTREE == layout->storage.u.chunk.ops)); HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); /* Retrieve the dataset dimensions */ @@ -3285,7 +3295,8 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Reset the chunk offset indices */ HDmemset(chunk_offset, 0, (layout->u.chunk.ndims * sizeof(chunk_offset[0]))); @@ -3359,7 +3370,8 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) chunk_size = orig_chunk_size; /* Initialize the chunk information */ - udata.common.mesg = layout; + udata.common.layout = &layout->u.chunk; + udata.common.storage = &layout->storage.u.chunk; udata.common.offset = chunk_offset; H5_ASSIGN_OVERFLOW(udata.nbytes, chunk_size, size_t, uint32_t); udata.filter_mask = filter_mask; @@ -3460,7 +3472,7 @@ H5D_chunk_prune_fill(const H5D_chunk_rec_t *chunk_rec, H5D_chunk_it_ud1_t *udata const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */ H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ - unsigned rank = udata->common.mesg->u.chunk.ndims - 1; /* Dataset rank */ + unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */ H5S_sel_iter_t chunk_iter; /* Memory selection iteration info */ hssize_t sel_nelmts; /* Number of elements in selection */ hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */ @@ -3505,7 +3517,8 @@ H5D_chunk_prune_fill(const H5D_chunk_rec_t *chunk_rec, H5D_chunk_it_ud1_t *udata /* Lock the chunk into the cache, to get a pointer to the chunk buffer */ /* (Casting away const OK -QAK) */ io_info->store->chunk.offset = (hsize_t *)chunk_rec->offset; - chk_udata.common.mesg = layout; + chk_udata.common.layout = &layout->u.chunk; + chk_udata.common.storage = &layout->storage.u.chunk; chk_udata.common.offset = chunk_rec->offset; chk_udata.nbytes = chunk_rec->nbytes; chk_udata.filter_mask = chunk_rec->filter_mask; @@ -3587,7 +3600,7 @@ H5D_chunk_prune_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_prune_cb) /* Figure out what chunks are no longer in use for the specified extent and release them */ - rank = udata->common.mesg->u.chunk.ndims - 1; + rank = udata->common.layout->ndims - 1; for(u = 0; u < rank; u++) /* The chunk record points to a chunk of storage that contains the * beginning of the logical address space represented by UDATA. @@ -3601,7 +3614,7 @@ H5D_chunk_prune_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) break; } /* end if */ /* Check for chunk that overlaps new extent and will need fill values */ - else if((chunk_rec->offset[u] + udata->common.mesg->u.chunk.dim[u]) > udata->dims[u]) + else if((chunk_rec->offset[u] + udata->common.layout->dim[u]) > udata->dims[u]) /* Indicate that the chunk needs filling */ /* (but continue in loop, since it could be outside the extent in * another dimension -QAK) @@ -3766,12 +3779,12 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dims) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - HDassert((H5D_CHUNK_IDX_EARRAY == layout->u.chunk.idx_type && - H5D_COPS_EARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout->u.chunk.idx_type && - H5D_COPS_FARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout->u.chunk.idx_type && - H5D_COPS_BTREE == layout->u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_EARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_FARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == layout->storage.u.chunk.idx_type && + H5D_COPS_BTREE == layout->storage.u.chunk.ops)); HDassert(dxpl_cache); /* set the removal stack pointer in udata to NULL, so if the function fails @@ -3816,11 +3829,13 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dims) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Initialize the user data for the iteration */ HDmemset(&udata, 0, sizeof udata); - udata.common.mesg = layout; + udata.common.layout = &layout->u.chunk; + udata.common.storage = &layout->storage.u.chunk; udata.io_info = &chk_io_info; udata.idx_info = &idx_info; udata.dims = curr_dims; @@ -3889,19 +3904,20 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dims) } /* end while */ /* Iterate over the chunks */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_prune_cb, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_prune_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve prune chunks from index") /* Traverse the stack of chunks to be deleted, removing each. We will free * the nodes later in the "done" section. */ - idx_udata.mesg = layout; + idx_udata.layout = &layout->u.chunk; + idx_udata.storage = &layout->storage.u.chunk; tmp_stack = udata.rm_stack; while(tmp_stack) { /* Update the offset in idx_udata */ idx_udata.offset = tmp_stack->rec.offset; /* Remove the chunk from disk */ - if((layout->u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) + if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, H5_ITER_ERROR, "unable to remove chunk entry from index") /* Advance the stack pointer */ @@ -3960,14 +3976,14 @@ static int H5D_chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */ - unsigned rank = udata->common.mesg->u.chunk.ndims - 1; /* # of dimensions of dataset */ + unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */ hsize_t chunk_index; int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_addrmap_cb) /* Compute the index for this chunk */ - if(H5V_chunk_index(rank, chunk_rec->offset, udata->common.mesg->u.chunk.dim, udata->common.mesg->u.chunk.down_chunks, &chunk_index) < 0) + if(H5V_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, H5_ITER_ERROR, "can't get chunk index") /* Set it in the userdata to return */ @@ -4013,17 +4029,19 @@ H5D_chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) /* Set up user data for B-tree callback */ HDmemset(&udata, 0, sizeof(udata)); - udata.common.mesg = &dset->shared->layout; + udata.common.layout = &dset->shared->layout.u.chunk; + udata.common.storage = &dset->shared->layout.storage.u.chunk; udata.chunk_addr = chunk_addr; /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.dxpl_id = io_info->dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Iterate over chunks to build mapping of chunk addresses */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_addrmap_cb, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_addrmap_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunk index to build address map") done: @@ -4046,9 +4064,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_layout_t *layout) +H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5O_layout_t layout; /* Dataset layout message */ H5O_pline_t pline; /* I/O pipeline message */ htri_t exists; /* Flag if header message of interest exists */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4058,32 +4077,43 @@ H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_layout_t *layout) /* Sanity check */ HDassert(f); HDassert(oh); - HDassert(layout); - HDassert((H5D_CHUNK_IDX_EARRAY == layout->u.chunk.idx_type && - H5D_COPS_EARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout->u.chunk.idx_type && - H5D_COPS_FARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout->u.chunk.idx_type && - H5D_COPS_BTREE == layout->u.chunk.ops)); + HDassert(storage); + HDassert((H5D_CHUNK_IDX_EARRAY == storage->u.chunk.idx_type && + H5D_COPS_EARRAY == storage->u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == storage->u.chunk.idx_type && + H5D_COPS_FARRAY == storage->u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == storage->u.chunk.idx_type && + H5D_COPS_BTREE == storage->u.chunk.ops)); /* Check for I/O pipeline message */ if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message") else if(exists) { if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_PLINE_ID, &pline)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find I/O pipeline message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O pipeline message") } /* end else if */ else HDmemset(&pline, 0, sizeof(pline)); + /* Retrieve dataset layout message */ + if((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message") + else if(exists) { + if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, &layout)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message") + } /* end else if */ + else + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "can't find layout message") + /* Compose chunked index info struct */ idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = &pline; - idx_info.layout = layout; + idx_info.layout = &layout.u.chunk; + idx_info.storage = &storage->u.chunk; /* Delete the chunked storage information in the file */ - if((layout->u.chunk.ops->idx_delete)(&idx_info) < 0) + if((storage->u.chunk.ops->idx_delete)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index") done: @@ -4316,7 +4346,8 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Set up destination chunk callback information for insertion */ - udata_dst.common.mesg = udata->idx_info_dst->layout; + udata_dst.common.layout = udata->idx_info_dst->layout; + udata_dst.common.storage = udata->idx_info_dst->storage; udata_dst.common.offset = chunk_rec->offset; udata_dst.nbytes = chunk_rec->nbytes; udata_dst.filter_mask = chunk_rec->filter_mask; @@ -4337,7 +4368,7 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Insert chunk into the destination index */ - if((udata->idx_info_dst->layout->u.chunk.ops->insert)(udata->idx_info_dst, &udata_dst) < 0) + if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk into index") /* Write chunk data to destination file */ @@ -4396,19 +4427,19 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, HDassert(f_src); HDassert(f_dst); HDassert(layout_src && H5D_CHUNKED == layout_src->type); - HDassert((H5D_CHUNK_IDX_EARRAY == layout_src->u.chunk.idx_type && - H5D_COPS_EARRAY == layout_src->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout_src->u.chunk.idx_type && - H5D_COPS_FARRAY == layout_src->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout_src->u.chunk.idx_type && - H5D_COPS_BTREE == layout_src->u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == layout_src->storage.u.chunk.idx_type && + H5D_COPS_EARRAY == layout_src->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == layout_src->storage.u.chunk.idx_type && + H5D_COPS_FARRAY == layout_src->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == layout_src->storage.u.chunk.idx_type && + H5D_COPS_BTREE == layout_src->storage.u.chunk.ops)); HDassert(layout_dst && H5D_CHUNKED == layout_dst->type); - HDassert((H5D_CHUNK_IDX_EARRAY == layout_dst->u.chunk.idx_type && - H5D_COPS_EARRAY == layout_dst->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout_dst->u.chunk.idx_type && - H5D_COPS_FARRAY == layout_dst->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout_dst->u.chunk.idx_type && - H5D_COPS_BTREE == layout_dst->u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == layout_dst->storage.u.chunk.idx_type && + H5D_COPS_EARRAY == layout_dst->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == layout_dst->storage.u.chunk.idx_type && + H5D_COPS_FARRAY == layout_dst->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == layout_dst->storage.u.chunk.idx_type && + H5D_COPS_BTREE == layout_dst->storage.u.chunk.ops)); HDassert(ds_extent_src); HDassert(dt_src); @@ -4421,7 +4452,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, pline = pline_src; /* Layout is not created in the destination file, reset index address */ - if(H5D_chunk_idx_reset(layout_dst, TRUE) < 0) + if(H5D_chunk_idx_reset(&layout_dst->storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") /* Initialize layout information */ @@ -4448,15 +4479,17 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, idx_info_src.f = f_src; idx_info_src.dxpl_id = dxpl_id; idx_info_src.pline = pline; - idx_info_src.layout = layout_src; + idx_info_src.layout = &layout_src->u.chunk; + idx_info_src.storage = &layout_src->storage.u.chunk; idx_info_dst.f = f_dst; idx_info_dst.dxpl_id = dxpl_id; idx_info_dst.pline = pline; /* Use same I/O filter pipeline for dest. */ - idx_info_dst.layout = layout_dst; + idx_info_dst.layout = &layout_dst->u.chunk; + idx_info_dst.storage = &layout_dst->storage.u.chunk; /* Call the index-specific "copy setup" routine */ - if((layout_src->u.chunk.ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0) + if((layout_src->storage.u.chunk.ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up index-specific chunk copying information") copy_setup_done = TRUE; @@ -4560,7 +4593,8 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, /* Initialize the callback structure for the source */ HDmemset(&udata, 0, sizeof udata); - udata.common.mesg = layout_src; + udata.common.layout = &layout_src->u.chunk; + udata.common.storage = &layout_src->storage.u.chunk; udata.file_src = f_src; udata.idx_info_dst = &idx_info_dst; udata.buf = buf; @@ -4581,7 +4615,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, udata.cpy_info = cpy_info; /* Iterate over chunks to copy data */ - if((layout_src->u.chunk.ops->iterate)(&idx_info_src, H5D_chunk_copy_cb, &udata) < 0) + if((layout_src->storage.u.chunk.ops->iterate)(&idx_info_src, H5D_chunk_copy_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to copy data") /* I/O buffers may have been re-allocated */ @@ -4609,7 +4643,7 @@ done: /* Clean up any index information */ if(copy_setup_done) - if((layout_src->u.chunk.ops->copy_shutdown)(layout_src, layout_dst, dxpl_id) < 0) + if((layout_src->storage.u.chunk.ops->copy_shutdown)(&layout_src->storage.u.chunk, &layout_dst->storage.u.chunk, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to shut down index copying info") FUNC_LEAVE_NOAPI(ret_value) @@ -4641,12 +4675,12 @@ H5D_chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, /* Check args */ HDassert(f); HDassert(layout); - HDassert((H5D_CHUNK_IDX_EARRAY == layout->u.chunk.idx_type && - H5D_COPS_EARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == layout->u.chunk.idx_type && - H5D_COPS_FARRAY == layout->u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == layout->u.chunk.idx_type && - H5D_COPS_BTREE == layout->u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_EARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == layout->storage.u.chunk.idx_type && + H5D_COPS_FARRAY == layout->storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == layout->storage.u.chunk.idx_type && + H5D_COPS_BTREE == layout->storage.u.chunk.ops)); HDassert(pline); HDassert(index_size); @@ -4654,10 +4688,11 @@ H5D_chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = pline; - idx_info.layout = layout; + idx_info.layout = &layout->u.chunk; + idx_info.storage = &layout->storage.u.chunk; /* Get size of index structure */ - if((layout->u.chunk.ops->size)(&idx_info, index_size) < 0) + if((layout->storage.u.chunk.ops->size)(&idx_info, index_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info") done: @@ -4734,27 +4769,28 @@ H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) /* Sanity check */ HDassert(dset); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); /* Only display info if stream is defined */ if(stream) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_chunk_it_ud4_t udata; /* User data for callback */ + /* Display info for index */ + if((dset->shared->layout.storage.u.chunk.ops->dump)(&dset->shared->layout.storage.u.chunk, stream) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") + /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; - - /* Display info for index */ - if((dset->shared->layout.u.chunk.ops->dump)(&idx_info, stream) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Set up user data for callback */ udata.stream = stream; @@ -4762,7 +4798,7 @@ H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) udata.ndims = dset->shared->layout.u.chunk.ndims; /* Iterate over index and dump chunk info */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_dump_index_cb, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_dump_index_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to dump chunk info") } /* end if */ @@ -4799,12 +4835,12 @@ H5D_chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) HDassert(f); HDassert(dset); - HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_EARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_FARRAY == dset->shared->layout.u.chunk.ops) || - (H5D_CHUNK_IDX_BTREE == dset->shared->layout.u.chunk.idx_type && - H5D_COPS_BTREE == dset->shared->layout.u.chunk.ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_EARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_FARRAY == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_FARRAY == dset->shared->layout.storage.u.chunk.ops) || + (H5D_CHUNK_IDX_BTREE == dset->shared->layout.storage.u.chunk.idx_type && + H5D_COPS_BTREE == dset->shared->layout.storage.u.chunk.ops)); /* Fill the DXPL cache values for later use */ if(H5D_get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) @@ -4828,10 +4864,11 @@ H5D_chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Free any index structures */ - if((dset->shared->layout.u.chunk.ops->dest)(&idx_info) < 0) + if((dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") done: diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 17bf531..ae6a72e 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -127,16 +127,16 @@ H5D_compact_fill(H5D_t *dset, hid_t dxpl_id) /* Check args */ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); HDassert(dset && H5D_COMPACT == dset->shared->layout.type); - HDassert(dset->shared->layout.store.u.compact.buf); + HDassert(dset->shared->layout.storage.u.compact.buf); HDassert(dset->shared->type); HDassert(dset->shared->space); /* Initialize the fill value buffer */ /* (use the compact dataset storage buffer as the fill value buffer) */ - if(H5D_fill_init(&fb_info, dset->shared->layout.store.u.compact.buf, FALSE, + if(H5D_fill_init(&fb_info, dset->shared->layout.storage.u.compact.buf, FALSE, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, - dset->shared->type_id, (size_t)0, dset->shared->layout.store.u.compact.size, dxpl_id) < 0) + dset->shared->type_id, (size_t)0, dset->shared->layout.storage.u.compact.size, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") fb_info_init = TRUE; @@ -186,13 +186,13 @@ H5D_compact_construct(H5F_t *f, H5D_t *dset) * layout. */ tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(dset->shared->type); - H5_ASSIGN_OVERFLOW(dset->shared->layout.store.u.compact.size, tmp_size, hssize_t, size_t); + H5_ASSIGN_OVERFLOW(dset->shared->layout.storage.u.compact.size, tmp_size, hssize_t, size_t); /* Verify data size is smaller than maximum header message size * (64KB) minus other layout message fields. */ max_comp_data_size = H5O_MESG_MAX_SIZE - H5D_layout_meta_size(f, &(dset->shared->layout), FALSE); - if(dset->shared->layout.store.u.compact.size > max_comp_data_size) + if(dset->shared->layout.storage.u.compact.size > max_comp_data_size) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "compact dataset size is bigger than header message maximum size") done: @@ -244,8 +244,8 @@ H5D_compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t UNUSED * { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_compact_io_init) - io_info->store->compact.buf = io_info->dset->shared->layout.store.u.compact.buf; - io_info->store->compact.dirty = &io_info->dset->shared->layout.store.u.compact.dirty; + io_info->store->compact.buf = io_info->dset->shared->layout.storage.u.compact.buf; + io_info->store->compact.dirty = &io_info->dset->shared->layout.storage.u.compact.dirty; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_compact_io_init() */ @@ -356,10 +356,10 @@ H5D_compact_flush(H5D_t *dset, hid_t dxpl_id, unsigned UNUSED flags) HDassert(dset); /* Check if the buffered compact information is dirty */ - if(dset->shared->layout.store.u.compact.dirty) { + if(dset->shared->layout.storage.u.compact.dirty) { if(H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout), dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") - dset->shared->layout.store.u.compact.dirty = FALSE; + dset->shared->layout.storage.u.compact.dirty = FALSE; } /* end if */ done: @@ -449,7 +449,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, max_dt_size = MAX(max_dt_size, tmp_dt_size); /* Set number of whole elements that fit in buffer */ - if(0 == (nelmts = layout_src->store.u.compact.size / src_dt_size)) + if(0 == (nelmts = layout_src->storage.u.compact.size / src_dt_size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large") /* Set up number of bytes to copy, and initial buffer size */ @@ -476,7 +476,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemcpy(buf, layout_src->store.u.compact.buf, layout_src->store.u.compact.size); + HDmemcpy(buf, layout_src->storage.u.compact.buf, layout_src->storage.u.compact.size); /* Convert from source file to memory */ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0) @@ -492,7 +492,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") - HDmemcpy(layout_dst->store.u.compact.buf, buf, layout_dst->store.u.compact.size); + HDmemcpy(layout_dst->storage.u.compact.buf, buf, layout_dst->storage.u.compact.size); if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") @@ -504,24 +504,24 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, size_t ref_count; /* Determine # of reference elements to copy */ - ref_count = layout_src->store.u.compact.size / H5T_get_size(dt_src); + ref_count = layout_src->storage.u.compact.size / H5T_get_size(dt_src); /* Copy objects referenced in source buffer to destination file and set destination elements */ - if(H5O_copy_expand_ref(f_src, layout_src->store.u.compact.buf, dxpl_id, f_dst, - layout_dst->store.u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0) + if(H5O_copy_expand_ref(f_src, layout_src->storage.u.compact.buf, dxpl_id, f_dst, + layout_dst->storage.u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") } /* end if */ else /* Reset value to zero */ - HDmemset(layout_dst->store.u.compact.buf, 0, layout_src->store.u.compact.size); + HDmemset(layout_dst->storage.u.compact.buf, 0, layout_src->storage.u.compact.size); } /* end if */ else /* Type conversion not necessary */ - HDmemcpy(layout_dst->store.u.compact.buf, layout_src->store.u.compact.buf, layout_src->store.u.compact.size); + HDmemcpy(layout_dst->storage.u.compact.buf, layout_src->storage.u.compact.buf, layout_src->storage.u.compact.size); } /* end if */ else /* Type conversion not necessary */ - HDmemcpy(layout_dst->store.u.compact.buf, layout_src->store.u.compact.buf, layout_src->store.u.compact.size); + HDmemcpy(layout_dst->storage.u.compact.buf, layout_src->storage.u.compact.buf, layout_src->storage.u.compact.size); done: if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE) < 0) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 66427a3..62b63a5 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->store.u.contig.size))) + if(HADDR_UNDEF == (layout->storage.u.contig.addr = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->storage.u.contig.size))) HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space") done: @@ -179,8 +179,8 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) /* Check args */ 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.store.u.contig.size > 0); + HDassert(H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)); + HDassert(dset->shared->layout.storage.u.contig.size > 0); HDassert(dset->shared->space); HDassert(dset->shared->type); @@ -214,8 +214,8 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Initialize storage info for this dataset */ - store.contig.dset_addr = dset->shared->layout.store.u.contig.addr; - store.contig.dset_size = dset->shared->layout.store.u.contig.size; + store.contig.dset_addr = dset->shared->layout.storage.u.contig.addr; + store.contig.dset_size = dset->shared->layout.storage.u.contig.size; /* Get the number of elements in the dataset's dataspace */ snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space); @@ -317,7 +317,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) +H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const H5O_storage_t *storage) { herr_t ret_value = SUCCEED; /* Return value */ @@ -325,11 +325,11 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) /* check args */ HDassert(f); - HDassert(layout); + HDassert(storage); /* Free the file space for the chunk */ - 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") + if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, storage->u.contig.addr, storage->u.contig.size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free contiguous storage space") done: FUNC_LEAVE_NOAPI(ret_value) @@ -357,7 +357,7 @@ H5D_contig_get_addr(const H5D_t *dset) HDassert(dset); HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); - FUNC_LEAVE_NOAPI(dset->shared->layout.store.u.contig.addr) + FUNC_LEAVE_NOAPI(dset->shared->layout.storage.u.contig.addr) } /* end H5D_contig_get_addr() */ @@ -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.store.u.contig.size = tmp_size; + dset->shared->layout.storage.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); @@ -456,7 +456,7 @@ H5D_contig_is_space_alloc(const H5O_layout_t *layout) HDassert(layout); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->store.u.contig.addr); + ret_value = (hbool_t)H5F_addr_defined(layout->storage.u.contig.addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_is_space_alloc() */ @@ -481,8 +481,8 @@ 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.store.u.contig.size; + io_info->store->contig.dset_addr = io_info->dset->shared->layout.storage.u.contig.addr; + io_info->store->contig.dset_size = io_info->dset->shared->layout.storage.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->store.u.contig.size; + total_src_nbytes = layout_dst->storage.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); @@ -1365,8 +1365,8 @@ H5D_contig_copy(H5F_t *f_src, const H5O_layout_t *layout_src, H5F_t *f_dst, } /* end if */ /* Loop over copying data */ - addr_src = layout_src->store.u.contig.addr; - addr_dst = layout_dst->store.u.contig.addr; + addr_src = layout_src->storage.u.contig.addr; + addr_dst = layout_dst->storage.u.contig.addr; while(total_src_nbytes > 0) { /* Check if we should reduce the number of bytes to transfer */ if(total_src_nbytes < src_nbytes) { diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index a7e7fa9..fa4c54c 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -115,7 +115,7 @@ H5Ddebug(hid_t dset_id) if(H5D_CHUNKED == dset->shared->layout.type) (void)H5D_chunk_dump_index(dset, H5AC_dxpl_id, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.store.u.contig.addr); + HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 865526e..9dddf12 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -58,7 +58,7 @@ /* Extensible array create/open user data */ typedef struct H5D_earray_ctx_ud_t { const H5F_t *f; /* Pointer to file info */ - const H5O_layout_t *layout; /* Pointer to layout info */ + const H5O_layout_chunk_t *layout; /* Pointer to layout info */ } H5D_earray_ctx_ud_t; /* Extensible array callback context */ @@ -110,12 +110,12 @@ static herr_t H5D_earray_filt_debug(FILE *stream, int indent, int fwidth, static herr_t H5D_earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); static herr_t H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info); -static hbool_t H5D_earray_idx_is_space_alloc(const H5O_layout_t *layout); +static hbool_t H5D_earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage); static herr_t H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); -static herr_t H5D_earray_idx_resize(H5O_layout_t *layout); +static herr_t H5D_earray_idx_resize(H5O_layout_chunk_t *layout); static int H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); static herr_t H5D_earray_idx_remove(const H5D_chk_idx_info_t *idx_info, @@ -123,11 +123,11 @@ static herr_t H5D_earray_idx_remove(const H5D_chk_idx_info_t *idx_info, static herr_t H5D_earray_idx_delete(const H5D_chk_idx_info_t *idx_info); static herr_t H5D_earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); -static herr_t H5D_earray_idx_copy_shutdown(H5O_layout_t *layout_src, - H5O_layout_t *layout_dst, hid_t dxpl_id); +static herr_t H5D_earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); static herr_t H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); -static herr_t H5D_earray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr); +static herr_t H5D_earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); static herr_t H5D_earray_idx_support(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry); static herr_t H5D_earray_idx_unsupport(const H5D_chk_idx_info_t *idx_info, @@ -239,7 +239,7 @@ H5D_earray_crt_context(void *_udata) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - ctx->chunk_size_len = 1 + ((H5V_log2_gen(udata->layout->u.chunk.size) + 8) / 8); + ctx->chunk_size_len = 1 + ((H5V_log2_gen(udata->layout->size) + 8) / 8); if(ctx->chunk_size_len > 8) ctx->chunk_size_len = 8; @@ -621,21 +621,23 @@ H5D_earray_idx_depend(const H5D_chk_idx_info_t *idx_info) HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->u.chunk.idx_type); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); - HDassert(idx_info->layout->u.chunk.u.earray.ea); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(idx_info->storage->u.earray.ea); /* Set up object header location for dataset */ H5O_loc_reset(&oloc); oloc.file = idx_info->f; - oloc.addr = idx_info->layout->u.chunk.u.earray.dset_ohdr_addr; + oloc.addr = idx_info->storage->u.earray.dset_ohdr_addr; /* Pin the dataset's object header */ if(NULL == (oh = H5O_pin(&oloc, idx_info->dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") /* Make the extensible array a child flush dependency of the dataset's object header */ - if(H5EA_depend((H5AC_info_t *)oh, idx_info->layout->u.chunk.u.earray.ea) < 0) + if(H5EA_depend((H5AC_info_t *)oh, idx_info->storage->u.earray.ea) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header") done: @@ -676,21 +678,23 @@ H5D_earray_idx_undepend(const H5D_chk_idx_info_t *idx_info) HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->u.chunk.idx_type); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); - HDassert(idx_info->layout->u.chunk.u.earray.ea); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(idx_info->storage->u.earray.ea); /* Set up object header location for dataset */ H5O_loc_reset(&oloc); oloc.file = idx_info->f; - oloc.addr = idx_info->layout->u.chunk.u.earray.dset_ohdr_addr; + oloc.addr = idx_info->storage->u.earray.dset_ohdr_addr; /* Pin the dataset's object header */ if(NULL == (oh = H5O_pin(&oloc, idx_info->dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") /* Remove the extensible array as a child flush dependency of the dataset's object header */ - if(H5EA_undepend((H5AC_info_t *)oh, idx_info->layout->u.chunk.u.earray.ea) < 0) + if(H5EA_undepend((H5AC_info_t *)oh, idx_info->storage->u.earray.ea) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on object header") done: @@ -734,9 +738,11 @@ H5D_earray_idx_open(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->u.chunk.idx_type); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); - HDassert(NULL == idx_info->layout->u.chunk.u.earray.ea); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.earray.ea); /* Set up the user data */ udata.f = idx_info->f; @@ -744,7 +750,7 @@ H5D_earray_idx_open(const H5D_chk_idx_info_t *idx_info) /* Open the extensible array for the chunk index */ cls = (idx_info->pline->nused > 0) ? H5EA_CLS_FILT_CHUNK : H5EA_CLS_CHUNK; - if(NULL == (idx_info->layout->u.chunk.u.earray.ea = H5EA_open(idx_info->f, idx_info->dxpl_id, idx_info->layout->store.u.chunk.idx_addr, cls, &udata))) + if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, cls, &udata))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array") /* Check for SWMR writes to the file */ @@ -788,6 +794,7 @@ H5D_earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); HDassert(space); HDassert(H5F_addr_defined(dset_ohdr_addr)); @@ -815,10 +822,10 @@ H5D_earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, HGOTO_ERROR(H5E_DATASET, H5E_UNINITIALIZED, FAIL, "didn't find unlimited dimension") /* Set the unlimited dimension for the layout's future use */ - idx_info->layout->u.chunk.u.earray.unlim_dim = (unsigned)unlim_dim; + idx_info->layout->u.earray.unlim_dim = (unsigned)unlim_dim; /* Store the dataset's object header address for later */ - idx_info->layout->u.chunk.u.earray.dset_ohdr_addr = dset_ohdr_addr; + idx_info->storage->u.earray.dset_ohdr_addr = dset_ohdr_addr; done: FUNC_LEAVE_NOAPI(ret_value) @@ -857,8 +864,9 @@ H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(!H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); - HDassert(NULL == idx_info->layout->u.chunk.u.earray.ea); + HDassert(idx_info->storage); + HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.earray.ea); /* General parameters */ if(idx_info->pline->nused > 0) { @@ -867,7 +875,7 @@ H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->u.chunk.size) + 8) / 8); + chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->size) + 8) / 8); if(chunk_size_len > 8) chunk_size_len = 8; @@ -878,15 +886,15 @@ H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info) cparam.cls = H5EA_CLS_CHUNK; cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f); } /* end else */ - cparam.max_nelmts_bits = idx_info->layout->u.chunk.u.earray.cparam.max_nelmts_bits; + cparam.max_nelmts_bits = idx_info->layout->u.earray.cparam.max_nelmts_bits; HDassert(cparam.max_nelmts_bits > 0); - cparam.idx_blk_elmts = idx_info->layout->u.chunk.u.earray.cparam.idx_blk_elmts; + cparam.idx_blk_elmts = idx_info->layout->u.earray.cparam.idx_blk_elmts; HDassert(cparam.idx_blk_elmts > 0); - cparam.sup_blk_min_data_ptrs = idx_info->layout->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs; + cparam.sup_blk_min_data_ptrs = idx_info->layout->u.earray.cparam.sup_blk_min_data_ptrs; HDassert(cparam.sup_blk_min_data_ptrs > 0); - cparam.data_blk_min_elmts = idx_info->layout->u.chunk.u.earray.cparam.data_blk_min_elmts; + cparam.data_blk_min_elmts = idx_info->layout->u.earray.cparam.data_blk_min_elmts; HDassert(cparam.data_blk_min_elmts > 0); - cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits; + cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.earray.cparam.max_dblk_page_nelmts_bits; HDassert(cparam.max_dblk_page_nelmts_bits > 0); /* Set up the user data */ @@ -894,11 +902,11 @@ H5D_earray_idx_create(const H5D_chk_idx_info_t *idx_info) udata.layout = idx_info->layout; /* Create the extensible array for the chunk index */ - if(NULL == (idx_info->layout->u.chunk.u.earray.ea = H5EA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata))) + if(NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array") /* Get the address of the extensible array in file */ - if(H5EA_get_addr(idx_info->layout->u.chunk.u.earray.ea, &(idx_info->layout->store.u.chunk.idx_addr)) < 0) + if(H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address") /* Check for SWMR writes to the file */ @@ -925,17 +933,17 @@ done: *------------------------------------------------------------------------- */ static hbool_t -H5D_earray_idx_is_space_alloc(const H5O_layout_t *layout) +H5D_earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { hbool_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_earray_idx_is_space_alloc) /* Check args */ - HDassert(layout); + HDassert(storage); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->store.u.chunk.idx_addr); + ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_earray_idx_is_space_alloc() */ @@ -967,35 +975,36 @@ H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.chunk.u.earray.unlim_dim > 0) { + if(idx_info->layout->u.earray.unlim_dim > 0) { hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->u.chunk.ndims - 1); /* Number of dimensions */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ /* Set up the swizzled chunk coordinates */ HDmemcpy(swizzled_coords, udata->common.offset, ndims * sizeof(udata->common.offset[0])); - H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.chunk.u.earray.unlim_dim); + H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.u.earray.swizzled_down_chunks, &idx) < 0) + if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ else { /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->common.offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end else */ @@ -1009,7 +1018,7 @@ H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - allow_chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->u.chunk.size) + 8) / 8); + allow_chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->size) + 8) / 8); if(allow_chunk_size_len > 8) allow_chunk_size_len = 8; @@ -1068,7 +1077,7 @@ H5D_earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) } /* end if */ else { HDassert(!H5F_addr_defined(udata->addr)); - HDassert(udata->nbytes == idx_info->layout->u.chunk.size); + HDassert(udata->nbytes == idx_info->layout->size); #ifndef NDEBUG { @@ -1127,35 +1136,36 @@ H5D_earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.chunk.u.earray.unlim_dim > 0) { + if(idx_info->layout->u.earray.unlim_dim > 0) { hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->u.chunk.ndims - 1); /* Number of dimensions */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ /* Set up the swizzled chunk coordinates */ HDmemcpy(swizzled_coords, udata->common.offset, ndims * sizeof(udata->common.offset[0])); - H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.chunk.u.earray.unlim_dim); + H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.u.earray.swizzled_down_chunks, &idx) < 0) + if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ else { /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->common.offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end else */ @@ -1178,7 +1188,7 @@ H5D_earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") /* Update the other (constant) information for the chunk */ - udata->nbytes = idx_info->layout->u.chunk.size; + udata->nbytes = idx_info->layout->size; udata->filter_mask = 0; } /* end else */ @@ -1201,7 +1211,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_earray_idx_resize(H5O_layout_t *layout) +H5D_earray_idx_resize(H5O_layout_chunk_t *layout) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1211,14 +1221,14 @@ H5D_earray_idx_resize(H5O_layout_t *layout) HDassert(layout); /* Set up the swizzled "down" chunk information */ - if(layout->u.chunk.u.earray.unlim_dim > 0) { + if(layout->u.earray.unlim_dim > 0) { hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */ - HDmemcpy(swizzled_chunks, layout->u.chunk.chunks, (layout->u.chunk.ndims - 1) * sizeof(swizzled_chunks[0])); - H5V_swizzle_coords(swizzled_chunks, layout->u.chunk.u.earray.unlim_dim); + HDmemcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0])); + H5V_swizzle_coords(swizzled_chunks, layout->u.earray.unlim_dim); /* Get the swizzled "down" sizes for each dimension */ - if(H5V_array_down((layout->u.chunk.ndims - 1), swizzled_chunks, layout->u.chunk.u.earray.swizzled_down_chunks) < 0) + if(H5V_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") } /* end if */ @@ -1258,19 +1268,20 @@ H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(chunk_cb); HDassert(chunk_udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Get the extensible array statistics */ if(H5EA_get_stats(ea, &ea_stat) < 0) @@ -1288,7 +1299,7 @@ H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Loop over array elements */ /* (Note: this may be too simple for datasets with >1 dimension) */ - for(u = 0; u < ea_stat.stored.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->u.chunk.dim[0]) { + for(u = 0; u < ea_stat.stored.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->dim[0]) { H5D_earray_filt_elmt_t elmt; /* Extensible array element */ /* Get the info about the chunk for the index */ @@ -1311,12 +1322,12 @@ H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, else { /* Prepare common fields of chunk record for callback */ HDmemset(&chunk_rec, 0, sizeof(chunk_rec)); - chunk_rec.nbytes = idx_info->layout->u.chunk.size; + chunk_rec.nbytes = idx_info->layout->size; chunk_rec.filter_mask = 0; /* Loop over array elements */ /* (Note: this may be too simple for datasets with >1 dimension) */ - for(u = 0; u < ea_stat.stored.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->u.chunk.dim[0]) { + for(u = 0; u < ea_stat.stored.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->dim[0]) { haddr_t addr; /* Chunk address */ /* Get the address of the chunk for the index */ @@ -1366,35 +1377,36 @@ H5D_earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.chunk.u.earray.unlim_dim > 0) { + if(idx_info->layout->u.earray.unlim_dim > 0) { hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->u.chunk.ndims - 1); /* Number of dimensions */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ /* Set up the swizzled chunk coordinates */ HDmemcpy(swizzled_coords, udata->offset, ndims * sizeof(udata->offset[0])); - H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.chunk.u.earray.unlim_dim); + H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.u.earray.swizzled_down_chunks, &idx) < 0) + if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ else { /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end else */ @@ -1428,8 +1440,8 @@ H5D_earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t /* Remove raw data chunk from file */ HDassert(H5F_addr_defined(addr)); - H5_CHECK_OVERFLOW(idx_info->layout->u.chunk.size, /*From: */uint32_t, /*To: */hsize_t); - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->u.chunk.size) < 0) + H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") /* Reset the address of the chunk for the index */ @@ -1511,9 +1523,10 @@ H5D_earray_idx_delete(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); /* Check if the index data structure has been allocated */ - if(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)) { + if(H5F_addr_defined(idx_info->storage->idx_addr)) { H5D_earray_ud_t udata; /* User data for callback */ /* Initialize user data for callback */ @@ -1525,17 +1538,17 @@ H5D_earray_idx_delete(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses") /* Close extensible array */ - if(H5EA_close(idx_info->layout->u.chunk.u.earray.ea, idx_info->dxpl_id) < 0) + if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") - idx_info->layout->u.chunk.u.earray.ea = NULL; + idx_info->storage->u.earray.ea = NULL; /* Delete extensible array */ - if(H5EA_delete(idx_info->f, idx_info->dxpl_id, idx_info->layout->store.u.chunk.idx_addr) < 0) + if(H5EA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array") - idx_info->layout->store.u.chunk.idx_addr = HADDR_UNDEF; + idx_info->storage->idx_addr = HADDR_UNDEF; } /* end if */ else - HDassert(NULL == idx_info->layout->u.chunk.u.earray.ea); + HDassert(NULL == idx_info->storage->u.earray.ea); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1567,14 +1580,16 @@ H5D_earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(idx_info_src->f); HDassert(idx_info_src->pline); HDassert(idx_info_src->layout); + HDassert(idx_info_src->storage); HDassert(idx_info_dst); HDassert(idx_info_dst->f); HDassert(idx_info_dst->pline); HDassert(idx_info_dst->layout); - HDassert(!H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); + HDassert(idx_info_dst->storage); + HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); /* Check if the source extensible array is open yet */ - if(NULL == idx_info_src->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info_src->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info_src) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") @@ -1583,7 +1598,7 @@ H5D_earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, /* Create the extensible array that describes chunked storage in the dest. file */ if(H5D_earray_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); + HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1603,26 +1618,26 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_earray_idx_copy_shutdown(H5O_layout_t *layout_src, H5O_layout_t *layout_dst, - hid_t dxpl_id) +H5D_earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_earray_idx_copy_shutdown) /* Check args */ - HDassert(layout_src); - HDassert(layout_src->u.chunk.u.earray.ea); - HDassert(layout_dst); - HDassert(layout_dst->u.chunk.u.earray.ea); + HDassert(storage_src); + HDassert(storage_src->u.earray.ea); + HDassert(storage_dst); + HDassert(storage_dst->u.earray.ea); /* Close extensible arrays */ - if(H5EA_close(layout_src->u.chunk.u.earray.ea, dxpl_id) < 0) + if(H5EA_close(storage_src->u.earray.ea, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") - layout_src->u.chunk.u.earray.ea = NULL; - if(H5EA_close(layout_dst->u.chunk.u.earray.ea, dxpl_id) < 0) + storage_src->u.earray.ea = NULL; + if(H5EA_close(storage_dst->u.earray.ea, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") - layout_dst->u.chunk.u.earray.ea = NULL; + storage_dst->u.earray.ea = NULL; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1656,7 +1671,8 @@ H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(index_size); /* Open the extensible array in file */ @@ -1664,7 +1680,7 @@ H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Get the extensible array statistics */ if(H5EA_get_stats(ea, &ea_stat) < 0) @@ -1675,10 +1691,10 @@ H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) + ea_stat.stored.super_blk_size + ea_stat.stored.data_blk_size; done: - if(idx_info->layout->u.chunk.u.earray.ea) { - if(H5EA_close(idx_info->layout->u.chunk.u.earray.ea, idx_info->dxpl_id) < 0) + if(idx_info->storage->u.earray.ea) { + if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") - idx_info->layout->u.chunk.u.earray.ea = NULL; + idx_info->storage->u.earray.ea = NULL; } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1702,19 +1718,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_earray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) +H5D_earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_earray_idx_reset) /* Check args */ - HDassert(layout); + HDassert(storage); /* Reset index info */ if(reset_addr) { - layout->store.u.chunk.idx_addr = HADDR_UNDEF; - layout->u.chunk.u.earray.dset_ohdr_addr = HADDR_UNDEF; + storage->idx_addr = HADDR_UNDEF; + storage->u.earray.dset_ohdr_addr = HADDR_UNDEF; } /* end if */ - layout->u.chunk.u.earray.ea = NULL; + storage->u.earray.ea = NULL; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_earray_idx_reset() */ @@ -1745,35 +1761,37 @@ H5D_earray_idx_support(const H5D_chk_idx_info_t *idx_info, /* Check args */ HDassert(idx_info); + HDassert(idx_info->layout); + HDassert(idx_info->storage); HDassert(udata); HDassert(child_entry); /* Check if the extensible array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.chunk.u.earray.unlim_dim > 0) { + if(idx_info->layout->u.earray.unlim_dim > 0) { hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->u.chunk.ndims - 1); /* Number of dimensions */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ /* Set up the swizzled chunk coordinates */ HDmemcpy(swizzled_coords, udata->offset, ndims * sizeof(udata->offset[0])); - H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.chunk.u.earray.unlim_dim); + H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.u.earray.swizzled_down_chunks, &idx) < 0) + if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ else { /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end else */ @@ -1813,35 +1831,37 @@ H5D_earray_idx_unsupport(const H5D_chk_idx_info_t *idx_info, /* Check args */ HDassert(idx_info); + HDassert(idx_info->layout); + HDassert(idx_info->storage); HDassert(udata); HDassert(child_entry); /* Check if the extensible array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.earray.ea) { + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D_earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") } /* end if */ /* Set convenience pointer to extensible array structure */ - ea = idx_info->layout->u.chunk.u.earray.ea; + ea = idx_info->storage->u.earray.ea; /* Check for unlimited dim. not being the slowest-changing dim. */ - if(idx_info->layout->u.chunk.u.earray.unlim_dim > 0) { + if(idx_info->layout->u.earray.unlim_dim > 0) { hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ - unsigned ndims = (idx_info->layout->u.chunk.ndims - 1); /* Number of dimensions */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ /* Set up the swizzled chunk coordinates */ HDmemcpy(swizzled_coords, udata->offset, ndims * sizeof(udata->offset[0])); - H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.chunk.u.earray.unlim_dim); + H5V_swizzle_coords(swizzled_coords, idx_info->layout->u.earray.unlim_dim); /* Calculate the index of this chunk */ - if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.u.earray.swizzled_down_chunks, &idx) < 0) + if(H5V_chunk_index(ndims, swizzled_coords, idx_info->layout->dim, idx_info->layout->u.earray.swizzled_down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end if */ else { /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") } /* end else */ @@ -1876,10 +1896,10 @@ H5D_earray_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream) /* Check args */ HDassert(idx_info); HDassert(idx_info->f); - HDassert(idx_info->layout); + HDassert(idx_info->storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", idx_info->layout->store.u.chunk.idx_addr); + HDfprintf(stream, " Address: %a\n", idx_info->storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_earray_idx_dump() */ @@ -1907,14 +1927,14 @@ H5D_earray_idx_dest(const H5D_chk_idx_info_t *idx_info) /* Check args */ HDassert(idx_info); HDassert(idx_info->f); - HDassert(idx_info->layout); + HDassert(idx_info->storage); /* Check if the extensible array is open */ - if(idx_info->layout->u.chunk.u.earray.ea) { + if(idx_info->storage->u.earray.ea) { /* Check for SWMR writes to the file */ if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) { /* Sanity check */ - HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.earray.dset_ohdr_addr)); + HDassert(H5F_addr_defined(idx_info->storage->u.earray.dset_ohdr_addr)); /* Remove flush dependency between extensible array and dataset' object header */ if(H5D_earray_idx_undepend(idx_info) < 0) @@ -1922,9 +1942,9 @@ H5D_earray_idx_dest(const H5D_chk_idx_info_t *idx_info) } /* end if */ /* Close extensible array */ - if(H5EA_close(idx_info->layout->u.chunk.u.earray.ea, idx_info->dxpl_id) < 0) + if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") - idx_info->layout->u.chunk.u.earray.ea = NULL; + idx_info->storage->u.earray.ea = NULL; } /* end if */ done: diff --git a/src/H5Defl.c b/src/H5Defl.c index c884fd0..af57eff 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.store.u.contig.size, tmp_size, hssize_t, hsize_t); + H5_ASSIGN_OVERFLOW(dset->shared->layout.storage.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/H5Dfarray.c b/src/H5Dfarray.c index 8bba822..ebe6495 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -57,7 +57,7 @@ /* Fixed array create/open user data */ typedef struct H5D_farray_ctx_ud_t { const H5F_t *f; /* Pointer to file info */ - const H5O_layout_t *layout; /* Pointer to layout info */ + const H5O_layout_chunk_t *layout; /* Pointer to layout info */ } H5D_farray_ctx_ud_t; /* Fixed array callback context */ @@ -122,7 +122,7 @@ static herr_t H5D_farray_filt_debug(FILE *stream, int indent, int fwidth, /* Chunked layout indexing callbacks */ static herr_t H5D_farray_idx_create(const H5D_chk_idx_info_t *idx_info); -static hbool_t H5D_farray_idx_is_space_alloc(const H5O_layout_t *layout); +static hbool_t H5D_farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage); static herr_t H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); static herr_t H5D_farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, @@ -134,13 +134,12 @@ static herr_t H5D_farray_idx_remove(const H5D_chk_idx_info_t *idx_info, static herr_t H5D_farray_idx_delete(const H5D_chk_idx_info_t *idx_info); static herr_t H5D_farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); -static herr_t H5D_farray_idx_copy_shutdown(H5O_layout_t *layout_src, - H5O_layout_t *layout_dst, hid_t dxpl_id); +static herr_t H5D_farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); static herr_t H5D_farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); -static herr_t H5D_farray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr); -static herr_t H5D_farray_idx_dump(const H5D_chk_idx_info_t *idx_info, - FILE *stream); +static herr_t H5D_farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D_farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); static herr_t H5D_farray_idx_dest(const H5D_chk_idx_info_t *idx_info); @@ -248,7 +247,7 @@ H5D_farray_crt_context(void *_udata) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - ctx->chunk_size_len = 1 + ((H5V_log2_gen(udata->layout->u.chunk.size) + 8) / 8); + ctx->chunk_size_len = 1 + ((H5V_log2_gen(udata->layout->size) + 8) / 8); if(ctx->chunk_size_len > 8) ctx->chunk_size_len = 8; @@ -629,9 +628,11 @@ H5D_farray_idx_open(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->u.chunk.idx_type); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); - HDassert(NULL == idx_info->layout->u.chunk.u.farray.fa); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.farray.fa); /* Set up the user data */ udata.f = idx_info->f; @@ -639,7 +640,7 @@ H5D_farray_idx_open(const H5D_chk_idx_info_t *idx_info) /* Open the fixed array for the chunk index */ cls = (idx_info->pline->nused > 0) ? H5FA_CLS_FILT_CHUNK : H5FA_CLS_CHUNK; - if(NULL == (idx_info->layout->u.chunk.u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->layout->store.u.chunk.idx_addr, cls, &udata))) + if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, cls, &udata))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array") done: @@ -679,9 +680,10 @@ H5D_farray_idx_create(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(!H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); - HDassert(NULL == idx_info->layout->u.chunk.u.farray.fa); - HDassert(idx_info->layout->u.chunk.nchunks); + HDassert(idx_info->storage); + HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.farray.fa); + HDassert(idx_info->layout->nchunks); /* General parameters */ if(idx_info->pline->nused > 0) { @@ -690,7 +692,7 @@ H5D_farray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->u.chunk.size) + 8) / 8); + chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->size) + 8) / 8); if(chunk_size_len > 8) chunk_size_len = 8; @@ -701,20 +703,20 @@ H5D_farray_idx_create(const H5D_chk_idx_info_t *idx_info) cparam.cls = H5FA_CLS_CHUNK; cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f); } /* end else */ - cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits; + cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.farray.cparam.max_dblk_page_nelmts_bits; HDassert(cparam.max_dblk_page_nelmts_bits > 0); - cparam.nelmts = idx_info->layout->u.chunk.nchunks; + cparam.nelmts = idx_info->layout->nchunks; /* Set up the user data */ udata.f = idx_info->f; udata.layout = idx_info->layout; /* Create the fixed array for the chunk index */ - if(NULL == (idx_info->layout->u.chunk.u.farray.fa = H5FA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata))) + if(NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array") /* Get the address of the fixed array in file */ - if(H5FA_get_addr(idx_info->layout->u.chunk.u.farray.fa, &(idx_info->layout->store.u.chunk.idx_addr)) < 0) + if(H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address") done: @@ -735,17 +737,17 @@ done: *------------------------------------------------------------------------- */ static hbool_t -H5D_farray_idx_is_space_alloc(const H5O_layout_t *layout) +H5D_farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { hbool_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_farray_idx_is_space_alloc) /* Check args */ - HDassert(layout); + HDassert(storage); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->store.u.chunk.idx_addr); + ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_farray_idx_is_space_alloc() */ @@ -777,21 +779,22 @@ H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.farray.fa) { + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D_farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") } /* end if */ /* Set convenience pointer to fixed array structure */ - fa = idx_info->layout->u.chunk.u.farray.fa; + fa = idx_info->storage->u.farray.fa; /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->common.offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Check for filters on chunks */ @@ -804,7 +807,7 @@ H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - allow_chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->u.chunk.size) + 8) / 8); + allow_chunk_size_len = 1 + ((H5V_log2_gen(idx_info->layout->size) + 8) / 8); if(allow_chunk_size_len > 8) allow_chunk_size_len = 8; @@ -863,7 +866,7 @@ H5D_farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) } /* end if */ else { HDassert(!H5F_addr_defined(udata->addr)); - HDassert(udata->nbytes == idx_info->layout->u.chunk.size); + HDassert(udata->nbytes == idx_info->layout->size); #ifndef NDEBUG { @@ -922,21 +925,22 @@ H5D_farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.farray.fa) { + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D_farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") } /* end if */ /* Set convenience pointer to fixed array structure */ - fa = idx_info->layout->u.chunk.u.farray.fa; + fa = idx_info->storage->u.farray.fa; /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->common.offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->common.offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Check for filters on chunks */ @@ -958,7 +962,7 @@ H5D_farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") /* Update the other (constant) information for the chunk */ - udata->nbytes = idx_info->layout->u.chunk.size; + udata->nbytes = idx_info->layout->size; udata->filter_mask = 0; } /* end else */ @@ -1005,16 +1009,16 @@ H5D_farray_idx_iterate_cb(hsize_t UNUSED idx, const void *_elmt, void *_udata) HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); /* Update coordinates of chunk in dataset */ - ndims = udata->common.mesg->u.chunk.ndims - 1; + ndims = udata->common.layout->ndims - 1; HDassert(ndims > 0); curr_dim = (int)(ndims - 1); while(curr_dim >= 0) { /* Increment coordinate in current dimension */ udata->chunk_offset[curr_dim]++; - udata->chunk_rec.offset[curr_dim] += udata->common.mesg->u.chunk.dim[curr_dim]; + udata->chunk_rec.offset[curr_dim] += udata->common.layout->dim[curr_dim]; /* Check if we went off the end of the current dimension */ - if(udata->chunk_offset[curr_dim] >= udata->common.mesg->u.chunk.chunks[curr_dim]) { + if(udata->chunk_offset[curr_dim] >= udata->common.layout->chunks[curr_dim]) { /* Reset coordinate & move to next faster dimension */ udata->chunk_offset[curr_dim] = 0; udata->chunk_rec.offset[curr_dim] = 0; @@ -1055,19 +1059,20 @@ H5D_farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(chunk_cb); HDassert(chunk_udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.farray.fa) { + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D_farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") } /* end if */ /* Set convenience pointer to fixed array structure */ - fa = idx_info->layout->u.chunk.u.farray.fa; + fa = idx_info->storage->u.farray.fa; /* Get the fixed array statistics */ if(H5FA_get_stats(fa, &fa_stat) < 0) @@ -1079,12 +1084,13 @@ H5D_farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Initialize userdata */ HDmemset(&udata, 0, sizeof udata); - udata.common.mesg = idx_info->layout; + udata.common.layout = idx_info->layout; + udata.common.storage = idx_info->storage; HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); HDmemset(&udata.chunk_offset, 0, sizeof(udata.chunk_offset)); udata.filtered = (idx_info->pline->nused > 0); if(!udata.filtered) { - udata.chunk_rec.nbytes = idx_info->layout->u.chunk.size; + udata.chunk_rec.nbytes = idx_info->layout->size; udata.chunk_rec.filter_mask = 0; } /* end if */ udata.cb = chunk_cb; @@ -1125,21 +1131,22 @@ H5D_farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.farray.fa) { + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D_farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") } /* end if */ /* Set convenience pointer to fixed array structure */ - fa = idx_info->layout->u.chunk.u.farray.fa; + fa = idx_info->storage->u.farray.fa; /* Calculate the index of this chunk */ - if(H5V_chunk_index((idx_info->layout->u.chunk.ndims - 1), udata->offset, idx_info->layout->u.chunk.dim, idx_info->layout->u.chunk.down_chunks, &idx) < 0) + if(H5V_chunk_index((idx_info->layout->ndims - 1), udata->offset, idx_info->layout->dim, idx_info->layout->down_chunks, &idx) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Check for filters on chunks */ @@ -1172,8 +1179,8 @@ H5D_farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t /* Remove raw data chunk from file */ HDassert(H5F_addr_defined(addr)); - H5_CHECK_OVERFLOW(idx_info->layout->u.chunk.size, /*From: */uint32_t, /*To: */hsize_t); - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->u.chunk.size) < 0) + H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") /* Reset the address of the chunk for the index */ @@ -1263,21 +1270,22 @@ H5D_farray_idx_delete(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); + HDassert(idx_info->storage); /* Check if the index data structure has been allocated */ - if(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)) { + if(H5F_addr_defined(idx_info->storage->idx_addr)) { H5FA_t *fa; /* Pointer to fixed array structure */ H5FA_stat_t fa_stat; /* Fixed array statistics */ /* Check if the fixed array is open yet */ - if(NULL == idx_info->layout->u.chunk.u.farray.fa) { + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D_farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") } /* end if */ /* Set convenience pointer to fixed array structure */ - fa = idx_info->layout->u.chunk.u.farray.fa; + fa = idx_info->storage->u.farray.fa; /* Get the fixed array statistics */ if(H5FA_get_stats(fa, &fa_stat) < 0) @@ -1291,7 +1299,7 @@ H5D_farray_idx_delete(const H5D_chk_idx_info_t *idx_info) udata.f = idx_info->f; udata.dxpl_id = idx_info->dxpl_id; udata.filtered = (idx_info->pline->nused > 0); - udata.unfilt_size = idx_info->layout->u.chunk.size; + udata.unfilt_size = idx_info->layout->size; /* Iterate over the chunk addresses in the fixed array, deleting each chunk */ if(H5FA_iterate(fa, idx_info->dxpl_id, H5D_farray_idx_delete_cb, &udata) < 0) @@ -1299,17 +1307,17 @@ H5D_farray_idx_delete(const H5D_chk_idx_info_t *idx_info) } /* end if */ /* Close fixed array */ - if(H5FA_close(idx_info->layout->u.chunk.u.farray.fa, idx_info->dxpl_id) < 0) + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") - idx_info->layout->u.chunk.u.farray.fa = NULL; + idx_info->storage->u.farray.fa = NULL; /* Delete fixed array */ - if(H5FA_delete(idx_info->f, idx_info->dxpl_id, idx_info->layout->store.u.chunk.idx_addr) < 0) + if(H5FA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array") - idx_info->layout->store.u.chunk.idx_addr = HADDR_UNDEF; + idx_info->storage->idx_addr = HADDR_UNDEF; } /* end if */ else - HDassert(NULL == idx_info->layout->u.chunk.u.farray.fa); + HDassert(NULL == idx_info->storage->u.farray.fa); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1341,14 +1349,16 @@ H5D_farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(idx_info_src->f); HDassert(idx_info_src->pline); HDassert(idx_info_src->layout); + HDassert(idx_info_src->storage); HDassert(idx_info_dst); HDassert(idx_info_dst->f); HDassert(idx_info_dst->pline); HDassert(idx_info_dst->layout); - HDassert(!H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); + HDassert(idx_info_dst->storage); + HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); /* Check if the source fixed array is open yet */ - if(NULL == idx_info_src->layout->u.chunk.u.farray.fa) { + if(NULL == idx_info_src->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D_farray_idx_open(idx_info_src) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") @@ -1357,7 +1367,7 @@ H5D_farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, /* Create the fixed array that describes chunked storage in the dest. file */ if(H5D_farray_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); + HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1377,26 +1387,26 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_farray_idx_copy_shutdown(H5O_layout_t *layout_src, H5O_layout_t *layout_dst, - hid_t dxpl_id) +H5D_farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_farray_idx_copy_shutdown) /* Check args */ - HDassert(layout_src); - HDassert(layout_src->u.chunk.u.farray.fa); - HDassert(layout_dst); - HDassert(layout_dst->u.chunk.u.farray.fa); + HDassert(storage_src); + HDassert(storage_src->u.farray.fa); + HDassert(storage_dst); + HDassert(storage_dst->u.farray.fa); /* Close fixed arrays */ - if(H5FA_close(layout_src->u.chunk.u.farray.fa, dxpl_id) < 0) + if(H5FA_close(storage_src->u.farray.fa, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") - layout_src->u.chunk.u.farray.fa = NULL; - if(H5FA_close(layout_dst->u.chunk.u.farray.fa, dxpl_id) < 0) + storage_src->u.farray.fa = NULL; + if(H5FA_close(storage_dst->u.farray.fa, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") - layout_dst->u.chunk.u.farray.fa = NULL; + storage_dst->u.farray.fa = NULL; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1430,7 +1440,8 @@ H5D_farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); HDassert(index_size); /* Open the fixed array in file */ @@ -1438,7 +1449,7 @@ H5D_farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") /* Set convenience pointer to fixed array structure */ - fa = idx_info->layout->u.chunk.u.farray.fa; + fa = idx_info->storage->u.farray.fa; /* Get the fixed array statistics */ if(H5FA_get_stats(fa, &fa_stat) < 0) @@ -1448,10 +1459,10 @@ H5D_farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) *index_size += fa_stat.dblk_size; done: - if(idx_info->layout->u.chunk.u.farray.fa) { - if(H5FA_close(idx_info->layout->u.chunk.u.farray.fa, idx_info->dxpl_id) < 0) + if(idx_info->storage->u.farray.fa) { + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") - idx_info->layout->u.chunk.u.farray.fa = NULL; + idx_info->storage->u.farray.fa = NULL; } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1471,17 +1482,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_farray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) +H5D_farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_farray_idx_reset) /* Check args */ - HDassert(layout); + HDassert(storage); /* Reset index info */ if(reset_addr) - layout->store.u.chunk.idx_addr = HADDR_UNDEF; - layout->u.chunk.u.farray.fa = NULL; + storage->idx_addr = HADDR_UNDEF; + storage->u.farray.fa = NULL; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_farray_idx_reset() */ @@ -1500,17 +1511,15 @@ H5D_farray_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) *------------------------------------------------------------------------- */ static herr_t -H5D_farray_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream) +H5D_farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_farray_idx_dump) /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->layout); + HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", idx_info->layout->store.u.chunk.idx_addr); + HDfprintf(stream, " Address: %a\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_farray_idx_dump() */ @@ -1538,13 +1547,13 @@ H5D_farray_idx_dest(const H5D_chk_idx_info_t *idx_info) /* Check args */ HDassert(idx_info); HDassert(idx_info->f); - HDassert(idx_info->layout); + HDassert(idx_info->storage); /* Check if the fixed array is open */ - if(idx_info->layout->u.chunk.u.farray.fa) { - if(H5FA_close(idx_info->layout->u.chunk.u.farray.fa, idx_info->dxpl_id) < 0) + if(idx_info->storage->u.farray.fa) { + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") - idx_info->layout->u.chunk.u.farray.fa = NULL; + idx_info->storage->u.farray.fa = NULL; } /* end if */ done: diff --git a/src/H5Dint.c b/src/H5Dint.c index f07e220..faaeb80 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -784,7 +784,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) /* Add the dataset's raw data size to the size of the header, if the raw data will be stored as compact */ if(layout->type == H5D_COMPACT) - ohdr_size += layout->store.u.compact.size; + ohdr_size += layout->storage.u.compact.size; /* Create an object header for the dataset */ if(H5O_create(file, dxpl_id, ohdr_size, dset->shared->dcpl_id, oloc/*out*/) < 0) @@ -1407,7 +1407,7 @@ H5D_close(H5D_t *dataset) case H5D_COMPACT: /* Free the buffer for the raw data for compact datasets */ - dataset->shared->layout.store.u.compact.buf = H5MM_xfree(dataset->shared->layout.store.u.compact.buf); + dataset->shared->layout.storage.u.compact.buf = H5MM_xfree(dataset->shared->layout.storage.u.compact.buf); break; default: @@ -1621,14 +1621,14 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al case H5D_COMPACT: /* Check if space is already allocated */ - if(NULL == layout->store.u.compact.buf) { + if(NULL == layout->storage.u.compact.buf) { /* Reserve space in layout header message for the entire array. */ - HDassert(layout->store.u.compact.size > 0); - if(NULL == (layout->store.u.compact.buf = H5MM_malloc(layout->store.u.compact.size))) + HDassert(layout->storage.u.compact.size > 0); + if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset") if(!full_overwrite) - HDmemset(layout->store.u.compact.buf, 0, layout->store.u.compact.size); - layout->store.u.compact.dirty = TRUE; + HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); + layout->storage.u.compact.dirty = TRUE; /* Indicate that we should initialize storage space */ must_init_space = TRUE; @@ -1788,13 +1788,13 @@ 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.store.u.contig.size; + ret_value = dset->shared->layout.storage.u.contig.size; else ret_value = 0; break; case H5D_COMPACT: - ret_value = dset->shared->layout.store.u.compact.size; + ret_value = dset->shared->layout.storage.u.compact.size; break; default: @@ -1838,9 +1838,9 @@ H5D_get_offset(const H5D_t *dset) case H5D_CONTIGUOUS: /* If dataspace hasn't been allocated or dataset is stored in * an external file, the value will be HADDR_UNDEF. */ - if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.store.u.contig.addr)) + if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)) /* Return the absolute dataset offset from the beginning of file. */ - ret_value = dset->shared->layout.store.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); + ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); break; default: diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index b2c0ede..853f902 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -98,15 +98,15 @@ H5D_layout_set_io_ops(const H5D_t *dataset) /* Set the chunk operations */ switch(dataset->shared->layout.u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: - dataset->shared->layout.u.chunk.ops = H5D_COPS_BTREE; + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE; break; case H5D_CHUNK_IDX_FARRAY: - dataset->shared->layout.u.chunk.ops = H5D_COPS_FARRAY; + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_FARRAY; break; case H5D_CHUNK_IDX_EARRAY: - dataset->shared->layout.u.chunk.ops = H5D_COPS_EARRAY; + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_EARRAY; break; default: @@ -162,7 +162,7 @@ H5D_layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include /* Size of raw data */ ret_value += 2; if(include_compact_data) - ret_value += layout->store.u.compact.size;/* data for compact dataset */ + ret_value += layout->storage.u.compact.size;/* data for compact dataset */ break; case H5D_CONTIGUOUS: @@ -564,7 +564,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.store.u.contig.size = tmp_size; + dataset->shared->layout.storage.u.contig.size = tmp_size; } /* end if */ /* Get the sieve buffer size for this dataset */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 925f6e0..67d6cd8 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -233,7 +233,8 @@ typedef struct H5D_chk_idx_info_t { H5F_t *f; /* File pointer for operation */ hid_t dxpl_id; /* DXPL ID for operation */ const H5O_pline_t *pline; /* I/O pipeline info */ - H5O_layout_t *layout; /* Layout info for chunks */ + H5O_layout_chunk_t *layout; /* Chunk layout description */ + H5O_storage_chunk_t *storage; /* Chunk storage description */ } H5D_chk_idx_info_t; /* @@ -249,7 +250,7 @@ typedef struct H5D_chk_idx_info_t { */ typedef struct H5D_chunk_rec_t { uint32_t nbytes; /* Size of stored data */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Logical offset to start*/ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ unsigned filter_mask; /* Excluded filters */ haddr_t chunk_addr; /* Address of chunk in file */ } H5D_chunk_rec_t; @@ -261,8 +262,9 @@ typedef struct H5D_chunk_rec_t { */ typedef struct H5D_chunk_common_ud_t { /* downward */ - const H5O_layout_t *mesg; /*layout message */ - const hsize_t *offset; /*logical offset of chunk*/ + const H5O_layout_chunk_t *layout; /* Chunk layout description */ + const H5O_storage_chunk_t *storage; /* Chunk storage description */ + const hsize_t *offset; /* Logical offset of chunk */ } H5D_chunk_common_ud_t; /* B-tree callback info for various operations */ @@ -283,12 +285,12 @@ typedef int (*H5D_chunk_cb_func_t)(const H5D_chunk_rec_t *chunk_rec, typedef herr_t (*H5D_chunk_init_func_t)(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); typedef herr_t (*H5D_chunk_create_func_t)(const H5D_chk_idx_info_t *idx_info); -typedef hbool_t (*H5D_chunk_is_space_alloc_func_t)(const H5O_layout_t *layout); +typedef hbool_t (*H5D_chunk_is_space_alloc_func_t)(const H5O_storage_chunk_t *storage); typedef herr_t (*H5D_chunk_insert_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); typedef herr_t (*H5D_chunk_get_addr_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); -typedef herr_t (*H5D_chunk_resize_func_t)(H5O_layout_t *layout); +typedef herr_t (*H5D_chunk_resize_func_t)(H5O_layout_chunk_t *layout); typedef int (*H5D_chunk_iterate_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); typedef herr_t (*H5D_chunk_remove_func_t)(const H5D_chk_idx_info_t *idx_info, @@ -296,16 +298,16 @@ typedef herr_t (*H5D_chunk_remove_func_t)(const H5D_chk_idx_info_t *idx_info, typedef herr_t (*H5D_chunk_delete_func_t)(const H5D_chk_idx_info_t *idx_info); typedef herr_t (*H5D_chunk_copy_setup_func_t)(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); -typedef herr_t (*H5D_chunk_copy_shutdown_func_t)(H5O_layout_t *layout_src, - H5O_layout_t *layout_dst, hid_t dxpl_id); +typedef herr_t (*H5D_chunk_copy_shutdown_func_t)(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); typedef herr_t (*H5D_chunk_size_func_t)(const H5D_chk_idx_info_t *idx_info, hsize_t *idx_size); -typedef herr_t (*H5D_chunk_reset_func_t)(H5O_layout_t *layout, hbool_t reset_addr); +typedef herr_t (*H5D_chunk_reset_func_t)(H5O_storage_chunk_t *storage, hbool_t reset_addr); typedef herr_t (*H5D_chunk_support_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry); typedef herr_t (*H5D_chunk_unsupport_func_t)(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata, H5AC_info_t *child_entry); -typedef herr_t (*H5D_chunk_dump_func_t)(const H5D_chk_idx_info_t *idx_info, +typedef herr_t (*H5D_chunk_dump_func_t)(const H5O_storage_chunk_t *storage, FILE *stream); typedef herr_t (*H5D_chunk_dest_func_t)(const H5D_chk_idx_info_t *idx_info); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index ad9c795..277b87a 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -163,12 +163,12 @@ H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, /* Functions that operate on contiguous storage */ H5_DLL herr_t H5D_contig_delete(H5F_t *f, hid_t dxpl_id, - const H5O_layout_t *layout); + const H5O_storage_t *store); /* Functions that operate on chunked storage */ -H5_DLL herr_t H5D_chunk_idx_reset(H5O_layout_t *layout, hbool_t reset_addr); +H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); H5_DLL herr_t H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - H5O_layout_t *layout); + H5O_storage_t *store); /* Functions that operate on indexed storage */ H5_DLL herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, diff --git a/src/H5Dproxy.c b/src/H5Dproxy.c index e888540..429500e 100644 --- a/src/H5Dproxy.c +++ b/src/H5Dproxy.c @@ -356,12 +356,13 @@ HDfprintf(stderr, "%s: ent->proxy_addr = %a\n", FUNC, ent->proxy_addr); idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &(dset->shared->dcpl_cache.pline); - idx_info.layout = &(dset->shared->layout); + idx_info.layout = &(dset->shared->layout.u.chunk); + idx_info.storage = &(dset->shared->layout.storage.u.chunk); /* Create a flush dependency between the proxy (as the child) and the * metadata object in the index (as the parent). */ - if((dset->shared->layout.u.chunk.ops->support)(&idx_info, udata, (H5AC_info_t *)proxy) < 0) + if((dset->shared->layout.storage.u.chunk.ops->support)(&idx_info, udata, (H5AC_info_t *)proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency for chunk proxy") done: @@ -412,16 +413,18 @@ HDfprintf(stderr, "%s: ent->proxy_addr = %a\n", FUNC, ent->proxy_addr); idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &(dset->shared->dcpl_cache.pline); - idx_info.layout = &(dset->shared->layout); + idx_info.layout = &(dset->shared->layout.u.chunk); + idx_info.storage = &(dset->shared->layout.storage.u.chunk); /* Compose user-data for chunk */ - udata.mesg = &(dset->shared->layout); + udata.layout = &(dset->shared->layout.u.chunk); + udata.storage = &(dset->shared->layout.storage.u.chunk); udata.offset = ent->offset; /* Remove flush dependency between the proxy (as the child) and the * metadata object in the index (as the parent). */ - if((dset->shared->layout.u.chunk.ops->unsupport)(&idx_info, &udata, (H5AC_info_t *)proxy) < 0) + if((dset->shared->layout.storage.u.chunk.ops->unsupport)(&idx_info, &udata, (H5AC_info_t *)proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency for chunk proxy") /* Unpin & delete chunk proxy from metadata cache, taking ownership of it */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index e99ea61..485f98f 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.store.u.contig.size; + *size = dset->shared->layout.storage.u.contig.size; } /* end if */ done: diff --git a/src/H5E.c b/src/H5E.c index dc90a5a..fa9bf58 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1273,7 +1273,6 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, { va_list ap; /* Varargs info */ H5E_t *estack; /* Pointer to error stack to modify */ - H5E_msg_t *maj_ptr, *min_ptr; /* Pointer to major and minor error info */ #ifndef H5_HAVE_VASPRINTF int tmp_len; /* Current size of description buffer */ int desc_len; /* Actual length of description when formatted */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 8f5adc6..c95a3e9 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -153,21 +153,21 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* Address */ if(mesg->type == H5D_CONTIGUOUS) { - H5F_addr_decode(f, &p, &(mesg->store.u.contig.addr)); + H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CONTIG; } /* end if */ else if(mesg->type == H5D_CHUNKED) { - H5F_addr_decode(f, &p, &(mesg->store.u.chunk.idx_addr)); + H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; /* Set the chunk operations */ /* (Only "btree" indexing type currently supported in this version) */ - mesg->u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; - mesg->u.chunk.ops = H5D_COPS_BTREE; + mesg->storage.u.chunk.idx_type = H5D_CHUNK_BTREE; + mesg->storage.u.chunk.ops = H5D_COPS_BTREE; } /* end if */ else { /* Sanity check */ @@ -198,12 +198,12 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, } /* end if */ if(mesg->type == H5D_COMPACT) { - UINT32DECODE(p, mesg->store.u.compact.size); - if(mesg->store.u.compact.size > 0) { - if(NULL == (mesg->store.u.compact.buf = H5MM_malloc(mesg->store.u.compact.size))) + UINT32DECODE(p, mesg->storage.u.compact.size); + if(mesg->storage.u.compact.size > 0) { + if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") - HDmemcpy(mesg->store.u.compact.buf, p, mesg->store.u.compact.size); - p += mesg->store.u.compact.size; + HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); + p += mesg->storage.u.compact.size; } /* end if */ } /* end if */ } /* end if */ @@ -214,12 +214,12 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* Interpret the rest of the message according to the layout class */ switch(mesg->type) { case H5D_COMPACT: - UINT16DECODE(p, mesg->store.u.compact.size); - if(mesg->store.u.compact.size > 0) { - if(NULL == (mesg->store.u.compact.buf = H5MM_malloc(mesg->store.u.compact.size))) + UINT16DECODE(p, mesg->storage.u.compact.size); + if(mesg->storage.u.compact.size > 0) { + if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") - HDmemcpy(mesg->store.u.compact.buf, p, mesg->store.u.compact.size); - p += mesg->store.u.compact.size; + HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); + p += mesg->storage.u.compact.size; } /* end if */ /* Set the layout operations */ @@ -227,8 +227,8 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, break; case H5D_CONTIGUOUS: - H5F_addr_decode(f, &p, &(mesg->store.u.contig.addr)); - H5F_DECODE_LENGTH(f, p, mesg->store.u.contig.size); + H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr)); + H5F_DECODE_LENGTH(f, p, mesg->storage.u.contig.size); /* Set the layout operations */ mesg->ops = H5D_LOPS_CONTIG; @@ -242,7 +242,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") /* B-tree address */ - H5F_addr_decode(f, &p, &(mesg->store.u.chunk.idx_addr)); + H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); /* Chunk dimensions */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -254,8 +254,8 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* Set the chunk operations */ /* (Only "btree" indexing type supported with v3 of message format) */ - mesg->u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; - mesg->u.chunk.ops = H5D_COPS_BTREE; + mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; + mesg->storage.u.chunk.ops = H5D_COPS_BTREE; } /* end if */ else { unsigned char flags; /* Flags for encoding group info */ @@ -292,14 +292,15 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, mesg->u.chunk.idx_type = (H5D_chunk_index_t)*p++; if(mesg->u.chunk.idx_type >= H5D_CHUNK_IDX_NTYPES) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown chunk index type") + mesg->storage.u.chunk.idx_type = mesg->u.chunk.idx_type; /* Chunk index address */ - H5F_addr_decode(f, &p, &(mesg->store.u.chunk.idx_addr)); + H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); switch(mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: /* Remove this when v2 B-tree indices added */ /* Set the chunk operations */ - mesg->u.chunk.ops = H5D_COPS_BTREE; + mesg->storage.u.chunk.ops = H5D_COPS_BTREE; break; case H5D_CHUNK_IDX_FARRAY: @@ -309,7 +310,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid fixed array creation parameter") /* Set the chunk operations */ - mesg->u.chunk.ops = H5D_COPS_FARRAY; + mesg->storage.u.chunk.ops = H5D_COPS_FARRAY; break; case H5D_CHUNK_IDX_EARRAY: @@ -331,7 +332,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter") /* Set the chunk operations */ - mesg->u.chunk.ops = H5D_COPS_EARRAY; + mesg->storage.u.chunk.ops = H5D_COPS_EARRAY; break; default: @@ -419,21 +420,21 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi switch(mesg->type) { case H5D_COMPACT: /* Size of raw data */ - UINT16ENCODE(p, mesg->store.u.compact.size); + UINT16ENCODE(p, mesg->storage.u.compact.size); /* Raw data */ - if(mesg->store.u.compact.size > 0) { - if(mesg->store.u.compact.buf) - HDmemcpy(p, mesg->store.u.compact.buf, mesg->store.u.compact.size); + if(mesg->storage.u.compact.size > 0) { + if(mesg->storage.u.compact.buf) + HDmemcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size); else - HDmemset(p, 0, mesg->store.u.compact.size); - p += mesg->store.u.compact.size; + HDmemset(p, 0, mesg->storage.u.compact.size); + p += mesg->storage.u.compact.size; } /* end if */ break; case H5D_CONTIGUOUS: - H5F_addr_encode(f, &p, mesg->store.u.contig.addr); - H5F_ENCODE_LENGTH(f, p, mesg->store.u.contig.size); + H5F_addr_encode(f, &p, mesg->storage.u.contig.addr); + H5F_ENCODE_LENGTH(f, p, mesg->storage.u.contig.size); break; case H5D_CHUNKED: @@ -443,7 +444,7 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi *p++ = (uint8_t)mesg->u.chunk.ndims; /* B-tree address */ - H5F_addr_encode(f, &p, mesg->store.u.chunk.idx_addr); + H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr); /* Dimension sizes */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -469,7 +470,7 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi *p++ = (uint8_t)mesg->u.chunk.idx_type; /* Chunk index address */ - H5F_addr_encode(f, &p, mesg->store.u.chunk.idx_addr); + H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr); switch(mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: /* Remove this when v2 B-tree indices added */ @@ -542,18 +543,18 @@ H5O_layout_copy(const void *_mesg, void *_dest) *dest = *mesg; /* Deep copy the buffer for compact datasets also */ - if(mesg->type == H5D_COMPACT && mesg->store.u.compact.size > 0) { + if(mesg->type == H5D_COMPACT && mesg->storage.u.compact.size > 0) { /* Allocate memory for the raw data */ - if(NULL == (dest->store.u.compact.buf = H5MM_malloc(dest->store.u.compact.size))) + if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") /* Copy over the raw data */ - HDmemcpy(dest->store.u.compact.buf, mesg->store.u.compact.buf, dest->store.u.compact.size); + HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); } /* end if */ /* Reset the pointer of the chunked storage index but not the address */ - if(dest->type == H5D_CHUNKED && dest->u.chunk.ops) - H5D_chunk_idx_reset(dest, FALSE); + if(dest->type == H5D_CHUNKED && dest->storage.u.chunk.ops) + H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE); /* Set return value */ ret_value = dest; @@ -622,7 +623,7 @@ H5O_layout_reset(void *_mesg) if(mesg) { /* Free the compact storage buffer */ if(H5D_COMPACT == mesg->type) - mesg->store.u.compact.buf = H5MM_xfree(mesg->store.u.compact.buf); + mesg->storage.u.compact.buf = H5MM_xfree(mesg->storage.u.compact.buf); /* Reset the message */ mesg->type = H5D_CONTIGUOUS; @@ -642,26 +643,26 @@ H5O_layout_reset(void *_mesg) * Programmer: Quincey Koziol * Saturday, March 11, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5O_layout_free(void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *) _mesg; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_free) + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_free) HDassert(mesg); - /* Free the compact storage buffer */ - if(H5D_COMPACT == mesg->type) - mesg->store.u.compact.buf = H5MM_xfree(mesg->store.u.compact.buf); + /* Free resources within the message */ + if(H5O_layout_reset(mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources") (void)H5FL_FREE(H5O_layout_t, mesg); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_free() */ @@ -675,8 +676,6 @@ H5O_layout_free(void *_mesg) * Programmer: Quincey Koziol * Wednesday, March 19, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -700,13 +699,13 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) case H5D_CONTIGUOUS: /* Contiguous block on disk */ /* Free the file space for the raw data */ - if(H5D_contig_delete(f, dxpl_id, mesg) < 0) + if(H5D_contig_delete(f, dxpl_id, &mesg->storage) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data") break; case H5D_CHUNKED: /* Chunked blocks on disk */ /* Free the file space for the index & chunk raw data */ - if(H5D_chunk_delete(f, dxpl_id, open_oh, mesg) < 0) + if(H5D_chunk_delete(f, dxpl_id, open_oh, &mesg->storage) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data") break; @@ -763,15 +762,15 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* Copy the layout type specific information */ switch(layout_src->type) { case H5D_COMPACT: - if(layout_src->store.u.compact.buf) { - if(NULL == (layout_dst->store.u.compact.buf = H5MM_malloc(layout_src->store.u.compact.size))) + if(layout_src->storage.u.compact.buf) { + if(NULL == (layout_dst->storage.u.compact.buf = H5MM_malloc(layout_src->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") /* copy compact raw data */ if(H5D_compact_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage") - layout_dst->store.u.compact.dirty = TRUE; + layout_dst->storage.u.compact.dirty = TRUE; } /* end if */ break; @@ -781,10 +780,10 @@ 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->store.u.contig.size = H5S_extent_nelem(udata->src_space_extent) * + layout_dst->storage.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)) { + if(H5F_addr_defined(layout_src->storage.u.contig.addr)) { /* create contig layout */ if(H5D_contig_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy contiguous storage") @@ -865,7 +864,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "}\n"); /* Index information */ - switch(mesg->u.chunk.idx_type) { + switch(mesg->storage.u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v1 B-tree"); @@ -883,27 +882,27 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, default: HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, - "Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type); + "Index Type:", "Unknown", (unsigned)mesg->storage.u.chunk.idx_type); break; } /* end switch */ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Index address:", mesg->store.u.chunk.idx_addr); + "Index address:", mesg->storage.u.chunk.idx_addr); break; case H5D_CONTIGUOUS: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous"); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Data address:", mesg->store.u.contig.addr); + "Data address:", mesg->storage.u.contig.addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Data Size:", mesg->store.u.contig.size); + "Data Size:", mesg->storage.u.contig.size); break; case H5D_COMPACT: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact"); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Data Size:", mesg->store.u.compact.size); + "Data Size:", mesg->storage.u.compact.size); break; default: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 856d1fd..251e770 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -363,8 +363,34 @@ typedef struct H5O_storage_contig_t { hsize_t size; /* Size of data in bytes */ } H5O_storage_contig_t; +typedef struct H5O_storage_chunk_btree_t { + H5RC_t *shared; /* Ref-counted shared info for B-tree nodes */ +} H5O_storage_chunk_btree_t; + +/* Forward declaration of structs used below */ +struct H5FA_t; /* Defined in H5FAprivate.h */ + +typedef struct H5O_storage_chunk_farray_t { + struct H5FA_t *fa; /* Pointer to fixed index array struct */ +} H5O_storage_chunk_farray_t; + +/* Forward declaration of structs used below */ +struct H5EA_t; /* Defined in H5EAprivate.h */ + +typedef struct H5O_storage_chunk_earray_t { + haddr_t dset_ohdr_addr; /* File address dataset's object header */ + struct H5EA_t *ea; /* Pointer to extensible index array struct */ +} H5O_storage_chunk_earray_t; + typedef struct H5O_storage_chunk_t { + H5D_chunk_index_t idx_type; /* Type of chunk index */ haddr_t idx_addr; /* File address of chunk index */ + const struct H5D_chunk_ops_t *ops; /* Pointer to chunked storage operations */ + union { + H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ + H5O_storage_chunk_farray_t farray; /* Information for fixed array index */ + H5O_storage_chunk_earray_t earray; /* Information for extensible array index */ + } u; } H5O_storage_chunk_t; typedef struct H5O_storage_compact_t { @@ -382,13 +408,6 @@ typedef struct H5O_storage_t { } u; } H5O_storage_t; -typedef struct H5O_layout_chunk_btree_t { - H5RC_t *shared; /* Ref-counted shared info for B-tree nodes */ -} H5O_layout_chunk_btree_t; - -/* Forward declaration of structs used below */ -struct H5FA_t; /* Defined in H5FAprivate.h */ - typedef struct H5O_layout_chunk_farray_t { /* Creation parameters for fixed array data structure */ struct { @@ -396,13 +415,8 @@ typedef struct H5O_layout_chunk_farray_t { i.e. # of bits needed to store max. # of elements in a data block page */ } cparam; - - struct H5FA_t *fa; /* Pointer to fixed index array struct */ } H5O_layout_chunk_farray_t; -/* Forward declaration of structs used below */ -struct H5EA_t; /* Defined in H5EAprivate.h */ - typedef struct H5O_layout_chunk_earray_t { /* Creation parameters for extensible array data structure */ struct { @@ -413,10 +427,8 @@ typedef struct H5O_layout_chunk_earray_t { uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ } cparam; - haddr_t dset_ohdr_addr; /* File address dataset's object header */ unsigned unlim_dim; /* Rank of unlimited dimension for dataset */ hsize_t swizzled_down_chunks[H5O_LAYOUT_NDIMS]; /* swizzled "down" size of number of chunks in each dimension */ - struct H5EA_t *ea; /* Pointer to extensible array struct */ } H5O_layout_chunk_earray_t; typedef struct H5O_layout_chunk_t { @@ -428,9 +440,7 @@ typedef struct H5O_layout_chunk_t { hsize_t nchunks; /* Number of chunks in dataset */ hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in dataset dimensions */ hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ - const struct H5D_chunk_ops_t *ops; /* Pointer to chunked layout operations */ union { - H5O_layout_chunk_btree_t btree; /* Information for v1 B-tree index */ H5O_layout_chunk_farray_t farray; /* Information for fixed array index */ H5O_layout_chunk_earray_t earray; /* Information for extensible array index */ } u; @@ -443,7 +453,7 @@ typedef struct H5O_layout_t { union { H5O_layout_chunk_t chunk; /* Information for chunked layout */ } u; - H5O_storage_t store; /* Information for storing dataset elements */ + H5O_storage_t storage; /* Information for storing dataset elements */ } H5O_layout_t; /* Enable reading/writing "bogus" messages */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 5afeaa4..84ca255 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -51,8 +51,8 @@ /* 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, (hsize_t)0} -#define H5D_DEF_STORAGE_CHUNK_INIT {HADDR_UNDEF} -#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_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}, (unsigned)0, (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}}} +#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, NULL, {{NULL}}} +#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_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}, {{(uint8_t)0}}, {{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 }} @@ -273,13 +273,13 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) dst_layout.ops = NULL; switch(dst_layout.type) { case H5D_COMPACT: - dst_layout.store.u.compact.buf = H5MM_xfree(dst_layout.store.u.compact.buf); - HDmemset(&dst_layout.store.u.compact, 0, sizeof(dst_layout.store.u.compact)); + dst_layout.storage.u.compact.buf = H5MM_xfree(dst_layout.storage.u.compact.buf); + HDmemset(&dst_layout.storage.u.compact, 0, sizeof(dst_layout.storage.u.compact)); break; case H5D_CONTIGUOUS: - dst_layout.store.u.contig.addr = HADDR_UNDEF; - dst_layout.store.u.contig.size = 0; + dst_layout.storage.u.contig.addr = HADDR_UNDEF; + dst_layout.storage.u.contig.size = 0; break; case H5D_CHUNKED: @@ -287,13 +287,13 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) dst_layout.u.chunk.size = 0; /* Reset index info, if the chunk ops are set */ - if(dst_layout.u.chunk.ops) + if(dst_layout.storage.u.chunk.ops) /* Reset address and pointer of the array struct for the chunked storage index */ - if(H5D_chunk_idx_reset(&dst_layout, TRUE) < 0) + if(H5D_chunk_idx_reset(&dst_layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") /* Reset chunk index ops */ - dst_layout.u.chunk.ops = NULL; + dst_layout.storage.u.chunk.ops = NULL; break; default: @@ -780,9 +780,9 @@ H5P_init_def_layout(void) /* Initialize the default layout info for non-contigous layouts */ H5D_def_layout_compact_g.u.compact = def_layout_compact; - H5D_def_layout_compact_g.store.u.compact = def_store_compact; + H5D_def_layout_compact_g.storage.u.compact = def_store_compact; H5D_def_layout_chunk_g.u.chunk = def_chunk; - H5D_def_layout_compact_g.store.u.chunk = def_store_chunk; + H5D_def_layout_compact_g.storage.u.chunk = def_store_chunk; /* Note that we've initialized the default values */ H5P_dcrt_def_layout_init_g = TRUE; diff --git a/src/H5trace.c b/src/H5trace.c index 6e2578b..172a7f7 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -293,234 +293,257 @@ H5_trace (const double *returning, const char *func, const char *type, ...) break; case 'D': - switch (type[1]) { - case 'a': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_alloc_time_t alloc_time = va_arg (ap, H5D_alloc_time_t); /*lint !e64 Type mismatch not really occuring */ - switch (alloc_time) { - case H5D_ALLOC_TIME_ERROR: - fprintf (out, "H5D_ALLOC_TIME_ERROR"); - break; - case H5D_ALLOC_TIME_DEFAULT: - fprintf (out, "H5D_ALLOC_TIME_DEFAULT"); - break; - case H5D_ALLOC_TIME_EARLY: - fprintf (out, "H5D_ALLOC_TIME_EARLY"); - break; - case H5D_ALLOC_TIME_LATE: - fprintf (out, "H5D_ALLOC_TIME_LATE"); - break; - case H5D_ALLOC_TIME_INCR: - fprintf (out, "H5D_ALLOC_TIME_INCR"); - break; - default: - fprintf (out, "%ld", (long)alloc_time); - break; - } - } - break; + switch(type[1]) { + case 'a': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int); - case 'c': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5FD_mpio_collective_opt_t opt= va_arg(ap, H5FD_mpio_collective_opt_t); /*lint !e64 Type mismatch not really occuring */ - switch (opt) { - case H5FD_MPIO_COLLECTIVE_IO: - fprintf (out, "H5FD_MPIO_COLLECTIVE_IO"); - break; - case H5FD_MPIO_INDIVIDUAL_IO: - fprintf (out, "H5FD_MPIO_INDIVIDUAL_IO"); - break; - default: - fprintf (out, "%ld", (long)opt); - break; - } - } - break; + switch(alloc_time) { + case H5D_ALLOC_TIME_ERROR: + fprintf(out, "H5D_ALLOC_TIME_ERROR"); + break; - case 'f': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_fill_time_t fill_time = va_arg (ap, H5D_fill_time_t); /*lint !e64 Type mismatch not really occuring */ - switch (fill_time) { - case H5D_FILL_TIME_ERROR: - fprintf (out, "H5D_FILL_TIME_ERROR"); - break; - case H5D_FILL_TIME_ALLOC: - fprintf (out, "H5D_FILL_TIME_ALLOC"); - break; - case H5D_FILL_TIME_NEVER: - fprintf (out, "H5D_FILL_TIME_NEVER"); - break; - case H5D_FILL_TIME_IFSET: - fprintf (out, "H5D_FILL_TIME_IFSET"); - break; - default: - fprintf (out, "%ld", (long)fill_time); - break; - } - } - break; + case H5D_ALLOC_TIME_DEFAULT: + fprintf(out, "H5D_ALLOC_TIME_DEFAULT"); + break; - case 'F': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_fill_value_t fill_value = va_arg (ap, H5D_fill_value_t); /*lint !e64 Type mismatch not really occuring */ - switch (fill_value) { - case H5D_FILL_VALUE_ERROR: - fprintf (out, "H5D_FILL_VALUE_ERROR"); - break; - case H5D_FILL_VALUE_UNDEFINED: - fprintf (out, "H5D_FILL_VALUE_UNDEFINED"); - break; - case H5D_FILL_VALUE_DEFAULT: - fprintf (out, "H5D_FILL_VALUE_DEFAULT"); - break; - case H5D_FILL_VALUE_USER_DEFINED: - fprintf (out, "H5D_FILL_VALUE_USER_DEFINED"); - break; - default: - fprintf (out, "%ld", (long)fill_value); - break; - } - } - break; + case H5D_ALLOC_TIME_EARLY: + fprintf(out, "H5D_ALLOC_TIME_EARLY"); + break; - case 'h': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5FD_mpio_chunk_opt_t opt = va_arg(ap, H5FD_mpio_chunk_opt_t); /*lint !e64 Type mismatch not really occuring */ - switch (opt) { - case H5FD_MPIO_CHUNK_DEFAULT: - fprintf (out, "H5FD_MPIO_CHUNK_DEFAULT"); - break; - case H5FD_MPIO_CHUNK_ONE_IO: - fprintf (out, "H5FD_MPIO_CHUNK_ONE_IO"); - break; - case H5FD_MPIO_CHUNK_MULTI_IO: - fprintf (out, "H5FD_MPIO_CHUNK_MULTI_IO"); - break; - default: - fprintf (out, "%ld", (long)opt); - break; - } - } - break; + case H5D_ALLOC_TIME_LATE: + fprintf(out, "H5D_ALLOC_TIME_LATE"); + break; - case 'l': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_layout_t layout = va_arg (ap, H5D_layout_t); /*lint !e64 Type mismatch not really occuring */ - switch (layout) { - case H5D_LAYOUT_ERROR: - fprintf (out, "H5D_LAYOUT_ERROR"); - break; - case H5D_COMPACT: - fprintf (out, "H5D_COMPACT"); - break; - case H5D_CONTIGUOUS: - fprintf (out, "H5D_CONTIGUOUS"); - break; - case H5D_CHUNKED: - fprintf (out, "H5D_CHUNKED"); - break; - case H5D_NLAYOUTS: - fprintf (out, "H5D_NLAYOUTS"); - break; - default: - fprintf (out, "%ld", (long)layout); - break; - } - } - break; + case H5D_ALLOC_TIME_INCR: + fprintf(out, "H5D_ALLOC_TIME_INCR"); + break; - case 's': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t); /*lint !e64 Type mismatch not really occuring */ - switch (space_status) { - case H5D_SPACE_STATUS_NOT_ALLOCATED: - fprintf (out, "H5D_SPACE_STATUS_NOT_ALLOCATED"); - break; - case H5D_SPACE_STATUS_PART_ALLOCATED: - fprintf (out, "H5D_SPACE_STATUS_PART_ALLOCATED"); - break; - case H5D_SPACE_STATUS_ALLOCATED: - fprintf (out, "H5D_SPACE_STATUS_ALLOCATED"); - break; - case H5D_SPACE_STATUS_ERROR: - fprintf (out, "H5D_SPACE_STATUS_ERROR"); - break; - default: - fprintf (out, "%ld", (long)space_status); - break; - } - } - break; + default: + fprintf(out, "%ld", (long)alloc_time); + break; + } /* end switch */ + } /* end else */ + break; - case 't': - if (ptr) { - if (vp) { - fprintf (out, "0x%lx", (unsigned long)vp); - } else { - fprintf(out, "NULL"); - } - } else { - H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t); /*lint !e64 Type mismatch not really occuring */ - switch (transfer) { - case H5FD_MPIO_INDEPENDENT: - fprintf (out, "H5FD_MPIO_INDEPENDENT"); - break; - case H5FD_MPIO_COLLECTIVE: - fprintf (out, "H5FD_MPIO_COLLECTIVE"); - break; - default: - fprintf (out, "%ld", (long)transfer); - break; - } - } - break; + case 'c': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int); - default: - fprintf (out, "BADTYPE(D%c)", type[1]); - goto error; - } + switch(opt) { + case H5FD_MPIO_COLLECTIVE_IO: + fprintf(out, "H5FD_MPIO_COLLECTIVE_IO"); + break; + + case H5FD_MPIO_INDIVIDUAL_IO: + fprintf(out, "H5FD_MPIO_INDIVIDUAL_IO"); + break; + + default: + fprintf(out, "%ld", (long)opt); + break; + } /* end switch */ + } /* end else */ + break; + + case 'f': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int); + + switch(fill_time) { + case H5D_FILL_TIME_ERROR: + fprintf(out, "H5D_FILL_TIME_ERROR"); + break; + + case H5D_FILL_TIME_ALLOC: + fprintf(out, "H5D_FILL_TIME_ALLOC"); + break; + + case H5D_FILL_TIME_NEVER: + fprintf(out, "H5D_FILL_TIME_NEVER"); + break; + + case H5D_FILL_TIME_IFSET: + fprintf(out, "H5D_FILL_TIME_IFSET"); + break; + + default: + fprintf(out, "%ld", (long)fill_time); + break; + } /* end switch */ + } /* end else */ + break; + + case 'F': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int); + + switch(fill_value) { + case H5D_FILL_VALUE_ERROR: + fprintf(out, "H5D_FILL_VALUE_ERROR"); + break; + + case H5D_FILL_VALUE_UNDEFINED: + fprintf(out, "H5D_FILL_VALUE_UNDEFINED"); + break; + + case H5D_FILL_VALUE_DEFAULT: + fprintf(out, "H5D_FILL_VALUE_DEFAULT"); + break; + + case H5D_FILL_VALUE_USER_DEFINED: + fprintf(out, "H5D_FILL_VALUE_USER_DEFINED"); + break; + + default: + fprintf(out, "%ld", (long)fill_value); + break; + } /* end switch */ + } /* end else */ + break; + + case 'h': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int); + + switch(opt) { + case H5FD_MPIO_CHUNK_DEFAULT: + fprintf(out, "H5FD_MPIO_CHUNK_DEFAULT"); + break; + + case H5FD_MPIO_CHUNK_ONE_IO: + fprintf(out, "H5FD_MPIO_CHUNK_ONE_IO"); + break; + + case H5FD_MPIO_CHUNK_MULTI_IO: + fprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO"); + break; + + default: + fprintf(out, "%ld", (long)opt); + break; + } /* end switch */ + } /* end else */ + break; + + case 'l': + if (ptr) { + if (vp) { + fprintf (out, "0x%lx", (unsigned long)vp); + } else { + fprintf(out, "NULL"); + } + } else { + H5D_layout_t layout = va_arg (ap, H5D_layout_t); /*lint !e64 Type mismatch not really occuring */ + switch (layout) { + case H5D_LAYOUT_ERROR: + fprintf (out, "H5D_LAYOUT_ERROR"); + break; + case H5D_COMPACT: + fprintf (out, "H5D_COMPACT"); + break; + case H5D_CONTIGUOUS: + fprintf (out, "H5D_CONTIGUOUS"); + break; + case H5D_CHUNKED: + fprintf (out, "H5D_CHUNKED"); + break; + case H5D_NLAYOUTS: + fprintf (out, "H5D_NLAYOUTS"); + break; + default: + fprintf (out, "%ld", (long)layout); + break; + } + } + break; + + case 's': + if (ptr) { + if (vp) { + fprintf (out, "0x%lx", (unsigned long)vp); + } else { + fprintf(out, "NULL"); + } + } else { + H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t); /*lint !e64 Type mismatch not really occuring */ + switch (space_status) { + case H5D_SPACE_STATUS_NOT_ALLOCATED: + fprintf (out, "H5D_SPACE_STATUS_NOT_ALLOCATED"); + break; + case H5D_SPACE_STATUS_PART_ALLOCATED: + fprintf (out, "H5D_SPACE_STATUS_PART_ALLOCATED"); + break; + case H5D_SPACE_STATUS_ALLOCATED: + fprintf (out, "H5D_SPACE_STATUS_ALLOCATED"); + break; + case H5D_SPACE_STATUS_ERROR: + fprintf (out, "H5D_SPACE_STATUS_ERROR"); + break; + default: + fprintf (out, "%ld", (long)space_status); + break; + } + } + break; + + case 't': + if (ptr) { + if (vp) { + fprintf (out, "0x%lx", (unsigned long)vp); + } else { + fprintf(out, "NULL"); + } + } else { + H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t); /*lint !e64 Type mismatch not really occuring */ + switch (transfer) { + case H5FD_MPIO_INDEPENDENT: + fprintf (out, "H5FD_MPIO_INDEPENDENT"); + break; + case H5FD_MPIO_COLLECTIVE: + fprintf (out, "H5FD_MPIO_COLLECTIVE"); + break; + default: + fprintf (out, "%ld", (long)transfer); + break; + } + } + break; + + default: + fprintf (out, "BADTYPE(D%c)", type[1]); + goto error; + } /* end switch */ break; case 'e': -- cgit v0.12