diff options
Diffstat (limited to 'src/H5B2cache.c')
-rw-r--r-- | src/H5B2cache.c | 258 |
1 files changed, 129 insertions, 129 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 933831e..1201ce5 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -69,15 +69,15 @@ /********************/ /* Metadata cache callbacks */ -static H5B2_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); -static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_t *b, unsigned UNUSED * flags_ptr); -static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *b, hbool_t destroy); -static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t *bt, size_t *size_ptr); +static H5B2_hdr_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); +static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_hdr_t *hdr, unsigned UNUSED * flags_ptr); +static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_hdr_t *hdr, hbool_t destroy); +static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_hdr_t *hdr, size_t *size_ptr); static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *udata2); static herr_t H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_internal_t *i, unsigned UNUSED * flags_ptr); static herr_t H5B2_cache_internal_clear(H5F_t *f, H5B2_internal_t *i, hbool_t destroy); static herr_t H5B2_cache_internal_size(const H5F_t *f, const H5B2_internal_t *i, size_t *size_ptr); -static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bt2); +static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_hdr); static herr_t H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_leaf_t *l, unsigned UNUSED * flags_ptr); static herr_t H5B2_cache_leaf_clear(H5F_t *f, H5B2_leaf_t *l, hbool_t destroy); static herr_t H5B2_cache_leaf_size(const H5F_t *f, const H5B2_leaf_t *l, size_t *size_ptr); @@ -146,22 +146,22 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ * *------------------------------------------------------------------------- */ -static H5B2_t * +static H5B2_hdr_t * H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, 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 */ - H5B2_t *bt2 = NULL; /* B-tree info */ + H5B2_hdr_t *hdr = NULL; /* B-tree header */ size_t size; /* Header size */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ H5WB_t *wb = NULL; /* Wrapped buffer for header data */ uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */ - uint8_t *hdr; /* Pointer to header buffer */ + uint8_t *buf; /* Pointer to header buffer */ uint8_t *p; /* Pointer into raw data buffer */ - H5B2_t *ret_value; /* Return value */ + H5B2_hdr_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5B2_cache_hdr_load, NULL) @@ -171,9 +171,9 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo HDassert(type); /* Allocate new B-tree header and reset cache info */ - if(NULL == (bt2 = H5FL_MALLOC(H5B2_t))) + if(NULL == (hdr = H5FL_MALLOC(H5B2_hdr_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemset(&bt2->cache_info, 0, sizeof(H5AC_info_t)); + HDmemset(&hdr->cache_info, 0, sizeof(H5AC_info_t)); /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) @@ -183,15 +183,15 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo size = H5B2_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "can't get actual buffer") /* Read header from disk */ - if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, hdr) < 0) + if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header") /* Get temporary pointer to serialized header */ - p = hdr; + p = buf; /* Magic number */ if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) @@ -220,39 +220,39 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo merge_percent = *p++; /* Root node pointer */ - H5F_addr_decode(f, (const uint8_t **)&p, &(bt2->root.addr)); - UINT16DECODE(p, bt2->root.node_nrec); - H5F_DECODE_LENGTH(f, p, bt2->root.all_nrec); + H5F_addr_decode(f, (const uint8_t **)&p, &(hdr->root.addr)); + UINT16DECODE(p, hdr->root.node_nrec); + H5F_DECODE_LENGTH(f, p, hdr->root.all_nrec); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - hdr) == size); + HDassert((size_t)(p - buf) == size); /* Compute checksum on entire header */ - computed_chksum = H5_checksum_metadata(hdr, (size - H5B2_SIZEOF_CHKSUM), 0); + computed_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0); /* Verify checksum */ if(stored_chksum != computed_chksum) 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, bt2, type, depth, node_size, rrec_size, split_percent, merge_percent) < 0) + if(H5B2_hdr_init(f, hdr, type, depth, node_size, rrec_size, split_percent, merge_percent) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") /* Set the B-tree header's address */ - bt2->addr = addr; + hdr->addr = addr; /* Set return value */ - ret_value = bt2; + ret_value = hdr; done: /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_BTREE, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") - if(!ret_value && bt2) - (void)H5B2_cache_hdr_dest(f, bt2); + if(!ret_value && hdr) + (void)H5B2_cache_hdr_dest(f, hdr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -273,7 +273,7 @@ done: */ static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, - H5B2_t *bt2, unsigned UNUSED * flags_ptr) + H5B2_hdr_t *hdr, unsigned UNUSED * flags_ptr) { H5WB_t *wb = NULL; /* Wrapped buffer for header data */ uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */ @@ -284,16 +284,16 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(bt2); + HDassert(hdr); - if(bt2->cache_info.is_dirty) { - uint8_t *hdr; /* Pointer to header buffer */ + if(hdr->cache_info.is_dirty) { + uint8_t *buf; /* Pointer to header buffer */ uint8_t *p; /* Pointer into raw data buffer */ size_t size; /* Header size on disk */ uint32_t metadata_chksum; /* Computed metadata checksum value */ /* Set the B-tree header's file context for this operation */ - bt2->f = f; + hdr->f = f; /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) @@ -303,11 +303,11 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, size = H5B2_HEADER_SIZE(f); /* Get a pointer to a buffer that's large enough for header */ - if(NULL == (hdr = (uint8_t *)H5WB_actual(wb, size))) + if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Get temporary pointer to serialized header */ - p = hdr; + p = buf; /* Magic number */ HDmemcpy(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -317,44 +317,44 @@ 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++ = bt2->type->id; + *p++ = hdr->type->id; /* Node size (in bytes) */ - UINT32ENCODE(p, bt2->node_size); + UINT32ENCODE(p, hdr->node_size); /* Raw key size (in bytes) */ - UINT16ENCODE(p, bt2->rrec_size); + UINT16ENCODE(p, hdr->rrec_size); /* Depth of tree */ - UINT16ENCODE(p, bt2->depth); + UINT16ENCODE(p, hdr->depth); /* Split & merge %s */ - H5_CHECK_OVERFLOW(bt2->split_percent, /* From: */ unsigned, /* To: */ uint8_t); - *p++ = (uint8_t)bt2->split_percent; - H5_CHECK_OVERFLOW(bt2->merge_percent, /* From: */ unsigned, /* To: */ uint8_t); - *p++ = (uint8_t)bt2->merge_percent; + H5_CHECK_OVERFLOW(hdr->split_percent, /* From: */ unsigned, /* To: */ uint8_t); + *p++ = (uint8_t)hdr->split_percent; + H5_CHECK_OVERFLOW(hdr->merge_percent, /* From: */ unsigned, /* To: */ uint8_t); + *p++ = (uint8_t)hdr->merge_percent; /* Root node pointer */ - H5F_addr_encode(f, &p, bt2->root.addr); - UINT16ENCODE(p, bt2->root.node_nrec); - H5F_ENCODE_LENGTH(f, p, bt2->root.all_nrec); + H5F_addr_encode(f, &p, hdr->root.addr); + UINT16ENCODE(p, hdr->root.node_nrec); + H5F_ENCODE_LENGTH(f, p, hdr->root.all_nrec); /* Compute metadata checksum */ - metadata_chksum = H5_checksum_metadata(hdr, (size - H5B2_SIZEOF_CHKSUM), 0); + metadata_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); /* Write the B-tree header. */ - HDassert((size_t)(p - hdr) == size); - if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, hdr) < 0) + HDassert((size_t)(p - buf) == size); + if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree header to disk") - bt2->cache_info.is_dirty = FALSE; + hdr->cache_info.is_dirty = FALSE; } /* end if */ if(destroy) - if(H5B2_cache_hdr_dest(f, bt2) < 0) + if(H5B2_cache_hdr_dest(f, hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header") done: @@ -380,7 +380,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *bt2) +H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -389,26 +389,26 @@ H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *bt2) /* * Check arguments. */ - HDassert(bt2); - HDassert(bt2->rc == 0); + HDassert(hdr); + HDassert(hdr->rc == 0); /* If we're going to free the space on disk, the address must be valid */ - HDassert(!bt2->cache_info.free_file_space_on_destroy || H5F_addr_defined(bt2->cache_info.addr)); + HDassert(!hdr->cache_info.free_file_space_on_destroy || H5F_addr_defined(hdr->cache_info.addr)); /* Check for freeing file space for B-tree header */ - if(bt2->cache_info.free_file_space_on_destroy) { + if(hdr->cache_info.free_file_space_on_destroy) { /* Release the space on disk */ /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, bt2->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(f)) < 0) + if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(f)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header") } /* end if */ /* Release B-tree header info */ - if(H5B2_hdr_free(bt2) < 0) + if(H5B2_hdr_free(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header info") /* Free B-tree header info */ - (void)H5FL_FREE(H5B2_t, bt2); + (void)H5FL_FREE(H5B2_hdr_t, hdr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -429,7 +429,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *bt2, hbool_t destroy) +H5B2_cache_hdr_clear(H5F_t *f, H5B2_hdr_t *hdr, hbool_t destroy) { herr_t ret_value = SUCCEED; /* Return value */ @@ -438,13 +438,13 @@ H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *bt2, hbool_t destroy) /* * Check arguments. */ - HDassert(bt2); + HDassert(hdr); /* Reset the dirty flag. */ - bt2->cache_info.is_dirty = FALSE; + hdr->cache_info.is_dirty = FALSE; if(destroy) - if(H5B2_cache_hdr_dest(f, bt2) < 0) + if(H5B2_cache_hdr_dest(f, hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header") done: @@ -468,7 +468,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr) +H5B2_cache_hdr_size(const H5F_t *f, const H5B2_hdr_t UNUSED *hdr, size_t *size_ptr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_hdr_size) @@ -523,20 +523,20 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda HDmemset(&internal->cache_info, 0, sizeof(H5AC_info_t)); /* Set the B-tree header's file context for this operation */ - udata->bt2->f = f; + udata->hdr->f = f; /* Increment ref. count on B-tree header */ - if(H5B2_hdr_incr(udata->bt2) < 0) + if(H5B2_hdr_incr(udata->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header") /* Share B-tree information */ - internal->bt2 = udata->bt2; + internal->hdr = udata->hdr; /* Read header from disk */ - if(H5F_block_read(f, H5FD_MEM_BTREE, addr, udata->bt2->node_size, dxpl_id, udata->bt2->page) < 0) + if(H5F_block_read(f, H5FD_MEM_BTREE, addr, udata->hdr->node_size, dxpl_id, udata->hdr->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree internal node") - p = udata->bt2->page; + p = udata->hdr->page; /* Magic number */ if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) @@ -548,15 +548,15 @@ 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->bt2->type->id) + if(*p++ != (uint8_t)udata->hdr->type->id) HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") /* Allocate space for the native keys in memory */ - if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(udata->bt2->node_info[udata->depth].nat_rec_fac))) + if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal native keys") /* Allocate space for the node pointers in memory */ - if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(udata->bt2->node_info[udata->depth].node_ptr_fac))) + if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal node pointers") /* Set the number of records in the leaf & it's depth */ @@ -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->bt2->type->decode)(f, p, native) < 0) + if((udata->hdr->type->decode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record") /* Move to next record */ - p += udata->bt2->rrec_size; - native += udata->bt2->type->nrec_size; + p += udata->hdr->rrec_size; + native += udata->hdr->type->nrec_size; } /* end for */ /* Deserialize node pointers for internal node */ @@ -580,9 +580,9 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda for(u = 0; u < internal->nrec + 1; u++) { /* Decode node pointer */ H5F_addr_decode(f, (const uint8_t **)&p, &(int_node_ptr->addr)); - UINT64DECODE_VAR(p, int_node_ptr->node_nrec, udata->bt2->max_nrec_size); + UINT64DECODE_VAR(p, int_node_ptr->node_nrec, udata->hdr->max_nrec_size); if(udata->depth > 1) - UINT64DECODE_VAR(p, int_node_ptr->all_nrec, udata->bt2->node_info[udata->depth - 1].cum_max_nrec_size) + UINT64DECODE_VAR(p, int_node_ptr->all_nrec, udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size) else int_node_ptr->all_nrec = int_node_ptr->node_nrec; @@ -591,13 +591,13 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda } /* end for */ /* Compute checksum on internal node */ - computed_chksum = H5_checksum_metadata(udata->bt2->page, (size_t)(p - udata->bt2->page), 0); + computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - udata->hdr->page), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(p - udata->bt2->page) <= udata->bt2->node_size); + HDassert((size_t)(p - udata->hdr->page) <= udata->hdr->node_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -637,7 +637,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(internal); - HDassert(internal->bt2); + HDassert(internal->hdr); if(internal->cache_info.is_dirty) { uint8_t *p; /* Pointer into raw data buffer */ @@ -647,9 +647,9 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr unsigned u; /* Local index variable */ /* Set the B-tree header's file context for this operation */ - internal->bt2->f = f; + internal->hdr->f = f; - p = internal->bt2->page; + p = internal->hdr->page; /* Magic number */ HDmemcpy(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -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->bt2->type->id; - HDassert((size_t)(p - internal->bt2->page) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); + *p++ = internal->hdr->type->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->bt2->type->encode)(f, p, native) < 0) + if((internal->hdr->type->encode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") /* Move to next record */ - p += internal->bt2->rrec_size; - native += internal->bt2->type->nrec_size; + p += internal->hdr->rrec_size; + native += internal->hdr->type->nrec_size; } /* end for */ /* Serialize node pointers for internal node */ @@ -679,23 +679,23 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr for(u = 0; u < internal->nrec + 1; u++) { /* Encode node pointer */ H5F_addr_encode(f, &p, int_node_ptr->addr); - UINT64ENCODE_VAR(p, int_node_ptr->node_nrec, internal->bt2->max_nrec_size); + UINT64ENCODE_VAR(p, int_node_ptr->node_nrec, internal->hdr->max_nrec_size); if(internal->depth > 1) - UINT64ENCODE_VAR(p, int_node_ptr->all_nrec, internal->bt2->node_info[internal->depth - 1].cum_max_nrec_size); + UINT64ENCODE_VAR(p, int_node_ptr->all_nrec, internal->hdr->node_info[internal->depth - 1].cum_max_nrec_size); /* Move to next node pointer */ int_node_ptr++; } /* end for */ /* Compute metadata checksum */ - metadata_chksum = H5_checksum_metadata(internal->bt2->page, (size_t)(p - internal->bt2->page), 0); + metadata_chksum = H5_checksum_metadata(internal->hdr->page, (size_t)(p - internal->hdr->page), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); /* Write the B-tree internal node */ - HDassert((size_t)(p - internal->bt2->page) <= internal->bt2->node_size); - if(H5F_block_write(f, H5FD_MEM_BTREE, addr, internal->bt2->node_size, dxpl_id, internal->bt2->page) < 0) + HDassert((size_t)(p - internal->hdr->page) <= internal->hdr->node_size); + if(H5F_block_write(f, H5FD_MEM_BTREE, addr, internal->hdr->node_size, dxpl_id, internal->hdr->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree internal node to disk") internal->cache_info.is_dirty = FALSE; @@ -734,7 +734,7 @@ H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal) * Check arguments. */ HDassert(internal); - HDassert(internal->bt2); + HDassert(internal->hdr); /* If we're going to free the space on disk, the address must be valid */ HDassert(!internal->cache_info.free_file_space_on_destroy || H5F_addr_defined(internal->cache_info.addr)); @@ -743,23 +743,23 @@ H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal) if(internal->cache_info.free_file_space_on_destroy) { /* Release the space on disk */ /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, internal->cache_info.addr, (hsize_t)internal->bt2->node_size) < 0) + if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, internal->cache_info.addr, (hsize_t)internal->hdr->node_size) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree internal node") } /* end if */ /* Set the B-tree header's file context for this operation */ - internal->bt2->f = f; + internal->hdr->f = f; /* Release internal node's native key buffer */ if(internal->int_native) - H5FL_FAC_FREE(internal->bt2->node_info[internal->depth].nat_rec_fac, internal->int_native); + H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].nat_rec_fac, internal->int_native); /* Release internal node's node pointer buffer */ if(internal->node_ptrs) - H5FL_FAC_FREE(internal->bt2->node_info[internal->depth].node_ptr_fac, internal->node_ptrs); + H5FL_FAC_FREE(internal->hdr->node_info[internal->depth].node_ptr_fac, internal->node_ptrs); /* Decrement ref. count on B-tree header */ - if(H5B2_hdr_decr(internal->bt2) < 0) + if(H5B2_hdr_decr(internal->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header") /* Free B-tree internal node info */ @@ -829,11 +829,11 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal, /* check arguments */ HDassert(internal); - HDassert(internal->bt2); + HDassert(internal->hdr); HDassert(size_ptr); /* Set size value */ - *size_ptr = internal->bt2->node_size; + *size_ptr = internal->hdr->node_size; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2_cache_internal_size() */ @@ -854,10 +854,10 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal, *------------------------------------------------------------------------- */ static H5B2_leaf_t * -H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bt2) +H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_hdr) { const unsigned *nrec = (const unsigned *)_nrec; - H5B2_t *bt2 = (H5B2_t *)_bt2; /* B-tree header information */ + H5B2_hdr_t *hdr = (H5B2_hdr_t *)_hdr; /* B-tree header information */ H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */ uint8_t *p; /* Pointer into raw data buffer */ uint8_t *native; /* Pointer to native keys */ @@ -871,7 +871,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(bt2); + HDassert(hdr); /* Allocate new leaf node and reset cache info */ if(NULL == (leaf = H5FL_MALLOC(H5B2_leaf_t))) @@ -879,20 +879,20 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v HDmemset(&leaf->cache_info, 0, sizeof(H5AC_info_t)); /* Set the B-tree header's file context for this operation */ - bt2->f = f; + hdr->f = f; /* Increment ref. count on B-tree header */ - if(H5B2_hdr_incr(bt2) < 0) + if(H5B2_hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ - leaf->bt2 = bt2; + leaf->hdr = hdr; /* Read header from disk */ - if(H5F_block_read(f, H5FD_MEM_BTREE, addr, bt2->node_size, dxpl_id, bt2->page) < 0) + if(H5F_block_read(f, H5FD_MEM_BTREE, addr, hdr->node_size, dxpl_id, hdr->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree leaf node") - p = bt2->page; + p = hdr->page; /* Magic number */ if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) @@ -904,11 +904,11 @@ 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)bt2->type->id) + if(*p++ != (uint8_t)hdr->type->id) HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") /* Allocate space for the native keys in memory */ - if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(bt2->node_info[0].nat_rec_fac))) + if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys") /* Set the number of records in the leaf */ @@ -918,22 +918,22 @@ 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((bt2->type->decode)(f, p, native) < 0) + if((hdr->type->decode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record") /* Move to next record */ - p += bt2->rrec_size; - native += bt2->type->nrec_size; + p += hdr->rrec_size; + native += hdr->type->nrec_size; } /* end for */ /* Compute checksum on internal node */ - computed_chksum = H5_checksum_metadata(bt2->page, (size_t)(p - bt2->page), 0); + computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - hdr->page), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(p - bt2->page) <= bt2->node_size); + HDassert((size_t)(p - hdr->page) <= hdr->node_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -973,7 +973,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5 HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(leaf); - HDassert(leaf->bt2); + HDassert(leaf->hdr); if(leaf->cache_info.is_dirty) { uint8_t *p; /* Pointer into raw data buffer */ @@ -982,9 +982,9 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5 unsigned u; /* Local index variable */ /* Set the B-tree header's file context for this operation */ - leaf->bt2->f = f; + leaf->hdr->f = f; - p = leaf->bt2->page; + p = leaf->hdr->page; /* magic number */ HDmemcpy(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -994,30 +994,30 @@ 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->bt2->type->id; - HDassert((size_t)(p - leaf->bt2->page) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); + *p++ = leaf->hdr->type->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->bt2->type->encode)(f, p, native) < 0) + if((leaf->hdr->type->encode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") /* Move to next record */ - p += leaf->bt2->rrec_size; - native += leaf->bt2->type->nrec_size; + p += leaf->hdr->rrec_size; + native += leaf->hdr->type->nrec_size; } /* end for */ /* Compute metadata checksum */ - metadata_chksum = H5_checksum_metadata(leaf->bt2->page, (size_t)(p - leaf->bt2->page), 0); + metadata_chksum = H5_checksum_metadata(leaf->hdr->page, (size_t)(p - leaf->hdr->page), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); /* Write the B-tree leaf node */ - HDassert((size_t)(p - leaf->bt2->page) <= leaf->bt2->node_size); - if(H5F_block_write(f, H5FD_MEM_BTREE, addr, leaf->bt2->node_size, dxpl_id, leaf->bt2->page) < 0) + HDassert((size_t)(p - leaf->hdr->page) <= leaf->hdr->node_size); + if(H5F_block_write(f, H5FD_MEM_BTREE, addr, leaf->hdr->node_size, dxpl_id, leaf->hdr->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree leaf node to disk") leaf->cache_info.is_dirty = FALSE; @@ -1056,7 +1056,7 @@ H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf) * Check arguments. */ HDassert(leaf); - HDassert(leaf->bt2); + HDassert(leaf->hdr); /* If we're going to free the space on disk, the address must be valid */ HDassert(!leaf->cache_info.free_file_space_on_destroy || H5F_addr_defined(leaf->cache_info.addr)); @@ -1065,19 +1065,19 @@ H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf) if(leaf->cache_info.free_file_space_on_destroy) { /* Release the space on disk */ /* (XXX: Nasty usage of internal DXPL value! -QAK) */ - if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, leaf->cache_info.addr, (hsize_t)leaf->bt2->node_size) < 0) + if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, leaf->cache_info.addr, (hsize_t)leaf->hdr->node_size) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree leaf node") } /* end if */ /* Set the B-tree header's file context for this operation */ - leaf->bt2->f = f; + leaf->hdr->f = f; /* Release leaf's native key buffer */ if(leaf->leaf_native) - H5FL_FAC_FREE(leaf->bt2->node_info[0].nat_rec_fac, leaf->leaf_native); + H5FL_FAC_FREE(leaf->hdr->node_info[0].nat_rec_fac, leaf->leaf_native); /* Decrement ref. count on B-tree header */ - if(H5B2_hdr_decr(leaf->bt2) < 0) + if(H5B2_hdr_decr(leaf->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header") /* Free B-tree leaf node info */ @@ -1147,11 +1147,11 @@ H5B2_cache_leaf_size(const H5F_t UNUSED *f, const H5B2_leaf_t *leaf, size_t *siz /* check arguments */ HDassert(leaf); - HDassert(leaf->bt2); + HDassert(leaf->hdr); HDassert(size_ptr); /* Set size value */ - *size_ptr = leaf->bt2->node_size; + *size_ptr = leaf->hdr->node_size; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2_cache_leaf_size() */ |