From f985e7d22f389d336894e33b84c0d60427d4ae27 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 24 Oct 2009 14:16:06 -0500 Subject: [svn-r17740] Description: Refactor v2 B-tree code to take creation parameters to H5B2_create() as a struct (instead of individual arguments), call the client's class "cls" instead of "type" internally, and add client class name to client class struct. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.1 (amazon) in debug mode Mac OS X/32 10.6.1 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- src/H5Abtree2.c | 8 ++-- src/H5Adense.c | 24 ++++++----- src/H5B2.c | 20 ++++----- src/H5B2cache.c | 52 +++++++++++------------ src/H5B2dbg.c | 45 +++----------------- src/H5B2hdr.c | 34 +++++++++++----- src/H5B2int.c | 120 +++++++++++++++++++++++++++--------------------------- src/H5B2pkg.h | 7 ++-- src/H5B2private.h | 15 +++++-- src/H5B2stat.c | 2 + src/H5B2test.c | 5 ++- src/H5Gbtree2.c | 4 +- src/H5Gdense.c | 24 ++++++----- src/H5HFbtree2.c | 10 +++-- src/H5HFhuge.c | 27 ++++++------ src/H5SM.c | 21 +++++++--- src/H5SMbtree2.c | 1 + test/btree2.c | 97 ++++++++++++++++++++++--------------------- 18 files changed, 263 insertions(+), 253 deletions(-) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index a0035b3..8959b4c 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -108,7 +108,8 @@ static herr_t H5A_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_da /*********************/ /* v2 B-tree class for indexing 'name' field of attributes */ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ - H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */ + H5B2_ATTR_DENSE_NAME_ID, /* Type of B-tree */ + "H5B2_ATTR_DENSE_NAME_ID", /* Name of B-tree class */ sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */ H5A_dense_btree2_name_store, /* Record storage callback */ H5A_dense_btree2_name_compare, /* Record comparison callback */ @@ -118,8 +119,9 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ }}; /* v2 B-tree class for indexing 'creation order' field of attributes */ -const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ - H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */ +const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ + H5B2_ATTR_DENSE_CORDER_ID, /* Type of B-tree */ + "H5B2_ATTR_DENSE_CORDER_ID", /* Name of B-tree class */ sizeof(H5A_dense_bt2_corder_rec_t),/* Size of native record */ H5A_dense_btree2_corder_store, /* Record storage callback */ H5A_dense_btree2_corder_compare, /* Record comparison callback */ diff --git a/src/H5Adense.c b/src/H5Adense.c index bc5ddfb..ccc4e0f 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -186,8 +186,8 @@ herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo) { H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */ + H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ H5HF_t *fheap; /* Fractal heap handle */ - size_t bt2_rrec_size; /* v2 B-tree raw record size */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5A_dense_create, FAIL) @@ -239,14 +239,15 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") /* Create the name index v2 B-tree */ - bt2_rrec_size = 4 + /* Name's hash value */ + bt2_cparam.cls = H5A_BT2_NAME; + bt2_cparam.node_size = (size_t)H5A_NAME_BT2_NODE_SIZE; + bt2_cparam.rrec_size = 4 + /* Name's hash value */ 4 + /* Creation order index */ 1 + /* Message flags */ H5O_FHEAP_ID_LEN; /* Fractal heap ID */ - if(H5B2_create(f, dxpl_id, H5A_BT2_NAME, - (size_t)H5A_NAME_BT2_NODE_SIZE, bt2_rrec_size, - H5A_NAME_BT2_SPLIT_PERC, H5A_NAME_BT2_MERGE_PERC, - &ainfo->name_bt2_addr) < 0) + bt2_cparam.split_percent = H5A_NAME_BT2_SPLIT_PERC; + bt2_cparam.merge_percent = H5A_NAME_BT2_MERGE_PERC; + if(H5B2_create(f, dxpl_id, &bt2_cparam, &ainfo->name_bt2_addr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") #ifdef QAK HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr); @@ -255,13 +256,14 @@ HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr) /* Check if we should create a creation order index v2 B-tree */ if(ainfo->index_corder) { /* Create the creation order index v2 B-tree */ - bt2_rrec_size = 4 + /* Creation order index */ + bt2_cparam.cls = H5A_BT2_CORDER; + bt2_cparam.node_size = (size_t)H5A_CORDER_BT2_NODE_SIZE; + bt2_cparam.rrec_size = 4 + /* Creation order index */ 1 + /* Message flags */ H5O_FHEAP_ID_LEN; /* Fractal heap ID */ - if(H5B2_create(f, dxpl_id, H5A_BT2_CORDER, - (size_t)H5A_CORDER_BT2_NODE_SIZE, bt2_rrec_size, - H5A_CORDER_BT2_SPLIT_PERC, H5A_CORDER_BT2_MERGE_PERC, - &ainfo->corder_bt2_addr) < 0) + bt2_cparam.split_percent = H5A_CORDER_BT2_SPLIT_PERC; + bt2_cparam.merge_percent = H5A_CORDER_BT2_MERGE_PERC; + if(H5B2_create(f, dxpl_id, &bt2_cparam, &ainfo->corder_bt2_addr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") #ifdef QAK HDfprintf(stderr, "%s: ainfo->corder_bt2_addr = %a\n", FUNC, ainfo->corder_bt2_addr); diff --git a/src/H5B2.c b/src/H5B2.c index f9990fe..e15c11e 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -100,8 +100,7 @@ H5FL_DEFINE(H5B2_hdr_t); *------------------------------------------------------------------------- */ herr_t -H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, size_t node_size, - size_t rrec_size, unsigned split_percent, unsigned merge_percent, +H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, haddr_t *addr_p) { H5B2_hdr_t *hdr = NULL; /* The new B-tree header information */ @@ -113,12 +112,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, size_t node_size, * Check arguments. */ HDassert(f); - HDassert(type); - HDassert(node_size > 0); - HDassert(rrec_size > 0); - HDassert(merge_percent > 0 && merge_percent <= 100); - HDassert(split_percent > 0 && split_percent <= 100); - HDassert(merge_percent < (split_percent / 2)); + HDassert(cparam); HDassert(addr_p); /* @@ -131,7 +125,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, size_t node_size, hdr->root.addr = HADDR_UNDEF; /* Initialize shared B-tree info */ - if(H5B2_hdr_init(f, hdr, type, 0, node_size, rrec_size, split_percent, merge_percent) < 0) + if(H5B2_hdr_init(f, hdr, cparam, 0) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create shared B-tree info") /* Allocate space for the header on disk */ @@ -388,7 +382,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); if(cmp > 0) idx++; @@ -433,7 +427,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate record */ - cmp = H5B2_locate_record(hdr->type, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); if(cmp != 0) { /* Unlock leaf node */ @@ -1030,7 +1024,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); if(cmp > 0) idx++; @@ -1084,7 +1078,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate record */ - cmp = H5B2_locate_record(hdr->type, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); if(cmp != 0) { /* Unlock leaf node */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 1201ce5..ffb2995 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -147,12 +147,11 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ *------------------------------------------------------------------------- */ static H5B2_hdr_t * -H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void UNUSED *udata) +H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, void UNUSED *udata) { - const H5B2_class_t *type = (const H5B2_class_t *) _type; /* Type of B-tree */ - unsigned depth; /* Depth of B-tree */ - size_t node_size, rrec_size; /* Size info for B-tree */ - uint8_t split_percent, merge_percent; /* Split & merge %s for B-tree */ + const H5B2_class_t *cls = (const H5B2_class_t *) _cls; /* Class of B-tree client */ + H5B2_create_t cparam; /* B-tree creation parameters */ + unsigned depth; /* Depth of B-tree */ H5B2_hdr_t *hdr = NULL; /* B-tree header */ size_t size; /* Header size */ uint32_t stored_chksum; /* Stored metadata checksum value */ @@ -168,7 +167,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(type); + HDassert(cls); /* Allocate new B-tree header and reset cache info */ if(NULL == (hdr = H5FL_MALLOC(H5B2_hdr_t))) @@ -202,22 +201,22 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo if(*p++ != H5B2_HDR_VERSION) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version") - /* B-tree type */ - if(*p++ != (uint8_t)type->id) + /* B-tree class */ + if(*p++ != (uint8_t)cls->id) HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") /* Node size (in bytes) */ - UINT32DECODE(p, node_size); + UINT32DECODE(p, cparam.node_size); /* Raw key size (in bytes) */ - UINT16DECODE(p, rrec_size); + UINT16DECODE(p, cparam.rrec_size); /* Depth of tree */ UINT16DECODE(p, depth); /* Split & merge %s */ - split_percent = *p++; - merge_percent = *p++; + cparam.split_percent = *p++; + cparam.merge_percent = *p++; /* Root node pointer */ H5F_addr_decode(f, (const uint8_t **)&p, &(hdr->root.addr)); @@ -238,7 +237,8 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 B-tree header") /* Initialize B-tree header info */ - if(H5B2_hdr_init(f, hdr, type, depth, node_size, rrec_size, split_percent, merge_percent) < 0) + cparam.cls = cls; + if(H5B2_hdr_init(f, hdr, &cparam, depth) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") /* Set the B-tree header's address */ @@ -317,7 +317,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = H5B2_HDR_VERSION; /* B-tree type */ - *p++ = hdr->type->id; + *p++ = hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(p, hdr->node_size); @@ -548,7 +548,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree internal node version") /* B-tree type */ - if(*p++ != (uint8_t)udata->hdr->type->id) + if(*p++ != (uint8_t)udata->hdr->cls->id) HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") /* Allocate space for the native keys in memory */ @@ -567,12 +567,12 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda native = internal->int_native; for(u = 0; u < internal->nrec; u++) { /* Decode record */ - if((udata->hdr->type->decode)(f, p, native) < 0) + if((udata->hdr->cls->decode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record") /* Move to next record */ p += udata->hdr->rrec_size; - native += udata->hdr->type->nrec_size; + native += udata->hdr->cls->nrec_size; } /* end for */ /* Deserialize node pointers for internal node */ @@ -659,19 +659,19 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr *p++ = H5B2_INT_VERSION; /* B-tree type */ - *p++ = internal->hdr->type->id; + *p++ = internal->hdr->cls->id; HDassert((size_t)(p - internal->hdr->page) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ native = internal->int_native; for(u = 0; u < internal->nrec; u++) { /* Encode record */ - if((internal->hdr->type->encode)(f, p, native) < 0) + if((internal->hdr->cls->encode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") /* Move to next record */ p += internal->hdr->rrec_size; - native += internal->hdr->type->nrec_size; + native += internal->hdr->cls->nrec_size; } /* end for */ /* Serialize node pointers for internal node */ @@ -904,7 +904,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree leaf node version") /* B-tree type */ - if(*p++ != (uint8_t)hdr->type->id) + if(*p++ != (uint8_t)hdr->cls->id) HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") /* Allocate space for the native keys in memory */ @@ -918,12 +918,12 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v native = leaf->leaf_native; for(u = 0; u < leaf->nrec; u++) { /* Decode record */ - if((hdr->type->decode)(f, p, native) < 0) + if((hdr->cls->decode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record") /* Move to next record */ p += hdr->rrec_size; - native += hdr->type->nrec_size; + native += hdr->cls->nrec_size; } /* end for */ /* Compute checksum on internal node */ @@ -994,19 +994,19 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5 *p++ = H5B2_LEAF_VERSION; /* b-tree type */ - *p++ = leaf->hdr->type->id; + *p++ = leaf->hdr->cls->id; HDassert((size_t)(p - leaf->hdr->page) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for leaf node */ native = leaf->leaf_native; for(u = 0; u < leaf->nrec; u++) { /* Encode record */ - if((leaf->hdr->type->encode)(f, p, native) < 0) + if((leaf->hdr->cls->encode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") /* Move to next record */ p += leaf->hdr->rrec_size; - native += leaf->hdr->type->nrec_size; + native += leaf->hdr->cls->nrec_size; } /* end for */ /* Compute metadata checksum */ diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 4bc5421..86877a6 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -122,19 +122,8 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Tree type ID:", - (hdr->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : - (hdr->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : - (hdr->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : - (hdr->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : - (hdr->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : - (hdr->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : - "Unknown!"))))))))))); + HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, + "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", hdr->node_size); @@ -244,19 +233,8 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Tree type ID:", - (hdr->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : - (hdr->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : - (hdr->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : - (hdr->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : - (hdr->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : - (hdr->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : - "Unknown!"))))))))))); + HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, + "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", hdr->node_size); @@ -368,19 +346,8 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Tree type ID:", - (hdr->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : - (hdr->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : - (hdr->type->id == H5B2_GRP_DENSE_NAME_ID ? "H5B2_GRP_DENSE_NAME_ID" : - (hdr->type->id == H5B2_GRP_DENSE_CORDER_ID ? "H5B2_GRP_DENSE_CORDER_ID" : - (hdr->type->id == H5B2_SOHM_INDEX_ID ? "H5B2_SOHM_INDEX_ID" : - (hdr->type->id == H5B2_ATTR_DENSE_NAME_ID ? "H5B2_ATTR_DENSE_NAME_ID" : - (hdr->type->id == H5B2_ATTR_DENSE_CORDER_ID ? "H5B2_ATTR_DENSE_CORDER_ID" : - "Unknown!"))))))))))); + HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, + "Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", hdr->node_size); diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 5e577f5..ef57186 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -104,9 +104,8 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_class_t *type, - unsigned depth, size_t node_size, size_t rrec_size, - unsigned split_percent, unsigned merge_percent) +H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_create_t *cparam, + unsigned depth) { size_t sz_max_nrec; /* Temporary variable for range checking */ unsigned u_max_nrec_size; /* Temporary variable for range checking */ @@ -115,6 +114,19 @@ H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_class_t *type, FUNC_ENTER_NOAPI_NOINIT(H5B2_hdr_init) + /* + * Check arguments. + */ + HDassert(f); + HDassert(hdr); + HDassert(cparam); + HDassert(cparam->cls); + HDassert(cparam->node_size > 0); + HDassert(cparam->rrec_size > 0); + HDassert(cparam->merge_percent > 0 && cparam->merge_percent <= 100); + HDassert(cparam->split_percent > 0 && cparam->split_percent <= 100); + HDassert(cparam->merge_percent < (cparam->split_percent / 2)); + /* Initialize basic information */ hdr->f = f; hdr->rc = 0; @@ -124,13 +136,13 @@ H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_class_t *type, hdr->depth = depth; /* Assign user's information */ - hdr->split_percent = split_percent; - hdr->merge_percent = merge_percent; - hdr->node_size = node_size; - hdr->rrec_size = rrec_size; + hdr->split_percent = cparam->split_percent; + hdr->merge_percent = cparam->merge_percent; + hdr->node_size = cparam->node_size; + hdr->rrec_size = cparam->rrec_size; /* Assign common type information */ - hdr->type = type; + hdr->cls = cparam->cls; /* Allocate "page" for node I/O */ if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size))) @@ -150,7 +162,7 @@ HDmemset(hdr->page, 0, hdr->node_size); hdr->node_info[0].merge_nrec = (hdr->node_info[0].max_nrec * hdr->merge_percent) / 100; hdr->node_info[0].cum_max_nrec = hdr->node_info[0].max_nrec; hdr->node_info[0].cum_max_nrec_size = 0; - if(NULL == (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(type->nrec_size * hdr->node_info[0].max_nrec))) + if(NULL == (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") hdr->node_info[0].node_ptr_fac = NULL; @@ -162,7 +174,7 @@ HDmemset(hdr->page, 0, hdr->node_size); /* Initialize offsets in native key block */ /* (uses leaf # of records because its the largest) */ for(u = 0; u < hdr->node_info[0].max_nrec; u++) - hdr->nat_off[u] = type->nrec_size * u; + hdr->nat_off[u] = hdr->cls->nrec_size * u; /* Compute size to store # of records in each node */ /* (uses leaf # of records because its the largest) */ @@ -185,7 +197,7 @@ HDmemset(hdr->page, 0, hdr->node_size); u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[u].cum_max_nrec); H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[u].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) - if(NULL == (hdr->node_info[u].nat_rec_fac = H5FL_fac_init(hdr->type->nrec_size * hdr->node_info[u].max_nrec))) + if(NULL == (hdr->node_info[u].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") if(NULL == (hdr->node_info[u].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[u].max_nrec + 1)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory") diff --git a/src/H5B2int.c b/src/H5B2int.c index 610bc86..33fa63b 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -199,7 +199,7 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ /* Slide records in parent node up one space, to make room for promoted record */ if(idx < internal->nrec) { - HDmemmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size * (internal->nrec - idx)); + HDmemmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size * (internal->nrec - idx)); HDmemmove(&(internal->node_ptrs[idx + 2]), &(internal->node_ptrs[idx + 1]), sizeof(H5B2_node_ptr_t) * (internal->nrec - idx)); } /* end if */ @@ -270,7 +270,7 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ /* Copy "upper half" of records to new child */ HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, mid_record + 1), - hdr->type->nrec_size * (old_node_nrec - (mid_record + 1))); + hdr->cls->nrec_size * (old_node_nrec - (mid_record + 1))); /* Copy "upper half" of node pointers, if the node is an internal node */ if(depth > 1) @@ -278,7 +278,7 @@ H5B2_split1(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *curr_node_ sizeof(H5B2_node_ptr_t) * (old_node_nrec - mid_record)); /* Copy "middle" record to internal node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size); /* Update record counts in child nodes */ internal->node_ptrs[idx].node_nrec = *left_nrec = mid_record; @@ -388,7 +388,7 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr) hdr->node_info[hdr->depth - 1].cum_max_nrec) + hdr->node_info[hdr->depth].max_nrec; u_max_nrec_size = H5V_limit_enc_size((uint64_t)hdr->node_info[hdr->depth].cum_max_nrec); H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[hdr->depth].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ uint8_t) - if(NULL == (hdr->node_info[hdr->depth].nat_rec_fac = H5FL_fac_init(hdr->type->nrec_size * hdr->node_info[hdr->depth].max_nrec))) + if(NULL == (hdr->node_info[hdr->depth].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[hdr->depth].max_nrec))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") if(NULL == (hdr->node_info[hdr->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[hdr->depth].max_nrec + 1)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal 'branch' node node pointer block factory") @@ -527,17 +527,17 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int unsigned move_nrec = *right_nrec - new_right_nrec; /* Number of records to move from right node to left */ /* Copy record from parent node down into left child */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* See if we need to move records from right node */ if(move_nrec > 1) - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->type->nrec_size * (move_nrec - 1)); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (move_nrec - 1)); /* Move record from right node into parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size); /* Slide records in right node down */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->type->nrec_size * new_right_nrec); + HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->cls->nrec_size * new_right_nrec); /* Handle node pointers, if we have an internal node */ if(depth > 1) { @@ -570,17 +570,17 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int /* Slide records in right node up */ HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec), H5B2_NAT_NREC(right_native, hdr, 0), - hdr->type->nrec_size * (*right_nrec)); + hdr->cls->nrec_size * (*right_nrec)); /* Copy record from parent node down into right child */ - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* See if we need to move records from left node */ if(move_nrec > 1) - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->type->nrec_size * (move_nrec - 1)); + HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (move_nrec - 1)); /* Move record from left node into parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size); /* Handle node pointers, if we have an internal node */ if(depth > 1) { @@ -769,20 +769,20 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, unsigned moved_middle_nrec = 0; /* Number of records moved into left node */ /* Move left parent record down to left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); /* Move records from middle node into left node */ if((new_left_nrec - 1) > *left_nrec) { moved_middle_nrec = new_left_nrec - (*left_nrec + 1); - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->type->nrec_size * moved_middle_nrec); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec); } /* end if */ /* Move record from middle node up to parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size); moved_middle_nrec++; /* Slide records in middle node down */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->type->nrec_size * (*middle_nrec - moved_middle_nrec)); + HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size * (*middle_nrec - moved_middle_nrec)); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -813,17 +813,17 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, unsigned right_nrec_move = new_right_nrec - *right_nrec; /* Number of records to move out of right node */ /* Slide records in right node up */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->type->nrec_size * (*right_nrec)); + HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); /* Move right parent record down to right node */ - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Move records from middle node into right node */ if(right_nrec_move > 1) - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->type->nrec_size * (right_nrec_move - 1)); + HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1)); /* Move record from middle node up to parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -852,17 +852,17 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, unsigned left_nrec_move = *left_nrec - new_left_nrec; /* Number of records to move out of left node */ /* Slide middle records up */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->type->nrec_size * curr_middle_nrec); + HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * curr_middle_nrec); /* Move left parent record down to middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); /* Move left records to middle node */ if(left_nrec_move > 1) - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->type->nrec_size * (left_nrec_move - 1)); + HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->cls->nrec_size * (left_nrec_move - 1)); /* Move left parent record up from left node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -891,16 +891,16 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, unsigned right_nrec_move = *right_nrec - new_right_nrec; /* Number of records to move out of right node */ /* Move right parent record down to middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Move right records to middle node */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->type->nrec_size * (right_nrec_move - 1)); + HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1)); /* Move right parent record up from right node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size); /* Slide right records down */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->type->nrec_size * new_right_nrec); + HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->cls->nrec_size * new_right_nrec); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -954,25 +954,25 @@ H5B2_redistribute3(H5F_t *f, hid_t dxpl_id, unsigned depth, HDfprintf(stderr, "%s: Internal records:\n", FUNC); for(u = 0; u < internal->nrec; u++) { HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->type->debug)(stderr, f, dxpl_id, 3, 4, H5B2_INT_NREC(internal, hdr, u), NULL); + (hdr->cls->debug)(stderr, f, dxpl_id, 3, 4, H5B2_INT_NREC(internal, hdr, u), NULL); } /* end for */ HDfprintf(stderr, "%s: Left Child records:\n", FUNC); for(u = 0; u < *left_nrec; u++) { HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->type->debug)(stderr, f, dxpl_id, 3, 4, H5B2_NAT_NREC(left_native, hdr, u), NULL); + (hdr->cls->debug)(stderr, f, dxpl_id, 3, 4, H5B2_NAT_NREC(left_native, hdr, u), NULL); } /* end for */ HDfprintf(stderr, "%s: Middle Child records:\n", FUNC); for(u = 0; u < *middle_nrec; u++) { HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->type->debug)(stderr, f, dxpl_id, 3, 4, H5B2_NAT_NREC(middle_native, hdr, u), NULL); + (hdr->cls->debug)(stderr, f, dxpl_id, 3, 4, H5B2_NAT_NREC(middle_native, hdr, u), NULL); } /* end for */ HDfprintf(stderr, "%s: Right Child records:\n", FUNC); for(u = 0; u < *right_nrec; u++) { HDfprintf(stderr, "%s: u = %u\n", FUNC, u); - (hdr->type->debug)(stderr, f, dxpl_id, 3, 4, H5B2_NAT_NREC(right_native, hdr, u), NULL); + (hdr->cls->debug)(stderr, f, dxpl_id, 3, 4, H5B2_NAT_NREC(right_native, hdr, u), NULL); } /* end for */ for(u = 0; u < internal->nrec + 1; u++) @@ -1108,10 +1108,10 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, /* Redistribute records into left node */ { /* Copy record from parent node to proper location */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Copy records from right node to left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->type->nrec_size * (*right_nrec)); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); /* Copy node pointers from right node into left node */ if(depth > 1) @@ -1129,7 +1129,7 @@ H5B2_merge2(H5F_t *f, hid_t dxpl_id, unsigned depth, /* Slide records in parent node down, to eliminate demoted record */ if((idx + 1) < internal->nrec) { - HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->type->nrec_size * (internal->nrec - (idx + 1))); + HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->cls->nrec_size * (internal->nrec - (idx + 1))); HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1))); } /* end if */ @@ -1287,16 +1287,16 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, middle_moved_nrec = middle_nrec_move; /* Copy record from parent node to proper location in left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); /* Copy records from middle node to left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->type->nrec_size * (middle_nrec_move - 1)); + HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1)); /* Copy record from middle node to proper location in parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->type->nrec_size); + HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size); /* Slide records in middle node down */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->type->nrec_size * (*middle_nrec - middle_nrec_move)); + HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move)); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -1321,10 +1321,10 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, /* Redistribute records into middle node */ { /* Copy record from parent node to proper location in middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->type->nrec_size); + HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Copy records from right node to middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->type->nrec_size * (*right_nrec)); + HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); /* Move node pointers also if this is an internal node */ if(depth > 1) @@ -1345,7 +1345,7 @@ H5B2_merge3(H5F_t *f, hid_t dxpl_id, unsigned depth, /* Slide records in parent node down, to eliminate demoted record */ if((idx + 1) < internal->nrec) { - HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->type->nrec_size * (internal->nrec - (idx + 1))); + HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), hdr->cls->nrec_size * (internal->nrec - (idx + 1))); HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1))); } /* end if */ @@ -1460,9 +1460,9 @@ H5B2_swap_leaf(H5F_t *f, hid_t dxpl_id, unsigned depth, } /* end else */ /* Swap records (use disk page as temporary buffer) */ - HDmemcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->type->nrec_size); - HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->type->nrec_size); - HDmemcpy(swap_loc, hdr->page, hdr->type->nrec_size); + HDmemcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size); + HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size); + HDmemcpy(swap_loc, hdr->page, hdr->cls->nrec_size); /* Mark parent as dirty */ *internal_flags_ptr |= H5AC__DIRTIED_FLAG; @@ -1530,18 +1530,18 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr idx = 0; else { /* Find correct location to insert this record */ - if((cmp = H5B2_locate_record(hdr->type, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx)) == 0) + if((cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx)) == 0) HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") if(cmp > 0) idx++; /* Make room for new record */ if(idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->type->nrec_size * (leaf->nrec - idx)); + HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx)); } /* end else */ /* Make callback to store record in native form */ - if((hdr->type->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) + if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") /* Update record count for node pointer to current node */ @@ -1603,7 +1603,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, unsigned depth, size_t split_nrec; /* Number of records to split node at */ /* Locate node pointer for child */ - if((cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0) + if((cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0) HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") if(cmp > 0) idx++; @@ -1659,7 +1659,7 @@ H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, unsigned depth, /* Locate node pointer for child (after split/redistribute) */ /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ - if((cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0) + if((cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0) HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") if(cmp > 0) idx++; @@ -1739,7 +1739,7 @@ H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, H5B2_node_ptr_t *node if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") #ifdef H5_CLEAR_MEMORY -HDmemset(leaf->leaf_native, 0, hdr->type->nrec_size * hdr->node_info[0].max_nrec); +HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); #endif /* H5_CLEAR_MEMORY */ /* Set number of records */ @@ -1810,7 +1810,7 @@ H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") #ifdef H5_CLEAR_MEMORY -HDmemset(internal->int_native, 0, hdr->type->nrec_size * hdr->node_info[depth].max_nrec); +HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); #endif /* H5_CLEAR_MEMORY */ /* Allocate space for the node pointers in memory */ @@ -1959,7 +1959,7 @@ H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, unsigned depth, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") /* Copy the native keys */ - HDmemcpy(native, node_native, (hdr->type->nrec_size * curr_node->node_nrec)); + HDmemcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec)); /* Unlock the node */ if(H5AC_unprotect(f, dxpl_id, curr_node_class, curr_node->addr, node, H5AC__NO_FLAGS_SET) < 0) @@ -2040,7 +2040,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, HDassert(leaf->nrec == curr_node_ptr->node_nrec); /* Find correct location to remove this record */ - if(H5B2_locate_record(hdr->type, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx) != 0) + if(H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx) != 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree") /* Make 'remove' callback if there is one */ @@ -2057,7 +2057,7 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, if(leaf->nrec > 0) { /* Pack record out of leaf */ if(idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->type->nrec_size * (leaf->nrec - idx)); + HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->cls->nrec_size * (leaf->nrec - idx)); } /* end if */ else { /* Let the cache know that the object is deleted */ @@ -2165,7 +2165,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, if(swap_loc) idx = 0; else { - cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); if(cmp >= 0) idx++; } /* end else */ @@ -2227,7 +2227,7 @@ H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, idx = 0; else { /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ - cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); if(cmp >= 0) idx++; } /* end else */ @@ -2338,7 +2338,7 @@ H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, if(leaf->nrec > 0) { /* Pack record out of leaf */ if(idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->type->nrec_size * (leaf->nrec - idx)); + HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), hdr->cls->nrec_size * (leaf->nrec - idx)); } /* end if */ else { /* Let the cache know that the object is deleted */ @@ -2669,7 +2669,7 @@ H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree leaf node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->type, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); if(cmp > 0) idx++; else @@ -2757,7 +2757,7 @@ H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5B2_hdr_t *hdr, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); if(cmp > 0) idx++; diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 80e53cd..b47cc32 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -159,7 +159,7 @@ typedef struct H5B2_hdr_t { haddr_t addr; /* Address of B-tree header in the file */ size_t rc; /* Reference count of nodes using this header */ hbool_t pending_delete; /* B-tree is pending deletion */ - const H5B2_class_t *type; /* Type of tree */ + const H5B2_class_t *cls; /* Class of B-tree client */ uint8_t *page; /* Common disk page for I/O */ size_t *nat_off; /* Array of offsets of native records */ H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */ @@ -242,9 +242,8 @@ H5_DLL herr_t H5B2_hdr_incr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2_hdr_decr(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2_hdr_dirty(H5B2_hdr_t *hdr); H5_DLL herr_t H5B2_hdr_delete(H5B2_hdr_t *hdr); -H5_DLL herr_t H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_class_t *type, - unsigned depth, size_t node_size, size_t rrec_size, - unsigned split_percent, unsigned merge_percent); +H5_DLL herr_t H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, + const H5B2_create_t *cparam, unsigned depth); H5_DLL herr_t H5B2_hdr_free(H5B2_hdr_t *hdr); /* Routines for operating on internal nodes */ diff --git a/src/H5B2private.h b/src/H5B2private.h index 80d7977..e99def0 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -82,6 +82,7 @@ typedef enum H5B2_compare_t { typedef struct H5B2_class_t H5B2_class_t; struct H5B2_class_t { H5B2_subid_t id; /* ID of B-tree class, as found in file */ + const char *name; /* Name of B-tree class, for debugging */ size_t nrec_size; /* Size of native (memory) record */ /* Store record from application to B-tree 'native' form */ @@ -100,6 +101,15 @@ struct H5B2_class_t { const void *udata); }; +/* v2 B-tree creation parameters */ +typedef struct H5B2_create_t { + const H5B2_class_t *cls; /* v2 B-tree client class */ + size_t node_size; /* Size of each node (in bytes) */ + size_t rrec_size; /* Size of raw record (in bytes) */ + unsigned split_percent; /* % full to split nodes */ + unsigned merge_percent; /* % full to merge nodes */ +} H5B2_create_t; + /* v2 B-tree metadata statistics info */ typedef struct H5B2_stat_t { unsigned depth; /* Depth of B-tree */ @@ -114,9 +124,8 @@ typedef struct H5B2_stat_t { /***************************************/ /* Library-private Function Prototypes */ /***************************************/ -H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, - size_t node_size, size_t rrec_size, unsigned split_percent, - unsigned merge_percent, haddr_t *addr_p); +H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, + haddr_t *addr_p); H5_DLL herr_t H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr, void *udata); H5_DLL herr_t H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, diff --git a/src/H5B2stat.c b/src/H5B2stat.c index 2d5dd85..4b97e17 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -26,6 +26,7 @@ #define H5B2_PACKAGE /*suppress error about including H5B2pkg */ + /***********/ /* Headers */ /***********/ @@ -33,6 +34,7 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5B2test.c b/src/H5B2test.c index 4f50814..be0cf02 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -66,6 +66,7 @@ static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, /*********************/ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2_TEST_ID, /* Type of B-tree */ + "H5B2_TEST_ID", /* Name of B-tree class */ sizeof(hsize_t), /* Size of native record */ H5B2_test_store, /* Record storage callback */ H5B2_test_compare, /* Record comparison callback */ @@ -316,7 +317,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->type, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); if(cmp > 0) idx++; @@ -356,7 +357,7 @@ H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate record */ - cmp = H5B2_locate_record(hdr->type, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); /* Unlock current node */ if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 5f7ad23..29ab309 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -104,8 +104,9 @@ static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_da /* Package Variables */ /*********************/ /* v2 B-tree class for indexing 'name' field of links */ -const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ +const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ H5B2_GRP_DENSE_NAME_ID, /* Type of B-tree */ + "H5B2_GRP_DENSE_NAME_ID", /* Name of B-tree class */ sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */ H5G_dense_btree2_name_store, /* Record storage callback */ H5G_dense_btree2_name_compare, /* Record comparison callback */ @@ -117,6 +118,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ /* v2 B-tree class for indexing 'creation order' field of links */ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ H5B2_GRP_DENSE_CORDER_ID, /* Type of B-tree */ + "H5B2_GRP_DENSE_CORDER_ID", /* Name of B-tree class */ sizeof(H5G_dense_bt2_corder_rec_t), /* Size of native record */ H5G_dense_btree2_corder_store, /* Record storage callback */ H5G_dense_btree2_corder_compare, /* Record comparison callback */ diff --git a/src/H5Gdense.c b/src/H5Gdense.c index a7c6b9b..a9219e9 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -271,9 +271,9 @@ H5G_dense_create(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, const H5O_pline_t *pline) { H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */ + H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ H5HF_t *fheap; /* Fractal heap handle */ size_t fheap_id_len; /* Fractal heap ID length */ - size_t bt2_rrec_size; /* v2 B-tree raw record size */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_dense_create, FAIL) @@ -321,12 +321,13 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") /* Create the name index v2 B-tree */ - bt2_rrec_size = 4 + /* Name's hash value */ + bt2_cparam.cls = H5G_BT2_NAME; + bt2_cparam.node_size = (size_t)H5G_NAME_BT2_NODE_SIZE; + bt2_cparam.rrec_size = 4 + /* Name's hash value */ fheap_id_len; /* Fractal heap ID */ - if(H5B2_create(f, dxpl_id, H5G_BT2_NAME, - (size_t)H5G_NAME_BT2_NODE_SIZE, bt2_rrec_size, - H5G_NAME_BT2_SPLIT_PERC, H5G_NAME_BT2_MERGE_PERC, - &(linfo->name_bt2_addr)) < 0) + bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC; + bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC; + if(H5B2_create(f, dxpl_id, &bt2_cparam, &(linfo->name_bt2_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") #ifdef QAK HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr); @@ -335,12 +336,13 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr) /* Check if we should create a creation order index v2 B-tree */ if(linfo->index_corder) { /* Create the creation order index v2 B-tree */ - bt2_rrec_size = 8 + /* Creation order value */ + bt2_cparam.cls = H5G_BT2_CORDER; + bt2_cparam.node_size = (size_t)H5G_CORDER_BT2_NODE_SIZE; + bt2_cparam.rrec_size = 8 + /* Creation order value */ fheap_id_len; /* Fractal heap ID */ - if(H5B2_create(f, dxpl_id, H5G_BT2_CORDER, - (size_t)H5G_CORDER_BT2_NODE_SIZE, bt2_rrec_size, - H5G_CORDER_BT2_SPLIT_PERC, H5G_CORDER_BT2_MERGE_PERC, - &(linfo->corder_bt2_addr)) < 0) + bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC; + bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC; + if(H5B2_create(f, dxpl_id, &bt2_cparam, &(linfo->corder_bt2_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") #ifdef QAK HDfprintf(stderr, "%s: linfo->corder_bt2_addr = %a\n", FUNC, linfo->corder_bt2_addr); diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 5958c03..ae50bf3 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -102,6 +102,7 @@ static herr_t H5HF_huge_btree2_filt_dir_debug(FILE *stream, const H5F_t *f, hid_ /* v2 B-tree class for indirectly accessed 'huge' objects */ const H5B2_class_t H5HF_BT2_INDIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_INDIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */ H5HF_huge_btree2_indir_store, /* Record storage callback */ H5HF_huge_btree2_indir_compare, /* Record comparison callback */ @@ -111,8 +112,9 @@ const H5B2_class_t H5HF_BT2_INDIR[1]={{ /* B-tree class information */ }}; /* v2 B-tree class for indirectly accessed, filtered 'huge' objects */ -const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */ +const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_FILT_INDIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */ H5HF_huge_btree2_filt_indir_store, /* Record storage callback */ H5HF_huge_btree2_filt_indir_compare, /* Record comparison callback */ @@ -122,8 +124,9 @@ const H5B2_class_t H5HF_BT2_FILT_INDIR[1]={{ /* B-tree class information */ }}; /* v2 B-tree class for directly accessed 'huge' objects */ -const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */ +const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_DIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */ H5HF_huge_btree2_dir_store, /* Record storage callback */ H5HF_huge_btree2_dir_compare, /* Record comparison callback */ @@ -133,8 +136,9 @@ const H5B2_class_t H5HF_BT2_DIR[1]={{ /* B-tree class information */ }}; /* v2 B-tree class for directly accessed, filtered 'huge' objects */ -const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */ +const H5B2_class_t H5HF_BT2_FILT_DIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */ + "H5B2_FHEAP_HUGE_FILT_DIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_filt_dir_rec_t),/* Size of native record */ H5HF_huge_btree2_filt_dir_store, /* Record storage callback */ H5HF_huge_btree2_filt_dir_compare, /* Record comparison callback */ diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 792a865..71a3d61 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -105,8 +105,7 @@ static herr_t H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, static herr_t H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) { - const H5B2_class_t *bt2_class; /* v2 B-tree class to use */ - size_t rrec_size; /* Size of 'raw' records on disk */ + H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_bt2_create) @@ -125,38 +124,40 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) */ if(hdr->huge_ids_direct) { if(hdr->filter_len > 0) { - rrec_size = hdr->sizeof_addr /* Address of object */ + bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size /* Length of object */ + 4 /* Filter mask for filtered object */ + hdr->sizeof_size; /* Size of de-filtered object in memory */ - bt2_class = H5HF_BT2_FILT_DIR; + bt2_cparam.cls = H5HF_BT2_FILT_DIR; } /* end if */ else { - rrec_size = hdr->sizeof_addr /* Address of object */ + bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size; /* Length of object */ - bt2_class = H5HF_BT2_DIR; + bt2_cparam.cls = H5HF_BT2_DIR; } /* end else */ } /* end if */ else { - if (hdr->filter_len > 0) { - rrec_size = hdr->sizeof_addr /* Address of filtered object */ + if(hdr->filter_len > 0) { + bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of filtered object */ + hdr->sizeof_size /* Length of filtered object */ + 4 /* Filter mask for filtered object */ + hdr->sizeof_size /* Size of de-filtered object in memory */ + hdr->sizeof_size; /* Unique ID for object */ - bt2_class = H5HF_BT2_FILT_INDIR; + bt2_cparam.cls = H5HF_BT2_FILT_INDIR; } /* end if */ else { - rrec_size = hdr->sizeof_addr /* Address of object */ + bt2_cparam.rrec_size = hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size /* Length of object */ + hdr->sizeof_size; /* Unique ID for object */ - bt2_class = H5HF_BT2_INDIR; + bt2_cparam.cls = H5HF_BT2_INDIR; } /* end else */ } /* end else */ + bt2_cparam.node_size = (size_t)H5HF_HUGE_BT2_NODE_SIZE; + bt2_cparam.split_percent = H5HF_HUGE_BT2_SPLIT_PERC; + bt2_cparam.merge_percent = H5HF_HUGE_BT2_MERGE_PERC; /* Create v2 B-tree for tracking 'huge' objects */ - if(H5B2_create(hdr->f, dxpl_id, bt2_class, (size_t)H5HF_HUGE_BT2_NODE_SIZE, rrec_size, - H5HF_HUGE_BT2_SPLIT_PERC, H5HF_HUGE_BT2_MERGE_PERC, &hdr->huge_bt2_addr/*out*/) < 0) + if(H5B2_create(hdr->f, dxpl_id, &bt2_cparam, &hdr->huge_bt2_addr/*out*/) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") done: diff --git a/src/H5SM.c b/src/H5SM.c index cccddc6..56d00e3 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -463,11 +463,16 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id) } /* end if */ /* index is a B-tree */ else { + H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ + header->index_type = H5SM_BTREE; - if(H5B2_create(f, dxpl_id, H5SM_INDEX, (size_t)H5SM_B2_NODE_SIZE, - (size_t)H5SM_SOHM_ENTRY_SIZE(f), H5SM_B2_SPLIT_PERCENT, - H5SM_B2_MERGE_PERCENT, &tree_addr) < 0) + bt2_cparam.cls = H5SM_INDEX; + bt2_cparam.node_size = (size_t)H5SM_B2_NODE_SIZE; + bt2_cparam.rrec_size = (size_t)H5SM_SOHM_ENTRY_SIZE(f); + bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT; + bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT; + if(H5B2_create(f, dxpl_id, &bt2_cparam, &tree_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index") header->index_addr = tree_addr; @@ -683,6 +688,7 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, { H5SM_list_t *list; /* Pointer to the existing message list */ H5SM_mesg_key_t key; /* Key for inserting records in v2 B-tree */ + H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ haddr_t tree_addr; /* New v2 B-tree's address */ size_t num_messages; /* Number of messages being tracked */ size_t x; @@ -698,9 +704,12 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, list = *_list; /* Create the new v2 B-tree for tracking the messages */ - if(H5B2_create(f, dxpl_id, H5SM_INDEX, (size_t)H5SM_B2_NODE_SIZE, - (size_t)H5SM_SOHM_ENTRY_SIZE(f), H5SM_B2_SPLIT_PERCENT, - H5SM_B2_MERGE_PERCENT, &tree_addr) < 0) + bt2_cparam.cls = H5SM_INDEX; + bt2_cparam.node_size = (size_t)H5SM_B2_NODE_SIZE; + bt2_cparam.rrec_size = (size_t)H5SM_SOHM_ENTRY_SIZE(f); + bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT; + bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT; + if(H5B2_create(f, dxpl_id, &bt2_cparam, &tree_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index") /* Set up key values that all messages will use. Since these messages diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 3ddd3f2..5b54532 100755 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -63,6 +63,7 @@ static herr_t H5SM_btree_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* v2 B-tree class for SOHM indexes*/ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5B2_SOHM_INDEX_ID, /* Type of B-tree */ + "H5B2_SOHM_INDEX_ID", /* Name of B-tree class */ sizeof(H5SM_sohm_t), /* Size of native record */ H5SM_btree_store, /* Record storage callback */ H5SM_message_compare, /* Record comparison callback */ diff --git a/test/btree2.c b/test/btree2.c index e7dbfee..88f4f07 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -42,6 +42,9 @@ const char *FILENAME[] = { #define DELETE_MEDIUM 200 #define DELETE_LARGE 2000 +/* B-tree creation parameters */ +static const H5B2_create_t cparam_g = {H5B2_TEST, 512, 8, 100, 40}; + /*------------------------------------------------------------------------- * Function: iter_cb @@ -245,7 +248,7 @@ test_insert_basic(hid_t fapl) * Test v2 B-tree creation */ TESTING("B-tree creation"); - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR if(!H5F_addr_defined(bt2_addr)) FAIL_STACK_ERROR @@ -436,7 +439,7 @@ test_insert_split_root(hid_t fapl) /* * Test v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert records to fill root leaf node */ @@ -610,7 +613,7 @@ test_insert_level1_2leaf_redistrib(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 leaves */ @@ -663,7 +666,7 @@ test_insert_level1_2leaf_redistrib(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 leaves */ @@ -770,7 +773,7 @@ test_insert_level1_side_split(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 leaves */ @@ -828,7 +831,7 @@ test_insert_level1_side_split(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 leaves */ @@ -942,7 +945,7 @@ test_insert_level1_3leaf_redistrib(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 leaves */ @@ -1090,7 +1093,7 @@ test_insert_level1_middle_split(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 leaves */ @@ -1215,7 +1218,7 @@ test_insert_make_level2(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 internal nodes */ @@ -1398,7 +1401,7 @@ test_insert_level2_leaf_redistrib(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 internal nodes */ @@ -1663,7 +1666,7 @@ test_insert_level2_leaf_split(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 internal nodes */ @@ -1939,7 +1942,7 @@ test_insert_level2_2internal_redistrib(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 internal nodes */ @@ -2132,7 +2135,7 @@ test_insert_level2_2internal_split(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 2 internal nodes */ @@ -2335,7 +2338,7 @@ test_insert_level2_3internal_redistrib(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 3 internal nodes */ @@ -2537,7 +2540,7 @@ test_insert_level2_3internal_split(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert enough records to force root to split into 3 internal nodes */ @@ -2771,7 +2774,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert random records */ @@ -2944,9 +2947,9 @@ test_remove_basic(hid_t fapl) TESTING("B-tree remove: record from empty B-tree"); /* - * Test v2 B-tree creation + * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Query the number of records in the B-tree */ @@ -3231,9 +3234,9 @@ test_remove_level1_noredistrib(hid_t fapl) TESTING("B-tree remove: non-existant record from level-1 B-tree"); /* - * Test v2 B-tree creation + * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -3453,9 +3456,9 @@ test_remove_level1_redistrib(hid_t fapl) TESTING("B-tree remove: redistribute 2 leaves in level-1 B-tree (r->l)"); /* - * Test v2 B-tree creation + * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -3653,9 +3656,9 @@ test_remove_level1_2leaf_merge(hid_t fapl) TESTING("B-tree remove: merge 2 leaves to 1 in level-1 B-tree (r->l)"); /* - * Test v2 B-tree creation + * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -3839,7 +3842,7 @@ test_remove_level1_3leaf_merge(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -3967,7 +3970,7 @@ test_remove_level1_promote(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 5 leaves */ @@ -4211,7 +4214,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -4364,7 +4367,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -4517,7 +4520,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 3 leaves */ @@ -4665,7 +4668,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 leaves */ @@ -4812,7 +4815,7 @@ test_remove_level1_collapse(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-1 B-tree with 2 leaves */ @@ -4952,7 +4955,7 @@ test_remove_level2_promote(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -5243,7 +5246,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -5396,7 +5399,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -5549,7 +5552,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -5705,7 +5708,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -5861,7 +5864,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -5989,7 +5992,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -6117,7 +6120,7 @@ test_remove_level2_3internal_merge(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -6246,7 +6249,7 @@ test_remove_level2_collapse_right(hid_t fapl) /* * v2 B-tree creation */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ @@ -6362,7 +6365,7 @@ gen_l4_btree2(const char *filename, hid_t fapl, haddr_t *bt2_addr, /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert random records */ @@ -6844,7 +6847,7 @@ test_find_neighbor(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert records */ @@ -7068,7 +7071,7 @@ test_delete(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* @@ -7105,7 +7108,7 @@ test_delete(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert records */ @@ -7155,7 +7158,7 @@ test_delete(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert records */ @@ -7205,7 +7208,7 @@ test_delete(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Insert records */ @@ -7299,7 +7302,7 @@ test_modify(hid_t fapl) /* * Create v2 B-tree */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, (size_t)512, (size_t)8, 100, 40, &bt2_addr/*out*/) < 0) + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &cparam_g, &bt2_addr/*out*/) < 0) FAIL_STACK_ERROR /* Create level-2 B-tree with 3 internal nodes */ -- cgit v0.12