diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-29 22:45:57 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-29 22:45:57 (GMT) |
commit | 0836a8cf5652392f59d3917446a7ca2af9234e09 (patch) | |
tree | 6f2865263358c81f0eb5c077dc789e777c7cae5e | |
parent | 913adc97563247edb3e41ccaf827aae30a885b23 (diff) | |
download | hdf5-0836a8cf5652392f59d3917446a7ca2af9234e09.zip hdf5-0836a8cf5652392f59d3917446a7ca2af9234e09.tar.gz hdf5-0836a8cf5652392f59d3917446a7ca2af9234e09.tar.bz2 |
[svn-r17264] Description:
Refine how we store the chunk index address in the layout storage
structure.
Tested on:
FreeBSD/32 6.3 (duty) debug
Mac OS X/32 10.5.7 (amazon) debug & production
Too minor to require h5committest
-rw-r--r-- | src/H5Dbtree.c | 34 | ||||
-rw-r--r-- | src/H5Olayout.c | 8 | ||||
-rw-r--r-- | src/H5Oprivate.h | 9 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 2 |
4 files changed, 23 insertions, 30 deletions
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 6d9038d..0e4ee6f 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -898,13 +898,13 @@ 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.u.btree.addr)); + HDassert(!H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); /* Initialize "user" data for B-tree callbacks, etc. */ udata.mesg = idx_info->layout; /* 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.u.btree.addr)/*out*/) < 0) + if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->layout->store.u.chunk.idx_addr)/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: @@ -935,7 +935,7 @@ H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout) HDassert(layout); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->store.u.chunk.u.btree.addr); + ret_value = (hbool_t)H5F_addr_defined(layout->store.u.chunk.idx_addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_btree_idx_is_space_alloc() */ @@ -965,14 +965,14 @@ 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.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.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.u.btree.addr, udata) < 0) + if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, udata) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") done: @@ -1009,7 +1009,7 @@ H5D_btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata 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.u.btree.addr, udata) < 0) + if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") done: @@ -1091,7 +1091,7 @@ 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.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.idx_addr)); HDassert(chunk_cb); HDassert(chunk_udata); @@ -1102,7 +1102,7 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, 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.u.btree.addr, H5D_btree_idx_iterate_cb, &udata)) < 0) + 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) HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree"); FUNC_LEAVE_NOAPI(ret_value) @@ -1132,13 +1132,13 @@ 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.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.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.u.btree.addr, udata) < 0) + if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.idx_addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry") done: @@ -1174,7 +1174,7 @@ H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->layout); /* Check if the index data structure has been allocated */ - if(H5F_addr_defined(idx_info->layout->store.u.chunk.u.btree.addr)) { + 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 */ @@ -1188,7 +1188,7 @@ H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") /* Delete entire B-tree */ - if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.store.u.chunk.u.btree.addr, &udata) < 0) + if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.store.u.chunk.idx_addr, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") /* Free the raw B-tree node buffer */ @@ -1231,7 +1231,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, 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.u.btree.addr)); + HDassert(!H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); /* Create shared B-tree info for each file */ if(H5D_btree_shared_create(idx_info_src->f, idx_info_src->layout) < 0) @@ -1242,7 +1242,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, /* 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.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info_dst->layout->store.u.chunk.idx_addr)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1323,7 +1323,7 @@ H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) udata.mesg = idx_info->layout; /* 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.u.btree.addr, &bt_info, NULL, &udata) < 0) + 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) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") /* Set the size of the B-tree */ @@ -1362,7 +1362,7 @@ H5D_btree_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) /* Reset index info */ if(reset_addr) - layout->store.u.chunk.u.btree.addr = HADDR_UNDEF; + layout->store.u.chunk.idx_addr = HADDR_UNDEF; layout->u.chunk.u.btree.shared = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1392,7 +1392,7 @@ H5D_btree_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream) HDassert(idx_info->layout); HDassert(stream); - HDfprintf(stream, " Address: %a\n", idx_info->layout->store.u.chunk.u.btree.addr); + HDfprintf(stream, " Address: %a\n", idx_info->layout->store.u.chunk.idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_btree_idx_dump() */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 9eb005d..0f9370a 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -137,7 +137,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, mesg->ops = H5D_LOPS_CONTIG; } /* end if */ else if(mesg->type == H5D_CHUNKED) { - H5F_addr_decode(f, &p, &(mesg->store.u.chunk.u.btree.addr)); + H5F_addr_decode(f, &p, &(mesg->store.u.chunk.idx_addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; @@ -219,7 +219,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.u.btree.addr)); + H5F_addr_decode(f, &p, &(mesg->store.u.chunk.idx_addr)); /* Chunk dimensions */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -332,7 +332,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.u.btree.addr); + H5F_addr_encode(f, &p, mesg->store.u.chunk.idx_addr); /* Dimension sizes */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -705,7 +705,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v1 B-tree"); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "B-tree address:", mesg->store.u.chunk.u.btree.addr); + "B-tree address:", mesg->store.u.chunk.idx_addr); break; default: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index acd8036..74f6b97 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -357,15 +357,8 @@ typedef struct H5O_storage_contig_t { haddr_t addr; /* File address of data */ } H5O_storage_contig_t; -typedef struct H5O_storage_chunk_btree_t { - haddr_t addr; /* File address of B-tree */ -} H5O_storage_chunk_btree_t; - typedef struct H5O_storage_chunk_t { - H5D_chunk_index_t idx_type; /* Type of chunk index */ - union { - H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ - } u; + haddr_t idx_addr; /* File address of chunk index */ } H5O_storage_chunk_t; typedef struct H5O_storage_compact_t { diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 0762fbf..317b9c3 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -50,7 +50,7 @@ /* Define default layout information */ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF} -#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_BTREE, {{HADDR_UNDEF}}} +#define H5D_DEF_STORAGE_CHUNK_INIT {HADDR_UNDEF} #define H5D_DEF_LAYOUT_CONTIG_INIT {(hsize_t)0} #define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_BTREE, (unsigned)1, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL, {{NULL}}} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER |