From 7e231953a25fd4cc82f5b14b48b2c928cb3748e7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 13 May 2015 16:30:24 -0500 Subject: [svn-r27058] Description: Convert internal chunk structures to use 'scaled' coordinates instead of absolute coordinates. Tested on: Mac OSX/64 10.10.3 (amazon) w/parallel & serial Linux 2.6.x/32 (jam) w/parallel & serial Linux 2.6.x/64 (koala) w/serial --- src/H5Bprivate.h | 1 + src/H5Dbtree.c | 222 +++++++++++++++++++++++++---------- src/H5Dchunk.c | 326 ++++++++++++++++++++++++++++++--------------------- src/H5Ddeprec.c | 50 +++++++- src/H5Dint.c | 42 ++++++- src/H5Dmpio.c | 8 +- src/H5Dpkg.h | 22 ++-- src/H5Dprivate.h | 2 +- src/H5Fprivate.h | 1 - src/H5VM.c | 97 ++++++--------- src/H5VMprivate.h | 6 +- tools/misc/h5debug.c | 39 +++++- 12 files changed, 528 insertions(+), 288 deletions(-) diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 9e95c15..02fb82c 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -100,6 +100,7 @@ typedef struct H5B_shared_t { size_t sizeof_len; /* Size of file lengths (in bytes) */ uint8_t *page; /* Disk page */ size_t *nkey; /* Offsets of each native key in native key buffer */ + void *udata; /* 'Local' info for a B-tree */ } H5B_shared_t; /* diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 4f6b988..2933e5e 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -49,11 +49,6 @@ /* Local Macros */ /****************/ -/* - * Given a B-tree node return the dimensionality of the chunks pointed to by - * that node. - */ -#define H5D_BTREE_NDIMS(X) (((X)->sizeof_rkey-8)/8) /******************/ /* Local Typedefs */ @@ -74,7 +69,7 @@ * The chunk's file address is part of the B-tree and not part of the key. */ typedef struct H5D_btree_key_t { - hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ uint32_t nbytes; /*size of stored data */ unsigned filter_mask; /*excluded filters */ } H5D_btree_key_t; @@ -97,8 +92,9 @@ typedef struct H5D_btree_dbg_t { /* Local Prototypes */ /********************/ +static herr_t H5D__btree_shared_free(void *_shared); static herr_t H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, - unsigned ndims); + const H5O_layout_chunk_t *layout); /* B-tree iterator callbacks */ static int H5D__btree_idx_iterate_cb(H5F_t *f, hid_t dxpl_id, const void *left_key, @@ -203,6 +199,10 @@ H5B_class_t H5B_BTREE[1] = {{ /* Local Variables */ /*******************/ +/* Declare a free list to manage H5O_layout_chunk_t objects */ +H5FL_DEFINE_STATIC(H5O_layout_chunk_t); + + /*------------------------------------------------------------------------- * Function: H5D__btree_get_shared @@ -287,7 +287,7 @@ H5D__btree_new_node(H5F_t *f, hid_t UNUSED dxpl_id, H5B_ins_t op, H5_CHECKED_ASSIGN(lt_key->nbytes, uint32_t, udata->chunk_block.length, hsize_t); lt_key->filter_mask = udata->filter_mask; for(u = 0; u < udata->common.layout->ndims; u++) - lt_key->offset[u] = udata->common.offset[u]; + lt_key->scaled[u] = udata->common.scaled[u]; /* * The right key might already be present. If not, then add a zero-width @@ -297,9 +297,8 @@ H5D__btree_new_node(H5F_t *f, hid_t UNUSED dxpl_id, H5B_ins_t op, rt_key->nbytes = 0; rt_key->filter_mask = 0; for(u = 0; u < udata->common.layout->ndims; u++) { - HDassert(udata->common.offset[u] + udata->common.layout->dim[u] > - udata->common.offset[u]); - rt_key->offset[u] = udata->common.offset[u] + udata->common.layout->dim[u]; + HDassert(udata->common.scaled[u] + 1 > udata->common.scaled[u]); + rt_key->scaled[u] = udata->common.scaled[u] + 1; } /* end if */ } /* end if */ @@ -342,7 +341,7 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key) HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ - ret_value = H5VM_vector_cmp_u(udata->layout->ndims, lt_key->offset, rt_key->offset); + ret_value = H5VM_vector_cmp_u(udata->layout->ndims, lt_key->scaled, rt_key->scaled); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_cmp2() */ @@ -397,18 +396,18 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key) /* indexed storage B-tree... */ /* (Dump the B-tree with h5debug to look at it) -QAK */ if(udata->layout->ndims == 2) { - if(udata->offset[0] > rt_key->offset[0]) + if(udata->scaled[0] > rt_key->scaled[0]) ret_value = 1; - else if(udata->offset[0] == rt_key->offset[0] && - udata->offset[1] >= rt_key->offset[1]) + else if(udata->scaled[0] == rt_key->scaled[0] && + udata->scaled[1] >= rt_key->scaled[1]) ret_value = 1; - else if(udata->offset[0] < lt_key->offset[0]) + else if(udata->scaled[0] < lt_key->scaled[0]) ret_value = (-1); } /* end if */ else { - if(H5VM_vector_ge_u(udata->layout->ndims, udata->offset, rt_key->offset)) + if(H5VM_vector_ge_u(udata->layout->ndims, udata->scaled, rt_key->scaled)) ret_value = 1; - else if(H5VM_vector_lt_u(udata->layout->ndims, udata->offset, lt_key->offset)) + else if(H5VM_vector_lt_u(udata->layout->ndims, udata->scaled, lt_key->scaled)) ret_value = (-1); } /* end else */ @@ -460,7 +459,7 @@ H5D__btree_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void /* Is this *really* the requested chunk? */ for(u = 0; u < udata->common.layout->ndims; u++) - if(udata->common.offset[u] >= lt_key->offset[u] + udata->common.layout->dim[u]) + if(udata->common.scaled[u] >= (lt_key->scaled[u] + 1)) HGOTO_DONE(FALSE) /* Initialize return values */ @@ -475,6 +474,44 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_disjoint + * + * Purpose: Determines if two chunks are disjoint. + * + * Return: Success: FALSE if they are not disjoint. + * TRUE if they are disjoint. + * + * Programmer: Quincey Koziol + * Wednesday, May 6, 2015 + * + * Note: Assumes that the chunk offsets are scaled coordinates + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D__chunk_disjoint(unsigned n, const hsize_t *scaled1, const hsize_t *scaled2) +{ + unsigned u; /* Local index variable */ + hbool_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(n); + HDassert(scaled1); + HDassert(scaled2); + + /* Loop over two chunks, detecting disjointness and getting out quickly */ + for(u = 0; u < n; u++) + if((scaled1[u] + 1) <= scaled2[u] || (scaled2[u] + 1) <= scaled1[u]) + HGOTO_DONE(TRUE) + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__chunk_disjoint() */ + + +/*------------------------------------------------------------------------- * Function: H5D__btree_insert * * Purpose: This function is called when the B-tree insert engine finds @@ -538,8 +575,7 @@ H5D__btree_insert(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t addr, void *_lt_key, HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") } else if(H5VM_vector_eq_u(udata->common.layout->ndims, - udata->common.offset, lt_key->offset) && - lt_key->nbytes > 0) { + udata->common.scaled, lt_key->scaled) && lt_key->nbytes > 0) { /* * Already exists. If the new size is not the same as the old size * then we should reallocate storage. @@ -558,22 +594,18 @@ H5D__btree_insert(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t addr, void *_lt_key, ret_value = H5B_INS_NOOP; } - } else if (H5VM_hyper_disjointp(udata->common.layout->ndims, - lt_key->offset, udata->common.layout->dim, - udata->common.offset, udata->common.layout->dim)) { - HDassert(H5VM_hyper_disjointp(udata->common.layout->ndims, - rt_key->offset, udata->common.layout->dim, - udata->common.offset, udata->common.layout->dim)); + } else if (H5D__chunk_disjoint(udata->common.layout->ndims, + lt_key->scaled, udata->common.scaled)) { + HDassert(H5D__chunk_disjoint(udata->common.layout->ndims, + rt_key->scaled, udata->common.scaled)); /* * Split this node, inserting the new new node to the right of the * current node. The MD_KEY is where the split occurs. */ H5_CHECKED_ASSIGN(md_key->nbytes, uint32_t, udata->chunk_block.length, hsize_t); md_key->filter_mask = udata->filter_mask; - for(u = 0; u < udata->common.layout->ndims; u++) { - HDassert(0 == udata->common.offset[u] % udata->common.layout->dim[u]); - md_key->offset[u] = udata->common.offset[u]; - } /* end for */ + for(u = 0; u < udata->common.layout->ndims; u++) + md_key->scaled[u] = udata->common.scaled[u]; HDassert(H5F_addr_defined(udata->chunk_block.offset)); *new_node_p = udata->chunk_block.offset; @@ -643,9 +675,10 @@ done: static herr_t H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) { - H5D_btree_key_t *key = (H5D_btree_key_t *) _key; - size_t ndims; - unsigned u; + const H5O_layout_chunk_t *layout; /* Chunk layout description */ + H5D_btree_key_t *key = (H5D_btree_key_t *) _key; /* Pointer to decoded key */ + hsize_t tmp_offset; /* Temporary coordinate offset, from file */ + unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -653,14 +686,21 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key HDassert(shared); HDassert(raw); HDassert(key); - ndims = H5D_BTREE_NDIMS(shared); - HDassert(ndims <= H5O_LAYOUT_NDIMS); + layout = (const H5O_layout_chunk_t *)shared->udata; + HDassert(layout); + HDassert(layout->ndims > 0 && layout->ndims <= H5O_LAYOUT_NDIMS); /* decode */ UINT32DECODE(raw, key->nbytes); UINT32DECODE(raw, key->filter_mask); - for(u = 0; u < ndims; u++) - UINT64DECODE(raw, key->offset[u]); + for(u = 0; u < layout->ndims; u++) { + /* Retrieve coordinate offset */ + UINT64DECODE(raw, tmp_offset); + HDassert(0 == (tmp_offset % layout->dim[u])); + + /* Convert to a scaled offset */ + key->scaled[u] = tmp_offset / layout->dim[u]; + } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_decode_key() */ @@ -681,9 +721,10 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key static herr_t H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) { + const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key; - size_t ndims; - unsigned u; + hsize_t tmp_offset; /* Temporary coordinate offset, from file */ + unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -691,14 +732,18 @@ H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key HDassert(shared); HDassert(raw); HDassert(key); - ndims = H5D_BTREE_NDIMS(shared); - HDassert(ndims <= H5O_LAYOUT_NDIMS); + layout = (const H5O_layout_chunk_t *)shared->udata; + HDassert(layout); + HDassert(layout->ndims > 0 && layout->ndims <= H5O_LAYOUT_NDIMS); /* encode */ UINT32ENCODE(raw, key->nbytes); UINT32ENCODE(raw, key->filter_mask); - for(u = 0; u < ndims; u++) - UINT64ENCODE(raw, key->offset[u]); + for(u = 0; u < layout->ndims; u++) { + /* Compute coordinate offset from scaled offset */ + tmp_offset = key->scaled[u] * layout->dim[u]; + UINT64ENCODE(raw, tmp_offset); + } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_encode_key() */ @@ -733,7 +778,7 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for(u = 0; u < udata->ndims; u++) - HDfprintf(stream, "%s%Hd", u?", ":"", key->offset[u]); + HDfprintf(stream, "%s%Hd", u?", ":"", (key->scaled[u] * udata->common.layout->dim[u])); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -741,6 +786,38 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, /*------------------------------------------------------------------------- + * Function: H5D__btree_shared_free + * + * Purpose: Free "local" B-tree shared info + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, May 7, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__btree_shared_free(void *_shared) +{ + H5B_shared_t *shared = (H5B_shared_t *)_shared; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the chunk layout information */ + shared->udata = H5FL_FREE(H5O_layout_chunk_t, shared->udata); + + /* Chain up to the generic B-tree shared info free routine */ + if(H5B_shared_free(shared) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't free shared B-tree info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__btree_shared_free() */ + + +/*------------------------------------------------------------------------- * Function: H5D__btree_shared_create * * Purpose: Create & initialize B-tree shared info @@ -753,9 +830,11 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, *------------------------------------------------------------------------- */ static herr_t -H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, unsigned ndims) +H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, + const H5O_layout_chunk_t *layout) { H5B_shared_t *shared; /* Shared B-tree node info */ + H5O_layout_chunk_t *my_layout = NULL; /* Pointer to copy of layout info */ size_t sizeof_rkey; /* Size of raw (disk) key */ herr_t ret_value = SUCCEED; /* Return value */ @@ -764,20 +843,27 @@ H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, unsigned nd /* Set the raw key size */ sizeof_rkey = 4 + /*storage size */ 4 + /*filter mask */ - ndims * 8; /*dimension indices */ + layout->ndims * 8; /*dimension indices */ /* Allocate & initialize global info for the shared structure */ if(NULL == (shared = H5B_shared_new(f, H5B_BTREE, sizeof_rkey))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info") /* Set up the "local" information for this dataset's chunks */ - /* */ + if(NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout") + HDmemcpy(my_layout, layout, sizeof(H5O_layout_chunk_t)); + shared->udata = my_layout; /* Make shared B-tree info reference counted */ - if(NULL == (store->u.btree.shared = H5UC_create(shared, H5B_shared_free))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") + if(NULL == (store->u.btree.shared = H5UC_create(shared, H5D__btree_shared_free))) + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: + if(ret_value < 0) + if(my_layout) + my_layout = H5FL_FREE(H5O_layout_chunk_t, my_layout); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_shared_create() */ @@ -813,7 +899,7 @@ H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t UNUSED *spac idx_info->storage->u.btree.dset_ohdr_addr = dset_ohdr_addr; /* Allocate the shared structure */ - if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout->ndims) < 0) + if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") done: @@ -1006,8 +1092,8 @@ H5D__btree_idx_iterate_cb(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, /* Sanity check for memcpy() */ HDcompile_assert(offsetof(H5D_chunk_rec_t, nbytes) == offsetof(H5D_btree_key_t, nbytes)); HDcompile_assert(sizeof(chunk_rec.nbytes) == sizeof(lt_key->nbytes)); - HDcompile_assert(offsetof(H5D_chunk_rec_t, offset) == offsetof(H5D_btree_key_t, offset)); - HDcompile_assert(sizeof(chunk_rec.offset) == sizeof(lt_key->offset)); + HDcompile_assert(offsetof(H5D_chunk_rec_t, scaled) == offsetof(H5D_btree_key_t, scaled)); + HDcompile_assert(sizeof(chunk_rec.scaled) == sizeof(lt_key->scaled)); HDcompile_assert(offsetof(H5D_chunk_rec_t, filter_mask) == offsetof(H5D_btree_key_t, filter_mask)); HDcompile_assert(sizeof(chunk_rec.filter_mask) == sizeof(lt_key->filter_mask)); @@ -1144,7 +1230,7 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) tmp_storage = *idx_info->storage; /* Set up the shared structure */ - if(H5D__btree_shared_create(idx_info->f, &tmp_storage, idx_info->layout->ndims) < 0) + if(H5D__btree_shared_create(idx_info->f, &tmp_storage, idx_info->layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") /* Set up B-tree user data */ @@ -1201,9 +1287,9 @@ H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); /* Create shared B-tree info for each file */ - if(H5D__btree_shared_create(idx_info_src->f, idx_info_src->storage, idx_info_src->layout->ndims) < 0) + if(H5D__btree_shared_create(idx_info_src->f, idx_info_src->storage, idx_info_src->layout) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for source shared B-tree info") - if(H5D__btree_shared_create(idx_info_dst->f, idx_info_dst->storage, idx_info_dst->layout->ndims) < 0) + if(H5D__btree_shared_create(idx_info_dst->f, idx_info_dst->storage, idx_info_dst->layout) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for destination shared B-tree info") /* Create the root of the B-tree that describes chunked storage in the dest. file */ @@ -1283,7 +1369,7 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HDassert(index_size); /* Initialize the shared info for the B-tree traversal */ - if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout->ndims) < 0) + if(H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") shared_init = TRUE; @@ -1415,11 +1501,13 @@ done: */ herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, - int fwidth, unsigned ndims) + int fwidth, unsigned ndims, const uint32_t *dim) { H5D_btree_dbg_t udata; /* User data for B-tree callback */ H5O_storage_chunk_t storage; /* Storage information for B-tree callback */ + H5O_layout_chunk_t layout; /* Layout information for B-tree callback */ hbool_t shared_init = FALSE; /* Whether B-tree shared info is initialized */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1428,15 +1516,21 @@ H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent HDmemset(&storage, 0, sizeof(storage)); storage.idx_type = H5D_CHUNK_IDX_BTREE; + /* Reset "fake" layout info */ + HDmemset(&layout, 0, sizeof(layout)); + layout.ndims = ndims; + for(u = 0; u < ndims; u++) + layout.dim[u] = dim[u]; + /* Allocate the shared structure */ - if(H5D__btree_shared_create(f, &storage, ndims) < 0) + if(H5D__btree_shared_create(f, &storage, &layout) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") shared_init = TRUE; /* Set up user data for callback */ - udata.common.layout = NULL; + udata.common.layout = &layout; udata.common.storage = &storage; - udata.common.offset = NULL; + udata.common.scaled = NULL; udata.ndims = ndims; /* Dump the records for the B-tree */ @@ -1446,10 +1540,10 @@ done: if(shared_init) { /* Free the raw B-tree node buffer */ if(NULL == storage.u.btree.shared) - HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") + HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted shared info nil") else if(H5UC_DEC(storage.u.btree.shared) < 0) - HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") + HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index d990804..ea3557c 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -160,6 +160,7 @@ typedef struct H5D_chunk_it_ud4_t { FILE *stream; /* Output stream */ hbool_t header_displayed; /* Node's header is displayed? */ unsigned ndims; /* Number of dimensions for chunk/dataset */ + uint32_t *chunk_dim; /* Chunk dimensions */ } H5D_chunk_it_ud4_t; /* Callback info for nonexistent readvv operation */ @@ -231,6 +232,7 @@ static herr_t H5D__chunk_file_cb(void *elem, hid_t type_id, unsigned ndims, const hsize_t *coords, void *fm); static herr_t H5D__chunk_mem_cb(void *elem, hid_t type_id, unsigned ndims, const hsize_t *coords, void *fm); +static unsigned H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled); static herr_t H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t reset); static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, @@ -322,9 +324,9 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz { const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ H5D_chunk_ud_t udata; /* User data for querying chunk info */ - hsize_t chunk_idx; /* Global index of chunk */ H5F_block_t old_chunk; /* Offset/length of old chunk */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ + hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ herr_t ret_value = SUCCEED; /* Return value */ @@ -337,10 +339,11 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") /* Calculate the index of this chunk */ - chunk_idx = H5VM_chunk_index(dset->shared->ndims, offset, layout->u.chunk.dim, layout->u.chunk.down_chunks); + H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); + scaled[dset->shared->ndims] = 0; /* Find out the file address of the chunk (if any) */ - if(H5D__chunk_lookup(dset, dxpl_id, offset, chunk_idx, &udata) < 0) + if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Sanity check */ @@ -627,6 +630,22 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) H5D__chunk_cinfo_cache_reset(&(rdcc->last)); } /* end else */ + /* Compute scaled dimension info, if dataset dims > 1 */ + if(dset->shared->ndims > 1) { + unsigned u; /* Local index value */ + + for(u = 0; u < dset->shared->ndims; u++) { + /* Initial scaled dimension sizes */ + rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u]; + + /* Inital 'power2up' values for scaled dimensions */ + rdcc->scaled_power2up[u] = H5VM_power2up(rdcc->scaled_dims[u]); + + /* Number of bits required to encode scaled dimension size */ + rdcc->scaled_encode_bits[u] = H5VM_log2_gen(rdcc->scaled_power2up[u]); + } /* end for */ + } /* end if */ + /* Compose chunked index info struct */ idx_info.f = f; idx_info.dxpl_id = dxpl_id; @@ -1128,6 +1147,7 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info) { H5D_chunk_info_t *chunk_info; /* Chunk information to insert into skip list */ + hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk */ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ unsigned u; /* Local index variable */ @@ -1149,19 +1169,20 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t /* Set chunk location & hyperslab size */ for(u = 0; u < fm->f_ndims; u++) { HDassert(sel_start[u] == sel_end[u]); - chunk_info->coords[u] = (sel_start[u] / fm->layout->u.chunk.dim[u]) * fm->layout->u.chunk.dim[u]; + chunk_info->scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u]; + coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u]; } /* end for */ - chunk_info->coords[fm->f_ndims] = 0; + chunk_info->scaled[fm->f_ndims] = 0; /* Calculate the index of this chunk */ - chunk_info->index = H5VM_chunk_index(fm->f_ndims, chunk_info->coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); + chunk_info->index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, chunk_info->scaled); /* Copy selection for file's dataspace into chunk dataspace */ if(H5S_select_copy(fm->single_space, fm->file_space, FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection") /* Move selection back to have correct offset in chunk */ - if(H5S_SELECT_ADJUST_U(fm->single_space, chunk_info->coords) < 0) + if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") #ifdef H5_HAVE_PARALLEL @@ -1214,6 +1235,8 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */ hsize_t chunk_index; /* Index of chunk */ + hsize_t start_scaled[H5S_MAX_RANK]; /* Starting scaled coordinates of selection */ + hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ int curr_dim; /* Current dimension to increment */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1232,13 +1255,13 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Set initial chunk location & hyperslab size */ for(u = 0; u < fm->f_ndims; u++) { - start_coords[u] = (sel_start[u] / fm->layout->u.chunk.dim[u]) * fm->layout->u.chunk.dim[u]; - coords[u] = start_coords[u]; + scaled[u] = start_scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u]; + coords[u] = start_coords[u] = scaled[u] * fm->layout->u.chunk.dim[u]; end[u] = (coords[u] + fm->chunk_dim[u]) - 1; } /* end for */ /* Calculate the index of this chunk */ - chunk_index = H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); + chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled); /* Iterate through each chunk in the dataset */ while(sel_points) { @@ -1304,9 +1327,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t new_chunk_info->mspace=NULL; new_chunk_info->mspace_shared = FALSE; - /* Copy the chunk's coordinates */ - HDmemcpy(new_chunk_info->coords, coords, sizeof(hsize_t) * fm->f_ndims); - new_chunk_info->coords[fm->f_ndims] = 0; + /* Copy the chunk's scaled coordinates */ + HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + new_chunk_info->scaled[fm->f_ndims] = 0; /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) { @@ -1337,11 +1360,13 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t H5_CHECK_OVERFLOW(fm->chunk_dim[curr_dim],hsize_t,hssize_t); coords[curr_dim]+=fm->chunk_dim[curr_dim]; end[curr_dim]+=fm->chunk_dim[curr_dim]; + scaled[curr_dim]++; /* Bring chunk location back into bounds, if necessary */ if(coords[curr_dim] > sel_end[curr_dim]) { do { /* Reset current dimension's location to 0 */ + scaled[curr_dim] = start_scaled[curr_dim]; coords[curr_dim] = start_coords[curr_dim]; /*lint !e771 The start_coords will always be initialized */ end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1; @@ -1349,12 +1374,13 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t curr_dim--; /* Increment chunk location in current dimension */ + scaled[curr_dim]++; coords[curr_dim] += fm->chunk_dim[curr_dim]; end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1; } while(coords[curr_dim] > sel_end[curr_dim]); /* Re-calculate the index of this chunk */ - chunk_index = H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); + chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled); } /* end if */ } /* end while */ @@ -1455,10 +1481,16 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) if(H5S_select_copy(chunk_info->mspace,chunk_info->fspace,FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection") - /* Compensate for the chunk offset */ - for(u=0; uf_ndims; u++) { - H5_CHECK_OVERFLOW(chunk_info->coords[u],hsize_t,hssize_t); - chunk_adjust[u]=adjust[u]-(hssize_t)chunk_info->coords[u]; /*lint !e771 The adjust array will always be initialized */ + /* Compute the adjustment for this chunk */ + for(u = 0; u < fm->f_ndims; u++) { + hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ + + /* Compute the chunk coordinates from the scaled coordinates */ + coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u]; + + /* Compensate for the chunk offset */ + H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t); + chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; /*lint !e771 The adjust array will always be initialized */ } /* end for */ /* Adjust the selection */ @@ -1553,12 +1585,9 @@ H5D__chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, cons /* Set the number of selected elements in chunk to zero */ chunk_info->chunk_points = 0; - /* Compute the chunk's coordinates */ - for(u = 0; u < fm->f_ndims; u++) { - H5_CHECK_OVERFLOW(fm->layout->u.chunk.dim[u], hsize_t, hssize_t); - chunk_info->coords[u] = scaled[u] * (hssize_t)fm->layout->u.chunk.dim[u]; - } /* end for */ - chunk_info->coords[fm->f_ndims] = 0; + /* Set the chunk's scaled coordinates */ + HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + chunk_info->scaled[fm->f_ndims] = 0; /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) { @@ -1580,7 +1609,7 @@ H5D__chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, cons /* Get the offset of the element within the chunk */ for(u = 0; u < fm->f_ndims; u++) - coords_in_chunk[u] = coords[u] - chunk_info->coords[u]; + coords_in_chunk[u] = coords[u] - (scaled[u] * fm->layout->u.chunk.dim[u]); /* Add point to file selection for chunk */ if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0) @@ -1831,7 +1860,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); /* Get the info for the chunk in the file */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Sanity check */ @@ -1849,14 +1878,15 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") if(cacheable) { - /* Pass in chunk's coordinates in a union. */ - io_info->store->chunk.offset = chunk_info->coords; - io_info->store->chunk.index = chunk_info->index; + /* Load the chunk into cache and lock it. */ /* Compute # of bytes accessed in chunk */ H5_CHECK_OVERFLOW(type_info->src_type_size, /*From:*/ size_t, /*To:*/ uint32_t); src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size; + /* Set chunk's [scaled] coordinates */ + io_info->store->chunk.scaled = chunk_info->scaled; + /* Lock the chunk into the cache */ if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") @@ -1963,7 +1993,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); /* Look up the chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Sanity check */ @@ -1978,10 +2008,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * simply allocate space instead of load the chunk. */ hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ - /* Pass in chunk's coordinates in a union. */ - io_info->store->chunk.offset = chunk_info->coords; - io_info->store->chunk.index = chunk_info->index; - /* Compute # of bytes accessed in chunk */ H5_CHECK_OVERFLOW(type_info->dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t); dst_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->dst_type_size; @@ -1991,6 +2017,9 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size) entire_chunk = FALSE; + /* Set chunk's [scaled] coordinates */ + io_info->store->chunk.scaled = chunk_info->scaled; + /* Lock the chunk into the cache */ if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") @@ -2242,11 +2271,10 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud HDassert(last); HDassert(udata); HDassert(udata->common.layout); - HDassert(udata->common.storage); - HDassert(udata->common.offset); + HDassert(udata->common.scaled); /* Stored the information to cache */ - HDmemcpy(last->offset, udata->common.offset, sizeof(hsize_t) * udata->common.layout->ndims); + HDmemcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims); last->addr = udata->chunk_block.offset; H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t); last->filter_mask = udata->filter_mask; @@ -2281,16 +2309,15 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda HDassert(last); HDassert(udata); HDassert(udata->common.layout); - HDassert(udata->common.storage); - HDassert(udata->common.offset); + HDassert(udata->common.scaled); /* Check if the cached information is what is desired */ if(last->valid) { unsigned u; /* Local index variable */ - /* Check that the offset is the same */ + /* Check that the scaled offset is the same */ for(u = 0; u < udata->common.layout->ndims; u++) - if(last->offset[u] != udata->common.offset[u]) + if(last->scaled[u] != udata->common.scaled[u]) HGOTO_DONE(FALSE) /* Retrieve the information from the cache */ @@ -2360,6 +2387,53 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_hash_val + * + * Purpose: To calculate an index based on the dataset's scaled coordinates and + * sizes of the faster dimensions. + * + * Return: Hash value index + * + * Programmer: Vailin Choi; Nov 2014 + * + *------------------------------------------------------------------------- + */ +static unsigned +H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) +{ + hsize_t val; /* Intermediate value */ + unsigned ndims = shared->ndims; /* Rank of dataset */ + unsigned ret; /* Value to return */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(shared); + HDassert(scaled); + + /* If the fastest changing dimension doesn't have enough entropy, use + * other dimensions too + */ + if(ndims > 1 && shared->cache.chunk.scaled_dims[ndims - 1] <= shared->cache.chunk.nslots) { + unsigned u; /* Local index variable */ + + val = scaled[0]; + for(u = 1; u < ndims; u++) { + val <<= shared->cache.chunk.scaled_encode_bits[u]; + val ^= scaled[u]; + } /* end for */ + } /* end if */ + else + val = scaled[ndims - 1]; + + /* Modulo value against the number of array slots */ + ret = (unsigned)(val % shared->cache.chunk.nslots); + + FUNC_LEAVE_NOAPI(ret) +} /* H5D__chunk_hash_val() */ + + +/*------------------------------------------------------------------------- * Function: H5D__chunk_lookup * * Purpose: Loops up a chunk in cache and on disk, and retrieves @@ -2373,8 +2447,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, - hsize_t chunk_idx, H5D_chunk_ud_t *udata) +H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, + H5D_chunk_ud_t *udata) { H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ hbool_t found = FALSE; /* In cache? */ @@ -2385,13 +2459,13 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, HDassert(dset); HDassert(dset->shared->layout.u.chunk.ndims > 0); - HDassert(chunk_offset); + HDassert(scaled); HDassert(udata); /* Initialize the query information about the chunk we are looking for */ udata->common.layout = &(dset->shared->layout.u.chunk); udata->common.storage = &(dset->shared->layout.storage.u.chunk); - udata->common.offset = chunk_offset; + udata->common.scaled = scaled; /* Reset information about the chunk we are looking for */ udata->chunk_block.offset = HADDR_UNDEF; @@ -2400,12 +2474,12 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { - udata->idx_hint = H5D_CHUNK_HASH(dset->shared, chunk_idx); + udata->idx_hint = H5D__chunk_hash_val(dset->shared, scaled); ent = dset->shared->cache.chunk.slot[udata->idx_hint]; if(ent) for(u = 0, found = TRUE; u < dset->shared->ndims; u++) - if(chunk_offset[u] != ent->offset[u]) { + if(scaled[u] != ent->scaled[u]) { found = FALSE; break; } /* end if */ @@ -2486,7 +2560,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Set up user data for index callbacks */ udata.common.layout = &dset->shared->layout.u.chunk; udata.common.storage = &dset->shared->layout.storage.u.chunk; - udata.common.offset = ent->offset; + udata.common.scaled = ent->scaled; udata.chunk_block.offset = ent->chunk_block.offset; udata.chunk_block.length = dset->shared->layout.u.chunk.size; udata.filter_mask = 0; @@ -2852,7 +2926,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, /* Make sure this is the right chunk */ for(u = 0; u < layout->u.chunk.ndims; u++) - HDassert(io_info->store->chunk.offset[u] == ent->offset[u]); + HDassert(io_info->store->chunk.scaled[u] == ent->scaled[u]); } #endif /* NDEBUG */ @@ -2979,7 +3053,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, /* See if the chunk can be cached */ if(rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max) { /* Calculate the index */ - udata->idx_hint = H5D_CHUNK_HASH(dset->shared, io_info->store->chunk.index); + udata->idx_hint = H5D__chunk_hash_val(io_info->dset->shared, udata->common.scaled); /* Add the chunk to the cache only if the slot is not already locked */ ent = rdcc->slot[udata->idx_hint]; @@ -2999,7 +3073,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, /* Initialize the new entry */ ent->chunk_block.offset = chunk_addr; ent->chunk_block.length = chunk_alloc; - HDmemcpy(ent->offset, io_info->store->chunk.offset, sizeof(hsize_t) * layout->u.chunk.ndims); + HDmemcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t); H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t); ent->chunk = (uint8_t *)chunk; @@ -3106,7 +3180,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, HDmemset(&fake_ent, 0, sizeof(fake_ent)); fake_ent.dirty = TRUE; - HDmemcpy(fake_ent.offset, io_info->store->chunk.offset, layout->u.chunk.ndims * sizeof(fake_ent.offset[0])); + HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); HDassert(layout->u.chunk.size > 0); fake_ent.chunk_block.offset = udata->chunk_block.offset; fake_ent.chunk_block.length = udata->chunk_block.length; @@ -3254,9 +3328,9 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, { H5D_chk_idx_info_t idx_info; /* Chunked index info */ const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */ - hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated */ - hsize_t max_unalloc[H5O_LAYOUT_NDIMS]; /* Last chunk in each dimension that is unallocated */ - hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ + hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled coordinates) */ + hsize_t max_unalloc[H5O_LAYOUT_NDIMS]; /* Last chunk in each dimension that is unallocated (in scaled coordinates) */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */ size_t orig_chunk_size; /* Original size of chunk in bytes */ size_t chunk_size; /* Actual size of chunk in bytes, possibly filtered */ unsigned filter_mask = 0; /* Filter mask for chunks that have them */ @@ -3292,8 +3366,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, space_dim = dset->shared->curr_dims; space_ndims = dset->shared->ndims; - /* The last dimension in chunk_offset is always 0 */ - chunk_offset[space_ndims] = (hsize_t)0; + /* The last dimension in scaled chunk coordinates is always 0 */ + scaled[space_ndims] = (hsize_t)0; /* Check if any space dimensions are 0, if so we do not have to do anything */ @@ -3380,10 +3454,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, * that we assume here that all elements of space_dim are > 0. This is * checked at the top of this function. */ for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { - min_unalloc[op_dim] = ((old_dim[op_dim] + chunk_dim[op_dim] - 1) - / chunk_dim[op_dim]) * chunk_dim[op_dim]; - max_unalloc[op_dim] = ((space_dim[op_dim] - 1) / chunk_dim[op_dim]) - * chunk_dim[op_dim]; + min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim]; + max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim]; } /* end for */ /* Loop over all chunks */ @@ -3403,6 +3475,9 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, * Every time the algorithm finishes allocating chunks allocated beyond a * certain dimension, max_unalloc is updated in order to avoid allocating * those chunks again. + * + * Note that min_unalloc & max_unalloc are in scaled coordinates. + * */ for(op_dim = 0; op_dim < space_ndims; op_dim++) { H5D_chunk_ud_t udata; /* User data for querying chunk info */ @@ -3413,8 +3488,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, continue; else { /* Reset the chunk offset indices */ - HDmemset(chunk_offset, 0, (space_ndims * sizeof(chunk_offset[0]))); - chunk_offset[op_dim] = min_unalloc[op_dim]; + HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0]))); + scaled[op_dim] = min_unalloc[op_dim]; carry = FALSE; } /* end else */ @@ -3428,11 +3503,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #ifndef NDEBUG /* None of the chunks should be allocated */ { - hsize_t chunk_idx; - /* Look up this chunk */ - chunk_idx = H5VM_chunk_index(space_ndims, chunk_offset, layout->u.chunk.dim, layout->u.chunk.down_chunks); - if(H5D__chunk_lookup(dset, dxpl_id, chunk_offset, chunk_idx, &udata) < 0) + if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") HDassert(!H5F_addr_defined(udata.chunk_block.offset)); @@ -3445,8 +3517,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hbool_t outside_orig = FALSE; for(u = 0; u < space_ndims; u++) { - HDassert(chunk_offset[u] < space_dim[u]); - if(chunk_offset[u] >= old_dim[u]) + HDassert((scaled[u] * chunk_dim[u]) < space_dim[u]); + if((scaled[u] * chunk_dim[u]) >= old_dim[u]) outside_orig = TRUE; } /* end for */ HDassert(outside_orig); @@ -3496,7 +3568,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Initialize the chunk information */ udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; - udata.common.offset = chunk_offset; + udata.common.scaled = scaled; udata.chunk_block.offset = HADDR_UNDEF; H5_CHECKED_ASSIGN(udata.chunk_block.length, uint32_t, chunk_size, size_t); udata.filter_mask = filter_mask; @@ -3549,12 +3621,12 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Increment indices and adjust the edge chunk state */ carry = TRUE; for(i = ((int)space_ndims - 1); i >= 0; --i) { - chunk_offset[i] += chunk_dim[i]; - if(chunk_offset[i] > max_unalloc[i]) { + scaled[i]++; + if(scaled[i] > max_unalloc[i]) { if((unsigned)i == op_dim) - chunk_offset[i] = min_unalloc[i]; + scaled[i] = min_unalloc[i]; else - chunk_offset[i] = 0; + scaled[i] = 0; } /* end if */ else { carry = FALSE; @@ -3569,7 +3641,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, if(min_unalloc[op_dim] == 0) break; else - max_unalloc[op_dim] = min_unalloc[op_dim] - chunk_dim[op_dim]; + max_unalloc[op_dim] = min_unalloc[op_dim] - 1; } /* end for(op_dim=0...) */ #ifdef H5_HAVE_PARALLEL @@ -3771,7 +3843,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */ - const hsize_t *chunk_offset = io_info->store->chunk.offset; /* Chunk offset */ + const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */ H5S_sel_iter_t chunk_iter; /* Memory selection iteration info */ hssize_t sel_nelmts; /* Number of elements in selection */ hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */ @@ -3790,7 +3862,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t); /* Get the info for the chunk in the file */ - if(H5D__chunk_lookup(dset, io_info->dxpl_id, chunk_offset, io_info->store->chunk.index, &chk_udata) < 0) + if(H5D__chunk_lookup(dset, io_info->dxpl_id, scaled, &chk_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* If this chunk does not exist in cache or on disk, no need to do anything */ @@ -3810,7 +3882,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) /* Compute the # of elements to leave with existing value, in each dimension */ for(u = 0; u < rank; u++) { - count[u] = MIN(layout->u.chunk.dim[u], (udata->space_dim[u] - chunk_offset[u])); + count[u] = MIN(layout->u.chunk.dim[u], (udata->space_dim[u] - (scaled[u] * layout->u.chunk.dim[u]))); HDassert(count[u] > 0); } /* end for */ @@ -3973,13 +4045,10 @@ done: herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) { - hsize_t min_mod_chunk_off[H5O_LAYOUT_NDIMS]; /* Offset of first chunk to modify in each dimension */ - hsize_t max_mod_chunk_off[H5O_LAYOUT_NDIMS]; /* Offset of last chunk to modify in each dimension */ - hssize_t max_fill_chunk_off[H5O_LAYOUT_NDIMS]; /* Offset of last chunk that might be filled in each dimension */ + hsize_t min_mod_chunk_off[H5O_LAYOUT_NDIMS]; /* Scaled offset of first chunk to modify in each dimension */ + hsize_t max_mod_chunk_off[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */ + hssize_t max_fill_chunk_off[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each dimension */ hbool_t fill_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension needs to be filled */ - hbool_t dims_outside_fill[H5O_LAYOUT_NDIMS]; /* Dimensions in chunk offset outside fill dimensions */ - int ndims_outside_fill = 0; /* Number of dimensions in chunk offset outside fill dimensions */ - hbool_t has_fill = FALSE; /* Whether there are chunks that must be filled */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t chk_io_info; /* Chunked I/O info object */ H5D_storage_t chk_store; /* Chunk storage information */ @@ -3987,7 +4056,6 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ - H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ unsigned space_ndims; /* Dataset's space rank */ const hsize_t *space_dim; /* Current dataspace dimensions */ unsigned op_dim; /* Current operating dimension */ @@ -3997,10 +4065,9 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) H5D_chunk_common_ud_t idx_udata; /* User data for index removal routine */ H5S_t *chunk_space = NULL; /* Dataspace for a chunk */ hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Chunk dimensions */ - hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled offset of current chunk */ hsize_t hyper_start[H5O_LAYOUT_NDIMS]; /* Starting location of hyperslab */ uint32_t elmts_per_chunk; /* Elements in chunk */ - hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4019,8 +4086,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) space_dim = dset->shared->curr_dims; space_ndims = dset->shared->ndims; - /* The last dimension in chunk_offset is always 0 */ - chunk_offset[space_ndims] = (hsize_t)0; + /* The last dimension in scaled is always 0 */ + scaled[space_ndims] = (hsize_t)0; /* Check if any old dimensions are 0, if so we do not have to do anything */ for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) @@ -4039,7 +4106,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) for(u = 0; u < space_ndims; u++) { elmts_per_chunk *= layout->u.chunk.dim[u]; chunk_dim[u] = layout->u.chunk.dim[u]; - shrunk_dim[u] = space_dim[u] < old_dim[u]; + shrunk_dim[u] = (space_dim[u] < old_dim[u]); } /* end for */ /* Create a dataspace for a chunk & set the extent */ @@ -4051,9 +4118,9 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDmemset(hyper_start, 0, sizeof(hyper_start)); /* Set up chunked I/O info object, for operations on chunks (in callback) - * Note that we only need to set chunk_offset once, as the array's address + * Note that we only need to set scaled once, as the array's address * will never change. */ - chk_store.chunk.offset = chunk_offset; + chk_store.chunk.scaled = scaled; H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, &chk_store, NULL); /* Compose chunked index info struct */ @@ -4067,6 +4134,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDmemset(&udata, 0, sizeof udata); udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; + udata.common.scaled = scaled; udata.io_info = &chk_io_info; udata.idx_info = &idx_info; udata.space_dim = space_dim; @@ -4088,16 +4156,14 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { /* Calculate the largest offset of chunks that might need to be * modified in this dimension */ - max_mod_chunk_off[op_dim] = chunk_dim[op_dim] * ((old_dim[op_dim] - 1) - / chunk_dim[op_dim]); + max_mod_chunk_off[op_dim] = (old_dim[op_dim] - 1) / chunk_dim[op_dim]; /* Calculate the largest offset of chunks that might need to be * filled in this dimension */ if(0 == space_dim[op_dim]) max_fill_chunk_off[op_dim] = -1; else - max_fill_chunk_off[op_dim] = (hssize_t)(chunk_dim[op_dim] - * ((MIN(space_dim[op_dim], old_dim[op_dim]) - 1) + max_fill_chunk_off[op_dim] = (hssize_t)(((MIN(space_dim[op_dim], old_dim[op_dim]) - 1) / chunk_dim[op_dim])); if(shrunk_dim[op_dim]) { @@ -4105,14 +4171,11 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) * modified in this dimension. Note that this array contains * garbage for all dimensions which are not shrunk. These locations * must not be read from! */ - min_mod_chunk_off[op_dim] = chunk_dim[op_dim] * (space_dim[op_dim] - / chunk_dim[op_dim]); + min_mod_chunk_off[op_dim] = space_dim[op_dim] / chunk_dim[op_dim]; /* Determine if we need to fill chunks in this dimension */ - if((hssize_t)min_mod_chunk_off[op_dim] == max_fill_chunk_off[op_dim]) { + if((hssize_t)min_mod_chunk_off[op_dim] == max_fill_chunk_off[op_dim]) fill_dim[op_dim] = TRUE; - has_fill = TRUE; - } /* end if */ else fill_dim[op_dim] = FALSE; } /* end if */ @@ -4122,38 +4185,38 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Main loop: fill or remove chunks */ for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { + hbool_t dims_outside_fill[H5O_LAYOUT_NDIMS]; /* Dimensions in chunk offset outside fill dimensions */ + int ndims_outside_fill; /* Number of dimensions in chunk offset outside fill dimensions */ + hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ + /* Check if modification along this dimension is really necessary */ if(!shrunk_dim[op_dim]) continue; else { - HDassert((hsize_t) max_mod_chunk_off[op_dim] >= min_mod_chunk_off[op_dim]); + HDassert(max_mod_chunk_off[op_dim] >= min_mod_chunk_off[op_dim]); /* Reset the chunk offset indices */ - HDmemset(chunk_offset, 0, (space_ndims * sizeof(chunk_offset[0]))); - chunk_offset[op_dim] = min_mod_chunk_off[op_dim]; + HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0]))); + scaled[op_dim] = min_mod_chunk_off[op_dim]; /* Initialize "dims_outside_fill" array */ ndims_outside_fill = 0; for(u = 0; u < space_ndims; u++) - if((hssize_t)chunk_offset[u] > max_fill_chunk_off[u]) { + if((hssize_t)scaled[u] > max_fill_chunk_off[u]) { dims_outside_fill[u] = TRUE; ndims_outside_fill++; } /* end if */ else dims_outside_fill[u] = FALSE; - - carry = FALSE; } /* end if */ + carry = FALSE; while(!carry) { int i; /* Local index variable */ - /* Calculate the index of this chunk */ - chk_io_info.store->chunk.index = H5VM_chunk_index(space_ndims, chunk_offset, layout->u.chunk.dim, layout->u.chunk.down_chunks); - if(0 == ndims_outside_fill) { HDassert(fill_dim[op_dim]); - HDassert(chunk_offset[op_dim] == min_mod_chunk_off[op_dim]); + HDassert(scaled[op_dim] == min_mod_chunk_off[op_dim]); /* Fill the unused parts of the chunk */ if(H5D__chunk_prune_fill(&udata) < 0) @@ -4168,7 +4231,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) hbool_t outside_dim = FALSE; for(u = 0; u < space_ndims; u++) - if(chunk_offset[u] >= space_dim[u]) { + if((scaled[u] * chunk_dim[u]) >= space_dim[u]) { outside_dim = TRUE; break; } /* end if */ @@ -4177,7 +4240,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) #endif /* NDEBUG */ /* Check if the chunk exists in cache or on disk */ - if(H5D__chunk_lookup(dset, dxpl_id, chunk_offset, chk_io_info.store->chunk.index, &chk_udata) < 0) + if(H5D__chunk_lookup(dset, dxpl_id, scaled, &chk_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk") /* Evict the entry from the cache if present, but do not flush @@ -4189,7 +4252,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Remove the chunk from disk, if present */ if(H5F_addr_defined(chk_udata.chunk_block.offset)) { /* Update the offset in idx_udata */ - idx_udata.offset = chunk_offset; + idx_udata.scaled = scaled; /* Remove the chunk from disk */ if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) @@ -4200,19 +4263,19 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Increment indices */ carry = TRUE; for(i = (int)(space_ndims - 1); i >= 0; --i) { - chunk_offset[i] += chunk_dim[i]; - if(chunk_offset[i] > (hsize_t) max_mod_chunk_off[i]) { + scaled[i]++; + if(scaled[i] > max_mod_chunk_off[i]) { /* Left maximum dimensions, "wrap around" and check if this * dimension is no longer outside the fill dimension */ if((unsigned)i == op_dim) { - chunk_offset[i] = min_mod_chunk_off[i]; + scaled[i] = min_mod_chunk_off[i]; if(dims_outside_fill[i] && fill_dim[i]) { dims_outside_fill[i] = FALSE; ndims_outside_fill--; } /* end if */ } /* end if */ else { - chunk_offset[i] = 0; + scaled[i] = 0; if(dims_outside_fill[i] && max_fill_chunk_off[i] >= 0) { dims_outside_fill[i] = FALSE; ndims_outside_fill--; @@ -4221,7 +4284,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) } /* end if */ else { /* Check if we just went outside the fill dimension */ - if(!dims_outside_fill[i] && (hssize_t)chunk_offset[i] > max_fill_chunk_off[i]) { + if(!dims_outside_fill[i] && (hssize_t)scaled[i] > max_fill_chunk_off[i]) { dims_outside_fill[i] = TRUE; ndims_outside_fill++; } /* end if */ @@ -4239,7 +4302,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) if(min_mod_chunk_off[op_dim] == 0) break; else - max_mod_chunk_off[op_dim] = min_mod_chunk_off[op_dim] - chunk_dim[op_dim]; + max_mod_chunk_off[op_dim] = min_mod_chunk_off[op_dim] - 1; } /* end for(op_dim=0...) */ /* Reset any cached chunk info for this dataset */ @@ -4282,7 +4345,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_STATIC /* Compute the index for this chunk */ - chunk_index = H5VM_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks); + chunk_index = H5VM_array_offset_pre(rank, udata->common.layout->down_chunks, chunk_rec->scaled); /* Set it in the userdata to return */ udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr; @@ -4440,7 +4503,6 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) H5D_rdcc_ent_t *ent, *next; /*cache entry */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ - unsigned rank; /* Current # of dimensions */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -4449,13 +4511,8 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) HDassert(dset && H5D_CHUNKED == dset->shared->layout.type); HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); - /* Get the rank */ - rank = dset->shared->layout.u.chunk.ndims - 1; - HDassert(rank > 0); - - /* 1-D dataset's chunks can't have their index change */ - if(rank == 1) - HGOTO_DONE(SUCCEED) + /* Check the rank */ + HDassert((dset->shared->layout.u.chunk.ndims - 1) > 1); /* Fill the DXPL cache values for later use */ if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) @@ -4463,18 +4520,14 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) /* Recompute the index for each cached chunk that is in a dataset */ for(ent = rdcc->head; ent; ent = next) { - hsize_t idx; /* Chunk index */ unsigned old_idx; /* Previous index number */ /* Get the pointer to the next cache entry */ next = ent->next; - /* Calculate the index of this chunk */ - idx = H5VM_chunk_index(rank, ent->offset, dset->shared->layout.u.chunk.dim, dset->shared->layout.u.chunk.down_chunks); - /* Compute the index for the chunk entry */ old_idx = ent->idx; /* Save for later */ - ent->idx = H5D_CHUNK_HASH(dset->shared, idx); + ent->idx = H5D__chunk_hash_val(dset->shared, ent->scaled); if(old_idx != ent->idx) { H5D_rdcc_ent_t *old_ent; /* Old cache entry */ @@ -4661,7 +4714,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Set up destination chunk callback information for insertion */ udata_dst.common.layout = udata->idx_info_dst->layout; udata_dst.common.storage = udata->idx_info_dst->storage; - udata_dst.common.offset = chunk_rec->offset; + udata_dst.common.scaled = chunk_rec->scaled; udata_dst.chunk_block.offset = HADDR_UNDEF; udata_dst.chunk_block.length = chunk_rec->nbytes; udata_dst.filter_mask = chunk_rec->filter_mask; @@ -5044,7 +5097,7 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Print information about this chunk */ HDfprintf(udata->stream, " 0x%08x %8Zu %10a [", chunk_rec->filter_mask, chunk_rec->nbytes, chunk_rec->chunk_addr); for(u = 0; u < udata->ndims; u++) - HDfprintf(udata->stream, "%s%Hd", (u ? ", " : ""), chunk_rec->offset[u]); + HDfprintf(udata->stream, "%s%Hu", (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u])); HDfputs("]\n", udata->stream); } /* end if */ @@ -5096,6 +5149,7 @@ H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) udata.stream = stream; udata.header_displayed = FALSE; udata.ndims = dset->shared->layout.u.chunk.ndims; + udata.chunk_dim = dset->shared->layout.u.chunk.dim; /* Iterate over index and dump chunk info */ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0) diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index b3dae7b..3da6b95 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -382,12 +382,56 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) /* Update the index values for the cached chunks for this dataset */ if(H5D_CHUNKED == dataset->shared->layout.type) { + hbool_t update_chunks = FALSE; /* Flag to indicate chunk cache update is needed */ + + /* Check if we need to track & update scaled dimension information */ + if(dataset->shared->ndims > 1) { + unsigned u; /* Local indicate variable */ + + /* Update scaled chunk information */ + for(u = 0; u < dataset->shared->ndims; u++) { + hsize_t scaled; /* Scaled value */ + + /* Compute the scaled dimension size value */ + scaled = size[u] / dataset->shared->layout.u.chunk.dim[u]; + + /* Check if scaled dimension size changed */ + if(scaled != dataset->shared->cache.chunk.scaled_dims[u]) { + hsize_t scaled_power2up; /* New size value, rounded to next power of 2 */ + + /* Update the scaled dimension size value for the current dimension */ + dataset->shared->cache.chunk.scaled_dims[u] = scaled; + + /* Check if algorithm for computing hash values will change */ + if((scaled > dataset->shared->cache.chunk.nslots && + dataset->shared->cache.chunk.scaled_dims[u] <= dataset->shared->cache.chunk.nslots) + || (scaled <= dataset->shared->cache.chunk.nslots && + dataset->shared->cache.chunk.scaled_dims[u] > dataset->shared->cache.chunk.nslots)) + update_chunks = TRUE; + + /* Check if the number of bits required to encode the scaled size value changed */ + if(dataset->shared->cache.chunk.scaled_power2up[u] != (scaled_power2up = H5VM_power2up(scaled))) { + /* Update the 'power2up' & 'encode_bits' values for the current dimension */ + dataset->shared->cache.chunk.scaled_power2up[u] = scaled_power2up; + dataset->shared->cache.chunk.scaled_encode_bits[u] = H5VM_log2_gen(scaled_power2up); + + /* Indicate that the chunk cache indices should be updated */ + update_chunks = TRUE; + } /* end if */ + } /* end if */ + } /* end for */ + } /* end if */ + /* Update general information for chunks */ if(H5D__chunk_set_info(dataset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks") - /* Update the chunk cache indices */ - if(H5D__chunk_update_cache(dataset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices") + + /* Check for updating chunk cache indices */ + if(update_chunks) { + /* Update the chunk cache indices */ + if(H5D__chunk_update_cache(dataset, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices") + } /* end if */ } /* end if */ /* Allocate space for the new parts of the dataset, if appropriate */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 23824e3..2289ac1 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2240,6 +2240,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) if(changed) { hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */ hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */ + hbool_t update_chunks = FALSE; /* Flag to indicate chunk cache update is needed */ unsigned u; /* Local index variable */ /* Determine if we are shrinking and/or expanding any dimensions */ @@ -2250,6 +2251,39 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) if(size[u] > curr_dims[u]) expand = TRUE; + /* Chunked storage specific checks */ + if(H5D_CHUNKED == dset->shared->layout.type && dset->shared->ndims > 1) { + hsize_t scaled; /* Scaled value */ + + /* Compute the scaled dimension size value */ + scaled = size[u] / dset->shared->layout.u.chunk.dim[u]; + + /* Check if scaled dimension size changed */ + if(scaled != dset->shared->cache.chunk.scaled_dims[u]) { + hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ + + /* Update the scaled dimension size value for the current dimension */ + dset->shared->cache.chunk.scaled_dims[u] = scaled; + + /* Check if algorithm for computing hash values will change */ + if((scaled > dset->shared->cache.chunk.nslots && + dset->shared->cache.chunk.scaled_dims[u] <= dset->shared->cache.chunk.nslots) + || (scaled <= dset->shared->cache.chunk.nslots && + dset->shared->cache.chunk.scaled_dims[u] > dset->shared->cache.chunk.nslots)) + update_chunks = TRUE; + + /* Check if the number of bits required to encode the scaled size value changed */ + if(dset->shared->cache.chunk.scaled_power2up[u] != (scaled_power2up = H5VM_power2up(scaled))) { + /* Update the 'power2up' & 'encode_bits' values for the current dimension */ + dset->shared->cache.chunk.scaled_power2up[u] = scaled_power2up; + dset->shared->cache.chunk.scaled_encode_bits[u] = H5VM_log2_gen(scaled_power2up); + + /* Indicate that the cached chunk indices need to be updated */ + update_chunks = TRUE; + } /* end if */ + } /* end if */ + } /* end if */ + /* Update the cached copy of the dataset's dimensions */ dset->shared->curr_dims[u] = size[u]; } /* end for */ @@ -2263,8 +2297,12 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) /* Set the cached chunk info */ if(H5D__chunk_set_info(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks") - if(H5D__chunk_update_cache(dset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices") + + /* Check if updating the chunk cache indices is necessary */ + if(update_chunks) + /* Update the chunk cache indices */ + if(H5D__chunk_update_cache(dset, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices") } /* end if */ /* Allocate space for the new parts of the dataset, if appropriate */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 825c562..63faa5d 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -860,7 +860,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ mspace = chunk_info->mspace; /* Look up address of chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk address") ctg_store.contig.dset_addr = udata.chunk_block.offset; } /* end else */ @@ -1200,8 +1200,7 @@ if(H5DEBUG(D)) HDassert(chunk_info->index == u); /* Pass in chunk's coordinates in a union. */ - store.chunk.offset = chunk_info->coords; - store.chunk.index = chunk_info->index; + store.chunk.scaled = chunk_info->scaled; } /* end if */ /* Collective IO for this chunk, @@ -1588,8 +1587,7 @@ if(H5DEBUG(D)) H5D_chunk_ud_t udata; /* User data for querying chunk info */ /* Get address of chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, - chunk_info->coords, chunk_info->index, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") chunk_addr = udata.chunk_block.offset; } /* end if */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 12e84b0..815dae4 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -61,8 +61,6 @@ (io_info)->op_type = H5D_IO_OP_READ; \ (io_info)->u.rbuf = buf -#define H5D_CHUNK_HASH(D, ADDR) H5F_addr_hash(ADDR, (D)->cache.chunk.nslots) - /* Flags for marking aspects of a dataset dirty */ #define H5D_MARK_SPACE 0x01 #define H5D_MARK_LAYOUT 0x02 @@ -165,8 +163,7 @@ typedef struct { } H5D_contig_storage_t; typedef struct { - hsize_t index; /* "Index" of chunk in dataset (must be first for TBBT routines) */ - hsize_t *offset; /* Chunk's coordinates in elements */ + hsize_t *scaled; /* Scaled coordinates for a chunk */ } H5D_chunk_storage_t; typedef struct { @@ -239,7 +236,7 @@ typedef struct H5D_chk_idx_info_t { * The chunk's file address, filter mask and size on disk are not key values. */ typedef struct H5D_chunk_rec_t { - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ uint32_t nbytes; /* Size of stored data */ unsigned filter_mask; /* Excluded filters */ haddr_t chunk_addr; /* Address of chunk in file */ @@ -254,7 +251,7 @@ typedef struct H5D_chunk_common_ud_t { /* downward */ const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5O_storage_chunk_t *storage; /* Chunk storage description */ - const hsize_t *offset; /* Logical offset of chunk */ + const hsize_t *scaled; /* Scaled coordinates for a chunk */ } H5D_chunk_common_ud_t; /* B-tree callback info for various operations */ @@ -320,7 +317,7 @@ typedef struct H5D_chunk_ops_t { typedef struct H5D_chunk_info_t { hsize_t index; /* "Index" of chunk in dataset */ uint32_t chunk_points; /* Number of elements selected in chunk */ - hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk in file dataset's dataspace */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled coordinates of chunk (in file dataset's dataspace) */ H5S_t *fspace; /* Dataspace describing chunk & selection in it */ hbool_t fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */ H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ @@ -360,7 +357,7 @@ typedef struct H5D_chunk_map_t { /* Cached information about a particular chunk */ typedef struct H5D_chunk_cached_t { hbool_t valid; /*whether cache info is valid*/ - hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/ haddr_t addr; /*file address of chunk */ uint32_t nbytes; /*size of stored data */ unsigned filter_mask; /*excluded filters */ @@ -386,6 +383,11 @@ typedef struct H5D_rdcc_t { H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */ H5S_t *single_space; /* Dataspace for single element I/O on chunks */ H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */ + + /* Cached information about scaled dataspace dimensions */ + hsize_t scaled_dims[H5S_MAX_RANK]; /* The scaled dim sizes */ + hsize_t scaled_power2up[H5S_MAX_RANK]; /* The scaled dim sizes, rounded up to next power of 2 */ + unsigned scaled_encode_bits[H5S_MAX_RANK]; /* The number of bits needed to encode the scaled dim sizes */ } H5D_rdcc_t; /* The raw data contiguous data cache */ @@ -494,7 +496,7 @@ typedef struct H5D_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ hbool_t deleted; /*chunk about to be deleted */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */ uint32_t rd_count; /*bytes remaining to be read */ uint32_t wr_count; /*bytes remaining to be written */ H5F_block_t chunk_block; /*offset/length of chunk in file */ @@ -612,7 +614,7 @@ H5_DLL herr_t H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id); H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, - const hsize_t *chunk_offset, hsize_t chunk_idx, H5D_chunk_ud_t *udata); + const hsize_t *scaled, H5D_chunk_ud_t *udata); H5_DLL void *H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax); H5_DLL herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 0b8b76f..55e5b47 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -176,7 +176,7 @@ H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_ad /* Functions that operate on indexed storage */ H5_DLL herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, - int indent, int fwidth, unsigned ndims); + int indent, int fwidth, unsigned ndims, const uint32_t *dim); #endif /* _H5Dprivate_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 4e57a19..9a5bfb3 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -244,7 +244,6 @@ #define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ HADDR_UNDEF==(X)+(haddr_t)(Z) || \ (X)+(haddr_t)(Z)<(X)) -#define H5F_addr_hash(X,M) ((unsigned)((X)%(M))) #define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making * certain that X is not HADDR_UNDEF and then checking that X equals Y diff --git a/src/H5VM.c b/src/H5VM.c index ffc657d..c546609 100644 --- a/src/H5VM.c +++ b/src/H5VM.c @@ -386,55 +386,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VM_hyper_disjointp - * - * Purpose: Determines if two hyperslabs are disjoint. - * - * Return: Success: FALSE if they are not disjoint. - * TRUE if they are disjoint. - * - * Failure: A hyperslab of zero size is disjoint from all - * other hyperslabs. - * - * Programmer: Robb Matzke - * Thursday, October 16, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -htri_t -H5VM_hyper_disjointp(unsigned n, - const hsize_t *offset1, const uint32_t *size1, - const hsize_t *offset2, const uint32_t *size2) -{ - unsigned u; - htri_t ret_value = FALSE; /* Return value */ - - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(!n || !size1 || !size2) - HGOTO_DONE(TRUE) - - for(u = 0; u < n; u++) { - HDcompile_assert(sizeof(uint32_t) <= sizeof(hsize_t)); - - if(0 == size1[u] || 0 == size2[u]) - HGOTO_DONE(TRUE) - if(((offset1 ? offset1[u] : 0) < (offset2 ? offset2[u] : 0) && - ((offset1 ? offset1[u] : 0) + size1[u] <= (offset2 ? offset2[u] : 0))) || - ((offset2 ? offset2[u] : 0) < (offset1 ? offset1[u] : 0) && - ((offset2 ? offset2[u] : 0) + size2[u] <= (offset1 ? offset1[u] : 0)))) - HGOTO_DONE(TRUE) - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VM_hyper_disjointp() */ - - -/*------------------------------------------------------------------------- * Function: H5VM_hyper_fill * * Purpose: Similar to memset() except it operates on hyperslabs... @@ -1068,17 +1019,12 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) * Programmer: Quincey Koziol * Tuesday, June 22, 1999 * - * Modifications: - * Use precomputed accumulator array - * Quincey Koziol - * Saturday, April 26, 2003 - * *------------------------------------------------------------------------- */ hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) { - int i; /*counter */ + unsigned u; /* Local index variable */ hsize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1088,8 +1034,8 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) HDassert(offset); /* Compute offset in array */ - for(i = (int)(n - 1), ret_value = 0; i >= 0; --i) - ret_value += acc[i] * offset[i]; + for(u = 0, ret_value = 0; u < n; u++) + ret_value += acc[u] * offset[u]; FUNC_LEAVE_NOAPI(ret_value) } /* end H5VM_array_offset_pre() */ @@ -1157,7 +1103,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *coords) { @@ -1288,6 +1234,41 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, /*------------------------------------------------------------------------- + * Function: H5VM_chunk_scaled + * + * Purpose: Compute the scaled coordinates for a chunk offset + * + * Return: + * + * Programmer: Quincey Koziol + * Wednesday, November 19, 2014 + * + *------------------------------------------------------------------------- + */ +void +H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, + hsize_t *scaled) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(ndims <= H5VM_HYPER_NDIMS); + HDassert(coord); + HDassert(chunk); + HDassert(scaled); + + /* Compute the scaled coordinates for actual coordinates */ + /* (Note that the 'scaled' array is an 'OUT' parameter) */ + for(u = 0; u < ndims; u++) + scaled[u] = coord[u] / chunk[u]; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5VM_chunk_scaled() */ + + +/*------------------------------------------------------------------------- * Function: H5VM_chunk_index_scaled * * Purpose: Given a coordinate offset (COORD), the size of each chunk diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 8ddb5ee..5d1e0c2 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -56,8 +56,6 @@ H5_DLL hsize_t H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, const hsize_t *offset, hsize_t *stride); -H5_DLL htri_t H5VM_hyper_disjointp(unsigned n, const hsize_t *offset1, - const uint32_t *size1, const hsize_t *offset2, const uint32_t *size2); H5_DLL htri_t H5VM_hyper_eq(unsigned n, const hsize_t *offset1, const hsize_t *size1, const hsize_t *offset2, const hsize_t *size2); @@ -87,10 +85,14 @@ H5_DLL hsize_t H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset); H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset); +H5_DLL herr_t H5VM_array_calc_pre(hsize_t offset, unsigned n, + const hsize_t *down, hsize_t *coords); H5_DLL herr_t H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *coords); H5_DLL hsize_t H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, const hsize_t *down_nchunks); +H5_DLL void H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, + const uint32_t *chunk, hsize_t *scaled); H5_DLL hsize_t H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *scaled); H5_DLL ssize_t H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 617e614..ea7a9ca 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -329,6 +329,7 @@ main(int argc, char *argv[]) */ H5B_subid_t subtype = (H5B_subid_t)sig[H5_SIZEOF_MAGIC]; unsigned ndims; + uint32_t dim[H5O_LAYOUT_NDIMS]; switch(subtype) { case H5B_SNODE_ID: @@ -337,6 +338,7 @@ main(int argc, char *argv[]) HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); HDfprintf(stderr, "B-tree symbol table node usage:\n"); HDfprintf(stderr, "\th5debug
\n\n"); + HDexit(4); } /* end if */ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); @@ -347,12 +349,37 @@ main(int argc, char *argv[]) if(extra == 0) { HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); HDfprintf(stderr, "B-tree chunked storage node usage:\n"); - HDfprintf(stderr, "\th5debug <# of dimensions>\n"); + HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); HDexit(4); } /* end if */ + /* Build array of chunk dimensions */ ndims = (unsigned)extra; - status = H5D_btree_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims); + dim[0] = extra2; + if(ndims > 1) + dim[1] = extra3; + if(ndims > 2) + dim[2] = extra4; + + /* Check for dimension error */ + if(ndims > 3) { + HDfprintf(stderr, "ERROR: Only 3 dimensions support currently (fix h5debug)\n"); + HDfprintf(stderr, "B-tree chunked storage node usage:\n"); + HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); + HDexit(4); + } /* end for */ + for(u = 0; u < ndims; u++) + if(0 == dim[u]) { + HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n"); + HDfprintf(stderr, "B-tree chunked storage node usage:\n"); + HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); + HDexit(4); + } /* end if */ + + /* Set the last dimension (the element size) to zero */ + dim[ndims] = 0; + + status = H5D_btree_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims, dim); break; default: @@ -491,7 +518,7 @@ main(int argc, char *argv[]) const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); - /* Check for enough valid parameters */ + /* Check for enough valid parameters */ if(extra == 0) { HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); HDfprintf(stderr, "Extensible array header block usage:\n"); @@ -559,11 +586,11 @@ main(int argc, char *argv[]) const H5FA_class_t *cls = get_H5FA_class(sig); HDassert(cls); - /* Check for enough valid parameters */ + /* Check for enough valid parameters */ if(extra == 0) { - HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); + HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); HDfprintf(stderr, "Fixed array header block usage:\n"); - HDfprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ -- cgit v0.12 From a86910deac84fe71cedc02686195a9321b6a820e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 00:32:55 -0500 Subject: [svn-r27060] Description: Clean up obsolete and unsupported versions of GCC, and update for GCC 5.1 release. Tested on: Mac OSX/64 10.10.3 (amazon) w/C++, FORTRAN, serial, production & parallel (gcc 5.1 not available on other systems) --- config/gnu-flags | 251 ++++++++++++++++++++----------------------------------- 1 file changed, 90 insertions(+), 161 deletions(-) diff --git a/config/gnu-flags b/config/gnu-flags index 6c33808..ec7b9b2 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -19,10 +19,10 @@ # if the compiler is not GNU; otherwise `cc_flags_set' is set to `yes' # -# Get the compiler version in a way that works for gcc, egcs, and -# pgcc unless a compiler version is already known +# Get the compiler version in a way that works for gcc +# unless a compiler version is already known # -# cc_vendor: The compiler name: gcc, egcs, or pgcc +# cc_vendor: The compiler name: gcc # cc_version: Version number: 2.91.60, 2.7.2.1 # if test X = "X$cc_flags_set"; then @@ -55,61 +55,9 @@ if test X = "X$cc_flags_set"; then cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` fi -# GCC compilers before gcc-2.8.1 have problems with `long long'. -if test gcc = "$cc_vendor" -a "$cc_vers_all" -lt 2008001; then - cat < `double' conversions. -elif test gcc = "$cc_vendor" -a "$cc_vers_all" -eq 2096000; then - cat < Date: Thu, 14 May 2015 11:51:20 -0500 Subject: [svn-r27064] HDFFV-9327: Refactor compiler flags to config file. Tested: local linux --- CMakeLists.txt | 259 +++------------------------------- MANIFEST | 17 +-- config/cmake/HDFCompilerFlags.cmake | 268 ++++++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+), 250 deletions(-) create mode 100644 config/cmake/HDFCompilerFlags.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a3d537c..33b4bca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ endif () # dependencies to this variable so that external projects pick them up # # HDF5_EXTERNAL_LIB_PREFIX : -# If the parent project needs to install hdf libraries, but avoid +# If the parent project needs to install hdf libraries, but avoid # name conflicts with system versions, then a prefix may be added # to ensure that the correct versions configured are used. # @@ -71,8 +71,8 @@ endif () # # Setup all necessary overrides for zlib so that HDF5 uses our # # internally compiled zlib rather than any other version # if (HDF5_ENABLE_Z_LIB_SUPPORT) -# # We must tell the main HDF5 library that it depends on our zlib -# set (HDF5_LIB_DEPENDENCIES vtkzlib) +# # We must tell the main HDF5 library that it depends on our zlib +# set (HDF5_LIB_DEPENDENCIES vtkzlib) # # Override the zlib header file # if (VTK_USE_SYSTEM_ZLIB) # set (H5_ZLIB_HEADER "zlib.h") @@ -83,7 +83,7 @@ endif () # set (ZLIB_LIBRARIES vtkzlib) # endif (VTK_USE_SYSTEM_ZLIB) # endif (HDF5_ENABLE_Z_LIB_SUPPORT) -# +# # # Add the sub project # add_subdirectory (Utilities/hdf5-1.8) #----------------------------------------------------------------------------- @@ -264,7 +264,7 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use -# by other projects using FindHDF5. +# by other projects using FindHDF5. #----------------------------------------------------------------------------- if (NOT HDF5_EXPORTED_TARGETS) set (HDF5_EXPORTED_TARGETS "hdf5-targets") @@ -322,7 +322,7 @@ option (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" O if (HDF5_ENABLE_COVERAGE) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") - set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") + set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") endif (HDF5_ENABLE_COVERAGE) #----------------------------------------------------------------------------- @@ -331,7 +331,7 @@ endif (HDF5_ENABLE_COVERAGE) # option (HDF5_ENABLE_USING_DMALLOC "Indicate that dmalloc is used" OFF) # if (HDF5_ENABLE_USING_DMALLOC) # find_package (DMALLOC) -# set (H5_HAVE_DMALLOC DMALLOC_FOUND) +# set (H5_HAVE_DMALLOC DMALLOC_FOUND) # endif (HDF5_ENABLE_USING_DMALLOC) #----------------------------------------------------------------------------- @@ -339,7 +339,7 @@ endif (HDF5_ENABLE_COVERAGE) #----------------------------------------------------------------------------- option (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) if (HDF5_ENABLE_USING_MEMCHECKER) - set (H5_USING_MEMCHECKER 1) + set (H5_USING_MEMCHECKER 1) endif (HDF5_ENABLE_USING_MEMCHECKER) #----------------------------------------------------------------------------- @@ -347,9 +347,9 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - set (H5_NO_DEPRECATED_SYMBOLS 0) + set (H5_NO_DEPRECATED_SYMBOLS 0) else (HDF5_ENABLE_DEPRECATED_SYMBOLS) - set (H5_NO_DEPRECATED_SYMBOLS 1) + set (H5_NO_DEPRECATED_SYMBOLS 1) endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) #----------------------------------------------------------------------------- @@ -413,24 +413,6 @@ else (CMAKE_BUILD_TYPE MATCHES Debug) endif (CMAKE_BUILD_TYPE MATCHES Debug) #----------------------------------------------------------------------------- -# Compiler specific flags : Shouldn't there be compiler tests for these -#----------------------------------------------------------------------------- -if (CMAKE_COMPILER_IS_GNUCC) - if (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -finline-functions -fno-common") - else (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -fomit-frame-pointer -finline-functions -fno-common") - endif (CMAKE_BUILD_TYPE MATCHES Debug) -endif (CMAKE_COMPILER_IS_GNUCC) -if (CMAKE_COMPILER_IS_GNUCXX) - if (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -finline-functions -fno-common") - else (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -fno-common") - endif (CMAKE_BUILD_TYPE MATCHES Debug) -endif (CMAKE_COMPILER_IS_GNUCXX) - -#----------------------------------------------------------------------------- # Option to embed library info into executables #----------------------------------------------------------------------------- option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON) @@ -438,214 +420,7 @@ if (HDF5_ENABLE_EMBEDDED_LIBINFO) set (H5_HAVE_EMBEDDED_LIBINFO 1) endif (HDF5_ENABLE_EMBEDDED_LIBINFO) -#----------------------------------------------------------------------------- -# Option to allow the user to disable compiler warnings -#----------------------------------------------------------------------------- -option (HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF) -if (HDF5_DISABLE_COMPILER_WARNINGS) - # MSVC uses /w to suppress warnings. It also complains if another - # warning level is given, so remove it. - if (MSVC) - set (HDF5_WARNINGS_BLOCKED 1) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") - endif (MSVC) - if (WIN32) - add_definitions (-D_CRT_SECURE_NO_WARNINGS) - endif (WIN32) - # Borland uses -w- to suppress warnings. - if (BORLAND) - set (HDF5_WARNINGS_BLOCKED 1) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") - endif (BORLAND) - - # Most compilers use -w to suppress warnings. - if (NOT HDF5_WARNINGS_BLOCKED) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") - endif (NOT HDF5_WARNINGS_BLOCKED) -endif (HDF5_DISABLE_COMPILER_WARNINGS) - -#----------------------------------------------------------------------------- -# CDash is configured to only allow 3000 warnings, so -# break into groups (from the config/gnu-flags file) -#----------------------------------------------------------------------------- -if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) - if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline") - else (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") - endif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - # Append warning flags - # Don't use the '-Wtraditional' flag, we're way past having K&R C code - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") - # Don't use the '-Wtraditional-conversion' flag, there's too many warnings - # from GCC's assert macro - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional-conversion") - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #set (H5_CFLAGS "${H5_CFLAGS} -Wfloat-equal -Wmissing-format-attribute -Wpadded") - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wfloat-equal -Wmissing-format-attribute") - - # Append warning flags from gcc-3.2* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn -Wpacked -Wdisabled-optimization") - - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wformat=2") - - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - #set (H5_CFLAGS "${H5_CFLAGS} -Wunreachable-code") - - # Append warning flags from gcc-3.3* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") - - # Append warning flags from gcc-3.4* case - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") - - # Append more extra warning flags that only gcc4.0+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") - - # Append more extra warning flags that only gcc 4.1+ know about - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wunsafe-loop-optimizations -Wc++-compat") - - # Append more extra warning flags that only gcc 4.2+ know about - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wstrict-overflow") - - # Append more extra warning flags that only gcc 4.3+ know about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS3 "${H5_CFLAGS3} -Wlogical-op -Wlarger-than=2048 -Wvla") - - # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") - - # Append more extra warning flags that only gcc 4.5+ know about - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") - - # Append more extra warning flags that only gcc 4.6+ know about - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines") - - # Append more extra warning flags that only gcc 4.7+ know about - set (H5_CFLAGS5 "${H5_CFLAGS5} -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") -endif (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable all warnings -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) -if (HDF5_ENABLE_ALL_WARNINGS) - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall") - else (MSVC) - if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}") - endif (CMAKE_COMPILER_IS_GNUCC) - endif (MSVC) -endif (HDF5_ENABLE_ALL_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) -if (HDF5_ENABLE_GROUPZERO_WARNINGS) - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1") - else (MSVC) - if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") - endif (CMAKE_COMPILER_IS_GNUCC) - endif (MSVC) -endif (HDF5_ENABLE_GROUPZERO_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) -if (HDF5_ENABLE_GROUPONE_WARNINGS) - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") - else (MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPONE_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) -if (HDF5_ENABLE_GROUPTWO_WARNINGS) - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") - else (MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPTWO_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) -if (HDF5_ENABLE_GROUPTHREE_WARNINGS) - if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") - else (MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}") - endif (MSVC) -endif (HDF5_ENABLE_GROUPTHREE_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) -if (HDF5_ENABLE_GROUPFOUR_WARNINGS) - if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPFOUR_WARNINGS) - -#----------------------------------------------------------------------------- -# Option to allow the user to enable warnings by groups -#----------------------------------------------------------------------------- -option (HDF5_ENABLE_GROUPFIVE_WARNINGS "Enable group five warnings" OFF) -if (HDF5_ENABLE_GROUPFIVE_WARNINGS) - if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS5}") - endif (NOT MSVC) -endif (HDF5_ENABLE_GROUPFIVE_WARNINGS) - -#----------------------------------------------------------------------------- -# This is in here to help some of the GCC based IDES like Eclipse -# and code blocks parse the compiler errors and warnings better. -#----------------------------------------------------------------------------- -if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") -endif (CMAKE_COMPILER_IS_GNUCC) -if (CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") -endif (CMAKE_COMPILER_IS_GNUCXX) +include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) #----------------------------------------------------------------------------- # All libs/tests/examples need the main include directories @@ -722,7 +497,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) PACKAGE_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) endif (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) - + if (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) PACKAGE_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT}) endif (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) @@ -730,7 +505,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Option to use threadsafe -# Note: Currently CMake only allows configuring of threadsafe on +# Note: Currently CMake only allows configuring of threadsafe on # non-Cygwin WINDOWS. #----------------------------------------------------------------------------- if (WIN32) @@ -764,7 +539,7 @@ endif (WIN32) # ----------------------------------------------------------------------- # wrapper script variables -# +# #set (CFLAGS "${C_DEFINES}") #set (CXXFLAGS "${CXX_DEFINES}") @@ -811,7 +586,7 @@ if (BUILD_TESTING) option (HDF5_TEST_FHEAP_VFD "Execute tests with different VFDs" ON) mark_as_advanced (HDF5_TEST_FHEAP_VFD) endif (HDF5_TEST_VFD) - + include (${HDF5_SOURCE_DIR}/CTestConfig.cmake) configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) endif (BUILD_TESTING) @@ -871,7 +646,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for # ----------------------------------------------------------------------- # wrapper script variables - # + # # set (FCFLAGS "${Fortran_DEFINES}") add_subdirectory (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) @@ -908,7 +683,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") #----------------------------------------------------------------------------- -# Check if Fortran's default real is double precision. If it is and HL is +# Check if Fortran's default real is double precision. If it is and HL is # being built then configure should fail due to bug HDFFV-889. #----------------------------------------------------------------------------- if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB ) diff --git a/MANIFEST b/MANIFEST index 68f95d0..3fd7242 100644 --- a/MANIFEST +++ b/MANIFEST @@ -13,7 +13,7 @@ # access to either file, you may request a copy from help@hdfgroup.org. # #------------------------------------------------------------------------------ -# This is the list of files that are part of HDF5 source distribution. +# This is the list of files that are part of HDF5 source distribution. # All files have a `./' prefix and appear in lexicographic order. # Lines that end with _DO_NOT_DISTRIBUTE_ will not be included in a # release. Blank lines and comments are ignored. Comments must start @@ -574,7 +574,7 @@ ./src/H5Bdbg.c ./src/H5Bpkg.h ./src/H5Bprivate.h -./src/H5Bpublic.h +./src/H5Bpublic.h ./src/H5B2.c ./src/H5B2cache.c ./src/H5B2dbg.c @@ -582,7 +582,7 @@ ./src/H5B2int.c ./src/H5B2pkg.h ./src/H5B2private.h -./src/H5B2public.h +./src/H5B2public.h ./src/H5B2stat.c ./src/H5B2test.c ./src/H5C.c @@ -736,7 +736,7 @@ ./src/H5HFman.c ./src/H5HFpkg.h ./src/H5HFprivate.h -./src/H5HFpublic.h +./src/H5HFpublic.h ./src/H5HFsection.c ./src/H5HFspace.c ./src/H5HFstat.c @@ -1429,8 +1429,8 @@ ./tools/testfiles/tattrintsize.ddl ./tools/testfiles/tattrintsize.h5 ./tools/testfiles/tattrreg.h5 -./tools/testfiles/tattrreg.ddl -./tools/testfiles/tattrregR.ddl +./tools/testfiles/tattrreg.ddl +./tools/testfiles/tattrregR.ddl ./tools/testfiles/tbigdims.ddl ./tools/testfiles/tbigdims.h5 ./tools/testfiles/tbinary.h5 @@ -1469,8 +1469,8 @@ ./tools/testfiles/tcompound2.h5 ./tools/testfiles/tcompound_complex.h5 ./tools/testfiles/tdatareg.h5 -./tools/testfiles/tdatareg.ddl -./tools/testfiles/tdataregR.ddl +./tools/testfiles/tdatareg.ddl +./tools/testfiles/tdataregR.ddl ./tools/testfiles/tdeflate.ddl ./tools/testfiles/tdset-1.ddl ./tools/testfiles/tdset-2.ddl @@ -2397,6 +2397,7 @@ ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in ./config/cmake/hdf5-config-version.cmake.in +./config/cmake/HDFCompilerFlags.cmake ./config/cmake/HDF5Macros.cmake ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/mccacheinit.cmake diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake new file mode 100644 index 0000000..6f37a48 --- /dev/null +++ b/config/cmake/HDFCompilerFlags.cmake @@ -0,0 +1,268 @@ +#----------------------------------------------------------------------------- +# Compiler specific flags : Shouldn't there be compiler tests for these +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCC) + if (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -ftrapv -fno-common") + else (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") + endif () + endif (CMAKE_BUILD_TYPE MATCHES Debug) +endif (CMAKE_COMPILER_IS_GNUCC) +if (CMAKE_COMPILER_IS_GNUCXX) + if (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99 -ftrapv -fno-common") + else (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") + endif () + endif (CMAKE_BUILD_TYPE MATCHES Debug) +endif (CMAKE_COMPILER_IS_GNUCXX) + +#----------------------------------------------------------------------------- +# Option to allow the user to disable compiler warnings +#----------------------------------------------------------------------------- +option (HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF) +if (HDF5_DISABLE_COMPILER_WARNINGS) + # MSVC uses /w to suppress warnings. It also complains if another + # warning level is given, so remove it. + if (MSVC) + set (HDF5_WARNINGS_BLOCKED 1) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") + endif (MSVC) + if (WIN32) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + endif (WIN32) + # Borland uses -w- to suppress warnings. + if (BORLAND) + set (HDF5_WARNINGS_BLOCKED 1) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") + endif (BORLAND) + + # Most compilers use -w to suppress warnings. + if (NOT HDF5_WARNINGS_BLOCKED) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") + endif (NOT HDF5_WARNINGS_BLOCKED) +endif (HDF5_DISABLE_COMPILER_WARNINGS) + +#----------------------------------------------------------------------------- +# CDash is configured to only allow 3000 warnings, so +# break into groups (from the config/gnu-flags file) +#----------------------------------------------------------------------------- +if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) + if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline") + else (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") + endif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + # Append warning flags + # Don't use the '-Wtraditional' flag, we're way past having K&R C code + # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") + # Don't use the '-Wtraditional-conversion' flag, there's too many warnings + # from GCC's assert macro + # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional-conversion") + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #set (H5_CFLAGS "${H5_CFLAGS} -Wfloat-equal -Wmissing-format-attribute -Wpadded") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wfloat-equal -Wmissing-format-attribute") + + # Append warning flags from gcc-3.2* case + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn -Wpacked -Wdisabled-optimization") + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wformat=2") + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wunreachable-code") + endif() + + # Append warning flags from gcc-3.3* case + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") + + # Append warning flags from gcc-3.4* case + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") + + # Append more extra warning flags that only gcc4.0+ know about + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") + + # Append more extra warning flags that only gcc 4.1+ know about + set (H5_CFLAGS3 "${H5_CFLAGS3} -Wunsafe-loop-optimizations -Wc++-compat") + + # Append more extra warning flags that only gcc 4.2+ know about + set (H5_CFLAGS3 "${H5_CFLAGS3} -Wstrict-overflow") + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + set (H5_CFLAGS3 "${H5_CFLAGS3} -Wlogical-op -Wlarger-than=2048 -Wvla") + + # Append more extra warning flags that only gcc 4.4+ know about + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + + # Append more extra warning flags that only gcc 4.5+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") + endif() + + # Append more extra warning flags that only gcc 4.6+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) + set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines") + endif() + + # Append more extra warning flags that only gcc 4.7+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + set (H5_CFLAGS5 "${H5_CFLAGS5} -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") + endif() + + # Append more extra warning flags that only gcc 4.8+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + set (H5_CFLAGS5 "${H5_CFLAGS5} -Wsuggest-attribute=format") + endif() + + # Append more extra warning flags that only gcc 4.9+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) + set (H5_CFLAGS5 "${H5_CFLAGS5} -Wdate-time -Wopenmp-simd") + endif() + + # (There was no release of gcc 5.0) + + # Append more extra warning flags that only gcc 5.1+ know about + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) + set (H5_CFLAGS6 "${H5_CFLAGS6} -Warray-bounds=2 -Wc99-c11-compat") + endif() + +endif (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable all warnings +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) +if (HDF5_ENABLE_ALL_WARNINGS) + if (MSVC) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall") + else (MSVC) + if (CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}") + endif (CMAKE_COMPILER_IS_GNUCC) + endif (MSVC) +endif (HDF5_ENABLE_ALL_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) +if (HDF5_ENABLE_GROUPZERO_WARNINGS) + if (MSVC) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1") + else (MSVC) + if (CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") + endif (CMAKE_COMPILER_IS_GNUCC) + endif (MSVC) +endif (HDF5_ENABLE_GROUPZERO_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) +if (HDF5_ENABLE_GROUPONE_WARNINGS) + if (MSVC) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") + else (MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}") + endif (MSVC) +endif (HDF5_ENABLE_GROUPONE_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) +if (HDF5_ENABLE_GROUPTWO_WARNINGS) + if (MSVC) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") + else (MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}") + endif (MSVC) +endif (HDF5_ENABLE_GROUPTWO_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) +if (HDF5_ENABLE_GROUPTHREE_WARNINGS) + if (MSVC) + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + else (MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}") + endif (MSVC) +endif (HDF5_ENABLE_GROUPTHREE_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) +if (HDF5_ENABLE_GROUPFOUR_WARNINGS) + if (NOT MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") + endif (NOT MSVC) +endif (HDF5_ENABLE_GROUPFOUR_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPFIVE_WARNINGS "Enable group five warnings" OFF) +if (HDF5_ENABLE_GROUPFIVE_WARNINGS) + if (NOT MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS5}") + endif (NOT MSVC) +endif (HDF5_ENABLE_GROUPFIVE_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_GROUPSIX_WARNINGS "Enable group six warnings" OFF) +if (HDF5_ENABLE_GROUPSIX_WARNINGS) + if (NOT MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS6}") + endif (NOT MSVC) +endif (HDF5_ENABLE_GROUPSIX_WARNINGS) + +#----------------------------------------------------------------------------- +# This is in here to help some of the GCC based IDES like Eclipse +# and code blocks parse the compiler errors and warnings better. +#----------------------------------------------------------------------------- +if (CMAKE_COMPILER_IS_GNUCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") +endif (CMAKE_COMPILER_IS_GNUCC) +if (CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") +endif (CMAKE_COMPILER_IS_GNUCXX) -- cgit v0.12 From e81f0ade7781aec1960d50202fb838e300da0f96 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:21:58 -0500 Subject: [svn-r27066] Description: Protect gcc 5 debugging options Tested on: MacOSX/64 10.10.3 (amazon) w/gcc 5.1 --- config/gnu-flags | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/gnu-flags b/config/gnu-flags index ec7b9b2..5f10519 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -111,7 +111,14 @@ case "$cc_vendor-$cc_version" in PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-Og -g -ftrapv -fno-common" + case "$cc_vendor-$cc_version" in + gcc-5.*) + DEBUG_CFLAGS="-Og -g -ftrapv -fno-common" + ;; + *) + DEBUG_CFLAGS="-g" + ;; + esac #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined" DEBUG_CPPFLAGS= -- cgit v0.12 From 3d5e75b0930bc87589727ce941e3e1f79a36bf20 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:33:12 -0500 Subject: [svn-r27068] Description: Clean up the H5A interface code, to better align with v3 metadata cache changes. Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial & parallel --- src/H5A.c | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++--- src/H5Abtree2.c | 132 ++++++++++++------------ src/H5Adense.c | 2 +- src/H5Aint.c | 307 ++++---------------------------------------------------- src/H5Apkg.h | 7 +- 5 files changed, 370 insertions(+), 370 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index d474234..3b993ec 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -21,7 +21,7 @@ #define H5O_PACKAGE /*suppress error about including H5Opkg */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5A_init_interface +#define H5_INTERFACE_INIT_FUNC H5A__init_interface /***********/ @@ -63,6 +63,9 @@ typedef struct H5A_iter_cb1 { /* Local Prototypes */ /********************/ +static herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id); +static herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id); +static ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf); /*********************/ /* Package Variables */ @@ -125,9 +128,9 @@ done: /*-------------------------------------------------------------------------- NAME - H5A_init_interface -- Initialize interface-specific information + H5A__init_interface -- Initialize interface-specific information USAGE - herr_t H5A_init_interface() + herr_t H5A__init_interface() RETURNS Non-negative on success/Negative on failure @@ -136,11 +139,11 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5A_init_interface(void) +H5A__init_interface(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Create attribute ID type. @@ -150,7 +153,7 @@ H5A_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A_init_interface() */ +} /* end H5A__init_interface() */ /*-------------------------------------------------------------------------- @@ -407,7 +410,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t UNUSED aapl_id) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ - if(H5A_open_common(&loc, attr) < 0) + if(H5A__open_common(&loc, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize attribute") /* Register the attribute and get an ID for it */ @@ -595,7 +598,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") /* Go write the actual data to the attribute */ - if((ret_value = H5A_write(attr, mem_type, buf, H5AC_dxpl_id)) < 0) + if((ret_value = H5A__write(attr, mem_type, buf, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -605,6 +608,120 @@ done: /*-------------------------------------------------------------------------- NAME + H5A__write + PURPOSE + Actually write out data to an attribute + USAGE + herr_t H5A__write (attr, mem_type, buf) + H5A_t *attr; IN: Attribute to write + const H5T_t *mem_type; IN: Memory datatype of buffer + const void *buf; IN: Buffer of data to write + RETURNS + Non-negative on success/Negative on failure + + DESCRIPTION + This function writes a complete attribute to disk. +--------------------------------------------------------------------------*/ +static herr_t +H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) +{ + uint8_t *tconv_buf = NULL; /* datatype conv buffer */ + hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */ + uint8_t *bkg_buf = NULL; /* temp conversion buffer */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + H5T_path_t *tpath = NULL; /* conversion information*/ + hid_t src_id = -1, dst_id = -1;/* temporary type atoms */ + size_t src_type_size; /* size of source type */ + size_t dst_type_size; /* size of destination type*/ + size_t buf_size; /* desired buffer size */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, attr->oloc.addr, FAIL) + + HDassert(attr); + HDassert(mem_type); + HDassert(buf); + + /* Get # of elements for attribute's dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); + + /* If there's actually data elements for the attribute, make a copy of the data passed in */ + if(nelmts > 0) { + /* Get the memory and file datatype sizes */ + src_type_size = H5T_GET_SIZE(mem_type); + dst_type_size = H5T_GET_SIZE(attr->shared->dt); + + /* Convert memory buffer into disk buffer */ + /* Set up type conversion function */ + if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt, NULL, NULL, dxpl_id, FALSE))) + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") + + /* Check for type conversion required */ + if(!H5T_path_noop(tpath)) { + if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 || + (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + + /* Get the maximum buffer size needed and allocate it */ + buf_size = nelmts * MAX(src_type_size, dst_type_size); + if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Copy the user's data into the buffer for conversion */ + HDmemcpy(tconv_buf, buf, (src_type_size * nelmts)); + + /* Perform datatype conversion */ + if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") + + /* Free the previous attribute data buffer, if there is one */ + if(attr->shared->data) + attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data); + + /* Set the pointer to the attribute data to the converted information */ + attr->shared->data = tconv_buf; + tconv_owned = TRUE; + } /* end if */ + /* No type conversion necessary */ + else { + HDassert(dst_type_size == src_type_size); + + /* Allocate the attribute buffer, if there isn't one */ + if(attr->shared->data == NULL) + if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Copy the attribute data into the user's buffer */ + HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts)); + } /* end else */ + + /* Modify the attribute in the object header */ + if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute") + } /* end if */ + +done: + /* Release resources */ + if(src_id >= 0 && H5I_dec_ref(src_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(tconv_buf && !tconv_owned) + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); + if(bkg_buf) + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); + + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) +} /* H5A__write() */ + + +/*-------------------------------------------------------------------------- + NAME H5Aread PURPOSE Read in data from an attribute @@ -638,7 +755,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") /* Go write the actual data to the attribute */ - if((ret_value = H5A_read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5A__read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -648,6 +765,109 @@ done: /*-------------------------------------------------------------------------- NAME + H5A__read + PURPOSE + Actually read in data from an attribute + USAGE + herr_t H5A__read (attr, mem_type, buf) + H5A_t *attr; IN: Attribute to read + const H5T_t *mem_type; IN: Memory datatype of buffer + void *buf; IN: Buffer for data to read + RETURNS + Non-negative on success/Negative on failure + + DESCRIPTION + This function reads a complete attribute from disk. +--------------------------------------------------------------------------*/ +static herr_t +H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) +{ + uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ + uint8_t *bkg_buf = NULL; /* background buffer */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute*/ + H5T_path_t *tpath = NULL; /* type conversion info */ + hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/ + size_t src_type_size; /* size of source type */ + size_t dst_type_size; /* size of destination type */ + size_t buf_size; /* desired buffer size */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(attr); + HDassert(mem_type); + HDassert(buf); + + /* Create buffer for data to store on disk */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); + + if(nelmts > 0) { + /* Get the memory and file datatype sizes */ + src_type_size = H5T_GET_SIZE(attr->shared->dt); + dst_type_size = H5T_GET_SIZE(mem_type); + + /* Check if the attribute has any data yet, if not, fill with zeroes */ + if(attr->obj_opened && !attr->shared->data) + HDmemset(buf, 0, (dst_type_size * nelmts)); + else { /* Attribute exists and has a value */ + /* Convert memory buffer into disk buffer */ + /* Set up type conversion function */ + if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type, NULL, NULL, dxpl_id, FALSE))) + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") + + /* Check for type conversion required */ + if(!H5T_path_noop(tpath)) { + if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 || + (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + + /* Get the maximum buffer size needed and allocate it */ + buf_size = nelmts * MAX(src_type_size, dst_type_size); + if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Copy the attribute data into the buffer for conversion */ + HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); + + /* Perform datatype conversion. */ + if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") + + /* Copy the converted data into the user's buffer */ + HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts)); + } /* end if */ + /* No type conversion necessary */ + else { + HDassert(dst_type_size == src_type_size); + + /* Copy the attribute data into the user's buffer */ + HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts)); + } /* end else */ + } /* end else */ + } /* end if */ + +done: + /* Release resources */ + if(src_id >= 0 && H5I_dec_ref(src_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(tconv_buf) + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); + if(bkg_buf) + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5A__read() */ + + +/*-------------------------------------------------------------------------- + NAME H5Aget_space PURPOSE Gets a copy of the dataspace for an attribute @@ -799,7 +1019,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") /* Call private function in turn */ - if(0 > (ret_value = H5A_get_name(my_attr, buf_size, buf))) + if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf))) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") done: @@ -807,6 +1027,52 @@ done: } /* H5Aget_name() */ +/*-------------------------------------------------------------------------- + NAME + H5A__get_name + PURPOSE + Private function for H5Aget_name. Gets a copy of the name for an + attribute + RETURNS + This function returns the length of the attribute's name (which may be + longer than 'buf_size') on success or negative for failure. + DESCRIPTION + This function retrieves the name of an attribute for an attribute ID. + Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string + terminator. If the name of the attribute is longer than 'buf_size'-1, + the string terminator is stored in the last position of the buffer to + properly terminate the string. +--------------------------------------------------------------------------*/ +static ssize_t +H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) +{ + size_t copy_len, nbytes; + ssize_t ret_value; + + FUNC_ENTER_STATIC_NOERR + + /* get the real attribute length */ + nbytes = HDstrlen(attr->shared->name); + HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/ + + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(buf_size - 1, nbytes); + + /* Copy all/some of the name */ + if(buf && copy_len > 0) { + HDmemcpy(buf, attr->shared->name, copy_len); + + /* Terminate the string */ + buf[copy_len]='\0'; + } /* end if */ + + /* Set return value */ + ret_value = (ssize_t)nbytes; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5A_get_name() */ + + /*------------------------------------------------------------------------- * Function: H5Aget_name_by_idx * @@ -942,7 +1208,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Get the attribute information */ - if(H5A_get_info(attr, ainfo) < 0) + if(H5A__get_info(attr, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -996,7 +1262,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ - if(H5A_get_info(attr, ainfo) < 0) + if(H5A__get_info(attr, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1058,7 +1324,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ - if(H5A_get_info(attr, ainfo) < 0) + if(H5A__get_info(attr, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 9b7dba6..5e74e55 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -79,27 +79,27 @@ typedef struct H5A_fh_ud_cmp_t { /* v2 B-tree function callbacks */ /* v2 B-tree driver callbacks for 'creation order' index */ -static herr_t H5A_dense_btree2_corder_store(void *native, const void *udata); -static herr_t H5A_dense_btree2_corder_compare(const void *rec1, const void *rec2); -static herr_t H5A_dense_btree2_corder_encode(uint8_t *raw, const void *native, +static herr_t H5A__dense_btree2_corder_store(void *native, const void *udata); +static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2); +static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5A_dense_btree2_corder_decode(const uint8_t *raw, void *native, +static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5A_dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, +static herr_t H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ -static herr_t H5A_dense_btree2_name_store(void *native, const void *udata); -static herr_t H5A_dense_btree2_name_compare(const void *rec1, const void *rec2); -static herr_t H5A_dense_btree2_name_encode(uint8_t *raw, const void *native, +static herr_t H5A__dense_btree2_name_store(void *native, const void *udata); +static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2); +static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5A_dense_btree2_name_decode(const uint8_t *raw, void *native, +static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5A_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, +static herr_t H5A__dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); /* Fractal heap function callbacks */ -static herr_t H5A_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); +static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); /*********************/ @@ -112,11 +112,11 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5A_dense_btree2_name_store, /* Record storage callback */ - H5A_dense_btree2_name_compare, /* Record comparison callback */ - H5A_dense_btree2_name_encode, /* Record encoding callback */ - H5A_dense_btree2_name_decode, /* Record decoding callback */ - H5A_dense_btree2_name_debug, /* Record debugging callback */ + H5A__dense_btree2_name_store, /* Record storage callback */ + H5A__dense_btree2_name_compare, /* Record comparison callback */ + H5A__dense_btree2_name_encode, /* Record encoding callback */ + H5A__dense_btree2_name_decode, /* Record decoding callback */ + H5A__dense_btree2_name_debug, /* Record debugging callback */ NULL, /* Create debugging context */ NULL /* Destroy debugging context */ }}; @@ -128,11 +128,11 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ sizeof(H5A_dense_bt2_corder_rec_t),/* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5A_dense_btree2_corder_store, /* Record storage callback */ - H5A_dense_btree2_corder_compare, /* Record comparison callback */ - H5A_dense_btree2_corder_encode, /* Record encoding callback */ - H5A_dense_btree2_corder_decode, /* Record decoding callback */ - H5A_dense_btree2_corder_debug, /* Record debugging callback */ + H5A__dense_btree2_corder_store, /* Record storage callback */ + H5A__dense_btree2_corder_compare, /* Record comparison callback */ + H5A__dense_btree2_corder_encode, /* Record encoding callback */ + H5A__dense_btree2_corder_decode, /* Record decoding callback */ + H5A__dense_btree2_corder_debug, /* Record debugging callback */ NULL, /* Create debugging context */ NULL /* Destroy debugging context */ }}; @@ -150,7 +150,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ /*------------------------------------------------------------------------- - * Function: H5A_dense_fh_name_cmp + * Function: H5A__dense_fh_name_cmp * * Purpose: Compares the name of a attribute in a fractal heap to another * name @@ -164,14 +164,14 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ *------------------------------------------------------------------------- */ static herr_t -H5A_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) +H5A__dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) { H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */ H5A_t *attr = NULL; /* Pointer to attribute created from heap object */ hbool_t took_ownership = FALSE; /* Whether the "found" operator took ownership of the attribute */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode attribute information */ if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj))) @@ -200,11 +200,11 @@ done: H5O_msg_free(H5O_ATTR_ID, attr); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A_dense_fh_name_cmp() */ +} /* end H5A__dense_fh_name_cmp() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_name_store + * Function: H5A__dense_btree2_name_store * * Purpose: Store user information into native record for v2 B-tree * @@ -217,12 +217,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_name_store(void *_nrecord, const void *_udata) +H5A__dense_btree2_name_store(void *_nrecord, const void *_udata) { const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata; H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->id = udata->id; @@ -231,11 +231,11 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata) nrecord->hash = udata->common.name_hash; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_name_store() */ +} /* H5A__dense_btree2_name_store() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_name_compare + * Function: H5A__dense_btree2_name_compare * * Purpose: Compare two native information records, according to some key * @@ -249,13 +249,13 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) +H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec; herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(bt2_udata); @@ -294,7 +294,7 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) HDassert(fheap); /* Check if the user's attribute and the B-tree's attribute have the same name */ - status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A_dense_fh_name_cmp, &fh_udata); + status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata); HDassert(status >= 0); /* Callback will set comparison value */ @@ -302,11 +302,11 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) } /* end else */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5A_dense_btree2_name_compare() */ +} /* H5A__dense_btree2_name_compare() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_name_encode + * Function: H5A__dense_btree2_name_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -319,11 +319,11 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx) +H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx) { const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); @@ -333,11 +333,11 @@ H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ct UINT32ENCODE(raw, nrecord->hash) FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_name_encode() */ +} /* H5A__dense_btree2_name_encode() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_name_decode + * Function: H5A__dense_btree2_name_decode * * Purpose: Decode raw disk form of record into native form * @@ -350,11 +350,11 @@ H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ct *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx) +H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx) { H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); @@ -364,11 +364,11 @@ H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ct UINT32DECODE(raw, nrecord->hash) FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_name_decode() */ +} /* H5A__dense_btree2_name_decode() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_name_debug + * Function: H5A__dense_btree2_name_debug * * Purpose: Debug native form of record * @@ -381,23 +381,23 @@ H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ct *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5A__dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata) { const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u, %08lx}\n", indent, "", fwidth, "Record:", (hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder, (unsigned long)nrecord->hash); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_name_debug() */ +} /* H5A__dense_btree2_name_debug() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_corder_store + * Function: H5A__dense_btree2_corder_store * * Purpose: Store user information into native record for v2 B-tree * @@ -410,12 +410,12 @@ H5A_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dx *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata) +H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata) { const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata; H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->id = udata->id; @@ -423,11 +423,11 @@ H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata) nrecord->corder = udata->common.corder; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_corder_store() */ +} /* H5A__dense_btree2_corder_store() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_corder_compare + * Function: H5A__dense_btree2_corder_compare * * Purpose: Compare two native information records, according to some key * @@ -441,13 +441,13 @@ H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) +H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec; herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(bt2_udata); @@ -462,11 +462,11 @@ H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5A_dense_btree2_corder_compare() */ +} /* H5A__dense_btree2_corder_compare() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_corder_encode + * Function: H5A__dense_btree2_corder_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -479,11 +479,11 @@ H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx) +H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx) { const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); @@ -492,11 +492,11 @@ H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED * UINT32ENCODE(raw, nrecord->corder) FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_corder_encode() */ +} /* H5A__dense_btree2_corder_encode() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_corder_decode + * Function: H5A__dense_btree2_corder_decode * * Purpose: Decode raw disk form of record into native form * @@ -509,11 +509,11 @@ H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED * *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx) +H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx) { H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); @@ -522,11 +522,11 @@ H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED * UINT32DECODE(raw, nrecord->corder) FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_corder_decode() */ +} /* H5A__dense_btree2_corder_decode() */ /*------------------------------------------------------------------------- - * Function: H5A_dense_btree2_corder_debug + * Function: H5A__dense_btree2_corder_debug * * Purpose: Debug native form of record * @@ -539,17 +539,17 @@ H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED * *------------------------------------------------------------------------- */ static herr_t -H5A_dense_btree2_corder_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata) { const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u}\n", indent, "", fwidth, "Record:", (hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5A_dense_btree2_corder_debug() */ +} /* H5A__dense_btree2_corder_debug() */ diff --git a/src/H5Adense.c b/src/H5Adense.c index e0499f5..674ab5d 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -1082,7 +1082,7 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) H5A_info_t ainfo; /* Info for attribute */ /* Get the attribute information */ - if(H5A_get_info(fh_udata.attr, &ainfo) < 0) + if(H5A__get_info(fh_udata.attr, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info") /* Make the application callback */ diff --git a/src/H5Aint.c b/src/H5Aint.c index bfc8eaf..84f7ecd 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -92,7 +92,7 @@ typedef struct { static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); -static herr_t H5A_dense_build_table_cb(const H5A_t *attr, void *_udata); +static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata); static int H5A__attr_cmp_name_inc(const void *attr1, const void *attr2); static int H5A__attr_cmp_name_dec(const void *attr1, const void *attr2); static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2); @@ -283,13 +283,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5A_open_common + * Function: H5A__open_common * * Purpose: * Finishes initializing an attributes the open * * Usage: - * herr_t H5A_open_common(loc, name, dxpl_id) + * herr_t H5A__open_common(loc, name, dxpl_id) * const H5G_loc_t *loc; IN: Pointer to group location for object * H5A_t *attr; IN/OUT: Pointer to attribute to initialize * @@ -301,11 +301,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5A_open_common(const H5G_loc_t *loc, H5A_t *attr) +H5A__open_common(const H5G_loc_t *loc, H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -336,7 +336,7 @@ H5A_open_common(const H5G_loc_t *loc, H5A_t *attr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5A_open_common() */ +} /* H5A__open_common() */ /*------------------------------------------------------------------------- @@ -383,7 +383,7 @@ H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header") /* Finish initializing attribute */ - if(H5A_open_common(&obj_loc, attr) < 0) + if(H5A__open_common(&obj_loc, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute") /* Set return value */ @@ -448,7 +448,7 @@ H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_na HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to load attribute info from object header") /* Finish initializing attribute */ - if(H5A_open_common(loc, attr) < 0) + if(H5A__open_common(loc, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute") /* Set return value */ @@ -468,223 +468,6 @@ done: } /* H5A_open_by_name() */ -/*-------------------------------------------------------------------------- - NAME - H5A_write - PURPOSE - Actually write out data to an attribute - USAGE - herr_t H5A_write (attr, mem_type, buf) - H5A_t *attr; IN: Attribute to write - const H5T_t *mem_type; IN: Memory datatype of buffer - const void *buf; IN: Buffer of data to write - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function writes a complete attribute to disk. ---------------------------------------------------------------------------*/ -herr_t -H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) -{ - uint8_t *tconv_buf = NULL; /* datatype conv buffer */ - hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */ - uint8_t *bkg_buf = NULL; /* temp conversion buffer */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute */ - H5T_path_t *tpath = NULL; /* conversion information*/ - hid_t src_id = -1, dst_id = -1;/* temporary type atoms */ - size_t src_type_size; /* size of source type */ - size_t dst_type_size; /* size of destination type*/ - size_t buf_size; /* desired buffer size */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, attr->oloc.addr, FAIL) - - HDassert(attr); - HDassert(mem_type); - HDassert(buf); - - /* Get # of elements for attribute's dataspace */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); - - /* If there's actually data elements for the attribute, make a copy of the data passed in */ - if(nelmts > 0) { - /* Get the memory and file datatype sizes */ - src_type_size = H5T_GET_SIZE(mem_type); - dst_type_size = H5T_GET_SIZE(attr->shared->dt); - - /* Convert memory buffer into disk buffer */ - /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") - - /* Check for type conversion required */ - if(!H5T_path_noop(tpath)) { - if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 || - (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") - - /* Get the maximum buffer size needed and allocate it */ - buf_size = nelmts * MAX(src_type_size, dst_type_size); - if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") - if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") - - /* Copy the user's data into the buffer for conversion */ - HDmemcpy(tconv_buf, buf, (src_type_size * nelmts)); - - /* Perform datatype conversion */ - if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") - - /* Free the previous attribute data buffer, if there is one */ - if(attr->shared->data) - attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data); - - /* Set the pointer to the attribute data to the converted information */ - attr->shared->data = tconv_buf; - tconv_owned = TRUE; - } /* end if */ - /* No type conversion necessary */ - else { - HDassert(dst_type_size == src_type_size); - - /* Allocate the attribute buffer, if there isn't one */ - if(attr->shared->data == NULL) - if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Copy the attribute data into the user's buffer */ - HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts)); - } /* end else */ - - /* Modify the attribute in the object header */ - if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute") - } /* end if */ - -done: - /* Release resources */ - if(src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(tconv_buf && !tconv_owned) - tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); - if(bkg_buf) - bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - - FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* H5A_write() */ - - -/*-------------------------------------------------------------------------- - NAME - H5A_read - PURPOSE - Actually read in data from an attribute - USAGE - herr_t H5A_read (attr, mem_type, buf) - H5A_t *attr; IN: Attribute to read - const H5T_t *mem_type; IN: Memory datatype of buffer - void *buf; IN: Buffer for data to read - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function reads a complete attribute from disk. ---------------------------------------------------------------------------*/ -herr_t -H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) -{ - uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ - uint8_t *bkg_buf = NULL; /* background buffer */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute*/ - H5T_path_t *tpath = NULL; /* type conversion info */ - hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/ - size_t src_type_size; /* size of source type */ - size_t dst_type_size; /* size of destination type */ - size_t buf_size; /* desired buffer size */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(attr); - HDassert(mem_type); - HDassert(buf); - - /* Create buffer for data to store on disk */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); - - if(nelmts > 0) { - /* Get the memory and file datatype sizes */ - src_type_size = H5T_GET_SIZE(attr->shared->dt); - dst_type_size = H5T_GET_SIZE(mem_type); - - /* Check if the attribute has any data yet, if not, fill with zeroes */ - if(attr->obj_opened && !attr->shared->data) - HDmemset(buf, 0, (dst_type_size * nelmts)); - else { /* Attribute exists and has a value */ - /* Convert memory buffer into disk buffer */ - /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") - - /* Check for type conversion required */ - if(!H5T_path_noop(tpath)) { - if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 || - (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") - - /* Get the maximum buffer size needed and allocate it */ - buf_size = nelmts * MAX(src_type_size, dst_type_size); - if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Copy the attribute data into the buffer for conversion */ - HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); - - /* Perform datatype conversion. */ - if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") - - /* Copy the converted data into the user's buffer */ - HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts)); - } /* end if */ - /* No type conversion necessary */ - else { - HDassert(dst_type_size == src_type_size); - - /* Copy the attribute data into the user's buffer */ - HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts)); - } /* end else */ - } /* end else */ - } /* end if */ - -done: - /* Release resources */ - if(src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(tconv_buf) - tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); - if(bkg_buf) - bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5A_read() */ - - /*------------------------------------------------------------------------- * Function: H5A_get_space * @@ -826,54 +609,8 @@ done: } /* end H5Aget_create_plist() */ -/*-------------------------------------------------------------------------- - NAME - H5A_get_name - PURPOSE - Private function for H5Aget_name. Gets a copy of the name for an - attribute - RETURNS - This function returns the length of the attribute's name (which may be - longer than 'buf_size') on success or negative for failure. - DESCRIPTION - This function retrieves the name of an attribute for an attribute ID. - Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string - terminator. If the name of the attribute is longer than 'buf_size'-1, - the string terminator is stored in the last position of the buffer to - properly terminate the string. ---------------------------------------------------------------------------*/ -ssize_t -H5A_get_name(H5A_t *attr, size_t buf_size, char *buf) -{ - size_t copy_len, nbytes; - ssize_t ret_value; - - FUNC_ENTER_NOAPI_NOERR - - /* get the real attribute length */ - nbytes = HDstrlen(attr->shared->name); - HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/ - - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(buf_size - 1, nbytes); - - /* Copy all/some of the name */ - if(buf && copy_len > 0) { - HDmemcpy(buf, attr->shared->name, copy_len); - - /* Terminate the string */ - buf[copy_len]='\0'; - } /* end if */ - - /* Set return value */ - ret_value = (ssize_t)nbytes; - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5A_get_name() */ - - /*------------------------------------------------------------------------- - * Function: H5A_get_info + * Function: H5A__get_info * * Purpose: Retrieve information about an attribute. * @@ -886,7 +623,7 @@ H5A_get_name(H5A_t *attr, size_t buf_size, char *buf) *------------------------------------------------------------------------- */ herr_t -H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo) +H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) { FUNC_ENTER_NOAPI_NOERR @@ -907,7 +644,7 @@ H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5A_get_info() */ +} /* end H5A__get_info() */ /*------------------------------------------------------------------------- @@ -1347,7 +1084,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5A_dense_build_table_cb + * Function: H5A__dense_build_table_cb * * Purpose: Callback routine for building table of attributes from dense * attribute storage. @@ -1362,12 +1099,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5A_dense_build_table_cb(const H5A_t *attr, void *_udata) +H5A__dense_build_table_cb(const H5A_t *attr, void *_udata) { H5A_dense_bt_ud_t *udata = (H5A_dense_bt_ud_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(attr); @@ -1387,7 +1124,7 @@ H5A_dense_build_table_cb(const H5A_t *attr, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A_dense_build_table_cb() */ +} /* end H5A__dense_build_table_cb() */ /*------------------------------------------------------------------------- @@ -1453,7 +1190,7 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, /* Build iterator operator */ attr_op.op_type = H5A_ATTR_OP_LIB; - attr_op.u.lib_op = H5A_dense_build_table_cb; + attr_op.u.lib_op = H5A__dense_build_table_cb; /* Iterate over the links in the group, building a table of the link messages */ if(H5A_dense_iterate(f, dxpl_id, (hid_t)0, ainfo, H5_INDEX_NAME, @@ -1689,7 +1426,7 @@ H5A_attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, H5A_info_t ainfo; /* Info for attribute */ /* Get the attribute information */ - if(H5A_get_info(atable->attrs[u], &ainfo) < 0) + if(H5A__get_info(atable->attrs[u], &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info") /* Make the application callback */ @@ -2257,7 +1994,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5A_dense_post_copy_file_cb + * Function: H5A__dense_post_copy_file_cb * * Purpose: Callback routine for copying a dense attribute from SRC to DST. * @@ -2271,13 +2008,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5A_dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) +H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) { H5A_dense_file_cp_ud_t *udata = (H5A_dense_file_cp_ud_t *)_udata; H5A_t *attr_dst = NULL; herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(attr_src); @@ -2313,7 +2050,7 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A_dense_post_copy_file_cb() */ +} /* end H5A__dense_post_copy_file_cb() */ /*------------------------------------------------------------------------- @@ -2354,7 +2091,7 @@ H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo udata.oloc_dst = dst_oloc; attr_op.op_type = H5A_ATTR_OP_LIB; - attr_op.u.lib_op = H5A_dense_post_copy_file_cb; + attr_op.u.lib_op = H5A__dense_post_copy_file_cb; if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME, diff --git a/src/H5Apkg.h b/src/H5Apkg.h index f587f81..f656214 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -192,12 +192,9 @@ H5_DLL H5A_t *H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name, hid_t lapl_id, hid_t dxpl_id); H5_DLL H5A_t *H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t dxpl_id); -H5_DLL herr_t H5A_open_common(const H5G_loc_t *loc, H5A_t *attr); -H5_DLL herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id); -H5_DLL herr_t H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id); -H5_DLL ssize_t H5A_get_name(H5A_t *attr, size_t buf_size, char *buf); +H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr); -H5_DLL herr_t H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo); +H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo); H5_DLL hid_t H5A_get_type(H5A_t *attr); H5_DLL hid_t H5A_get_space(H5A_t *attr); H5_DLL hid_t H5A_get_create_plist(H5A_t* attr); -- cgit v0.12 From acdef5f665b210d39444d9b2c230419f99104524 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:38:35 -0500 Subject: [svn-r27070] Description: Clean up the H5B interface code, to better align with v3 metadata cache changes. Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial & parallel --- src/H5B.c | 110 ++++++++++++++++++++++++++++----------------------------- src/H5Bcache.c | 7 ++-- src/H5Bdbg.c | 8 ++--- src/H5Bpkg.h | 4 +-- 4 files changed, 65 insertions(+), 64 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index 621209f..765a57e 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -134,7 +134,7 @@ typedef struct H5B_iter_ud_t { } H5B_info_ud_t; /* Convenience struct for the arguments needed to unprotect a b-tree after a - * call to H5B_iterate_helper() or H5B_split() */ + * call to H5B__iterate_helper() or H5B__split() */ typedef struct H5B_ins_ud_t { H5B_t *bt; /* B-tree */ haddr_t addr; /* B-tree address */ @@ -145,7 +145,7 @@ typedef struct H5B_ins_ud_t { /********************/ /* Local Prototypes */ /********************/ -static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, +static H5B_ins_t H5B__insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8_t *lt_key, hbool_t *lt_key_changed, @@ -153,13 +153,13 @@ static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, uint8_t *rt_key, hbool_t *rt_key_changed, H5B_ins_ud_t *split_bt_ud/*out*/); -static herr_t H5B_insert_child(H5B_t *bt, unsigned *bt_flags, +static herr_t H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key); -static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, +static herr_t H5B__split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_t *split_bt_ud/*out*/); -static H5B_t * H5B_copy(const H5B_t *old_bt); +static H5B_t * H5B__copy(const H5B_t *old_bt); /*********************/ @@ -258,7 +258,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, if(H5AC_insert_entry(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache") #ifdef H5B_DEBUG - H5B_assert(f, dxpl_id, *addr_p, shared->type, udata); + H5B__assert(f, dxpl_id, *addr_p, shared->type, udata); #endif done: @@ -269,7 +269,7 @@ done: } /* end if */ if(bt) /* Destroy B-tree node */ - if(H5B_node_dest(bt) < 0) + if(H5B__node_dest(bt) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") } /* end if */ @@ -375,7 +375,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5B_split + * Function: H5B__split * * Purpose: Split a single node into two nodes. The old node will * contain the left children and the new node will contain the @@ -397,7 +397,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, +H5B__split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_t *split_bt_ud/*out*/) { H5P_genplist_t *dx_plist; /* Data transfer property list */ @@ -407,7 +407,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, double split_ratios[3]; /* B-tree split ratios */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -446,7 +446,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, unsigned idx, side = "LEFT"; else side = "MIDDLE"; - fprintf(H5DEBUG(B), "H5B_split: %3u {%5.3f,%5.3f,%5.3f} %6s", + fprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s", shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side); } #endif @@ -539,7 +539,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_split() */ +} /* end H5B__split() */ /*------------------------------------------------------------------------- @@ -601,7 +601,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree") /* Insert the object */ - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &bt_ud, type, lt_key, + if((int)(my_ins = H5B__insert_helper(f, dxpl_id, &bt_ud, type, lt_key, <_key_changed, md_key, udata, rt_key, &rt_key_changed, &split_bt_ud/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") @@ -638,7 +638,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void */ /* Make a copy of the old root information */ - if(NULL == (new_root_bt = H5B_copy(bt_ud.bt))) + if(NULL == (new_root_bt = H5B__copy(bt_ud.bt))) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to copy old root") /* Unprotect the old root so we can move it. Also force it to be marked @@ -677,7 +677,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void done: if(ret_value < 0) - if(new_root_bt && H5B_node_dest(new_root_bt) < 0) + if(new_root_bt && H5B__node_dest(new_root_bt) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to free B-tree root node"); if(bt_ud.bt) @@ -690,7 +690,7 @@ done: #ifdef H5B_DEBUG if(ret_value >= 0) - H5B_assert(f, dxpl_id, addr, type, udata); + H5B__assert(f, dxpl_id, addr, type, udata); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -698,7 +698,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5B_insert_child + * Function: H5B__insert_child * * Purpose: Insert a child to the left or right of child[IDX] depending * on whether ANCHOR is H5B_INS_LEFT or H5B_INS_RIGHT. The BT @@ -713,13 +713,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, +H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5B_ins_t anchor, const void *md_key) { H5B_shared_t *shared; /* Pointer to shared B-tree info */ uint8_t *base; /* Base offset for move */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(bt); HDassert(bt_flags); @@ -771,7 +771,7 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, /*------------------------------------------------------------------------- - * Function: H5B_insert_helper + * Function: H5B__insert_helper * * Purpose: Inserts the item UDATA into the tree rooted at ADDR and having * the specified type. @@ -802,7 +802,7 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, *------------------------------------------------------------------------- */ static H5B_ins_t -H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, +H5B__insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, @@ -820,7 +820,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, H5B_ins_t my_ins = H5B_INS_ERROR; H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments @@ -904,7 +904,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &child_bt_ud, type, + if((int)(my_ins = H5B__insert_helper(f, dxpl_id, &child_bt_ud, type, H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud/*out*/)) < 0) @@ -950,7 +950,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &child_bt_ud, type, + if((int)(my_ins = H5B__insert_helper(f, dxpl_id, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud/*out*/)) < 0) @@ -1005,7 +1005,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, if(NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") - if((int)(my_ins = H5B_insert_helper(f, dxpl_id, &child_bt_ud, type, + if((int)(my_ins = H5B__insert_helper(f, dxpl_id, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree") @@ -1064,7 +1064,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, * If this node is full then split it before inserting the new child. */ if(bt->nchildren == shared->two_k) { - if(H5B_split(f, dxpl_id, bt_ud, idx, udata, split_bt_ud/*out*/) < 0) + if(H5B__split(f, dxpl_id, bt_ud, idx, udata, split_bt_ud/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node") if(idx < bt->nchildren) { tmp_bt = bt; @@ -1081,7 +1081,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, H5B_ins_ud_t *bt_ud, } /* end else */ /* Insert the child */ - if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0) + if(H5B__insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child") } /* end else-if */ @@ -1119,7 +1119,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5B_iterate_helper + * Function: H5B__iterate_helper * * Purpose: Calls the list callback for each leaf node of the * B-tree, passing it the caller's UDATA structure. @@ -1133,7 +1133,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, +H5B__iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, void *udata) { H5B_t *bt = NULL; /* Pointer to current B-tree node */ @@ -1143,7 +1143,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add unsigned u; /* Local index variable */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -1170,7 +1170,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add /* Iterate over node's children */ for(u = 0; u < bt->nchildren && ret_value == H5_ITER_CONT; u++) { if(bt->level > 0) - ret_value = H5B_iterate_helper(f, dxpl_id, type, bt->child[u], op, udata); + ret_value = H5B__iterate_helper(f, dxpl_id, type, bt->child[u], op, udata); else ret_value = (*op)(f, dxpl_id, H5B_NKEY(bt, shared, u), bt->child[u], H5B_NKEY(bt, shared, u + 1), udata); if(ret_value < 0) @@ -1182,7 +1182,7 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_iterate_helper() */ +} /* end H5B__iterate_helper() */ /*------------------------------------------------------------------------- @@ -1217,7 +1217,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDassert(udata); /* Iterate over the B-tree records */ - if((ret_value = H5B_iterate_helper(f, dxpl_id, type, addr, op, udata)) < 0) + if((ret_value = H5B__iterate_helper(f, dxpl_id, type, addr, op, udata)) < 0) HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed"); FUNC_LEAVE_NOAPI(ret_value) @@ -1225,7 +1225,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /*------------------------------------------------------------------------- - * Function: H5B_remove_helper + * Function: H5B__remove_helper * * Purpose: The recursive part of removing an item from a B-tree. The * sub B-tree that is being considered is located at ADDR and @@ -1249,7 +1249,7 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, *------------------------------------------------------------------------- */ static H5B_ins_t -H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, +H5B__remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, int level, uint8_t *lt_key/*out*/, hbool_t *lt_key_changed/*out*/, void *udata, uint8_t *rt_key/*out*/, hbool_t *rt_key_changed/*out*/) @@ -1263,7 +1263,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type int cmp = 1; /* Key comparison value */ H5B_ins_t ret_value = H5B_INS_ERROR; - FUNC_ENTER_NOAPI(H5B_INS_ERROR) + FUNC_ENTER_STATIC HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -1308,7 +1308,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HDassert(idx < bt->nchildren); if(bt->level > 0) { /* We're at an internal node -- call recursively */ - if((int)(ret_value = H5B_remove_helper(f, dxpl_id, + if((int)(ret_value = H5B__remove_helper(f, dxpl_id, bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx)/*out*/, lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/, rt_key_changed/*out*/)) < 0) @@ -1555,7 +1555,7 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_remove_helper() */ +} /* end H5B__remove_helper() */ /*------------------------------------------------------------------------- @@ -1594,12 +1594,12 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void HDassert(H5F_addr_defined(addr)); /* The actual removal */ - if(H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, <_key_changed, + if(H5B__remove_helper(f, dxpl_id, addr, type, 0, lt_key, <_key_changed, udata, rt_key, &rt_key_changed) == H5B_INS_ERROR) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree") #ifdef H5B_DEBUG - H5B_assert(f, dxpl_id, addr, type, udata); + H5B__assert(f, dxpl_id, addr, type, udata); #endif done: FUNC_LEAVE_NOAPI(ret_value) @@ -1789,7 +1789,7 @@ H5B_shared_free(void *_shared) /*------------------------------------------------------------------------- - * Function: H5B_copy + * Function: H5B__copy * * Purpose: Deep copies an existing H5B_t node. * @@ -1804,13 +1804,13 @@ H5B_shared_free(void *_shared) *------------------------------------------------------------------------- */ static H5B_t * -H5B_copy(const H5B_t *old_bt) +H5B__copy(const H5B_t *old_bt) { H5B_t *new_node = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_t *ret_value; - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* * Check arguments. @@ -1853,11 +1853,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_copy() */ +} /* end H5B__copy() */ /*------------------------------------------------------------------------- - * Function: H5B_get_info_helper + * Function: H5B__get_info_helper * * Purpose: Walks the B-tree nodes, getting information for all of them. * @@ -1870,7 +1870,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, +H5B__get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, const H5B_info_ud_t *info_udata) { H5B_t *bt = NULL; /* Pointer to current B-tree node */ @@ -1883,7 +1883,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad haddr_t left_child; /* Address of left-most child in node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -1951,7 +1951,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad /* Check for another "row" of B-tree nodes to iterate over */ if(level > 0) { /* Keep following the left-most child until we reach a leaf node. */ - if(H5B_get_info_helper(f, dxpl_id, type, left_child, info_udata) < 0) + if(H5B__get_info_helper(f, dxpl_id, type, left_child, info_udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node") } /* end if */ @@ -1960,7 +1960,7 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_get_info_helper() */ +} /* end H5B__get_info_helper() */ /*------------------------------------------------------------------------- @@ -2001,13 +2001,13 @@ H5B_get_info(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, info_udata.udata = udata; /* Iterate over the B-tree nodes */ - if(H5B_get_info_helper(f, dxpl_id, type, addr, &info_udata) < 0) + if(H5B__get_info_helper(f, dxpl_id, type, addr, &info_udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_BADITER, FAIL, "B-tree iteration failed") /* Iterate over the B-tree records, making any "leaf" callbacks */ /* (Only if operator defined) */ if(op) - if((ret_value = H5B_iterate_helper(f, dxpl_id, type, addr, op, udata)) < 0) + if((ret_value = H5B__iterate_helper(f, dxpl_id, type, addr, op, udata)) < 0) HERROR(H5E_BTREE, H5E_BADITER, "B-tree iteration failed"); done: @@ -2072,7 +2072,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5B_node_dest + * Function: H5B__node_dest * * Purpose: Destroy/release a B-tree node * @@ -2086,9 +2086,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B_node_dest(H5B_t *bt) +H5B__node_dest(H5B_t *bt) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* check arguments */ HDassert(bt); @@ -2100,5 +2100,5 @@ H5B_node_dest(H5B_t *bt) bt = H5FL_FREE(H5B_t, bt); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5B_node_dest() */ +} /* end H5B__node_dest() */ diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 2992986..07b594d 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -115,6 +115,7 @@ H5B__load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HDassert(H5F_addr_defined(addr)); HDassert(udata); + /* Allocate the B-tree node in memory */ if(NULL == (bt = H5FL_MALLOC(H5B_t))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct") HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); @@ -141,7 +142,7 @@ H5B__load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* magic number */ if(HDmemcmp(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature") p += 4; /* node type and level */ @@ -185,7 +186,7 @@ H5B__load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) done: if(!ret_value && bt) - if(H5B_node_dest(bt) < 0) + if(H5B__node_dest(bt) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree node") FUNC_LEAVE_NOAPI(ret_value) @@ -328,7 +329,7 @@ H5B__dest(H5F_t *f, H5B_t *bt) } /* end if */ /* Destroy B-tree node */ - if(H5B_node_dest(bt) < 0) + if(H5B__node_dest(bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") done: diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 3c81c26..526a647 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -156,7 +156,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5B_assert + * Function: H5B__assert * * Purpose: Verifies that the tree is structured correctly. * @@ -171,7 +171,7 @@ done: */ #ifdef H5B_DEBUG herr_t -H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata) +H5B__assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata) { H5B_t *bt = NULL; H5UC_t *rc_shared; /* Ref-counted shared info */ @@ -189,7 +189,7 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void struct child_t *next; } *head = NULL, *tail = NULL, *prev = NULL, *cur = NULL, *tmp = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE if(0 == ncalls++) { if(H5DEBUG(B)) @@ -285,6 +285,6 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_assert() */ +} /* end H5B__assert() */ #endif /* H5B_DEBUG */ diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index 598b122..374fcb5 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -88,9 +88,9 @@ H5FL_EXTERN(H5B_t); /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5B_node_dest(H5B_t *bt); +H5_DLL herr_t H5B__node_dest(H5B_t *bt); #ifdef H5B_DEBUG -herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, +herr_t H5B__assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata); #endif -- cgit v0.12 From 775a54c19a86e0c0fcd3c5589d0248c015719250 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:46:00 -0500 Subject: [svn-r27071] Description: Clean up H5B2 interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux 2.6.* (jam) w/serial & parallel --- src/H5B2.c | 78 ++++---- src/H5B2cache.c | 40 ++-- src/H5B2dbg.c | 31 +-- src/H5B2hdr.c | 86 ++++----- src/H5B2int.c | 526 +++++++++++++++++++++++++-------------------------- src/H5B2pkg.h | 88 ++++----- src/H5B2stat.c | 2 +- src/H5B2test.c | 110 +++++------ tools/misc/h5debug.c | 6 +- 9 files changed, 485 insertions(+), 482 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 7d7345e..0c0f24f 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -146,7 +146,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udat HDcompile_assert(H5B2_NUM_BTREE_ID == NELMTS(H5B2_client_class_g)); /* Create shared v2 B-tree header */ - if(HADDR_UNDEF == (hdr_addr = H5B2_hdr_create(f, dxpl_id, cparam, ctx_udata))) + if(HADDR_UNDEF == (hdr_addr = H5B2__hdr_create(f, dxpl_id, cparam, ctx_udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header") /* Create v2 B-tree wrapper */ @@ -161,11 +161,11 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udat /* Point v2 B-tree wrapper at header and bump it's ref count */ bt2->hdr = hdr; - if(H5B2_hdr_incr(bt2->hdr) < 0) + if(H5B2__hdr_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header") /* Increment # of files using this v2 B-tree header */ - if(H5B2_hdr_fuse_incr(bt2->hdr) < 0) + if(H5B2__hdr_fuse_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header") /* Set file pointer for this v2 B-tree open context */ @@ -229,11 +229,11 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata) /* Point v2 B-tree wrapper at header */ bt2->hdr = hdr; - if(H5B2_hdr_incr(bt2->hdr) < 0) + if(H5B2__hdr_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header") /* Increment # of files using this v2 B-tree header */ - if(H5B2_hdr_fuse_incr(bt2->hdr) < 0) + if(H5B2__hdr_fuse_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header") /* Set file pointer for this v2 B-tree open context */ @@ -287,28 +287,28 @@ H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata) /* Check if the root node is allocated yet */ if(!H5F_addr_defined(hdr->root.addr)) { /* Create root node as leaf node in B-tree */ - if(H5B2_create_leaf(hdr, dxpl_id, &(hdr->root)) < 0) + if(H5B2__create_leaf(hdr, dxpl_id, &(hdr->root)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") } /* end if */ /* Check if we need to split the root node (equiv. to a 1->2 node split) */ else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) { /* Split root node */ - if(H5B2_split_root(hdr, dxpl_id) < 0) + if(H5B2__split_root(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node") } /* end if */ /* Attempt to insert record into B-tree */ if(hdr->depth > 0) { - if(H5B2_insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, udata) < 0) + if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") } /* end if */ else { - if(H5B2_insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata) < 0) + if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") } /* end else */ /* Mark B-tree header as dirty */ - if(H5B2_hdr_dirty(hdr) < 0) + if(H5B2__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") done: @@ -385,7 +385,7 @@ H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data) /* Iterate through records */ if(hdr->root.node_nrec > 0) { /* Iterate through nodes */ - if((ret_value = H5B2_iterate_node(hdr, dxpl_id, hdr->depth, &hdr->root, op, op_data)) < 0) + if((ret_value = H5B2__iterate_node(hdr, dxpl_id, hdr->depth, &hdr->root, op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); } /* end if */ @@ -422,7 +422,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, { H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ - unsigned depth; /* Current depth of the tree */ + uint16_t depth; /* Current depth of the tree */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ H5B2_nodepos_t curr_pos; /* Position of the current node */ @@ -479,11 +479,11 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */ /* Lock B-tree current node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, 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++; @@ -542,11 +542,11 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */ /* Lock B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_READ))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate record */ - cmp = H5B2_locate_record(hdr->cls, 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 */ @@ -622,7 +622,7 @@ H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx, { H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ - unsigned depth; /* Current depth of the tree */ + uint16_t depth; /* Current depth of the tree */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -662,7 +662,7 @@ H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx, unsigned u; /* Local index variable */ /* Lock B-tree current node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Search for record with correct index */ @@ -734,7 +734,7 @@ H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx, H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */ /* Lock B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_READ))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Sanity check index */ @@ -798,7 +798,7 @@ H5B2_remove(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op, if(hdr->depth > 0) { hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */ - if(H5B2_remove_internal(hdr, dxpl_id, &depth_decreased, NULL, hdr->depth, + if(H5B2__remove_internal(hdr, dxpl_id, &depth_decreased, NULL, hdr->depth, &(hdr->cache_info), NULL, H5B2_POS_ROOT, &hdr->root, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") @@ -817,7 +817,7 @@ H5B2_remove(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op, } /* end for */ } /* end if */ else { - if(H5B2_remove_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata, op, op_data) < 0) + if(H5B2__remove_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") } /* end else */ @@ -825,7 +825,7 @@ H5B2_remove(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op, hdr->root.all_nrec--; /* Mark B-tree header as dirty */ - if(H5B2_hdr_dirty(hdr) < 0) + if(H5B2__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") done: @@ -880,7 +880,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, if(hdr->depth > 0) { hbool_t depth_decreased = FALSE; /* Flag to indicate whether the depth of the B-tree decreased */ - if(H5B2_remove_internal_by_idx(hdr, dxpl_id, &depth_decreased, NULL, hdr->depth, + if(H5B2__remove_internal_by_idx(hdr, dxpl_id, &depth_decreased, NULL, hdr->depth, &(hdr->cache_info), NULL, &hdr->root, H5B2_POS_ROOT, idx, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") @@ -899,7 +899,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, } /* end for */ } /* end if */ else { - if(H5B2_remove_leaf_by_idx(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, (unsigned)idx, op, op_data) < 0) + if(H5B2__remove_leaf_by_idx(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, (unsigned)idx, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") } /* end else */ @@ -907,7 +907,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hdr->root.all_nrec--; /* Mark B-tree header as dirty */ - if(H5B2_hdr_dirty(hdr) < 0) + if(H5B2__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") done: @@ -994,11 +994,11 @@ H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata, /* Attempt to find neighbor record in B-tree */ if(hdr->depth > 0) { - if(H5B2_neighbor_internal(hdr, dxpl_id, hdr->depth, &hdr->root, NULL, range, udata, op, op_data) < 0) + if(H5B2__neighbor_internal(hdr, dxpl_id, hdr->depth, &hdr->root, NULL, range, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node") } /* end if */ else { - if(H5B2_neighbor_leaf(hdr, dxpl_id, &hdr->root, NULL, range, udata, op, op_data) < 0) + if(H5B2__neighbor_leaf(hdr, dxpl_id, &hdr->root, NULL, range, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node") } /* end else */ @@ -1034,7 +1034,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ H5B2_nodepos_t curr_pos; /* Position of current node */ - unsigned depth; /* Current depth of the tree */ + uint16_t depth; /* Current depth of the tree */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1070,11 +1070,11 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */ /* Lock B-tree current node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_WRITE))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, 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++; @@ -1142,11 +1142,11 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, hbool_t changed = FALSE;/* Whether the 'modify' callback changed the record */ /* Lock B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_WRITE))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate record */ - cmp = H5B2_locate_record(hdr->cls, 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 */ @@ -1238,7 +1238,7 @@ H5B2_close(H5B2_t *bt2, hid_t dxpl_id) HDassert(bt2->f); /* Decrement file reference & check if this is the last open v2 B-tree using the shared B-tree header */ - if(0 == H5B2_hdr_fuse_decr(bt2->hdr)) { + if(0 == H5B2__hdr_fuse_decr(bt2->hdr)) { /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -1283,22 +1283,22 @@ H5B2_close(H5B2_t *bt2, hid_t dxpl_id) hdr->f = bt2->f; /* Decrement the reference count on the B-tree header */ - /* (don't put in H5B2_hdr_fuse_decr() as the B-tree header may be evicted + /* (don't put in H5B2__hdr_fuse_decr() as the B-tree header may be evicted * immediately -QAK) */ - if(H5B2_hdr_decr(bt2->hdr) < 0) + if(H5B2__hdr_decr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement reference count on shared v2 B-tree header") /* Delete v2 B-tree, starting with header (unprotects header) */ - if(H5B2_hdr_delete(hdr, dxpl_id) < 0) + if(H5B2__hdr_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree") } /* end if */ else { /* Decrement the reference count on the B-tree header */ - /* (don't put in H5B2_hdr_fuse_decr() as the B-tree header may be evicted + /* (don't put in H5B2__hdr_fuse_decr() as the B-tree header may be evicted * immediately -QAK) */ - if(H5B2_hdr_decr(bt2->hdr) < 0) + if(H5B2__hdr_decr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement reference count on shared v2 B-tree header") } /* end else */ @@ -1368,7 +1368,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); hdr->f = f; /* Delete v2 B-tree now, starting with header (unprotects header) */ - if(H5B2_hdr_delete(hdr, dxpl_id) < 0) + if(H5B2__hdr_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree") hdr = NULL; } /* end if */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 1e2a6a3..9e01c03 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -173,7 +173,7 @@ H5B2__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HDassert(udata); /* Allocate new B-tree header and reset cache info */ - if(NULL == (hdr = H5B2_hdr_alloc(udata->f))) + if(NULL == (hdr = H5B2__hdr_alloc(udata->f))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header") /* Wrap the local buffer for serialized header info */ @@ -238,7 +238,7 @@ H5B2__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Initialize B-tree header info */ cparam.cls = H5B2_client_class_g[id]; - if(H5B2_hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0) + if(H5B2__hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") /* Set the B-tree header's address */ @@ -252,7 +252,7 @@ done: if(wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_BTREE, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value && hdr) - if(H5B2_hdr_free(hdr) < 0) + if(H5B2__hdr_free(hdr) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, NULL, "can't release v2 B-tree header") FUNC_LEAVE_NOAPI(ret_value) @@ -282,7 +282,7 @@ H5B2__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, FUNC_ENTER_STATIC - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(hdr); @@ -399,7 +399,7 @@ H5B2__cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr) } /* end if */ /* Release B-tree header info */ - if(H5B2_hdr_free(hdr) < 0) + if(H5B2__hdr_free(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header info") done: @@ -464,7 +464,7 @@ H5B2__cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_ { FUNC_ENTER_STATIC_NOERR - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(hdr); HDassert(size_ptr); @@ -519,7 +519,7 @@ H5B2__cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) udata->hdr->f = f; /* Increment ref. count on B-tree header */ - if(H5B2_hdr_incr(udata->hdr) < 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 */ @@ -601,7 +601,7 @@ H5B2__cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) done: if(!ret_value && internal) - if(H5B2_internal_free(internal) < 0) + if(H5B2__internal_free(internal) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree internal node") FUNC_LEAVE_NOAPI(ret_value) @@ -628,7 +628,7 @@ H5B2__cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t add FUNC_ENTER_STATIC - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(internal); @@ -742,7 +742,7 @@ H5B2__cache_internal_dest(H5F_t *f, H5B2_internal_t *internal) } /* end if */ /* Release v2 b-tree internal node */ - if(H5B2_internal_free(internal) < 0) + if(H5B2__internal_free(internal) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node") done: @@ -807,7 +807,7 @@ H5B2__cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal { FUNC_ENTER_STATIC_NOERR - /* check arguments */ + /* Check arguments */ HDassert(internal); HDassert(internal->hdr); HDassert(size_ptr); @@ -854,14 +854,14 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata /* Allocate new leaf node and reset cache info */ if(NULL == (leaf = H5FL_MALLOC(H5B2_leaf_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed") HDmemset(&leaf->cache_info, 0, sizeof(H5AC_info_t)); /* Set the B-tree header's file context for this operation */ udata->hdr->f = udata->f; /* Increment ref. count on B-tree header */ - if(H5B2_hdr_incr(udata->hdr) < 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 header information */ @@ -875,12 +875,12 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata /* Magic number */ if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree leaf node signature") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5B2_LEAF_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree leaf node version") + HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree leaf node version") /* B-tree type */ if(*p++ != (uint8_t)udata->hdr->cls->id) @@ -888,7 +888,7 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata /* Allocate space for the native keys in memory */ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree leaf native keys") /* Set the number of records in the leaf */ leaf->nrec = udata->nrec; @@ -905,7 +905,7 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata native += udata->hdr->cls->nrec_size; } /* end for */ - /* Compute checksum on internal node */ + /* Compute checksum on leaf node */ computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - (const uint8_t *)udata->hdr->page), 0); /* Metadata checksum */ @@ -923,7 +923,7 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata done: if(!ret_value && leaf) - if(H5B2_leaf_free(leaf) < 0) + if(H5B2__leaf_free(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree leaf node") FUNC_LEAVE_NOAPI(ret_value) @@ -950,7 +950,7 @@ H5B2__cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H FUNC_ENTER_STATIC - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(leaf); @@ -1050,7 +1050,7 @@ H5B2__cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf) } /* end if */ /* Destroy v2 b-tree leaf node */ - if(H5B2_leaf_free(leaf) < 0) + if(H5B2__leaf_free(leaf) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node") done: diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 3e5d55a..50283f8 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -74,7 +74,7 @@ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_debug + * Function: H5B2__hdr_debug * * Purpose: Prints debugging info about a B-tree header. * @@ -87,7 +87,7 @@ *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, +H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ @@ -97,7 +97,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -185,11 +185,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_debug() */ +} /* end H5B2__hdr_debug() */ /*------------------------------------------------------------------------- - * Function: H5B2_int_debug + * Function: H5B2__int_debug * * Purpose: Prints debugging info about a B-tree internal node * @@ -202,7 +202,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, +H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header */ @@ -213,7 +213,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -251,7 +251,9 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* * Load the B-tree internal node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, addr, nrec, depth, H5AC_READ))) + H5_CHECK_OVERFLOW(nrec, unsigned, uint16_t); + H5_CHECK_OVERFLOW(depth, unsigned, uint16_t); + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, addr, (uint16_t)nrec, (uint16_t)depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") /* Print opening message */ @@ -317,11 +319,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_int_debug() */ +} /* end H5B2__int_debug() */ /*------------------------------------------------------------------------- - * Function: H5B2_leaf_debug + * Function: H5B2__leaf_debug * * Purpose: Prints debugging info about a B-tree leaf node * @@ -334,7 +336,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, +H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header */ @@ -345,7 +347,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -383,7 +385,8 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, /* * Load the B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, addr, nrec, H5AC_READ))) + H5_CHECK_OVERFLOW(nrec, unsigned, uint16_t); + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, addr, (uint16_t)nrec, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Print opening message */ @@ -430,5 +433,5 @@ done: HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_leaf_debug() */ +} /* end H5B2__leaf_debug() */ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index d28c263..97b979e 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -94,7 +94,7 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); /*------------------------------------------------------------------------- - * Function: H5B2_hdr_init + * Function: H5B2__hdr_init * * Purpose: Allocate & initialize B-tree header info * @@ -107,7 +107,7 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, +H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, uint16_t depth) { size_t sz_max_nrec; /* Temporary variable for range checking */ @@ -115,7 +115,7 @@ H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -215,15 +215,15 @@ HDmemset(hdr->page, 0, hdr->node_size); done: if(ret_value < 0) - if(H5B2_hdr_free(hdr) < 0) + if(H5B2__hdr_free(hdr) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free shared v2 B-tree info") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_init() */ +} /* end H5B2__hdr_init() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_alloc + * Function: H5B2__hdr_alloc * * Purpose: Allocate B-tree header * @@ -236,12 +236,12 @@ done: *------------------------------------------------------------------------- */ H5B2_hdr_t * -H5B2_hdr_alloc(H5F_t *f) +H5B2__hdr_alloc(H5F_t *f) { H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ H5B2_hdr_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -265,11 +265,11 @@ H5B2_hdr_alloc(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_alloc() */ +} /* end H5B2__hdr_alloc() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_create + * Function: H5B2__hdr_create * * Purpose: Create new fractal heap header * @@ -282,13 +282,13 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, +H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udata) { H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */ haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -297,11 +297,11 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, HDassert(cparam); /* Allocate v2 B-tree header */ - if(NULL == (hdr = H5B2_hdr_alloc(f))) + if(NULL == (hdr = H5B2__hdr_alloc(f))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header") /* Initialize shared B-tree info */ - if(H5B2_hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0) + if(H5B2__hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info") /* Allocate space for the header on disk */ @@ -317,15 +317,15 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, done: if(!H5F_addr_defined(ret_value) && hdr) - if(H5B2_hdr_free(hdr) < 0) + if(H5B2__hdr_free(hdr) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release v2 B-tree header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_create() */ +} /* end H5B2__hdr_create() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_incr + * Function: H5B2__hdr_incr * * Purpose: Increment reference count on B-tree header * @@ -338,11 +338,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_incr(H5B2_hdr_t *hdr) +H5B2__hdr_incr(H5B2_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(hdr); @@ -357,11 +357,11 @@ H5B2_hdr_incr(H5B2_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_incr_hdr() */ +} /* end H5B2__hdr_incr() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_decr + * Function: H5B2__hdr_decr * * Purpose: Decrement reference count on B-tree header * @@ -374,11 +374,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_decr(H5B2_hdr_t *hdr) +H5B2__hdr_decr(H5B2_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -394,11 +394,11 @@ H5B2_hdr_decr(H5B2_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_decr() */ +} /* end H5B2__hdr_decr() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_fuse_incr + * Function: H5B2__hdr_fuse_incr * * Purpose: Increment file reference count on shared v2 B-tree header * @@ -411,7 +411,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr) +H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -422,11 +422,11 @@ H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr) hdr->file_rc++; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5B2_hdr_fuse_incr() */ +} /* end H5B2__hdr_fuse_incr() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_fuse_decr + * Function: H5B2__hdr_fuse_decr * * Purpose: Decrement file reference count on shared v2 B-tree header * @@ -439,7 +439,7 @@ H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr) *------------------------------------------------------------------------- */ size_t -H5B2_hdr_fuse_decr(H5B2_hdr_t *hdr) +H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -451,11 +451,11 @@ H5B2_hdr_fuse_decr(H5B2_hdr_t *hdr) hdr->file_rc--; FUNC_LEAVE_NOAPI(hdr->file_rc) -} /* end H5B2_hdr_fuse_decr() */ +} /* end H5B2__hdr_fuse_decr() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_dirty + * Function: H5B2__hdr_dirty * * Purpose: Mark B-tree header as dirty * @@ -468,11 +468,11 @@ H5B2_hdr_fuse_decr(H5B2_hdr_t *hdr) *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_dirty(H5B2_hdr_t *hdr) +H5B2__hdr_dirty(H5B2_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -483,11 +483,11 @@ H5B2_hdr_dirty(H5B2_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_dirty() */ +} /* end H5B2__hdr_dirty() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_free + * Function: H5B2__hdr_free * * Purpose: Free B-tree header info * @@ -500,11 +500,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_free(H5B2_hdr_t *hdr) +H5B2__hdr_free(H5B2_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -557,11 +557,11 @@ H5B2_hdr_free(H5B2_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_free() */ +} /* end H5B2__hdr_free() */ /*------------------------------------------------------------------------- - * Function: H5B2_hdr_delete + * Function: H5B2__hdr_delete * * Purpose: Delete a v2 B-tree, starting with the header * @@ -574,12 +574,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id) +H5B2__hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id) { unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting v2 B-tree header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -600,7 +600,7 @@ H5B2_hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id) /* Delete all nodes in B-tree */ if(H5F_addr_defined(hdr->root.addr)) - if(H5B2_delete_node(hdr, dxpl_id, hdr->depth, &hdr->root, hdr->remove_op, hdr->remove_op_data) < 0) + if(H5B2__delete_node(hdr, dxpl_id, hdr->depth, &hdr->root, hdr->remove_op, hdr->remove_op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes") /* Indicate that the heap header should be deleted & file space freed */ @@ -612,5 +612,5 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_hdr_delete() */ +} /* end H5B2__hdr_delete() */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 310aef1..96636d5 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -61,29 +61,29 @@ /********************/ /* Helper functions */ -static herr_t H5B2_create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, - H5B2_node_ptr_t *node_ptr, unsigned depth); -static herr_t H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +static herr_t H5B2__split1(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx); -static herr_t H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +static herr_t H5B2__redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned idx); -static herr_t H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +static herr_t H5B2__redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx); -static herr_t H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +static herr_t H5B2__merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx); -static herr_t H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +static herr_t H5B2__merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx); -static herr_t H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +static herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, void *swap_loc); +static herr_t H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + H5B2_node_ptr_t *node_ptr, uint16_t depth); #ifdef H5B2_DEBUG -static herr_t H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf); -static herr_t H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t *leaf2); -static herr_t H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal); -static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2); +static herr_t H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf); +static herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t *leaf2); +static herr_t H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal); +static herr_t H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2); #endif /* H5B2_DEBUG */ /*********************/ @@ -112,7 +112,7 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t); /*------------------------------------------------------------------------- - * Function: H5B2_locate_record + * Function: H5B2__locate_record * * Purpose: Performs a binary search to locate a record in a sorted * array of records. @@ -133,14 +133,14 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t); *------------------------------------------------------------------------- */ int -H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, +H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx) { unsigned lo = 0, hi; /* Low & high index values */ unsigned my_idx = 0; /* Final index value */ int cmp = -1; /* Key comparison value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR hi = nrec; while(lo < hi && cmp) { @@ -154,11 +154,11 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, *idx = my_idx; FUNC_LEAVE_NOAPI(cmp) -} /* end H5B2_locate_record */ +} /* end H5B2__locate_record */ /*------------------------------------------------------------------------- - * Function: H5B2_split1 + * Function: H5B2__split1 * * Purpose: Perform a 1->2 node split * @@ -172,7 +172,7 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, *------------------------------------------------------------------------- */ static herr_t -H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__split1(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { @@ -187,7 +187,7 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -206,7 +206,7 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Create new internal node */ internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0; - if(H5B2_create_internal(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), (depth - 1)) < 0) + if(H5B2__create_internal(hdr, dxpl_id, &(internal->node_ptrs[idx + 1]), (uint16_t)(depth - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node") /* Setup information for unlocking child nodes */ @@ -215,9 +215,9 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Protect both leaves */ - if(NULL == (left_int = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (left_int = H5B2__protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - if(NULL == (right_int = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (right_int = H5B2__protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* More setup for child nodes */ @@ -235,7 +235,7 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Create new leaf node */ internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0; - if(H5B2_create_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1])) < 0) + if(H5B2__create_leaf(hdr, dxpl_id, &(internal->node_ptrs[idx + 1])) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new leaf node") /* Setup information for unlocking child nodes */ @@ -244,9 +244,9 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Protect both leaves */ - if(NULL == (left_leaf = H5B2_protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) + if(NULL == (left_leaf = H5B2__protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (right_leaf = H5B2_protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) + if(NULL == (right_leaf = H5B2__protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for child nodes */ @@ -322,14 +322,14 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG; #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) { - H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child); - H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child); + H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child); + H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child); } /* end if */ else { - H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child); - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child); } /* end else */ #endif /* H5B2_DEBUG */ @@ -341,11 +341,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_split1() */ +} /* end H5B2__split1() */ /*------------------------------------------------------------------------- - * Function: H5B2_split_root + * Function: H5B2__split_root * * Purpose: Split the root node * @@ -359,7 +359,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id) +H5B2__split_root(H5B2_hdr_t *hdr, hid_t dxpl_id) { H5B2_internal_t *new_root = NULL; /* Pointer to new root node */ unsigned new_root_flags = H5AC__NO_FLAGS_SET; /* Cache flags for new root node */ @@ -368,7 +368,7 @@ H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id) unsigned u_max_nrec_size; /* Temporary variable for range checking */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -399,18 +399,18 @@ H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id) /* Create new internal node to use as root */ hdr->root.node_nrec = 0; - if(H5B2_create_internal(hdr, dxpl_id, &(hdr->root), hdr->depth) < 0) + if(H5B2__create_internal(hdr, dxpl_id, &(hdr->root), hdr->depth) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node") /* Protect new root node */ - if(NULL == (new_root = H5B2_protect_internal(hdr, dxpl_id, hdr->root.addr, hdr->root.node_nrec, hdr->depth, H5AC_WRITE))) + if(NULL == (new_root = H5B2__protect_internal(hdr, dxpl_id, hdr->root.addr, hdr->root.node_nrec, hdr->depth, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Set first node pointer in root node to old root node pointer info */ new_root->node_ptrs[0] = old_root_ptr; /* Split original root node */ - if(H5B2_split1(hdr, dxpl_id, hdr->depth, &(hdr->root), NULL, new_root, &new_root_flags, 0) < 0) + if(H5B2__split1(hdr, dxpl_id, hdr->depth, &(hdr->root), NULL, new_root, &new_root_flags, 0) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split old root node") done: @@ -419,11 +419,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_split_root() */ +} /* end H5B2__split_root() */ /*------------------------------------------------------------------------- - * Function: H5B2_redistribute2 + * Function: H5B2__redistribute2 * * Purpose: Redistribute records between two nodes * @@ -437,7 +437,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned idx) { const H5AC_class_t *child_class; /* Pointer to child node's class info */ @@ -450,7 +450,7 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -467,9 +467,9 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock left & right B-tree child nodes */ - if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (left_internal = H5B2__protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (right_internal = H5B2__protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for child nodes */ @@ -492,9 +492,9 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock left & right B-tree child nodes */ - if(NULL == (left_leaf = H5B2_protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) + if(NULL == (left_leaf = H5B2__protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (right_leaf = H5B2_protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) + if(NULL == (right_leaf = H5B2__protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for child nodes */ @@ -507,14 +507,14 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, } /* end else */ #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) { - H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child); - H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child); + H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child); + H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child); } /* end if */ else { - H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child); - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child); } /* end else */ #endif /* H5B2_DEBUG */ @@ -627,14 +627,14 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, } /* end else */ #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) { - H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child); - H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child); + H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)right_child); + H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)left_child); } /* end if */ else { - H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child); - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child); } /* end else */ #endif /* H5B2_DEBUG */ @@ -646,11 +646,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_redistribute2() */ +} /* end H5B2__redistribute2() */ /*------------------------------------------------------------------------- - * Function: H5B2_redistribute3 + * Function: H5B2__redistribute3 * * Purpose: Redistribute records between three nodes * @@ -664,7 +664,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ @@ -684,7 +684,7 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -704,11 +704,11 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock B-tree child nodes */ - if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (left_internal = H5B2__protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - if(NULL == (middle_internal = H5B2_protect_internal(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (middle_internal = H5B2__protect_internal(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (right_internal = H5B2__protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* More setup for child nodes */ @@ -737,11 +737,11 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock B-tree child nodes */ - if(NULL == (left_leaf = H5B2_protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, H5AC_WRITE))) + if(NULL == (left_leaf = H5B2__protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (middle_leaf = H5B2_protect_leaf(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) + if(NULL == (middle_leaf = H5B2__protect_leaf(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (right_leaf = H5B2_protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) + if(NULL == (right_leaf = H5B2__protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for child nodes */ @@ -1009,17 +1009,17 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, } #endif /* QAK */ #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) { - H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child); - H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)left_child); - H5B2_assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)right_child); - H5B2_assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)middle_child); + H5B2__assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child); + H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)left_child); + H5B2__assert_internal2(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child, (H5B2_internal_t *)right_child); + H5B2__assert_internal2(internal->node_ptrs[idx + 1].all_nrec, hdr, (H5B2_internal_t *)right_child, (H5B2_internal_t *)middle_child); } /* end if */ else { - H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child); - H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)middle_child, (H5B2_leaf_t *)right_child); - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child); + H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)middle_child, (H5B2_leaf_t *)right_child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)right_child); } /* end else */ #endif /* H5B2_DEBUG */ @@ -1033,11 +1033,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_redistribute3() */ +} /* end H5B2__redistribute3() */ /*------------------------------------------------------------------------- - * Function: H5B2_merge2 + * Function: H5B2__merge2 * * Purpose: Perform a 2->1 node merge * @@ -1052,7 +1052,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { @@ -1065,7 +1065,7 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -1084,9 +1084,9 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock left & right B-tree child nodes */ - if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (left_internal = H5B2__protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (right_internal = H5B2__protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* More setup for accessing child node information */ @@ -1109,9 +1109,9 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock left & right B-tree child nodes */ - if(NULL == (left_leaf = H5B2_protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) + if(NULL == (left_leaf = H5B2__protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (right_leaf = H5B2_protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) + if(NULL == (right_leaf = H5B2__protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for accessing child node information */ @@ -1169,11 +1169,11 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG; #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) - H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child); + H5B2__assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)left_child); else - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)left_child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)left_child); #endif /* H5B2_DEBUG */ done: @@ -1186,11 +1186,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_merge2() */ +} /* end H5B2__merge2() */ /*------------------------------------------------------------------------- - * Function: H5B2_merge3 + * Function: H5B2__merge3 * * Purpose: Perform a 3->2 node merge * @@ -1205,7 +1205,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { @@ -1225,7 +1225,7 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -1246,11 +1246,11 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock B-tree child nodes */ - if(NULL == (left_internal = H5B2_protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (left_internal = H5B2__protect_internal(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - if(NULL == (middle_internal = H5B2_protect_internal(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (middle_internal = H5B2__protect_internal(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") - if(NULL == (right_internal = H5B2_protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (right_internal = H5B2__protect_internal(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* More setup for accessing child node information */ @@ -1279,11 +1279,11 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, right_addr = internal->node_ptrs[idx + 1].addr; /* Lock B-tree child nodes */ - if(NULL == (left_leaf = H5B2_protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, H5AC_WRITE))) + if(NULL == (left_leaf = H5B2__protect_leaf(hdr, dxpl_id, left_addr, internal->node_ptrs[idx - 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (middle_leaf = H5B2_protect_leaf(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) + if(NULL == (middle_leaf = H5B2__protect_leaf(hdr, dxpl_id, middle_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") - if(NULL == (right_leaf = H5B2_protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) + if(NULL == (right_leaf = H5B2__protect_leaf(hdr, dxpl_id, right_addr, internal->node_ptrs[idx + 1].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for accessing child node information */ @@ -1391,14 +1391,14 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, *parent_cache_info_flags_ptr |= H5AC__DIRTIED_FLAG; #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) { - H5B2_assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child); - H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child); + H5B2__assert_internal2(internal->node_ptrs[idx - 1].all_nrec, hdr, (H5B2_internal_t *)left_child, (H5B2_internal_t *)middle_child); + H5B2__assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)middle_child); } /* end if */ else { - H5B2_assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child); - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)middle_child); + H5B2__assert_leaf2(hdr, (H5B2_leaf_t *)left_child, (H5B2_leaf_t *)middle_child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)middle_child); } /* end else */ #endif /* H5B2_DEBUG */ @@ -1414,11 +1414,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_merge3() */ +} /* end H5B2__merge3() */ /*------------------------------------------------------------------------- - * Function: H5B2_swap_leaf + * Function: H5B2__swap_leaf * * Purpose: Swap a record in a node with a record in a leaf node * @@ -1433,7 +1433,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, void *swap_loc) { @@ -1443,7 +1443,7 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, uint8_t *child_native; /* Pointer to child's native records */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -1460,7 +1460,7 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, child_addr = internal->node_ptrs[idx].addr; /* Lock B-tree child nodes */ - if(NULL == (child_internal = H5B2_protect_internal(hdr, dxpl_id, child_addr, internal->node_ptrs[idx].node_nrec, (depth - 1), H5AC_WRITE))) + if(NULL == (child_internal = H5B2__protect_internal(hdr, dxpl_id, child_addr, internal->node_ptrs[idx].node_nrec, (uint16_t)(depth - 1), H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* More setup for accessing child node information */ @@ -1475,7 +1475,7 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, child_addr = internal->node_ptrs[idx].addr; /* Lock B-tree child node */ - if(NULL == (child_leaf = H5B2_protect_leaf(hdr, dxpl_id, child_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) + if(NULL == (child_leaf = H5B2__protect_leaf(hdr, dxpl_id, child_addr, internal->node_ptrs[idx].node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* More setup for accessing child node information */ @@ -1492,11 +1492,11 @@ H5B2_swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, *internal_flags_ptr |= H5AC__DIRTIED_FLAG; #ifdef H5B2_DEBUG - H5B2_assert_internal((hsize_t)0, hdr, internal); + H5B2__assert_internal((hsize_t)0, hdr, internal); if(depth > 1) - H5B2_assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)child); + H5B2__assert_internal(internal->node_ptrs[idx].all_nrec, hdr, (H5B2_internal_t *)child); else - H5B2_assert_leaf(hdr, (H5B2_leaf_t *)child); + H5B2__assert_leaf(hdr, (H5B2_leaf_t *)child); #endif /* H5B2_DEBUG */ done: @@ -1505,11 +1505,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_swap_leaf() */ +} /* end H5B2__swap_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_insert_leaf + * Function: H5B2__insert_leaf * * Purpose: Adds a new record to a B-tree leaf node. * @@ -1522,7 +1522,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, +H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata) { H5B2_leaf_t *leaf; /* Pointer to leaf node */ @@ -1530,7 +1530,7 @@ H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, unsigned idx; /* Location of record which matches key */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -1538,7 +1538,7 @@ H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, HDassert(H5F_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, H5AC_WRITE))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Must have a leaf node with enough space to insert a record now */ @@ -1553,7 +1553,7 @@ H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, idx = 0; else { /* Find correct location to insert this record */ - if((cmp = H5B2_locate_record(hdr->cls, 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++; @@ -1601,11 +1601,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_insert_leaf() */ +} /* H5B2__insert_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_insert_internal + * Function: H5B2__insert_internal * * Purpose: Adds a new record to a B-tree node. * @@ -1618,7 +1618,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata) { @@ -1628,7 +1628,7 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -1637,7 +1637,7 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, HDassert(H5F_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Split or redistribute child node pointers, if necessary */ @@ -1647,7 +1647,7 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, size_t split_nrec; /* Number of records to split node at */ /* Locate node pointer for child */ - if((cmp = H5B2_locate_record(hdr->cls, 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++; @@ -1668,22 +1668,22 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Attempt to redistribute records among children */ if(idx == 0) { /* Left-most child */ if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec < split_nrec)) { - if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, idx) < 0) + if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_split1(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__split1(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node") } /* end else */ } /* end if */ else if(idx == internal->nrec) { /* Right-most child */ if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec < split_nrec)) { - if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0) + if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_split1(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__split1(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node") } /* end else */ @@ -1691,11 +1691,11 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, else { /* Middle child */ if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec < split_nrec) || (internal->node_ptrs[idx - 1].node_nrec < split_nrec))) { - if(H5B2_redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0) + if(H5B2__redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_split1(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__split1(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node") } /* end else */ @@ -1703,7 +1703,7 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, 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->cls, 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++; @@ -1727,11 +1727,11 @@ H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Attempt to insert node */ if(depth > 1) { - if(H5B2_insert_internal(hdr, dxpl_id, (depth - 1), &internal_flags, &internal->node_ptrs[idx], next_pos, udata) < 0) + if(H5B2__insert_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], next_pos, udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") } /* end if */ else { - if(H5B2_insert_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], next_pos, udata) < 0) + if(H5B2__insert_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], next_pos, udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") } /* end else */ @@ -1747,11 +1747,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_insert_internal() */ +} /* H5B2__insert_internal() */ /*------------------------------------------------------------------------- - * Function: H5B2_create_leaf + * Function: H5B2__create_leaf * * Purpose: Creates empty leaf node of a B-tree and update node pointer * to point to it. @@ -1765,12 +1765,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr) +H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr) { H5B2_leaf_t *leaf = NULL; /* Pointer to new leaf node created */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -1784,7 +1784,7 @@ H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr) HDmemset(&leaf->cache_info, 0, sizeof(H5AC_info_t)); /* Increment ref. count on B-tree header */ - if(H5B2_hdr_incr(hdr) < 0) + if(H5B2__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ @@ -1811,16 +1811,16 @@ HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec) done: if(ret_value < 0) { if(leaf) - if(H5B2_leaf_free(leaf) < 0) + if(H5B2__leaf_free(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_create_leaf() */ +} /* H5B2__create_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_protect_leaf + * Function: H5B2__protect_leaf * * Purpose: "Protect" an leaf node in the metadata cache * @@ -1833,13 +1833,13 @@ done: *------------------------------------------------------------------------- */ H5B2_leaf_t * -H5B2_protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, unsigned nrec, +H5B2__protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, uint16_t nrec, H5AC_protect_t rw) { H5B2_leaf_cache_ud_t udata; /* User-data for callback */ H5B2_leaf_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -1856,11 +1856,11 @@ H5B2_protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, unsigned nrec, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_protect_leaf() */ +} /* H5B2__protect_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_create_internal + * Function: H5B2__create_internal * * Purpose: Creates empty internal node of a B-tree and update node pointer * to point to it. @@ -1874,13 +1874,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, - unsigned depth) +H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, + uint16_t depth) { H5B2_internal_t *internal = NULL; /* Pointer to new internal node created */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -1895,7 +1895,7 @@ H5B2_create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, HDmemset(&internal->cache_info, 0, sizeof(H5AC_info_t)); /* Increment ref. count on B-tree header */ - if(H5B2_hdr_incr(hdr) < 0) + if(H5B2__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ @@ -1917,7 +1917,7 @@ HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth /* Set number of records & depth of the node */ internal->nrec = 0; - internal->depth = (uint16_t)depth; + internal->depth = depth; /* Allocate space on disk for the internal node */ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size))) @@ -1930,16 +1930,16 @@ HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth done: if(ret_value < 0) { if(internal) - if(H5B2_internal_free(internal) < 0) + if(H5B2__internal_free(internal) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_create_internal() */ +} /* H5B2__create_internal() */ /*------------------------------------------------------------------------- - * Function: H5B2_protect_internal + * Function: H5B2__protect_internal * * Purpose: "Protect" an internal node in the metadata cache * @@ -1952,13 +1952,13 @@ done: *------------------------------------------------------------------------- */ H5B2_internal_t * -H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, - unsigned nrec, unsigned depth, H5AC_protect_t rw) +H5B2__protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, + uint16_t nrec, uint16_t depth, H5AC_protect_t rw) { H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */ H5B2_internal_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -1968,8 +1968,8 @@ H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, /* Set up user data for callback */ udata.f = hdr->f; udata.hdr = hdr; - H5_CHECKED_ASSIGN(udata.nrec, uint16_t, nrec, unsigned) - H5_CHECKED_ASSIGN(udata.depth, uint16_t, depth, unsigned) + udata.nrec = nrec; + udata.depth = depth; /* Protect the internal node */ if(NULL == (ret_value = (H5B2_internal_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_BT2_INT, addr, &udata, rw))) @@ -1977,11 +1977,11 @@ H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_protect_internal() */ +} /* H5B2__protect_internal() */ /*------------------------------------------------------------------------- - * Function: H5B2_iterate_node + * Function: H5B2__iterate_node * * Purpose: Iterate over all the records from a B-tree node, in "in-order" * order, making a callback for each record. @@ -1998,7 +1998,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data) { const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */ @@ -2009,7 +2009,7 @@ H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned u; /* Local index */ herr_t ret_value = H5_ITER_CONT; /* Iterator return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2021,7 +2021,7 @@ H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_internal_t *internal; /* Pointer to internal node */ /* Lock the current B-tree node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Set up information about current node */ @@ -2040,7 +2040,7 @@ H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_leaf_t *leaf; /* Pointer to leaf node */ /* Lock the current B-tree node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, H5AC_READ))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Set up information about current node */ @@ -2065,7 +2065,7 @@ H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, for(u = 0; u < curr_node->node_nrec && !ret_value; u++) { /* Descend into child node, if current node is an internal node */ if(depth > 0) { - if((ret_value = H5B2_iterate_node(hdr, dxpl_id, (depth - 1), &(node_ptrs[u]), op, op_data)) < 0) + if((ret_value = H5B2__iterate_node(hdr, dxpl_id, (uint16_t)(depth - 1), &(node_ptrs[u]), op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); } /* end if */ @@ -2078,7 +2078,7 @@ H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Descend into last child node, if current node is an internal node */ if(!ret_value && depth > 0) { - if((ret_value = H5B2_iterate_node(hdr, dxpl_id, (depth - 1), &(node_ptrs[u]), op, op_data)) < 0) + if((ret_value = H5B2__iterate_node(hdr, dxpl_id, (uint16_t)(depth - 1), &(node_ptrs[u]), op, op_data)) < 0) HERROR(H5E_BTREE, H5E_CANTLIST, "node iteration failed"); } /* end if */ @@ -2090,11 +2090,11 @@ done: native = (uint8_t *)H5FL_FAC_FREE(hdr->node_info[depth].nat_rec_fac, native); FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_iterate_node() */ +} /* H5B2__iterate_node() */ /*------------------------------------------------------------------------- - * Function: H5B2_remove_leaf + * Function: H5B2__remove_leaf * * Purpose: Removes a record from a B-tree leaf node. * @@ -2107,7 +2107,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, +H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata, H5B2_remove_t op, void *op_data) { H5B2_leaf_t *leaf; /* Pointer to leaf node */ @@ -2116,7 +2116,7 @@ H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, unsigned idx; /* Location of record which matches key */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2125,7 +2125,7 @@ H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, /* Lock current B-tree node */ leaf_addr = curr_node_ptr->addr; - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, leaf_addr, curr_node_ptr->node_nrec, H5AC_WRITE))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, leaf_addr, curr_node_ptr->node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Sanity check number of records */ @@ -2133,7 +2133,7 @@ H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, HDassert(leaf->nrec == curr_node_ptr->node_nrec); /* Find correct location to remove this record */ - if(H5B2_locate_record(hdr->cls, 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") /* Check for invalidating the min/max record for the tree */ @@ -2190,11 +2190,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_remove_leaf() */ +} /* H5B2__remove_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_remove_internal + * Function: H5B2__remove_internal * * Purpose: Removes a record from a B-tree node. * @@ -2207,8 +2207,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, - void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info, +H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, + void *swap_loc, uint16_t depth, H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, H5B2_nodepos_t curr_pos, H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op, void *op_data) { @@ -2223,7 +2223,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2234,7 +2234,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, /* Lock current B-tree node */ internal_addr = curr_node_ptr->addr; - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Determine the correct number of records to merge at */ @@ -2246,7 +2246,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, ((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) { /* Merge children of root node */ - if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") @@ -2281,7 +2281,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, if(swap_loc) idx = 0; else { - cmp = H5B2_locate_record(hdr->cls, 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 */ @@ -2300,27 +2300,27 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, /* (NOTE: These 2-node redistributions should actually get the * record to promote from the node with more records. - QAK) */ - /* (NOTE: This code is the same in both H5B2_remove_internal() and - * H5B2_remove_internal_by_idx(), fix bugs in both places! - QAK) + /* (NOTE: This code is the same in both H5B2__remove_internal() and + * H5B2__remove_internal_by_idx(), fix bugs in both places! - QAK) */ if(idx == 0) { /* Left-most child */ if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) { - if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, idx) < 0) + if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") } /* end else */ } /* end if */ else if(idx == internal->nrec) { /* Right-most child */ if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) { - if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0) + if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") } /* end else */ @@ -2328,11 +2328,11 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, else { /* Middle child */ if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) || (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) { - if(H5B2_redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0) + if(H5B2__redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_merge3(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge3(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") } /* end else */ @@ -2343,7 +2343,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, idx = 0; else { /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ - cmp = H5B2_locate_record(hdr->cls, 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 */ @@ -2358,7 +2358,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, /* Swap record to delete with record from leaf, if we are the last internal node */ if(swap_loc && depth == 1) - if(H5B2_swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0) + if(H5B2__swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree") /* Set pointers for advancing to child node */ @@ -2381,12 +2381,12 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, /* Attempt to remove record from child node */ if(depth > 1) { - if(H5B2_remove_internal(hdr, dxpl_id, depth_decreased, swap_loc, depth - 1, + if(H5B2__remove_internal(hdr, dxpl_id, depth_decreased, swap_loc, (uint16_t)(depth - 1), new_cache_info, new_cache_info_flags_ptr, next_pos, new_node_ptr, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") } /* end if */ else { - if(H5B2_remove_leaf(hdr, dxpl_id, new_node_ptr, next_pos, udata, op, op_data) < 0) + if(H5B2__remove_leaf(hdr, dxpl_id, new_node_ptr, next_pos, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") } /* end else */ @@ -2398,7 +2398,7 @@ H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, internal_flags |= H5AC__DIRTIED_FLAG; #ifdef H5B2_DEBUG - H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal); + H5B2__assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal); #endif /* H5B2_DEBUG */ done: @@ -2407,11 +2407,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_remove_internal() */ +} /* H5B2__remove_internal() */ /*------------------------------------------------------------------------- - * Function: H5B2_remove_leaf_by_idx + * Function: H5B2__remove_leaf_by_idx * * Purpose: Removes a record from a B-tree leaf node, according to the * offset in the B-tree records. @@ -2425,7 +2425,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, +H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, unsigned idx, H5B2_remove_t op, void *op_data) { @@ -2434,7 +2434,7 @@ H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2443,7 +2443,7 @@ H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Lock B-tree leaf node */ leaf_addr = curr_node_ptr->addr; - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, leaf_addr, curr_node_ptr->node_nrec, H5AC_WRITE))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, leaf_addr, curr_node_ptr->node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Sanity check number of records */ @@ -2505,11 +2505,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_remove_leaf_by_idx() */ +} /* H5B2__remove_leaf_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5B2_remove_internal_by_idx + * Function: H5B2__remove_internal_by_idx * * Purpose: Removes a record from a B-tree node, according to the offset * in the B-tree records @@ -2523,8 +2523,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, - hbool_t *depth_decreased, void *swap_loc, unsigned depth, +H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, + hbool_t *depth_decreased, void *swap_loc, uint16_t depth, H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n, H5B2_remove_t op, void *op_data) @@ -2540,7 +2540,7 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t collapsed_root = FALSE; /* Whether the root was collapsed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2551,7 +2551,7 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Lock current B-tree node */ internal_addr = curr_node_ptr->addr; - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, internal_addr, curr_node_ptr->node_nrec, depth, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") HDassert(internal->nrec == curr_node_ptr->node_nrec); HDassert(depth == hdr->depth || internal->nrec > 1); @@ -2566,7 +2566,7 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, HDassert(depth == hdr->depth); /* Merge children of root node */ - if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") @@ -2643,27 +2643,27 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* (NOTE: These 2-node redistributions should actually get the * record to promote from the node with more records. - QAK) */ - /* (NOTE: This code is the same in both H5B2_remove_internal() and - * H5B2_remove_internal_by_idx(), fix bugs in both places! - QAK) + /* (NOTE: This code is the same in both H5B2__remove_internal() and + * H5B2__remove_internal_by_idx(), fix bugs in both places! - QAK) */ if(idx == 0) { /* Left-most child */ if(retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) { - if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, idx) < 0) + if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") } /* end else */ } /* end if */ else if(idx == internal->nrec) { /* Right-most child */ if(retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) { - if(H5B2_redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0) + if(H5B2__redistribute2(hdr, dxpl_id, depth, internal, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_merge2(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge2(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") } /* end else */ @@ -2671,11 +2671,11 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, else { /* Middle child */ if(retries > 0 && ((internal->node_ptrs[idx + 1].node_nrec > merge_nrec) || (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) { - if(H5B2_redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0) + if(H5B2__redistribute3(hdr, dxpl_id, depth, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, "unable to redistribute child node records") } /* end if */ else { - if(H5B2_merge3(hdr, dxpl_id, depth, curr_node_ptr, + if(H5B2__merge3(hdr, dxpl_id, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") } /* end else */ @@ -2730,7 +2730,7 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Swap record to delete with record from leaf, if we are the last internal node */ if(swap_loc && depth == 1) - if(H5B2_swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0) + if(H5B2__swap_leaf(hdr, dxpl_id, depth, internal, &internal_flags, idx, swap_loc) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "can't swap records in B-tree") /* Set pointers for advancing to child node */ @@ -2753,12 +2753,12 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Attempt to remove record from child node */ if(depth > 1) { - if(H5B2_remove_internal_by_idx(hdr, dxpl_id, depth_decreased, swap_loc, depth - 1, + if(H5B2__remove_internal_by_idx(hdr, dxpl_id, depth_decreased, swap_loc, (uint16_t)(depth - 1), new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") } /* end if */ else { - if(H5B2_remove_leaf_by_idx(hdr, dxpl_id, new_node_ptr, next_pos, (unsigned)n, op, op_data) < 0) + if(H5B2__remove_leaf_by_idx(hdr, dxpl_id, new_node_ptr, next_pos, (unsigned)n, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") } /* end else */ @@ -2770,7 +2770,7 @@ H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, internal_flags |= H5AC__DIRTIED_FLAG; #ifdef H5B2_DEBUG - H5B2_assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal); + H5B2__assert_internal((!collapsed_root ? (curr_node_ptr->all_nrec - 1) : new_node_ptr->all_nrec), hdr, internal); #endif /* H5B2_DEBUG */ done: @@ -2779,11 +2779,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_remove_internal_by_idx() */ +} /* H5B2__remove_internal_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5B2_neighbor_leaf + * Function: H5B2__neighbor_leaf * * Purpose: Locate a record relative to the specified information in a * B-tree leaf node and return that information by filling in @@ -2809,7 +2809,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, +H5B2__neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data) { @@ -2818,7 +2818,7 @@ H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_pt int cmp = 0; /* Comparison value of records */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2827,11 +2827,11 @@ H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_pt HDassert(op); /* Lock current B-tree node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, H5AC_READ))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, 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 @@ -2865,11 +2865,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_neighbor_leaf() */ +} /* H5B2__neighbor_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_neighbor_internal + * Function: H5B2__neighbor_internal * * Purpose: Locate a record relative to the specified information in a * B-tree internal node and return that information by filling in @@ -2895,7 +2895,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data) { @@ -2904,7 +2904,7 @@ H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, int cmp = 0; /* Comparison value of records */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2914,11 +2914,11 @@ H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, HDassert(op); /* Lock current B-tree node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, 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++; @@ -2936,11 +2936,11 @@ H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Attempt to find neighboring record */ if(depth > 1) { - if(H5B2_neighbor_internal(hdr, dxpl_id, depth - 1, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0) + if(H5B2__neighbor_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree internal node") } /* end if */ else { - if(H5B2_neighbor_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0) + if(H5B2__neighbor_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], neighbor_loc, comp, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node") } /* end else */ @@ -2950,11 +2950,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_neighbor_internal() */ +} /* H5B2__neighbor_internal() */ /*------------------------------------------------------------------------- - * Function: H5B2_delete_node + * Function: H5B2__delete_node * * Purpose: Iterate over all the nodes in a B-tree node deleting them * after they no longer have any children @@ -2968,7 +2968,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, H5B2_remove_t op, void *op_data) { const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */ @@ -2976,7 +2976,7 @@ H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, uint8_t *native; /* Pointers to node's native records */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -2987,7 +2987,7 @@ H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, unsigned u; /* Local index */ /* Lock the current B-tree node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_WRITE))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Set up information about current node */ @@ -2997,14 +2997,14 @@ H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Descend into children */ for(u = 0; u < internal->nrec + (unsigned)1; u++) - if(H5B2_delete_node(hdr, dxpl_id, (depth - 1), &(internal->node_ptrs[u]), op, op_data) < 0) + if(H5B2__delete_node(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed") } /* end if */ else { H5B2_leaf_t *leaf; /* Pointer to leaf node */ /* Lock the current B-tree node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, H5AC_WRITE))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Set up information about current node */ @@ -3031,11 +3031,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_delete_node() */ +} /* H5B2__delete_node() */ /*------------------------------------------------------------------------- - * Function: H5B2_node_size + * Function: H5B2__node_size * * Purpose: Iterate over all the records from a B-tree node, collecting * btree storage info. @@ -3048,13 +3048,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5B2__node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, hsize_t *btree_size) { H5B2_internal_t *internal = NULL; /* Pointer to internal node */ herr_t ret_value = SUCCEED; /* Iterator return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(hdr); @@ -3063,7 +3063,7 @@ H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, HDassert(depth > 0); /* Lock the current B-tree node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node->addr, curr_node->node_nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */ @@ -3072,7 +3072,7 @@ H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, /* Descend into children */ for(u = 0; u < internal->nrec + (unsigned)1; u++) - if(H5B2_node_size(hdr, dxpl_id, (depth - 1), &(internal->node_ptrs[u]), btree_size) < 0) + if(H5B2__node_size(hdr, dxpl_id, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), btree_size) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed") } /* end if */ else /* depth is 1: count all the leaf nodes from this node */ @@ -3086,11 +3086,11 @@ done: HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_node_size() */ +} /* H5B2__node_size() */ /*------------------------------------------------------------------------- - * Function: H5B2_internal_free + * Function: H5B2__internal_free * * Purpose: Destroys a B-tree internal node in memory. * @@ -3103,11 +3103,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_internal_free(H5B2_internal_t *internal) +H5B2__internal_free(H5B2_internal_t *internal) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -3123,7 +3123,7 @@ H5B2_internal_free(H5B2_internal_t *internal) internal->node_ptrs = (H5B2_node_ptr_t *)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->hdr) < 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 */ @@ -3131,11 +3131,11 @@ H5B2_internal_free(H5B2_internal_t *internal) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_internal_free() */ +} /* end H5B2__internal_free() */ /*------------------------------------------------------------------------- - * Function: H5B2_leaf_free + * Function: H5B2__leaf_free * * Purpose: Destroys a B-tree leaf node in memory. * @@ -3148,11 +3148,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5B2_leaf_free(H5B2_leaf_t *leaf) +H5B2__leaf_free(H5B2_leaf_t *leaf) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -3164,7 +3164,7 @@ H5B2_leaf_free(H5B2_leaf_t *leaf) leaf->leaf_native = (uint8_t *)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->hdr) < 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 */ @@ -3172,12 +3172,12 @@ H5B2_leaf_free(H5B2_leaf_t *leaf) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B2_leaf_free() */ +} /* end H5B2__leaf_free() */ #ifdef H5B2_DEBUG /*------------------------------------------------------------------------- - * Function: H5B2_assert_leaf + * Function: H5B2__assert_leaf * * Purpose: Verify than a leaf node is mostly sane * @@ -3190,17 +3190,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) +H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) { /* General sanity checking on node */ HDassert(leaf->nrec <= hdr->node_info->split_nrec); return(0); -} /* end H5B2_assert_leaf() */ +} /* end H5B2__assert_leaf() */ /*------------------------------------------------------------------------- - * Function: H5B2_assert_leaf2 + * Function: H5B2__assert_leaf2 * * Purpose: Verify than a leaf node is mostly sane * @@ -3213,17 +3213,17 @@ H5B2_assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) *------------------------------------------------------------------------- */ static herr_t -H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t UNUSED *leaf2) +H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_leaf_t UNUSED *leaf2) { /* General sanity checking on node */ HDassert(leaf->nrec <= hdr->node_info->split_nrec); return(0); -} /* end H5B2_assert_leaf2() */ +} /* end H5B2__assert_leaf2() */ /*------------------------------------------------------------------------- - * Function: H5B2_assert_internal + * Function: H5B2__assert_internal * * Purpose: Verify than an internal node is mostly sane * @@ -3236,7 +3236,7 @@ H5B2_assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, const H5B2_lea *------------------------------------------------------------------------- */ static herr_t -H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal) +H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ uint16_t u, v; /* Local index variables */ @@ -3260,11 +3260,11 @@ H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_ HDassert(tot_all_nrec == parent_all_nrec); return(0); -} /* end H5B2_assert_internal() */ +} /* end H5B2__assert_internal() */ /*------------------------------------------------------------------------- - * Function: H5B2_assert_internal2 + * Function: H5B2__assert_internal2 * * Purpose: Verify than internal nodes are mostly sane * @@ -3277,7 +3277,7 @@ H5B2_assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_ *------------------------------------------------------------------------- */ static herr_t -H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) +H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ uint16_t u, v; /* Local index variables */ @@ -3303,6 +3303,6 @@ H5B2_assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2 HDassert(tot_all_nrec == parent_all_nrec); return(0); -} /* end H5B2_assert_internal2() */ +} /* end H5B2__assert_internal2() */ #endif /* H5B2_DEBUG */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 3ea9534..72476eb 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -228,15 +228,15 @@ typedef struct H5B2_hdr_cache_ud_t { typedef struct H5B2_internal_cache_ud_t { H5F_t *f; /* File that v2 b-tree header is within */ H5B2_hdr_t *hdr; /* v2 B-tree header */ - unsigned nrec; /* Number of records in node to load */ - unsigned depth; /* Depth of node to load */ + uint16_t nrec; /* Number of records in node to load */ + uint16_t depth; /* Depth of node to load */ } H5B2_internal_cache_ud_t; /* Callback info for loading a free space leaf node into the cache */ typedef struct H5B2_leaf_cache_ud_t { H5F_t *f; /* File that v2 b-tree header is within */ H5B2_hdr_t *hdr; /* v2 B-tree header */ - unsigned nrec; /* Number of records in node to load */ + uint16_t nrec; /* Number of records in node to load */ } H5B2_leaf_cache_ud_t; #ifdef H5B2_TESTING @@ -281,88 +281,88 @@ extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID]; /******************************/ /* Routines for managing B-tree header info */ -H5_DLL H5B2_hdr_t *H5B2_hdr_alloc(H5F_t *f); -H5_DLL haddr_t H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, +H5_DLL H5B2_hdr_t *H5B2__hdr_alloc(H5F_t *f); +H5_DLL haddr_t H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udata); -H5_DLL herr_t H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, +H5_DLL herr_t H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, uint16_t depth); -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_fuse_incr(H5B2_hdr_t *hdr); -H5_DLL size_t H5B2_hdr_fuse_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, hid_t dxpl_id); +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_fuse_incr(H5B2_hdr_t *hdr); +H5_DLL size_t H5B2__hdr_fuse_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, hid_t dxpl_id); /* Routines for operating on leaf nodes */ -H5B2_leaf_t *H5B2_protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, - unsigned nrec, H5AC_protect_t rw); +H5B2_leaf_t *H5B2__protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, + uint16_t nrec, H5AC_protect_t rw); /* Routines for operating on internal nodes */ -H5_DLL H5B2_internal_t *H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, - haddr_t addr, unsigned nrec, unsigned depth, H5AC_protect_t rw); +H5_DLL H5B2_internal_t *H5B2__protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + haddr_t addr, uint16_t nrec, uint16_t depth, H5AC_protect_t rw); /* Routines for allocating nodes */ -H5_DLL herr_t H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id); -H5_DLL herr_t H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, +H5_DLL herr_t H5B2__split_root(H5B2_hdr_t *hdr, hid_t dxpl_id); +H5_DLL herr_t H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr); /* Routines for releasing structures */ -H5_DLL herr_t H5B2_hdr_free(H5B2_hdr_t *hdr); -H5_DLL herr_t H5B2_leaf_free(H5B2_leaf_t *l); -H5_DLL herr_t H5B2_internal_free(H5B2_internal_t *i); +H5_DLL herr_t H5B2__hdr_free(H5B2_hdr_t *hdr); +H5_DLL herr_t H5B2__leaf_free(H5B2_leaf_t *l); +H5_DLL herr_t H5B2__internal_free(H5B2_internal_t *i); /* Routines for inserting records */ -H5_DLL herr_t H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, - unsigned depth, unsigned *parent_cache_info_flags_ptr, +H5_DLL herr_t H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + uint16_t depth, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata); -H5_DLL herr_t H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, +H5_DLL herr_t H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata); /* Routines for iterating over nodes/records */ -H5_DLL herr_t H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data); -H5_DLL herr_t H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, - unsigned depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data); +H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, + uint16_t depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data); /* Routines for locating records */ -H5_DLL int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, +H5_DLL int H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx); -H5_DLL herr_t H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, - unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, +H5_DLL herr_t H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data); -H5_DLL herr_t H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, +H5_DLL herr_t H5B2__neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data); /* Routines for removing records */ -H5_DLL herr_t H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, - hbool_t *depth_decreased, void *swap_loc, unsigned depth, - H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, +H5_DLL herr_t H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + hbool_t *depth_decreased, void *swap_loc, uint16_t depth, + H5AC_info_t *parent_cache_info, hbool_t *parent_cache_info_dirtied_ptr, H5B2_nodepos_t curr_pos, H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op, void *op_data); -H5_DLL herr_t H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, +H5_DLL herr_t H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata, H5B2_remove_t op, void *op_data); -H5_DLL herr_t H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, - hbool_t *depth_decreased, void *swap_loc, unsigned depth, - H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, - H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n, +H5_DLL herr_t H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, + hbool_t *depth_decreased, void *swap_loc, uint16_t depth, + H5AC_info_t *parent_cache_info, hbool_t *parent_cache_info_dirtied_ptr, + H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t idx, H5B2_remove_t op, void *op_data); -H5_DLL herr_t H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, +H5_DLL herr_t H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, unsigned idx, H5B2_remove_t op, void *op_data); /* Routines for deleting nodes */ -H5_DLL herr_t H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, +H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, H5B2_remove_t op, void *op_data); /* Debugging routines for dumping file structures */ -H5_DLL herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, +H5_DLL herr_t H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t obj_addr); -H5_DLL herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, +H5_DLL herr_t H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t obj_addr); -H5_DLL herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, +H5_DLL herr_t H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr); diff --git a/src/H5B2stat.c b/src/H5B2stat.c index 5d159ed..bdb4a1f 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -139,7 +139,7 @@ H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size) *btree_size += hdr->node_size; else /* Iterate through nodes */ - if(H5B2_node_size(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0) + if(H5B2__node_size(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed") } /* end if */ diff --git a/src/H5B2test.c b/src/H5B2test.c index 8507d6e..d3149a7 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -61,15 +61,15 @@ typedef struct H5B2_test_ctx_t { /* Local Prototypes */ /********************/ -static void *H5B2_test_crt_context(void *udata); -static herr_t H5B2_test_dst_context(void *ctx); -static herr_t H5B2_test_store(void *nrecord, const void *udata); -static herr_t H5B2_test_compare(const void *rec1, const void *rec2); -static herr_t H5B2_test_encode(uint8_t *raw, const void *nrecord, void *ctx); -static herr_t H5B2_test_decode(const uint8_t *raw, void *nrecord, void *ctx); -static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, +static void *H5B2__test_crt_context(void *udata); +static herr_t H5B2__test_dst_context(void *ctx); +static herr_t H5B2__test_store(void *nrecord, const void *udata); +static herr_t H5B2__test_compare(const void *rec1, const void *rec2); +static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); +static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); +static herr_t H5B2__test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *record, const void *_udata); -static void *H5B2_test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); +static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*********************/ @@ -80,15 +80,15 @@ 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_crt_context, /* Create client callback context */ - H5B2_test_dst_context, /* Destroy client callback context */ - H5B2_test_store, /* Record storage callback */ - H5B2_test_compare, /* Record comparison callback */ - H5B2_test_encode, /* Record encoding callback */ - H5B2_test_decode, /* Record decoding callback */ - H5B2_test_debug, /* Record debugging callback */ - H5B2_test_crt_dbg_context, /* Create debugging context */ - H5B2_test_dst_context /* Destroy debugging context */ + H5B2__test_crt_context, /* Create client callback context */ + H5B2__test_dst_context, /* Destroy client callback context */ + H5B2__test_store, /* Record storage callback */ + H5B2__test_compare, /* Record comparison callback */ + H5B2__test_encode, /* Record encoding callback */ + H5B2__test_decode, /* Record decoding callback */ + H5B2__test_debug, /* Record debugging callback */ + H5B2__test_crt_dbg_context, /* Create debugging context */ + H5B2__test_dst_context /* Destroy debugging context */ }}; @@ -107,7 +107,7 @@ H5FL_DEFINE_STATIC(H5B2_test_ctx_t); /*------------------------------------------------------------------------- - * Function: H5B2_test_crt_context + * Function: H5B2__test_crt_context * * Purpose: Create client callback context * @@ -120,13 +120,13 @@ H5FL_DEFINE_STATIC(H5B2_test_ctx_t); *------------------------------------------------------------------------- */ static void * -H5B2_test_crt_context(void *_f) +H5B2__test_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5B2_test_ctx_t *ctx; /* Callback context structure */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -143,11 +143,11 @@ H5B2_test_crt_context(void *_f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_test_crt_context() */ +} /* H5B2__test_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_dst_context + * Function: H5B2__test_dst_context * * Purpose: Destroy client callback context * @@ -160,11 +160,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_test_dst_context(void *_ctx) +H5B2__test_dst_context(void *_ctx) { H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -173,11 +173,11 @@ H5B2_test_dst_context(void *_ctx) ctx = H5FL_FREE(H5B2_test_ctx_t, ctx); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_test_dst_context() */ +} /* H5B2__test_dst_context() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_store + * Function: H5B2__test_store * * Purpose: Store native information into record for B-tree * @@ -190,18 +190,18 @@ H5B2_test_dst_context(void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5B2_test_store(void *nrecord, const void *udata) +H5B2__test_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(hsize_t *)nrecord = *(const hsize_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_test_store() */ +} /* H5B2__test_store() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_compare + * Function: H5B2__test_compare * * Purpose: Compare two native information records, according to some key * @@ -215,16 +215,16 @@ H5B2_test_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5B2_test_compare(const void *rec1, const void *rec2) +H5B2__test_compare(const void *rec1, const void *rec2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2)) -} /* H5B2_test_compare() */ +} /* H5B2__test_compare() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_encode + * Function: H5B2__test_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -237,11 +237,11 @@ H5B2_test_compare(const void *rec1, const void *rec2) *------------------------------------------------------------------------- */ static herr_t -H5B2_test_encode(uint8_t *raw, const void *nrecord, void *_ctx) +H5B2__test_encode(uint8_t *raw, const void *nrecord, void *_ctx) { H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -249,11 +249,11 @@ H5B2_test_encode(uint8_t *raw, const void *nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, *(const hsize_t *)nrecord, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_test_encode() */ +} /* H5B2__test_encode() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_decode + * Function: H5B2__test_decode * * Purpose: Decode raw disk form of record into native form * @@ -266,11 +266,11 @@ H5B2_test_encode(uint8_t *raw, const void *nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5B2_test_decode(const uint8_t *raw, void *nrecord, void *_ctx) +H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx) { H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -278,11 +278,11 @@ H5B2_test_decode(const uint8_t *raw, void *nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, *(hsize_t *)nrecord, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_test_decode() */ +} /* H5B2__test_decode() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_debug + * Function: H5B2__test_debug * * Purpose: Debug native form of record * @@ -295,11 +295,11 @@ H5B2_test_decode(const uint8_t *raw, void *nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, +H5B2__test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *record, const void UNUSED *_udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert (record); @@ -307,11 +307,11 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, *(const hsize_t *)record); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_test_debug() */ +} /* H5B2__test_debug() */ /*------------------------------------------------------------------------- - * Function: H5B2_test_crt_dbg_context + * Function: H5B2__test_crt_dbg_context * * Purpose: Create context for debugging callback * @@ -324,12 +324,12 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, *------------------------------------------------------------------------- */ static void * -H5B2_test_crt_dbg_context(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr) +H5B2__test_crt_dbg_context(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr) { H5B2_test_ctx_t *ctx; /* Callback context structure */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -346,7 +346,7 @@ H5B2_test_crt_dbg_context(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_test_crt_dbg_context() */ +} /* H5B2__test_crt_dbg_context() */ /*------------------------------------------------------------------------- @@ -397,7 +397,7 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata, { H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */ - unsigned depth; /* Current depth of the tree */ + uint16_t depth; /* Current depth of the tree */ int cmp; /* Comparison value of records */ unsigned idx; /* Location of record which matches key */ herr_t ret_value = SUCCEED; /* Return value */ @@ -430,11 +430,11 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */ /* Lock B-tree current node */ - if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ))) + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2_locate_record(hdr->cls, 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++; @@ -470,11 +470,11 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */ /* Lock B-tree leaf node */ - if(NULL == (leaf = H5B2_protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_READ))) + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate record */ - cmp = H5B2_locate_record(hdr->cls, 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(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) @@ -499,7 +499,7 @@ done: * * Purpose: Determine the depth of a node holding a record in the B-tree * - * Note: Just a simple wrapper around the H5B2_get_node_info_test() routine + * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine * * Return: Success: non-negative depth of the node where the record * was found diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index ea7a9ca..87c112a 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -394,7 +394,7 @@ main(int argc, char *argv[]) const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); - status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, (haddr_t)extra); + status = H5B2__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, (haddr_t)extra); } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -412,7 +412,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); + status = H5B2__int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -429,7 +429,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); + status = H5B2__leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* -- cgit v0.12 From 7206d78c523553b6192ac7d6befd54656d070130 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:48:50 -0500 Subject: [svn-r27072] Description: Clean up H5B interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5ACprivate.h | 50 ++----- src/H5C.c | 385 ++++++++++++++++++++---------------------------------- src/H5Cpkg.h | 34 ++--- src/H5Cprivate.h | 52 ++++---- 4 files changed, 203 insertions(+), 318 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 0a958b0..cf4c122 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -340,7 +340,7 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; H5_DLL herr_t H5AC_init(void); H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_get_entry_status(const H5F_t *f, haddr_t addr, - unsigned * status_ptr); + unsigned *status_ptr); H5_DLL herr_t H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags); H5_DLL herr_t H5AC_pin_protected_entry(void *thing); @@ -350,57 +350,35 @@ H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, H5_DLL herr_t H5AC_resize_entry(void *thing, size_t new_size); H5_DLL herr_t H5AC_unpin_entry(void *thing); H5_DLL herr_t H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing); -H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, - const H5AC_class_t *type, haddr_t addr, - void *thing, unsigned flags); +H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, + haddr_t addr, void *thing, unsigned flags); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5AC_mark_entry_dirty(void *thing); H5_DLL herr_t H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, - haddr_t old_addr, haddr_t new_addr); - + haddr_t old_addr, haddr_t new_addr); H5_DLL herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id); - H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, hid_t dxpl_id, - const H5AC_class_t *type, haddr_t addr, - unsigned flags); - + const H5AC_class_t *type, haddr_t addr, unsigned flags); H5_DLL herr_t H5AC_set_sync_point_done_callback(H5C_t *cache_ptr, void (*sync_point_done)(int num_writes, haddr_t *written_entries_tbl)); - H5_DLL herr_t H5AC_set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)); H5_DLL herr_t H5AC_stats(const H5F_t *f); - H5_DLL herr_t H5AC_dump_cache(const H5F_t *f); - H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr, - H5AC_cache_config_t *config_ptr); - -H5_DLL herr_t H5AC_get_cache_size(H5AC_t * cache_ptr, - size_t * max_size_ptr, - size_t * min_clean_size_ptr, - size_t * cur_size_ptr, - int32_t * cur_num_entries_ptr); - -H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t * cache_ptr, - double * hit_rate_ptr); - -H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr); - + H5AC_cache_config_t *config_ptr); +H5_DLL herr_t H5AC_get_cache_size(H5AC_t *cache_ptr, size_t *max_size_ptr, + size_t *min_clean_size_ptr, size_t *cur_size_ptr, int32_t *cur_num_entries_ptr); +H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t *cache_ptr, double *hit_rate_ptr); +H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr); H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, - H5AC_cache_config_t *config_ptr); - -H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t * config_ptr); - -H5_DLL herr_t H5AC_close_trace_file( H5AC_t * cache_ptr); - -H5_DLL herr_t H5AC_open_trace_file(H5AC_t * cache_ptr, - const char * trace_file_name); + H5AC_cache_config_t *config_ptr); +H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr); +H5_DLL herr_t H5AC_close_trace_file(H5AC_t *cache_ptr); +H5_DLL herr_t H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name); H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t * prev_tag); - H5_DLL herr_t H5AC_retag_copied_metadata(H5F_t * f, haddr_t metadata_tag); - H5_DLL herr_t H5AC_ignore_tags(H5F_t * f); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5C.c b/src/H5C.c index a28364a..3f11493 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -229,6 +229,8 @@ const H5C_class_t epoch_marker_class = /* size = */ &H5C_epoch_marker_size }; + + /*************************************************************************** * Class functions for H5C__EPOCH_MAKER_TYPE: * @@ -255,6 +257,8 @@ done: FUNC_LEAVE_NOAPI(ret_value) } + + static herr_t H5C_epoch_marker_flush(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, @@ -274,6 +278,8 @@ done: FUNC_LEAVE_NOAPI(ret_value) } + + static herr_t H5C_epoch_marker_dest(H5F_t UNUSED * f, void UNUSED * thing) @@ -784,7 +790,7 @@ H5C_apply_candidate_list(H5F_t * f, entries_flushed++; #if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 ) - HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank, + HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank, (long long)flush_ptr->addr); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ @@ -1604,48 +1610,38 @@ H5C_expunge_entry(H5F_t * f, FUNC_ENTER_NOAPI(FAIL) - HDassert( f ); - HDassert( f->shared ); + HDassert(f); + HDassert(f->shared); cache_ptr = f->shared->cache; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( type ); - HDassert( type->clear ); - HDassert( type->dest ); - HDassert( H5F_addr_defined(addr) ); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(type); + HDassert(type->clear); + HDassert(type->dest); + HDassert(H5F_addr_defined(addr)); #if H5C_DO_EXTREME_SANITY_CHECKS - if ( H5C_validate_lru_list(cache_ptr) < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "LRU extreme sanity check failed on entry.\n"); - } + if(H5C_validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "LRU extreme sanity check failed on entry.\n"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + /* Look for entry in cache */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - - if ( ( entry_ptr == NULL ) || ( entry_ptr->type != type ) ) { - + if((entry_ptr == NULL) || (entry_ptr->type != type)) /* the target doesn't exist in the cache, so we are done. */ HGOTO_DONE(SUCCEED) - } - - HDassert( entry_ptr->addr == addr ); - HDassert( entry_ptr->type == type ); - - if ( entry_ptr->is_protected ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \ - "Target entry is protected.") - } - if ( entry_ptr->is_pinned ) { + HDassert(entry_ptr->addr == addr); + HDassert(entry_ptr->type == type); - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \ - "Target entry is pinned.") - } + /* Check for entry being pinned or protected */ + if(entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected.") + if(entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned.") /* Pass along 'free file space' flag to cache client */ entry_ptr->free_file_space_on_destroy = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 ); @@ -1670,17 +1666,13 @@ H5C_expunge_entry(H5F_t * f, } done: - #if H5C_DO_EXTREME_SANITY_CHECKS - if ( H5C_validate_lru_list(cache_ptr) < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "LRU extreme sanity check failed on exit.\n"); - } + if(H5C_validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "LRU extreme sanity check failed on exit.\n"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_expunge_entry() */ @@ -1965,8 +1957,8 @@ H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsign FALSE); if ( status < 0 ) { - /* This shouldn't happen -- if it does, we are toast - * so just scream and die. + /* This shouldn't happen -- if it does, + * we are toast so just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "dirty pinned entry flush failed.") @@ -1983,7 +1975,7 @@ H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsign * aren't trying to do a destroy here, so that * is not an issue. */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ){ + if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { #if H5C_DO_SANITY_CHECKS flushed_entries_count++; flushed_entries_size += entry_ptr->size; @@ -1998,8 +1990,8 @@ H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsign FALSE); if ( status < 0 ) { - /* This shouldn't happen -- if it does, we are - * toast so just scream and die. + /* This shouldn't happen -- if it does, + * we are toast so just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "Can't flush entry.") @@ -2111,7 +2103,7 @@ H5C_flush_to_min_clean(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id) { - H5C_t * cache_ptr; + H5C_t * cache_ptr; herr_t result; hbool_t first_flush = TRUE; hbool_t write_permitted; @@ -2396,41 +2388,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_get_cache_hit_rate(H5C_t * cache_ptr, - double * hit_rate_ptr) - +H5C_get_cache_hit_rate(H5C_t * cache_ptr, double * hit_rate_ptr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - + if((cache_ptr == NULL ) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - if ( hit_rate_ptr == NULL ) { - + if(hit_rate_ptr == NULL) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry.") - } - HDassert( cache_ptr->cache_hits >= 0 ); - HDassert( cache_ptr->cache_accesses >= cache_ptr->cache_hits ); - - if ( cache_ptr->cache_accesses > 0 ) { + HDassert(cache_ptr->cache_hits >= 0); + HDassert(cache_ptr->cache_accesses >= cache_ptr->cache_hits); + if(cache_ptr->cache_accesses > 0) *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) / ((double)(cache_ptr->cache_accesses)); - - } else { - + else *hit_rate_ptr = 0.0f; - } done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_get_cache_hit_rate() */ @@ -2686,10 +2665,10 @@ H5C_insert_entry(H5F_t * f, herr_t result; hbool_t first_flush = TRUE; hbool_t insert_pinned; - hbool_t flush_last; + hbool_t flush_last; #ifdef H5_HAVE_PARALLEL - hbool_t flush_collectively; -#endif + hbool_t flush_collectively; +#endif /* H5_HAVE_PARALLEL */ hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; @@ -2731,7 +2710,7 @@ H5C_insert_entry(H5F_t * f, flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); #ifdef H5_HAVE_PARALLEL flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); -#endif +#endif /* H5_HAVE_PARALLEL */ entry_ptr = (H5C_cache_entry_t *)thing; @@ -2741,19 +2720,12 @@ H5C_insert_entry(H5F_t * f, H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - if ( test_entry_ptr != NULL ) { - - if ( test_entry_ptr == entry_ptr ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "entry already in cache.") - - } else { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "duplicate entry in cache.") - } - } + if(test_entry_ptr != NULL) { + if(test_entry_ptr == entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache.") + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache.") + } /* end if */ #ifndef NDEBUG entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; @@ -2829,28 +2801,17 @@ H5C_insert_entry(H5F_t * f, } } - if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) { - + if(cache_ptr->index_size >= cache_ptr->max_cache_size) empty_space = 0; - - } else { - + else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - } - - if ( ( cache_ptr->evictions_enabled ) - && + if ( ( cache_ptr->evictions_enabled ) && ( ( (cache_ptr->index_size + entry_ptr->size) > - cache_ptr->max_cache_size - ) + cache_ptr->max_cache_size) || - ( - ( ( empty_space + cache_ptr->clean_index_size ) < - cache_ptr->min_clean_size ) - ) - ) - ) { + ( ( ( empty_space + cache_ptr->clean_index_size ) < + cache_ptr->min_clean_size ) ) ) ) { size_t space_needed; @@ -3364,11 +3325,6 @@ done: * Programmer: John Mainzer * 6/2/04 * - * JRM -- 11/5/08 - * On review this function looks like no change is needed to - * support the new clean_index_size and dirty_index_size - * fields of H5C_t. - * *------------------------------------------------------------------------- */ herr_t @@ -3377,11 +3333,11 @@ H5C_move_entry(H5C_t * cache_ptr, haddr_t old_addr, haddr_t new_addr) { + H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * test_entry_ptr = NULL; #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS hbool_t was_dirty; #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - H5C_cache_entry_t * entry_ptr = NULL; - H5C_cache_entry_t * test_entry_ptr = NULL; #if H5C_DO_SANITY_CHECKS hbool_t removed_entry_from_slist = FALSE; #endif /* H5C_DO_SANITY_CHECKS */ @@ -3881,10 +3837,7 @@ H5C_protect(H5F_t * f, } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - if ( (flags & H5C__READ_ONLY_FLAG) != 0 ) - { - read_only = TRUE; - } + read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 ); /* first check to see if the target is in cache */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) @@ -3895,7 +3848,7 @@ H5C_protect(H5F_t * f, if(entry_ptr->type != type) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type") - #if H5C_DO_TAGGING_SANITY_CHECKS +#if H5C_DO_TAGGING_SANITY_CHECKS /* The entry is already in the cache, but make sure that the tag value being passed in via dxpl is still legal. This will ensure that had the entry NOT been in the cache, tagging was still set up correctly @@ -3918,8 +3871,8 @@ H5C_protect(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed"); } /* end if */ - #endif - +#endif + hit = TRUE; thing = (void *)entry_ptr; @@ -3958,21 +3911,15 @@ H5C_protect(H5F_t * f, } } - if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) { - + if(cache_ptr->index_size >= cache_ptr->max_cache_size) empty_space = 0; - - } else { - + else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - } - /* try to free up if necceary and if evictions are permitted. Note * that if evictions are enabled, we will call H5C_make_space_in_cache() * regardless if the min_free_space requirement is not met. */ - if ( ( cache_ptr->evictions_enabled ) && ( ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) @@ -3984,12 +3931,9 @@ H5C_protect(H5F_t * f, size_t space_needed; - if ( empty_space <= entry_ptr->size ) { - + if(empty_space <= entry_ptr->size) cache_ptr->cache_full = TRUE; - } - if ( cache_ptr->check_write_permitted != NULL ) { result = (cache_ptr->check_write_permitted)(f, @@ -4195,25 +4139,18 @@ H5C_protect(H5F_t * f, * into complience. */ - if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) { - + if(cache_ptr->index_size >= cache_ptr->max_cache_size) empty_space = 0; - - } else { - + else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - } - if ( ( cache_ptr->index_size > cache_ptr->max_cache_size ) || ( ( empty_space + cache_ptr->clean_index_size ) < cache_ptr->min_clean_size) ) { - if ( cache_ptr->index_size > cache_ptr->max_cache_size ) { - + if(cache_ptr->index_size > cache_ptr->max_cache_size) cache_ptr->cache_full = TRUE; - } result = H5C_make_space_in_cache(f, primary_dxpl_id, secondary_dxpl_id, @@ -4651,9 +4588,7 @@ H5C_set_prefix(H5C_t * cache_ptr, char * prefix) cache_ptr->prefix[H5C__PREFIX_LEN - 1] = '\0'; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_set_prefix() */ @@ -5564,7 +5499,7 @@ H5C_unprotect(H5F_t * f, void * thing, unsigned int flags) { - H5C_t * cache_ptr; + H5C_t * cache_ptr; hbool_t deleted; hbool_t dirtied; hbool_t set_flush_marker; @@ -5582,13 +5517,13 @@ H5C_unprotect(H5F_t * f, FUNC_ENTER_NOAPI(FAIL) - deleted = ( (flags & H5C__DELETED_FLAG) != 0 ); - dirtied = ( (flags & H5C__DIRTIED_FLAG) != 0 ); - set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 ); - pin_entry = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); - unpin_entry = ( (flags & H5C__UNPIN_ENTRY_FLAG) != 0 ); - free_file_space = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 ); - take_ownership = ( (flags & H5C__TAKE_OWNERSHIP_FLAG) != 0 ); + deleted = ((flags & H5C__DELETED_FLAG) != 0); + dirtied = ((flags & H5C__DIRTIED_FLAG) != 0); + set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); + pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0); + free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); HDassert( f ); HDassert( f->shared ); @@ -5632,49 +5567,39 @@ H5C_unprotect(H5F_t * f, * the ro_ref_counter. Don't actually unprotect until the ref count * drops to zero. */ - if ( entry_ptr->ro_ref_count > 1 ) { - - HDassert( entry_ptr->is_protected ); - HDassert( entry_ptr->is_read_only ); - - if ( dirtied ) { + if(entry_ptr->ro_ref_count > 1) { + /* Sanity check */ + HDassert(entry_ptr->is_protected); + HDassert(entry_ptr->is_read_only); - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "Read only entry modified(1)??") - } + if(dirtied) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") + /* Reduce the RO ref count */ (entry_ptr->ro_ref_count)--; /* Pin or unpin the entry as requested. */ - if ( pin_entry ) { - + if(pin_entry) { /* Pin the entry from a client */ if(H5C_pin_entry_from_client(cache_ptr, entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - - } else if ( unpin_entry ) { - + } else if(unpin_entry) { /* Unpin the entry from a client */ if(H5C_unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") - - } + } /* end if */ } else { + if(entry_ptr->is_read_only) { + /* Sanity check */ + HDassert(entry_ptr->ro_ref_count == 1); - if ( entry_ptr->is_read_only ) { - - HDassert( entry_ptr->ro_ref_count == 1 ); - - if ( dirtied ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "Read only entry modified(2)??") - } + if(dirtied) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") entry_ptr->is_read_only = FALSE; entry_ptr->ro_ref_count = 0; - } + } /* end if */ #ifdef H5_HAVE_PARALLEL /* When the H5C code is used to implement the metadata cache in the @@ -5692,47 +5617,36 @@ H5C_unprotect(H5F_t * f, * are contiguous, with only one dirty flag, we have to let the supplied * functions deal with the reseting the is_dirty flag. */ - if ( entry_ptr->clear_on_unprotect ) { - - HDassert( entry_ptr->is_dirty ); + if(entry_ptr->clear_on_unprotect) { + /* Sanity check */ + HDassert(entry_ptr->is_dirty); entry_ptr->clear_on_unprotect = FALSE; - - if ( ! dirtied ) { - + if(!dirtied) clear_entry = TRUE; - } - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ - if ( ! (entry_ptr->is_protected) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ - "Entry already unprotected??") - } - - /* mark the entry as dirty if appropriate */ - entry_ptr->is_dirty = ( (entry_ptr->is_dirty) || dirtied ); + if(!entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Entry already unprotected??") - if ( ( was_clean ) && ( entry_ptr->is_dirty ) ) { + /* Mark the entry as dirty if appropriate */ + entry_ptr->is_dirty = (entry_ptr->is_dirty || dirtied); + /* Update index for newly dirtied entry */ + if(was_clean && entry_ptr->is_dirty) H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) - } /* Pin or unpin the entry as requested. */ - if ( pin_entry ) { - + if(pin_entry) { /* Pin the entry from a client */ if(H5C_pin_entry_from_client(cache_ptr, entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - - } else if ( unpin_entry ) { - + } else if(unpin_entry) { /* Unpin the entry from a client */ if(H5C_unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") - - } + } /* end if */ /* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on * the pinned entry list if entry_ptr->is_pinned is TRUE. @@ -5744,16 +5658,11 @@ H5C_unprotect(H5F_t * f, /* if the entry is dirty, 'or' its flush_marker with the set flush flag, * and then add it to the skip list if it isn't there already. */ - - if ( entry_ptr->is_dirty ) { - + if(entry_ptr->is_dirty) { entry_ptr->flush_marker |= set_flush_marker; - - if ( ! (entry_ptr->in_slist) ) { - + if(!entry_ptr->in_slist) H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - } - } + } /* end if */ /* this implementation of the "deleted" option is a bit inefficient, as * we re-insert the entry to be deleted into the replacement policy @@ -5798,10 +5707,8 @@ H5C_unprotect(H5F_t * f, entry_ptr->free_file_space_on_destroy = free_file_space; /* Set the "take ownership" flag for the flush, if needed */ - if ( take_ownership) { - + if(take_ownership) flush_flags |= H5C__TAKE_OWNERSHIP_FLAG; - } if ( H5C_flush_single_entry(f, primary_dxpl_id, @@ -7854,7 +7761,6 @@ H5C_flush_invalidate_cache(H5F_t * f, * may be created by the flush call backs. Thus it is possible * that the slist will not be empty after we finish the scan. */ - if ( cache_ptr->slist_len == 0 ) { node_ptr = NULL; @@ -7875,7 +7781,6 @@ H5C_flush_invalidate_cache(H5F_t * f, HDassert( next_entry_ptr->in_slist ); } - #if H5C_DO_SANITY_CHECKS /* Depending on circumstances, H5C_flush_single_entry() will * remove dirty entries from the slist as it flushes them. @@ -7886,10 +7791,12 @@ H5C_flush_invalidate_cache(H5F_t * f, initial_slist_size = cache_ptr->slist_size; /* There is also the possibility that entries will be - * dirtied, resized, and/or moved as the result of - * calls to the flush callbacks. We use the slist_len_increase - * and slist_size_increase increase fields in struct H5C_t - * to track these changes for purpose of sanity checking. + * dirtied, resized, moved, and/or removed from the cache + * as the result of calls to the flush callbacks. We use + * the slist_len_increase and slist_size_increase increase + * fields in struct H5C_t to track these changes for purpose + * of sanity checking. + * * To this end, we must zero these fields before we start * the pass through the slist. */ @@ -7988,7 +7895,7 @@ H5C_flush_invalidate_cache(H5F_t * f, ( cache_ptr->num_last_entries >= cache_ptr->slist_len ) ) ) { - #if H5C_DO_SANITY_CHECKS +#if H5C_DO_SANITY_CHECKS /* update actual_slist_len & actual_slist_size before * the flush. Note that the entry will be removed * from the slist after the flush, and thus may be @@ -8001,7 +7908,7 @@ H5C_flush_invalidate_cache(H5F_t * f, */ actual_slist_len++; actual_slist_size += entry_ptr->size; - #endif /* H5C_DO_SANITY_CHECKS */ +#endif /* H5C_DO_SANITY_CHECKS */ if ( entry_ptr->is_protected ) { @@ -8028,8 +7935,8 @@ H5C_flush_invalidate_cache(H5F_t * f, FALSE); if ( status < 0 ) { - /* This shouldn't happen -- if it does, we are toast - * so just scream and die. + /* This shouldn't happen -- if it does, we + * are toast so just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ @@ -8054,8 +7961,8 @@ H5C_flush_invalidate_cache(H5F_t * f, TRUE); if ( status < 0 ) { - /* This shouldn't happen -- if it does, we are toast so - * just scream and die. + /* This shouldn't happen -- if it does, we + * are toast so just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ @@ -8123,8 +8030,9 @@ H5C_flush_invalidate_cache(H5F_t * f, if ( entry_ptr->is_protected ) { - /* we have major problems -- but lets flush and destroy - * everything we can before we flag an error. + /* we have major problems -- but lets flush and + * destroy everything we can before we flag an + * error. */ protected_entries++; @@ -8148,8 +8056,8 @@ H5C_flush_invalidate_cache(H5F_t * f, TRUE); if ( status < 0 ) { - /* This shouldn't happen -- if it does, we are toast so - * just scream and die. + /* This shouldn't happen -- if it does, + * we are toast so just scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ @@ -8304,10 +8212,10 @@ done: * primary_dxpl_id, and secondary_dxpl_id are all irrelevent, * and the call can't be part of a sequence of flushes. * - * If the caller knows the address of the TBBT node at + * If the caller knows the address of the skip list node at * which the target entry resides, it can avoid a lookup * by supplying that address in the tgt_node_ptr parameter. - * If this parameter is NULL, the function will do a TBBT + * If this parameter is NULL, the function will do a skip list * search for the entry instead. * * The function does nothing silently if there is no entry @@ -8332,9 +8240,9 @@ H5C_flush_single_entry(H5F_t * f, hbool_t del_entry_from_slist_on_destroy) { H5C_t * cache_ptr = f->shared->cache; - hbool_t destroy; - hbool_t clear_only; - hbool_t take_ownership; + hbool_t destroy; /* external flag */ + hbool_t clear_only; /* external flag */ + hbool_t take_ownership; /* external flag */ hbool_t was_dirty; hbool_t destroy_entry; herr_t status; @@ -8351,12 +8259,13 @@ H5C_flush_single_entry(H5F_t * f, HDassert( H5F_addr_defined(addr) ); HDassert( first_flush_ptr ); - destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); - clear_only = ( (flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); - take_ownership = ( (flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); + /* setup external flags from the flags parameter */ + destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); + clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); /* Set the flag for destroying the entry, based on the 'take ownership' - * and 'destroy' flags + * and 'destroy' flags */ if(take_ownership) destroy_entry = FALSE; @@ -8366,6 +8275,7 @@ H5C_flush_single_entry(H5F_t * f, /* attempt to find the target entry in the hash table */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + /* run initial sanity checks */ #if H5C_DO_SANITY_CHECKS if ( entry_ptr != NULL ) { @@ -8526,11 +8436,10 @@ H5C_flush_single_entry(H5F_t * f, #if H5C_DO_SANITY_CHECKS if ( ( entry_ptr->is_dirty ) && ( cache_ptr->check_write_permitted == NULL ) && - ( ! (cache_ptr->write_permitted) ) ) { + ( ! (cache_ptr->write_permitted) ) ) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Write when writes are always forbidden!?!?!") - } #endif /* H5C_DO_SANITY_CHECKS */ if ( destroy ) { @@ -8598,12 +8507,11 @@ H5C_flush_single_entry(H5F_t * f, * If that ceases to be the case, further * tests will be necessary. */ - if ( cache_ptr->aux_ptr != NULL ) { + if ( cache_ptr->aux_ptr != NULL ) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "resize/move in serialize occured in parallel case.") - } } #endif /* H5_HAVE_PARALLEL */ } @@ -8701,6 +8609,7 @@ H5C_flush_single_entry(H5F_t * f, } + /* reset the flush_in progress flag */ entry_ptr->flush_in_progress = FALSE; } @@ -8740,10 +8649,6 @@ done: * * Programmer: John Mainzer, 5/18/04 * - * QAK -- 1/31/08 - * Added initialization for the new free_file_space_on_destroy - * field. - * *------------------------------------------------------------------------- */ static void * @@ -8941,7 +8846,6 @@ H5C_make_space_in_cache(H5F_t * f, if ( write_permitted ) { initial_list_len = cache_ptr->LRU_list_len; - entry_ptr = cache_ptr->LRU_tail_ptr; if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) { @@ -8997,6 +8901,7 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_scanned_to_make_space++; } #endif /* H5C_COLLECT_CACHE_STATS */ + result = H5C_flush_single_entry(f, primary_dxpl_id, secondary_dxpl_id, diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 0fdaa79..ae6bdad 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -177,8 +177,8 @@ * entry is flushed to disk. * * - * In cases where memory is plentiful, and performance is an issue, it - * is useful to disable all cache evictions, and thereby postpone metadata + * In cases where memory is plentiful, and performance is an issue, it may + * be useful to disable all cache evictions, and thereby postpone metadata * writes. The following field is used to implement this. * * evictions_enabled: Boolean flag that is initialized to TRUE. When @@ -283,14 +283,14 @@ * some optimizations when I get to it. * * num_last_entries: The number of entries in the cache that can only be - * flushed after all other entries in the cache have - * been flushed. At this time, this will only ever be - * one entry (the superblock), and the code has been - * protected with HDasserts to enforce this. This restraint - * can certainly be relaxed in the future if the need for - * multiple entries being flushed last arises, though - * explicit tests for that case should be added when said - * HDasserts are removed. + * flushed after all other entries in the cache have + * been flushed. At this time, this will only ever be + * one entry (the superblock), and the code has been + * protected with HDasserts to enforce this. This restraint + * can certainly be relaxed in the future if the need for + * multiple entries being flushed last arises, though + * explicit tests for that case should be added when said + * HDasserts are removed. * * With the addition of the fractal heap, the cache must now deal with * the case in which entries may be dirtied, moved, or have their sizes @@ -354,7 +354,8 @@ * flush. * * Since pinned entries cannot be evicted, they must be kept on a pinned - * entry list, instead of being entrusted to the replacement policy code. + * entry list (pel), instead of being entrusted to the replacement policy + * code. * * Maintaining the pinned entry list requires the following fields: * @@ -382,7 +383,8 @@ * * While there has been interest in several replacement policies for * this cache, the initial development schedule is tight. Thus I have - * elected to support only a modified LRU policy for the first cut. + * elected to support only a modified LRU (least recently used) policy + * for the first cut. * * To further simplify matters, I have simply included the fields needed * by the modified LRU in this structure. When and if we add support for @@ -679,7 +681,7 @@ * equal to the array index has been evicted from the cache in * the current epoch. * - * moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells + * moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells * are used to record the number of times an entry with type * id equal to the array index has been moved in the current * epoch. @@ -714,7 +716,7 @@ * with type id equal to the array index has been flushed while * pinned in the current epoch. * - * pinned_cleared: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The + * pinned_clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The * cells are used to record the number of times an entry * with type id equal to the array index has been cleared while * pinned in the current epoch. @@ -2350,7 +2352,7 @@ if ( (cache_ptr)->index_size != \ HDassert( (new_size) <= (cache_ptr)->slist_size ); \ HDassert( ( (cache_ptr)->slist_len > 1 ) || \ ( (cache_ptr)->slist_size == (new_size) ) ); \ -} /* H5C__REMOVE_ENTRY_FROM_SLIST */ +} /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #else /* H5C_DO_SANITY_CHECKS */ @@ -2371,7 +2373,7 @@ if ( (cache_ptr)->index_size != \ HDassert( (new_size) <= (cache_ptr)->slist_size ); \ HDassert( ( (cache_ptr)->slist_len > 1 ) || \ ( (cache_ptr)->slist_size == (new_size) ) ); \ -} /* H5C__REMOVE_ENTRY_FROM_SLIST */ +} /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #endif /* H5C_DO_SANITY_CHECKS */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 38b9469..c9679f4 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -292,16 +292,15 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr, * dirtied while protected. * * This field is set to FALSE in the protect call, and may - * be set to TRUE by the - * H5C_mark_entry_dirty() - * call at an time prior to the unprotect call. + * be set to TRUE by the H5C_mark_entry_dirty() call at any + * time prior to the unprotect call. * - * The H5C_mark_entry_dirty() call exists - * as a convenience function for the fractal heap code which - * may not know if an entry is protected or pinned, but knows - * that is either protected or pinned. The dirtied field was - * added as in the parallel case, it is necessary to know - * whether a protected entry was dirty prior to the protect call. + * The H5C_mark_entry_dirty() call exists as a convenience + * function for the fractal heap code which may not know if + * an entry is protected or pinned, but knows that is either + * protected or pinned. The dirtied field was added as in + * the parallel case, it is necessary to know whether a + * protected entry is dirty prior to the protect call. * * is_protected: Boolean flag indicating whether this entry is protected * (or locked, to use more conventional terms). When it is @@ -372,21 +371,22 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr, * the entry is flushed for whatever reason. * * flush_me_last: Boolean flag indicating that this entry should not be - * flushed from the cache until all other entries without - * the flush_me_last flag set have been flushed. + * flushed from the cache until all other entries without + * the flush_me_last flag set have been flushed. * * flush_me_collectively: Boolean flag indicating that this entry needs - * to be flushed collectively when in a parallel - * situation. + * to be flushed collectively when in a parallel situation. * - * Note: At this time, the flush_me_last and flush_me_collectively - * flags will only be applied to one entry, the superblock, - * and the code utilizing these flags is protected with HDasserts - * to enforce this. This restraint can certainly be relaxed in - * the future if the the need for multiple entries getting flushed - * last or collectively arises, though the code allowing for that - * will need to be expanded and tested appropriately if that - * functionality is desired. + * Note: + * + * At this time, the flush_me_last and flush_me_collectively + * flags will only be applied to one entry, the superblock, + * and the code utilizing these flags is protected with HDasserts + * to enforce this. This restraint can certainly be relaxed in + * the future if the the need for multiple entries getting flushed + * last or collectively arises, though the code allowing for that + * will need to be expanded and tested appropriately if that + * functionality is desired. * * clear_on_unprotect: Boolean flag used only in PHDF5. When H5C is used * to implement the metadata cache In the parallel case, only @@ -608,7 +608,7 @@ typedef struct H5C_cache_entry_t #ifdef H5_HAVE_PARALLEL hbool_t flush_me_collectively; hbool_t clear_on_unprotect; - hbool_t flush_immediately; + hbool_t flush_immediately; #endif /* H5_HAVE_PARALLEL */ hbool_t flush_in_progress; hbool_t destroy_in_progress; @@ -617,10 +617,10 @@ typedef struct H5C_cache_entry_t /* fields supporting the 'flush dependency' feature: */ struct H5C_cache_entry_t * flush_dep_parent; - uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; - unsigned flush_dep_height; - hbool_t pinned_from_client; - hbool_t pinned_from_cache; + uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; + unsigned flush_dep_height; + hbool_t pinned_from_client; + hbool_t pinned_from_cache; /* fields supporting the hash table: */ -- cgit v0.12 From 9c9ac47ceb35345a4661f0f6038a13b0c90df0c3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:51:31 -0500 Subject: [svn-r27073] Description: Clean up H5D interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5Dchunk.c | 4 ++-- src/H5Defl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ea3557c..5d8ea4a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -319,8 +319,8 @@ H5FL_BLK_DEFINE_STATIC(chunk); *------------------------------------------------------------------------- */ herr_t -H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsize_t *offset, - uint32_t data_size, const void *buf) +H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, + hsize_t *offset, uint32_t data_size, const void *buf) { const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ H5D_chunk_ud_t udata; /* User data for querying chunk info */ diff --git a/src/H5Defl.c b/src/H5Defl.c index 6707568..1ae7a23 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -288,7 +288,7 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") if((fd = HDopen(efl->slot[u].name, O_RDONLY, 0)) < 0) HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - if(HDlseek(fd, (off_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_read = MIN(efl->slot[u].size-skip, (hsize_t)size); @@ -378,7 +378,7 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b else HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") } /* end if */ - if(HDlseek(fd, (off_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); -- cgit v0.12 From d0de32fc3adc28c7a20ee07928eeeee522d4fcf5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:54:30 -0500 Subject: [svn-r27074] Description: Clean up H5EA interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5EA.c | 14 ++++++------ src/H5EAcache.c | 26 ++--------------------- src/H5EAdbg.c | 30 +++++++++++++------------- src/H5EAhdr.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/H5EApkg.h | 21 ++++++++++-------- test/earray.c | 1 - 6 files changed, 101 insertions(+), 57 deletions(-) diff --git a/src/H5EA.c b/src/H5EA.c index b790590..37682e7 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -148,7 +148,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info") /* Lock the array header into memory */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, ctx_udata, H5AC_WRITE))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, ea_addr, ctx_udata, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Point extensible array wrapper at header and bump it's ref count */ @@ -168,7 +168,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); CATCH - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") if(!ret_value) if(ea && H5EA_close(ea, dxpl_id) < 0) @@ -209,7 +209,7 @@ H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata)) #ifdef QAK HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); #endif /* QAK */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, ctx_udata, H5AC_READ))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, ea_addr, ctx_udata, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long long)ea_addr) /* Check for pending array deletion */ @@ -237,7 +237,7 @@ HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); CATCH - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") if(!ret_value) if(ea && H5EA_close(ea, dxpl_id) < 0) @@ -1048,7 +1048,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(ea->f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, H5AC_WRITE))) + if(NULL == (hdr = H5EA__hdr_protect(ea->f, dxpl_id, ea_addr, NULL, H5AC_WRITE))) H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header") /* Set the shared array header's file context for this operation */ @@ -1112,7 +1112,7 @@ H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata)) #ifdef QAK HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); #endif /* QAK */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, ctx_udata, H5AC_WRITE))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, ea_addr, ctx_udata, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) /* Check for files using shared array header */ @@ -1131,7 +1131,7 @@ HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); CATCH /* Unprotect the header, if an error occurred */ - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PRIV) /* end H5EA_delete() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 1d40283..57d69a4 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -43,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ @@ -577,6 +577,7 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ haddr_t arr_addr; /* Address of array header in the file */ + size_t u; /* Local index variable */ /* Sanity check */ HDassert(f); @@ -638,8 +639,6 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Decode data block addresses in index block */ if(iblock->ndblk_addrs > 0) { - size_t u; /* Local index variable */ - /* Decode addresses of data blocks in index block */ for(u = 0; u < iblock->ndblk_addrs; u++) H5F_addr_decode(f, &p, &iblock->dblk_addrs[u]); @@ -647,8 +646,6 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Decode super block addresses in index block */ if(iblock->nsblk_addrs > 0) { - size_t u; /* Local index variable */ - /* Decode addresses of super blocks in index block */ for(u = 0; u < iblock->nsblk_addrs; u++) H5F_addr_decode(f, &p, &iblock->sblk_addrs[u]); @@ -872,11 +869,7 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, H5EA_iblock_t *iblock)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1300,11 +1293,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, H5EA_sblock_t *sblock)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1662,11 +1651,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, H5EA_dblock_t *dblock)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1791,9 +1776,6 @@ H5EA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(udata && udata->hdr && udata->parent); -#ifdef QAK -HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Allocate the extensible array data block page */ if(NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent))) @@ -2014,11 +1996,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, H5EA_dblk_page_t *dblk break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index b9a5bad..60b9ecd 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -119,7 +119,7 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end if */ /* Load the extensible array header */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, addr, dbg_ctx, H5AC_READ))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Print opening message */ @@ -171,7 +171,7 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__hdr_debug() */ @@ -196,9 +196,9 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, i int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)) /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ - H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ - void *dbg_ctx = NULL; /* Extensible array context */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + void *dbg_ctx = NULL; /* Extensible array context */ /* Check arguments */ HDassert(f); @@ -218,7 +218,7 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, i } /* end if */ /* Load the extensible array header */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Sanity check */ @@ -296,7 +296,7 @@ CATCH H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") if(iblock && H5EA__iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__iblock_debug() */ @@ -321,9 +321,9 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr)) /* Local variables */ - H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ - H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ - void *dbg_ctx = NULL; /* Extensible array context */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + void *dbg_ctx = NULL; /* Extensible array context */ /* Check arguments */ HDassert(f); @@ -343,7 +343,7 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde } /* end if */ /* Load the extensible array header */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Protect super block */ @@ -388,7 +388,7 @@ CATCH H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") if(sblock && H5EA__sblock_unprotect(sblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__sblock_debug() */ @@ -415,7 +415,7 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Local variables */ H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ - void *dbg_ctx = NULL; /* Extensible array context */ + void *dbg_ctx = NULL; /* Extensible array context */ size_t u; /* Local index variable */ /* Check arguments */ @@ -437,7 +437,7 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde } /* end if */ /* Load the extensible array header */ - if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ))) + if(NULL == (hdr = H5EA__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Protect data block */ @@ -471,7 +471,7 @@ CATCH H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") if(dblock && H5EA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5EA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__dblock_debug() */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index d5f3538..136cf1e 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -612,6 +612,70 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */ /*------------------------------------------------------------------------- + * Function: H5EA__hdr_protect + * + * Purpose: Convenience wrapper around protecting extensible array header + * + * Return: Non-NULL pointer to index block on success/NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 31 2013 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +H5EA_hdr_t *, NULL, NULL, +H5EA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata, + H5AC_protect_t rw)) + + /* Local variables */ + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); + + /* Protect the header */ + if(NULL == (ret_value = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, ctx_udata, rw))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_protect() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__hdr_unprotect + * + * Purpose: Convenience wrapper around unprotecting extensible array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 1 2013 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__hdr_unprotect(H5EA_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags)) + + /* Local variables */ + + /* Sanity check */ + HDassert(hdr); + + /* Unprotect the header */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu", (unsigned long long)hdr->addr) + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ + + +/*------------------------------------------------------------------------- * Function: H5EA__hdr_delete * * Purpose: Delete an extensible array, starting with the header @@ -665,7 +729,7 @@ HDfprintf(stderr, "%s: hdr->idx_blk_addr = %a\n", FUNC, hdr->idx_blk_addr); CATCH /* Unprotect the header, deleting it if an error hasn't occurred */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + if(H5EA__hdr_unprotect(hdr, dxpl_id, cache_flags) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__hdr_delete() */ diff --git a/src/H5EApkg.h b/src/H5EApkg.h index fc15e72..d89a35e 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -302,11 +302,12 @@ struct H5EA_t { /* Metadata cache callback user data types */ -/* Info needed for loading data block page */ -typedef struct H5EA_dblk_page_cache_ud_t { +/* Info needed for loading super block */ +typedef struct H5EA_sblock_cache_ud_t { H5EA_hdr_t *hdr; /* Shared extensible array information */ - H5EA_sblock_t *parent; /* Pointer to parent object for data block page (super block) */ -} H5EA_dblk_page_cache_ud_t; + H5EA_iblock_t *parent; /* Pointer to parent object for super block (index block) */ + unsigned sblk_idx; /* Index of super block */ +} H5EA_sblock_cache_ud_t; /* Info needed for loading data block */ typedef struct H5EA_dblock_cache_ud_t { @@ -315,12 +316,11 @@ typedef struct H5EA_dblock_cache_ud_t { size_t nelmts; /* Number of elements in data block */ } H5EA_dblock_cache_ud_t; -/* Info needed for loading super block */ -typedef struct H5EA_sblock_cache_ud_t { +/* Info needed for loading data block page */ +typedef struct H5EA_dblk_page_cache_ud_t { H5EA_hdr_t *hdr; /* Shared extensible array information */ - H5EA_iblock_t *parent; /* Pointer to parent object for super block (index block) */ - unsigned sblk_idx; /* Index of super block */ -} H5EA_sblock_cache_ud_t; + H5EA_sblock_t *parent; /* Pointer to parent object for data block page (super block) */ +} H5EA_dblk_page_cache_ud_t; #ifdef H5EA_TESTING typedef struct H5EA__ctx_cb_t { @@ -377,6 +377,9 @@ H5_DLL herr_t H5EA__hdr_decr(H5EA_hdr_t *hdr); H5_DLL herr_t H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr); H5_DLL size_t H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr); H5_DLL herr_t H5EA__hdr_modified(H5EA_hdr_t *hdr); +H5_DLL H5EA_hdr_t *H5EA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, + void *ctx_udata, H5AC_protect_t rw); +H5_DLL herr_t H5EA__hdr_unprotect(H5EA_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags); H5_DLL herr_t H5EA__hdr_delete(H5EA_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5EA__hdr_dest(H5EA_hdr_t *hdr); diff --git a/test/earray.c b/test/earray.c index 2d0a399..2135281 100644 --- a/test/earray.c +++ b/test/earray.c @@ -190,7 +190,6 @@ const H5AC_class_t H5AC_EARRAY_TEST[1] = {{ (H5AC_size_func_t)earray_cache_test_size, }}; - /*------------------------------------------------------------------------- * Function: init_cparam -- cgit v0.12 From 668be45b5678fc38c58fbb657c04b557c7baffe7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:57:34 -0500 Subject: [svn-r27075] Description: Clean up H5F interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5F.c | 2 +- src/H5Fdeprec.c | 2 +- src/H5Fint.c | 4 ++-- src/H5Fpkg.h | 8 ++++---- src/H5Fsuper.c | 46 +++++++++++++++++++++++----------------------- src/H5Fsuper_cache.c | 19 +++++++++++++++---- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 672c631..3cdb604 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1380,7 +1380,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock and any superblock extensions */ - if(H5F_super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) + if(H5F__super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") /* Get the size of any persistent free space */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index c5a500a..7e2ea17 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -181,7 +181,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock extension */ - if(H5F_super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) + if(H5F__super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size") /* Check for SOHM info */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 31f4176..775c91f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1074,7 +1074,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, /* Initialize information about the superblock and allocate space for it */ /* (Writes superblock extension messages, if there are any) */ - if(H5F_super_init(file, dxpl_id) < 0) + if(H5F__super_init(file, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock") /* Create and open the root group */ @@ -1085,7 +1085,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") } else if (1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ - if(H5F_super_read(file, dxpl_id) < 0) + if(H5F__super_read(file, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") /* Open the root group */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 53fe0d9..a645fd3 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -306,10 +306,10 @@ H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key); H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); /* Superblock related routines */ -H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_super_read(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size); -H5_DLL herr_t H5F_super_free(H5F_super_t *sblock); +H5_DLL herr_t H5F__super_init(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5F__super_read(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size); +H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 845ab8c..6db631e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -237,7 +237,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_read + * Function: H5F__super_read * * Purpose: Reads the superblock from the file or from the BUF. If * ADDR is a valid address, then it reads it from the file. @@ -254,17 +254,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_read(H5F_t *f, hid_t dxpl_id) +H5F__super_read(H5F_t *f, hid_t dxpl_id) { H5P_genplist_t *dxpl; /* DXPL object */ - H5F_super_t * sblock = NULL; /* superblock structure */ + H5F_super_t * sblock = NULL; /* Superblock structure */ unsigned sblock_flags = H5AC__NO_FLAGS_SET; /* flags used in superblock unprotect call */ haddr_t super_addr; /* Absolute address of superblock */ - H5AC_protect_t rw; /* read/write permissions for file */ + H5AC_protect_t rw; /* Read/write permissions for file */ hbool_t dirtied = FALSE; /* Bool for sblock protect call */ - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Get the DXPL plist object for DXPL ID */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) @@ -291,7 +291,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) /* Look up the superblock */ if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &dirtied, rw))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") /* Mark the superblock dirty if it was modified during loading or VFD indicated to do so */ if((H5AC_WRITE == rw) && (dirtied || H5F_HAS_FEATURE(f, H5FD_FEAT_DIRTY_SBLK_LOAD))) @@ -299,7 +299,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) /* Pin the superblock in the cache */ if(H5AC_pin_protected_entry(sblock) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTPIN, FAIL, "unable to pin superblock") /* Set the pointer to the pinned superblock */ f->shared->sblock = sblock; @@ -307,14 +307,14 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) done: /* Release the superblock */ if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5F_super_read() */ +} /* end H5F__super_read() */ /*------------------------------------------------------------------------- - * Function: H5F_super_init + * Function: H5F__super_init * * Purpose: Allocates the superblock for the file and initializes * information about the superblock in memory. Writes extension @@ -330,7 +330,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_init(H5F_t *f, hid_t dxpl_id) +H5F__super_init(H5F_t *f, hid_t dxpl_id) { H5F_super_t *sblock = NULL; /* Superblock cache structure */ hbool_t sblock_in_cache = FALSE; /* Whether the superblock has been inserted into the metadata cache */ @@ -344,7 +344,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) hbool_t ext_created = FALSE; /* Whether the extension has been created */ herr_t ret_value = SUCCEED; /* Return Value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Allocate space for the superblock */ if(NULL == (sblock = H5FL_CALLOC(H5F_super_t))) @@ -594,7 +594,7 @@ done: } /* end if */ else /* Free superblock */ - if(H5F_super_free(sblock) < 0) + if(H5F__super_free(sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") /* Reset variables in file structure */ @@ -603,7 +603,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5F_super_init() */ +} /* end H5F__super_init() */ /*------------------------------------------------------------------------- @@ -641,7 +641,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_free + * Function: H5F__super_free * * Purpose: Destroyer the file's superblock * @@ -654,9 +654,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_free(H5F_super_t *sblock) +H5F__super_free(H5F_super_t *sblock) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(sblock); @@ -668,11 +668,11 @@ H5F_super_free(H5F_super_t *sblock) sblock = (H5F_super_t *)H5FL_FREE(H5F_super_t, sblock); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5F_super_free() */ +} /* H5F__super_free() */ /*------------------------------------------------------------------------- - * Function: H5F_super_size + * Function: H5F__super_size * * Purpose: Get storage size of the superblock and superblock extension * @@ -685,11 +685,11 @@ H5F_super_free(H5F_super_t *sblock) *------------------------------------------------------------------------- */ herr_t -H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) +H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -725,7 +725,7 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_super_size() */ +} /* H5F__super_size() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 5737ce4..1e8675c 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -13,6 +13,17 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Fsuper_cache.c + * Aug 15 2009 + * Quincey Koziol + * + * Purpose: Implement file superblock & driver info metadata cache methods. + * + *------------------------------------------------------------------------- + */ + /****************/ /* Module Setup */ /****************/ @@ -133,7 +144,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_eq(addr, 0)); HDassert(dirtied); @@ -618,7 +629,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) done: /* Release the [possibly partially initialized] superblock on errors */ if(!ret_value && sblock) - if(H5F_super_free(sblock) < 0) + if(H5F__super_free(sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTFREE, NULL, "unable to destroy superblock data") FUNC_LEAVE_NOAPI(ret_value) @@ -779,7 +790,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, * ultimately match it. */ if ((rel_eof = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)) == HADDR_UNDEF) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - H5F_addr_encode(f, &p, rel_eof + sblock->base_addr); + H5F_addr_encode(f, &p, (rel_eof + sblock->base_addr)); /* Retrieve information for root group */ if(NULL == (root_oloc = H5G_oloc(f->shared->root_grp))) @@ -887,7 +898,7 @@ H5F_sblock_dest(H5F_t UNUSED *f, H5F_super_t* sblock) HDassert(sblock); /* Free superblock */ - if(H5F_super_free(sblock) < 0) + if(H5F__super_free(sblock) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") done: -- cgit v0.12 From 71bc00a0b50e803a7d4076c6f2249fa1c2c3670e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:00:27 -0500 Subject: [svn-r27076] Description: Clean up H5FA interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5FA.c | 20 ++++++++--------- src/H5FAcache.c | 15 ++++++------- src/H5FAdbg.c | 10 ++++----- src/H5FAdblock.c | 30 +++++++++++--------------- src/H5FAhdr.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/H5FApkg.h | 14 ++++++------ 6 files changed, 107 insertions(+), 48 deletions(-) diff --git a/src/H5FA.c b/src/H5FA.c index 128999a..1acb10b 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -141,7 +141,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") /* Lock the array header into memory */ - if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, ctx_udata, H5AC_WRITE))) + if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, fa_addr, ctx_udata, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Point fixed array wrapper at header and bump it's ref count */ @@ -161,7 +161,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); CATCH - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") if(!ret_value) if(fa && H5FA_close(fa, dxpl_id) < 0) @@ -201,7 +201,7 @@ H5FA_open(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata)) #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr); #endif /* H5FA_DEBUG */ - if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, ctx_udata, H5AC_READ))) + if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, fa_addr, ctx_udata, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header, address = %llu", (unsigned long long)fa_addr) /* Check for pending array deletion */ @@ -229,7 +229,7 @@ HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr); CATCH - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") if(!ret_value) if(fa && H5FA_close(fa, dxpl_id) < 0) @@ -351,7 +351,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx); #endif /* H5FA_DEBUG */ /* Create the data block */ - hdr->dblk_addr = H5FA__dblock_create(hdr, dxpl_id, &hdr_dirty, hdr->cparam.nelmts); + hdr->dblk_addr = H5FA__dblock_create(hdr, dxpl_id, &hdr_dirty); if(!H5F_addr_defined(hdr->dblk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create fixed array data block") } /* end if */ @@ -359,7 +359,7 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx HDassert(idx < hdr->cparam.nelmts); /* Protect data block */ - if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, hdr->dblk_addr, hdr->stats.nelmts, H5AC_WRITE))) + if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, hdr->dblk_addr, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)hdr->dblk_addr) /* Check for paging data block */ @@ -467,7 +467,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); else { /* Get the data block */ HDassert(H5F_addr_defined(hdr->dblk_addr)); - if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, hdr->dblk_addr, hdr->stats.nelmts, H5AC_READ))) + if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, hdr->dblk_addr, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)hdr->dblk_addr) /* Check for paged data block */ @@ -592,7 +592,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ - if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(fa->f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, NULL, H5AC_WRITE))) + if(NULL == (hdr = H5FA__hdr_protect(fa->f, dxpl_id, fa_addr, NULL, H5AC_WRITE))) H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header") /* Set the shared array header's file context for this operation */ @@ -655,7 +655,7 @@ H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata)) #ifdef H5FA_DEBUG HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr); #endif /* H5FA_DEBUG */ - if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, ctx_udata, H5AC_WRITE))) + if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, fa_addr, ctx_udata, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", (unsigned long long)fa_addr) /* Check for files using shared array header */ @@ -674,7 +674,7 @@ HDfprintf(stderr, "%s: fa_addr = %a\n", FUNC, fa_addr); CATCH /* Unprotect the header, if an error occurred */ - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PRIV) /* end H5FA_delete() */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index cb156db..2f07cd6 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -16,6 +16,8 @@ /*------------------------------------------------------------------------- * * Created: H5FAcache.c + * Jul 2 2009 + * Quincey Koziol * * Purpose: Implement fixed array metadata cache methods. * @@ -41,7 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ @@ -517,10 +519,10 @@ H5FA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Sanity check */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(udata && udata->hdr && udata->nelmts > 0); + HDassert(udata && udata->hdr); /* Allocate the fixed array data block */ - if(NULL == (dblock = H5FA__dblock_alloc(udata->hdr, udata->nelmts))) + if(NULL == (dblock = H5FA__dblock_alloc(udata->hdr))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Set the fixed array data block's information */ @@ -575,9 +577,9 @@ H5FA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) if(!dblock->npages) { /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ - if((udata->hdr->cparam.cls->decode)(p, dblock->elmts, (size_t)udata->nelmts, udata->hdr->cb_ctx) < 0) + if((udata->hdr->cparam.cls->decode)(p, dblock->elmts, (size_t)udata->hdr->stats.nelmts, udata->hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") - p += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); + p += (udata->hdr->stats.nelmts * udata->hdr->cparam.raw_elmt_size); } /* end if */ /* Sanity check */ @@ -868,9 +870,6 @@ H5FA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(udata && udata->hdr && udata->nelmts > 0); -#ifdef QAK -HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Allocate the fixed array data block page */ if(NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts))) diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index eb5e32e..d5239d3 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -117,7 +117,7 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end if */ /* Load the fixed array header */ - if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, addr, dbg_ctx, H5AC_READ))) + if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Print opening message */ @@ -150,7 +150,7 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_debug() */ @@ -198,11 +198,11 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde } /* end if */ /* Load the fixed array header */ - if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ))) + if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Protect data block */ - if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, addr, hdr->cparam.nelmts, H5AC_READ))) + if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, addr, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)addr) /* Print opening message */ @@ -280,7 +280,7 @@ CATCH H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(dblock && H5FA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") - if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__dblock_debug() */ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 9efc2bc..e6e0e74 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -102,14 +102,14 @@ H5FL_BLK_DEFINE(fa_page_init); */ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, -H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts)) +H5FA__dblock_alloc(H5FA_hdr_t *hdr)) /* Local variables */ H5FA_dblock_t *dblock = NULL; /* fixed array data block */ /* Check arguments */ HDassert(hdr); - HDassert(nelmts > 0); + HDassert(hdr->cparam.nelmts > 0); /* Allocate memory for the data block */ if(NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) @@ -124,9 +124,9 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts)) dblock->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; /* Check if this data block should be paged */ - if(nelmts > dblock->dblk_page_nelmts) { + if(hdr->cparam.nelmts > dblock->dblk_page_nelmts) { /* Compute number of pages */ - hsize_t npages = ((nelmts + dblock->dblk_page_nelmts) - 1) / dblock->dblk_page_nelmts; + hsize_t npages = ((hdr->cparam.nelmts + dblock->dblk_page_nelmts) - 1) / dblock->dblk_page_nelmts; /* Safely assign the number of pages */ H5_CHECKED_ASSIGN(dblock->npages, size_t, npages, hsize_t); @@ -146,10 +146,10 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts)) dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; /* Compute the # of elements on last page */ - if(0 == nelmts % dblock->dblk_page_nelmts) + if(0 == hdr->cparam.nelmts % dblock->dblk_page_nelmts) dblock->last_page_nelmts = dblock->dblk_page_nelmts; else - dblock->last_page_nelmts = (size_t)(nelmts % dblock->dblk_page_nelmts); + dblock->last_page_nelmts = (size_t)(hdr->cparam.nelmts % dblock->dblk_page_nelmts); } /* end if */ else { hsize_t dblk_size = hdr->cparam.nelmts * hdr->cparam.cls->nat_elmt_size; @@ -186,24 +186,22 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5FA__dblock_create(H5FA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, - hsize_t nelmts)) +H5FA__dblock_create(H5FA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty)) /* Local variables */ H5FA_dblock_t *dblock = NULL; /* fixed array data block */ haddr_t dblock_addr; /* fixed array data block address */ #ifdef H5FA_DEBUG -HDfprintf(stderr, "%s: Called, hdr->stats.nelmts = %Zu, nelmts = %Zu\n", FUNC, hdr->stats.nelmts, nelmts); +HDfprintf(stderr, "%s: Called, hdr->stats.nelmts = %Zu, nelmts = %Zu\n", FUNC, hdr->stats.nelmts, hdr->cparam.nelmts); #endif /* H5FA_DEBUG */ /* Sanity check */ HDassert(hdr); HDassert(hdr_dirty); - HDassert(nelmts > 0); /* Allocate the data block */ - if(NULL == (dblock = H5FA__dblock_alloc(hdr, nelmts))) + if(NULL == (dblock = H5FA__dblock_alloc(hdr))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Set size of data block on disk */ @@ -265,7 +263,7 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_protect(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr, - hsize_t dblk_nelmts, H5AC_protect_t rw)) + H5AC_protect_t rw)) /* Local variables */ H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */ @@ -277,11 +275,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(dblk_addr)); - HDassert(dblk_nelmts); /* Set up user data */ udata.hdr = hdr; - udata.nelmts = dblk_nelmts; /* Protect the data block */ if(NULL == (ret_value = (H5FA_dblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, rw))) @@ -340,8 +336,7 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5FA__dblock_delete(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr, - hsize_t dblk_nelmts)) +H5FA__dblock_delete(H5FA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr)) /* Local variables */ H5FA_dblock_t *dblock = NULL; /* Pointer to data block */ @@ -353,10 +348,9 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(dblk_addr)); - HDassert(dblk_nelmts > 0); /* Protect data block */ - if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, dblk_addr, dblk_nelmts, H5AC_WRITE))) + if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, dblk_addr, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr) /* Check if data block is paged */ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 23a554a..5970ff0 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -393,6 +393,70 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ /*------------------------------------------------------------------------- + * Function: H5FA__hdr_protect + * + * Purpose: Convenience wrapper around protecting fixed array header + * + * Return: Non-NULL pointer to index block on success/NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 12 2013 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +H5FA_hdr_t *, NULL, NULL, +H5FA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata, + H5AC_protect_t rw)) + + /* Local variables */ + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(fa_addr)); + + /* Protect the header */ + if(NULL == (ret_value = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, ctx_udata, rw))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", (unsigned long long)fa_addr) + +CATCH + +END_FUNC(PKG) /* end H5FA__hdr_protect() */ + + +/*------------------------------------------------------------------------- + * Function: H5FA__hdr_unprotect + * + * Purpose: Convenience wrapper around unprotecting fixed array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 12 2013 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5FA__hdr_unprotect(H5FA_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags)) + + /* Local variables */ + + /* Sanity check */ + HDassert(hdr); + + /* Unprotect the header */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr) + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ + + +/*------------------------------------------------------------------------- * Function: H5FA__hdr_delete * * Purpose: Delete a fixed array, starting with the header @@ -436,7 +500,7 @@ HDfprintf(stderr, "%s: hdr->dblk_addr = %a\n", FUNC, hdr->dblk_addr); #endif /* H5FA_DEBUG */ /* Delete Fixed Array Data block */ - if(H5FA__dblock_delete(hdr, dxpl_id, hdr->dblk_addr, hdr->cparam.nelmts) < 0) + if(H5FA__dblock_delete(hdr, dxpl_id, hdr->dblk_addr) < 0) H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block") } /* end if */ diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 20d30c3..7101f0b 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -199,13 +199,12 @@ struct H5FA_t { /* Info needed for loading data block */ typedef struct H5FA_dblock_cache_ud_t { H5FA_hdr_t *hdr; /* Shared fixed array information */ - hsize_t nelmts; /* Number of elements in data block */ } H5FA_dblock_cache_ud_t; /* Info needed for loading data block page */ typedef struct H5FA_dblk_page_cache_ud_t { H5FA_hdr_t *hdr; /* Shared fixed array information */ - size_t nelmts; /* Number of elements in data block page */ + size_t nelmts; /* Number of elements in data block page */ } H5FA_dblk_page_cache_ud_t; @@ -244,19 +243,22 @@ H5_DLL herr_t H5FA__hdr_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr); H5_DLL size_t H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_modified(H5FA_hdr_t *hdr); +H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, + void *ctx_udata, H5AC_protect_t rw); +H5_DLL herr_t H5FA__hdr_unprotect(H5FA_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags); H5_DLL herr_t H5FA__hdr_delete(H5FA_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); /* Data block routines */ -H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts); -H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, hsize_t nelmts); +H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr); +H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty); H5_DLL unsigned H5FA__dblock_sblk_idx(const H5FA_hdr_t *hdr, hsize_t idx); H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, hid_t dxpl_id, - haddr_t dblk_addr, hsize_t dblk_nelmts, H5AC_protect_t rw); + haddr_t dblk_addr, H5AC_protect_t rw); H5_DLL herr_t H5FA__dblock_unprotect(H5FA_dblock_t *dblock, hid_t dxpl_id, unsigned cache_flags); H5_DLL herr_t H5FA__dblock_delete(H5FA_hdr_t *hdr, hid_t dxpl_id, - haddr_t dblk_addr, hsize_t dblk_nelmts); + haddr_t dblk_addr); H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); /* Data block page routines */ -- cgit v0.12 From cd1620238c73d616c8ec3c773337e7733b47d3f2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:02:54 -0500 Subject: [svn-r27077] Description: Clean up H5FD interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5FD.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++------ src/H5FDfamily.c | 38 +++++++++++++++++-------------------- src/H5FDprivate.h | 2 +- src/H5Fsuper_cache.c | 20 ++------------------ 4 files changed, 67 insertions(+), 46 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index 0e4d840..c4ee11f 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -540,11 +540,11 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_sb_encode() */ /*------------------------------------------------------------------------- - * Function: H5FD_sb_decode + * Function: H5FD__sb_decode * * Purpose: Decodes the driver information block. * @@ -556,20 +556,61 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) +static herr_t +H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC HDassert(file && file->cls); + + /* Decode driver information */ if(file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sb_decode() */ +} /* end H5FD__sb_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_sb_load + * + * Purpose: Validate and decode the driver information block. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Friday, July 19, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file && file->cls); + + /* Check if driver matches driver information saved. Unfortunately, we can't push this + * function to each specific driver because we're checking if the driver is correct. + */ + if(!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family")) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used") + if(!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi")) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used") + + /* Decode driver information */ + if(H5FD__sb_decode(file, name, buf) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode driver information") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_sb_load() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index e79e1cf..8660f1f 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -587,26 +587,25 @@ H5FD_family_sb_decode(H5FD_t *_file, const char UNUSED *name, const unsigned cha * h5repart is being used to change member file size. h5repart will open * files for read and write. When the files are closed, metadata will be * flushed to the files and updated to this new size */ - if(file->mem_newsize) { + if(file->mem_newsize) file->memb_size = file->pmem_size = file->mem_newsize; - HGOTO_DONE(ret_value) - } /* end if */ - - /* Default - use the saved member size */ - if(file->pmem_size == H5F_FAMILY_DEFAULT) - file->pmem_size = msize; + else { + /* Default - use the saved member size */ + if(file->pmem_size == H5F_FAMILY_DEFAULT) + file->pmem_size = msize; - /* Check if member size from file access property is correct */ - if(msize != file->pmem_size) { - char err_msg[128]; + /* Check if member size from file access property is correct */ + if(msize != file->pmem_size) { + char err_msg[128]; - HDsnprintf(err_msg, sizeof(err_msg), "Family member size should be %lu. But the size from file access property is %lu", (unsigned long)msize, (unsigned long)file->pmem_size); - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, err_msg) - } /* end if */ + HDsnprintf(err_msg, sizeof(err_msg), "Family member size should be %lu. But the size from file access property is %lu", (unsigned long)msize, (unsigned long)file->pmem_size); + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, err_msg) + } /* end if */ - /* Update member file size to the size saved in the superblock. - * That's the size intended to be. */ - file->memb_size = msize; + /* Update member file size to the size saved in the superblock. + * That's the size intended to be. */ + file->memb_size = msize; + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -686,14 +685,11 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, /* Check for new family file size. It's used by h5repart only. */ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) { - hsize_t fam_newsize = 0; /* New member size, when repartitioning */ - /* Get the new family file size */ - if(H5P_get(plist, H5F_ACS_FAMILY_NEWSIZE_NAME, &fam_newsize) < 0) + if(H5P_get(plist, H5F_ACS_FAMILY_NEWSIZE_NAME, &file->mem_newsize) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get new family member size") - /* Store information for later */ - file->mem_newsize = fam_newsize; /* New member size passed in through property */ + /* Set flag for later */ file->repart_members = TRUE; } /* end if */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 20e9a79..0a7fe6c 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -109,7 +109,7 @@ H5_DLL herr_t H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, ha H5_DLL H5FD_class_t *H5FD_get_class(hid_t id); H5_DLL hsize_t H5FD_sb_size(H5FD_t *file); H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf); -H5_DLL herr_t H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf); +H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf); H5_DLL void *H5FD_fapl_get(H5FD_t *file); H5_DLL herr_t H5FD_fapl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info); H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, void *fapl); diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 1e8675c..46ebe6e 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -382,14 +382,6 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) drv_name[8] = '\0'; p += 8; /* advance past name/version */ - /* Check if driver matches driver information saved. Unfortunately, we can't push this - * function to each specific driver because we're checking if the driver is correct. - */ - if(!HDstrncmp(drv_name, "NCSAfami", (size_t)8) && HDstrcmp(lf->cls->name, "family")) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "family driver should be used") - if(!HDstrncmp(drv_name, "NCSAmult", (size_t)8) && HDstrcmp(lf->cls->name, "multi")) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "multi driver should be used") - /* Read in variable-sized portion of driver info block */ if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE + drv_variable_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed") @@ -397,7 +389,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read file driver information") /* Decode driver information */ - if(H5FD_sb_decode(lf, drv_name, p) < 0) + if(H5FD_sb_load(lf, drv_name, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to decode driver information") } /* end if */ } /* end if */ @@ -546,16 +538,8 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) if(NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo, dxpl_id)) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "driver info message not present") - /* Check if driver matches driver information saved. Unfortunately, we can't push this - * function to each specific driver because we're checking if the driver is correct. - */ - if(!HDstrncmp(drvinfo.name, "NCSAfami", (size_t)8) && HDstrcmp(lf->cls->name, "family")) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "family driver should be used") - if(!HDstrncmp(drvinfo.name, "NCSAmult", (size_t)8) && HDstrcmp(lf->cls->name, "multi")) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "multi driver should be used") - /* Decode driver information */ - if(H5FD_sb_decode(lf, drvinfo.name, drvinfo.buf) < 0) + if(H5FD_sb_load(lf, drvinfo.name, drvinfo.buf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to decode driver information") /* Reset driver info message */ -- cgit v0.12 From 8fd9d6b53f44b12204ea2bcd34eeedd3f3d54603 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:04:33 -0500 Subject: [svn-r27078] Description: Clean up H5FS interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5FS.c | 24 ++++++++++++------------ src/H5FScache.c | 14 ++++++-------- src/H5FSpkg.h | 4 ++-- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/H5FS.c b/src/H5FS.c index 9dcf081..67ec838 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -123,7 +123,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl /* * Allocate free space structure */ - if(NULL == (fspace = H5FS_new(f, nclasses, classes, cls_init_udata))) + if(NULL == (fspace = H5FS__new(f, nclasses, classes, cls_init_udata))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Initialize creation information for free space manager */ @@ -161,7 +161,7 @@ HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", FUNC, fspace, fspace-> done: if(!ret_value && fspace) - if(H5FS_hdr_dest(fspace) < 0) + if(H5FS__hdr_dest(fspace) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header") #ifdef H5FS_DEBUG @@ -573,7 +573,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va /*------------------------------------------------------------------------- - * Function: H5FS_new + * Function: H5FS__new * * Purpose: Create new free space manager structure * @@ -586,14 +586,14 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va *------------------------------------------------------------------------- */ H5FS_t * -H5FS_new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], +H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata) { H5FS_t *fspace = NULL; /* Free space manager */ size_t u; /* Local index variable */ H5FS_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(nclasses == 0 || (nclasses > 0 && classes)); @@ -631,7 +631,7 @@ H5FS_new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[ /* Initialize non-zero information for new free space manager */ fspace->addr = HADDR_UNDEF; - fspace->hdr_size = H5FS_HEADER_SIZE(f); + fspace->hdr_size = (size_t)H5FS_HEADER_SIZE(f); fspace->sect_addr = HADDR_UNDEF; /* Set return value */ @@ -649,7 +649,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_new() */ +} /* H5FS__new() */ /*------------------------------------------------------------------------- @@ -763,7 +763,7 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") } /* end if */ else { - if(H5FS_hdr_dest(fspace) < 0) + if(H5FS__hdr_dest(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space header") } /* end else */ } /* end if */ @@ -1005,7 +1005,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_hdr_dest + * Function: H5FS__hdr_dest * * Purpose: Destroys a free space header in memory. * @@ -1018,12 +1018,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_hdr_dest(H5FS_t *fspace) +H5FS__hdr_dest(H5FS_t *fspace) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1047,7 +1047,7 @@ H5FS_hdr_dest(H5FS_t *fspace) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_hdr_dest() */ +} /* end H5FS__hdr_dest() */ /*------------------------------------------------------------------------- diff --git a/src/H5FScache.c b/src/H5FScache.c index 306a3fd..5ab788e 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -38,7 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -167,7 +167,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HDassert(udata); /* Allocate a new free space manager */ - if(NULL == (fspace = H5FS_new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata))) + if(NULL == (fspace = H5FS__new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set free space manager's internal information */ @@ -260,7 +260,7 @@ done: if(wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value && fspace) - if(H5FS_hdr_dest(fspace) < 0) + if(H5FS__hdr_dest(fspace) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header") FUNC_LEAVE_NOAPI(ret_value) @@ -463,7 +463,7 @@ H5FS_cache_hdr_dest(H5F_t *f, H5FS_t *fspace) } /* end if */ /* Destroy free space header */ - if(H5FS_hdr_dest(fspace) < 0) + if(H5FS__hdr_dest(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") done: @@ -865,14 +865,12 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H udata.sect_cnt_size = H5VM_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); /* Iterate over all the bins */ - for(bin = 0; bin < sinfo->nbins; bin++) { + for(bin = 0; bin < sinfo->nbins; bin++) /* Check if there are any sections in this bin */ - if(sinfo->bins[bin].bin_list) { + if(sinfo->bins[bin].bin_list) /* Iterate over list of section size nodes for bin */ if(H5SL_iterate(sinfo->bins[bin].bin_list, H5FS_sinfo_serialize_node_cb, &udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") - } /* end if */ - } /* end for */ /* Compute checksum */ metadata_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index b6c240e..78afde8 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -221,7 +221,7 @@ H5FL_EXTERN(H5FS_t); /******************************/ /* Free space manager header routines */ -H5_DLL H5FS_t *H5FS_new(const H5F_t *f, uint16_t nclasses, +H5_DLL H5FS_t *H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); H5_DLL herr_t H5FS_incr(H5FS_t *fspace); H5_DLL herr_t H5FS_decr(H5FS_t *fspace); @@ -231,7 +231,7 @@ H5_DLL herr_t H5FS_dirty(H5FS_t *fspace); H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace); /* Routines for destroying structures */ -H5_DLL herr_t H5FS_hdr_dest(H5FS_t *hdr); +H5_DLL herr_t H5FS__hdr_dest(H5FS_t *hdr); H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ -- cgit v0.12 From 5c437fa51fa9dde519316b4597cd0b6e8e2caf3d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:06:09 -0500 Subject: [svn-r27079] Description: Clean up H5G interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5Gcache.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 15dbf65..d1923a6 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -145,10 +145,10 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) /* Allocate symbol table data structures */ if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - sym->node_size = H5G_NODE_SIZE(f); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + sym->node_size = (size_t)(H5G_NODE_SIZE(f)); if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Wrap the local buffer for serialized node info */ if(NULL == (wb = H5WB_wrap(node_buf, sizeof(node_buf)))) @@ -167,12 +167,12 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) /* magic */ if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature") - p += 4; + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature") + p += H5_SIZEOF_MAGIC; /* version */ if(H5G_NODE_VERS != *p++) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node version") /* reserved */ p++; @@ -182,7 +182,7 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) /* entries */ if(H5G__ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries") /* Set return value */ ret_value = sym; @@ -248,7 +248,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ /* magic number */ HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC); - p += 4; + p += H5_SIZEOF_MAGIC; /* version number */ *p++ = H5G_NODE_VERS; -- cgit v0.12 From 8cc79c08258778fe1aa2780b4c5dc330640fd227 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:08:27 -0500 Subject: [svn-r27080] Description: Clean up H5HF interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5HFcache.c | 950 +++++++++++++++++++++----------------------------------- 1 file changed, 355 insertions(+), 595 deletions(-) diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 0f73c68..e5ea437 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -40,7 +40,7 @@ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ @@ -75,8 +75,8 @@ /********************/ /* Local encode/decode routines */ -static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable); -static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable); +static herr_t H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable); +static herr_t H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable); /* Metadata cache (H5AC) callbacks */ static H5HF_hdr_t *H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); @@ -98,28 +98,16 @@ static herr_t H5HF_cache_dblock_notify(H5C_notify_action_t action, H5HF_direct_t static herr_t H5HF_cache_dblock_size(const H5F_t *f, const H5HF_direct_t *dblock, size_t *size_ptr); -/*********************************/ /* Debugging Function Prototypes */ -/*********************************/ #ifndef NDEBUG -static herr_t H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, - hid_t dxpl_id, - H5HF_hdr_t * hdr, - hbool_t *clean_ptr); -static herr_t H5HF_cache_verify_iblock_descendants_clean(H5F_t *f, - hid_t dxpl_id, - H5HF_indirect_t * iblock, - unsigned * iblock_status_ptr, - hbool_t *clean_ptr); -static herr_t H5HF_cache_verify_iblocks_dblocks_clean(H5F_t *f, - H5HF_indirect_t * iblock, - hbool_t *clean_ptr, - hbool_t *has_dblocks_ptr); -static herr_t H5HF_cache_verify_descendant_iblocks_clean(H5F_t *f, - hid_t dxpl_id, - H5HF_indirect_t * iblock, - hbool_t *clean_ptr, - hbool_t *has_iblocks_ptr); +static herr_t H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, + H5HF_hdr_t *hdr, hbool_t *clean); +static herr_t H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, hid_t dxpl_id, + H5HF_indirect_t *iblock, unsigned *iblock_status, hbool_t *clean); +static herr_t H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, + H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_dblocks); +static herr_t H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, hid_t dxpl_id, + H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_iblocks); #endif /* NDEBUG */ @@ -176,7 +164,7 @@ H5FL_BLK_DEFINE(direct_block); /*------------------------------------------------------------------------- - * Function: H5HF_dtable_decode + * Function: H5HF__dtable_decode * * Purpose: Decodes the metadata for a doubling table * @@ -191,9 +179,9 @@ H5FL_BLK_DEFINE(direct_block); *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) +H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(f); @@ -222,11 +210,11 @@ H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) UINT16DECODE(*pp, dtable->curr_root_rows); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_decode() */ +} /* end H5HF__dtable_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_encode + * Function: H5HF__dtable_encode * * Purpose: Encodes the metadata for a doubling table * @@ -241,9 +229,9 @@ H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) +H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(f); @@ -272,7 +260,7 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) UINT16ENCODE(*pp, dtable->curr_root_rows); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_encode() */ +} /* end H5HF__dtable_encode() */ /*------------------------------------------------------------------------- @@ -313,7 +301,7 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space for the fractal heap data structure */ if(NULL == (hdr = H5HF_hdr_alloc(udata->f))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) @@ -335,12 +323,12 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Magic number */ if(HDmemcmp(p, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap header signature") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap header signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5HF_HDR_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap header version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap header version") /* General heap information */ UINT16DECODE(p, hdr->id_len); /* Heap ID length */ @@ -373,7 +361,7 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) H5F_DECODE_LENGTH(udata->f, p, hdr->tiny_nobjs); /* Managed objects' doubling-table info */ - if(H5HF_dtable_decode(hdr->f, &p, &(hdr->man_dtable)) < 0) + if(H5HF__dtable_decode(hdr->f, &p, &(hdr->man_dtable)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, NULL, "unable to encode managed obj. doubling table info") /* Sanity check */ @@ -443,11 +431,11 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Verify checksum */ if(stored_chksum != computed_chksum) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap header") /* Finish initialization of heap header */ if(H5HF_hdr_finish_init(hdr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") /* Set return value */ ret_value = hdr; @@ -499,30 +487,27 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H uint32_t metadata_chksum; /* Computed metadata checksum value */ #ifndef NDEBUG - /* verify that flush dependencies are working correctly. Do this +{ + /* Verify that flush dependencies are working correctly. Do this * by verifying that either: * * 1) the header has a root iblock, and that the root iblock and all - * of its children are clean, or + * of its children are clean, or * - * 2) The header has a root dblock, which is clean, or + * 2) The header has a root dblock, which is clean, or * * 3) The heap is empty, and thus the header has neither a root - * iblock no a root dblock. In this case, the flush ordering + * iblock no a root dblock. In this case, the flush ordering * constraint is met by default. * - * Do this with a call to H5HF_cache_verify_hdr_descendants_clean(). + * Do this with a call to H5HF__cache_verify_hdr_descendants_clean(). */ hbool_t descendants_clean = TRUE; - if ( H5HF_cache_verify_hdr_descendants_clean(f, dxpl_id, hdr, - &descendants_clean) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "can't verify hdr descendants clean.") - - HDassert( descendants_clean ); - + if(H5HF__cache_verify_hdr_descendants_clean(f, dxpl_id, hdr, &descendants_clean) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify hdr descendants clean.") + HDassert(descendants_clean); +} #endif /* NDEBUG */ /* Set the shared heap header's file context for this operation */ @@ -557,8 +542,8 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H /* (bit 0: "huge" object IDs have wrapped) */ /* (bit 1: checksum direct blocks) */ heap_flags = 0; - heap_flags |= (hdr->huge_ids_wrapped ? H5HF_HDR_FLAGS_HUGE_ID_WRAPPED : 0); - heap_flags |= (hdr->checksum_dblocks ? H5HF_HDR_FLAGS_CHECKSUM_DBLOCKS : 0); + heap_flags = (uint8_t)(heap_flags | (hdr->huge_ids_wrapped ? H5HF_HDR_FLAGS_HUGE_ID_WRAPPED : 0)); + heap_flags = (uint8_t)(heap_flags | (hdr->checksum_dblocks ? H5HF_HDR_FLAGS_CHECKSUM_DBLOCKS : 0)); *p++ = heap_flags; /* "Huge" object information */ @@ -581,7 +566,7 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H H5F_ENCODE_LENGTH(f, p, hdr->tiny_nobjs); /* Managed objects' doubling-table info */ - if(H5HF_dtable_encode(hdr->f, &p, &(hdr->man_dtable)) < 0) + if(H5HF__dtable_encode(hdr->f, &p, &(hdr->man_dtable)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "unable to encode managed obj. doubling table info") /* Check for I/O filter information to encode */ @@ -780,7 +765,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space for the fractal heap indirect block */ if(NULL == (iblock = H5FL_CALLOC(H5HF_indirect_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Get the pointer to the shared heap header */ hdr = udata->par_info->hdr; @@ -791,7 +776,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Share common heap information */ iblock->hdr = hdr; if(H5HF_hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ iblock->rc = 0; @@ -818,17 +803,17 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Magic number */ if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap indirect block signature") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap indirect block signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5HF_IBLOCK_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") /* Address of heap that owns this block */ H5F_addr_decode(udata->f, &p, &heap_addr); if(H5F_addr_ne(heap_addr, hdr->heap_addr)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") /* Address of parent block */ iblock->parent = udata->par_info->iblock; @@ -856,9 +841,10 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate & decode child block entry tables */ HDassert(iblock->nrows > 0); if(NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct entries") + if(hdr->filter_len > 0) { - unsigned dir_rows; /* Number of direct rows in this indirect block */ + unsigned dir_rows; /* Number of direct rows in this indirect block */ /* Compute the number of direct rows for this indirect block */ dir_rows = MIN(iblock->nrows, hdr->man_dtable.max_direct_rows); @@ -869,6 +855,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) } /* end if */ else iblock->filt_ents = NULL; + for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) { /* Decode child block address */ H5F_addr_decode(udata->f, &p, &(iblock->ents[u].addr)); @@ -903,7 +890,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) } /* end for */ /* Sanity check */ - HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */ + HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */ /* Compute checksum on indirect block */ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); @@ -916,7 +903,7 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Verify checksum */ if(stored_chksum != computed_chksum) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") /* Check if we have any indirect block children */ if(iblock->nrows > hdr->man_dtable.max_direct_rows) { @@ -986,31 +973,26 @@ H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, size_t u; /* Local index variable */ #ifndef NDEBUG - /* verify that flush dependencies are working correctly. Do this +{ + /* Verify that flush dependencies are working correctly. Do this * by verifying that all children of this iblock are clean. */ hbool_t descendants_clean = TRUE; unsigned iblock_status; - if ( H5AC_get_entry_status(f, iblock->addr, &iblock_status) < 0 ) - + if(H5AC_get_entry_status(f, iblock->addr, &iblock_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") - /* since the current iblock is the guest of honor in a flush, we know + /* since the current iblock is the guest of honor in a flush, we know * that it is locked into the cache for the duration of the call. Hence - * there is no need to check to see if it is pinned or protected, or to + * there is no need to check to see if it is pinned or protected, or to * protect it if it is not. */ - - if ( H5HF_cache_verify_iblock_descendants_clean(f, dxpl_id, - iblock, &iblock_status, - &descendants_clean) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "can't verify descendants clean.") + if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, iblock, &iblock_status, &descendants_clean) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify descendants clean.") HDassert(descendants_clean); - +} #endif /* NDEBUG */ /* Get the pointer to the shared heap header */ @@ -1276,99 +1258,78 @@ H5HF_cache_iblock_notify(H5C_notify_action_t action, H5HF_indirect_t *iblock) HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(iblock->hdr); - if ( action == H5C_NOTIFY_ACTION_BEFORE_EVICT ) - HDassert((iblock->parent == iblock->fd_parent) || - ((NULL == iblock->parent) && (iblock->fd_parent))); + + if(action == H5AC_NOTIFY_ACTION_BEFORE_EVICT) + HDassert((iblock->parent == iblock->fd_parent) || ((NULL == iblock->parent) && (iblock->fd_parent))); else - HDassert(iblock->parent == iblock->fd_parent); + HDassert(iblock->parent == iblock->fd_parent); /* further sanity checks */ - if ( iblock->parent == NULL ) { - - /* Either this is the root iblock, or the parent pointer is */ + if(iblock->parent == NULL) { + /* Either this is the root iblock, or the parent pointer is */ /* invalid. Since we save a copy of the parent pointer on */ /* the insertion event, it doesn't matter if the parent pointer */ /* is invalid just before eviction. However, we will not be */ /* able to function if it is invalid on the insertion event. */ - /* Scream and die if this is the case. */ - - HDassert((action == H5C_NOTIFY_ACTION_BEFORE_EVICT) || - (iblock->block_off == 0)); + /* Scream and die if this is the case. */ + HDassert((action == H5C_NOTIFY_ACTION_BEFORE_EVICT) || (iblock->block_off == 0)); - /* pointer from hdr to root iblock will not be set up unless */ - /* the fractal heap has already pinned the hdr. Do what */ + /* pointer from hdr to root iblock will not be set up unless */ + /* the fractal heap has already pinned the hdr. Do what */ /* sanity checking we can. */ - - if ( ( iblock->block_off == 0 ) && - ( iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED ) ) + if((iblock->block_off == 0) && (iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED)) HDassert(iblock->hdr->root_iblock == iblock); - - } else { - /* if this is a child iblock, verify that the pointers are */ + } /* end if */ + else { + /* if this is a child iblock, verify that the pointers are */ /* either uninitialized or set up correctly. */ H5HF_indirect_t *par_iblock = iblock->parent; unsigned indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width)); + HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); /* Compute index in parent's child iblock pointer array */ - indir_idx = iblock->par_entry - - (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width); + indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width); - /* The pointer to iblock in the parent may not be set yet -- */ + /* The pointer to iblock in the parent may not be set yet -- */ /* verify that it is either NULL, or that it has been set to */ /* iblock. */ - HDassert((NULL == par_iblock->child_iblocks[indir_idx]) || - (par_iblock->child_iblocks[indir_idx] == iblock)); - } - - switch ( action ) - { - case H5C_NOTIFY_ACTION_AFTER_INSERT: - if ( iblock->parent ) /* this is a child iblock */ - { - /* create flush dependency with parent iblock */ - if(H5AC_create_flush_dependency(iblock->parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, \ - "unable to create flush dependency") - } - else /* this is the root iblock */ - { - /* create flush dependency with header */ - if(H5AC_create_flush_dependency(iblock->hdr, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, \ - "unable to create flush dependency") - } - break; - - case H5C_NOTIFY_ACTION_BEFORE_EVICT: - if ( iblock->fd_parent ) /* this is a child iblock */ - { - /* destroy flush dependency with parent iblock */ - if(H5AC_destroy_flush_dependency(iblock->fd_parent, - iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, \ - "unable to destroy flush dependency") - } - else /* this is the root iblock */ - { - /* destroy flush dependency with header */ - if(H5AC_destroy_flush_dependency(iblock->hdr, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, \ - "unable to destroy flush dependency") - - } - break; - - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "unknown action from metadata cache") - break; - } + HDassert((NULL == par_iblock->child_iblocks[indir_idx]) || (par_iblock->child_iblocks[indir_idx] == iblock)); + } /* end else */ + + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + if(iblock->parent) { /* this is a child iblock */ + /* create flush dependency with parent iblock */ + if(H5AC_create_flush_dependency(iblock->parent, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + } /* end if */ + else { /* this is the root iblock */ + /* create flush dependency with header */ + if(H5AC_create_flush_dependency(iblock->hdr, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + } /* end else */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + if(iblock->fd_parent) { /* this is a child iblock */ + /* destroy flush dependency with parent iblock */ + if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + } /* end if */ + else { /* this is the root iblock */ + /* destroy flush dependency with header */ + if(H5AC_destroy_flush_dependency(iblock->hdr, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + } /* end else */ + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + break; + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1424,8 +1385,8 @@ H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, siz static H5HF_direct_t * H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) { - H5HF_dblock_cache_ud_t *udata = (H5HF_dblock_cache_ud_t *)_udata; /* pointer to user data */ H5HF_hdr_t *hdr; /* Shared fractal heap information */ + H5HF_dblock_cache_ud_t *udata = (H5HF_dblock_cache_ud_t *)_udata; /* User data for callback */ H5HF_parent_t *par_info; /* Pointer to parent information */ H5HF_direct_t *dblock = NULL; /* Direct block info */ const uint8_t *p; /* Pointer into raw data buffer */ @@ -1443,7 +1404,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space for the fractal heap direct block */ if(NULL == (dblock = H5FL_MALLOC(H5HF_direct_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); /* Get the pointer to the shared heap header */ @@ -1456,7 +1417,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Share common heap information */ dblock->hdr = hdr; if(H5HF_hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ dblock->size = udata->dblock_size; @@ -1473,7 +1434,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */ void *read_buf; /* Pointer to buffer to read in */ size_t read_size; /* Size of filtered direct block to read */ - unsigned filter_mask; /* Excluded filters for direct block */ + unsigned filter_mask; /* Excluded filters for direct block */ /* Check for root direct block */ if(par_info->iblock == NULL) { @@ -1525,17 +1486,17 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Magic number */ if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block signature") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5HF_DBLOCK_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") /* Address of heap that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->f, &p, &heap_addr); if(H5F_addr_ne(heap_addr, hdr->heap_addr)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") /* Address of parent block */ dblock->parent = par_info->iblock; @@ -1973,57 +1934,43 @@ H5HF_cache_dblock_notify(H5C_notify_action_t action, H5HF_direct_t *dblock) HDassert(dblock); HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(dblock->hdr); - HDassert((dblock->fd_parent) || - ((dblock->hdr->man_dtable.curr_root_rows == 0) && - (dblock->block_off == (hsize_t)0))); - - switch ( action ) - { - case H5C_NOTIFY_ACTION_AFTER_INSERT: - HDassert(dblock->parent == dblock->fd_parent); - - if ( dblock->parent ) /* this is a leaf dblock */ - { - /* create flush dependency with parent iblock */ - if(H5AC_create_flush_dependency(dblock->parent, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, \ - "unable to create flush dependency") - } - else /* this is a root dblock */ - { - /* create flush dependency with header */ - if(H5AC_create_flush_dependency(dblock->hdr, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, \ - "unable to create flush dependency") - } - break; - - case H5C_NOTIFY_ACTION_BEFORE_EVICT: + HDassert((dblock->fd_parent) || + ((dblock->hdr->man_dtable.curr_root_rows == 0) && (dblock->block_off == (hsize_t)0))); + + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + HDassert(dblock->parent == dblock->fd_parent); + if(dblock->parent) { /* this is a leaf dblock */ + /* create flush dependency with parent iblock */ + if(H5AC_create_flush_dependency(dblock->parent, dblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + } /* end if */ + else { /* this is a root dblock */ + /* create flush dependency with header */ + if(H5AC_create_flush_dependency(dblock->hdr, dblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + } /* end else */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: HDassert((dblock->parent == dblock->fd_parent) || - ((NULL == dblock->parent) && (dblock->fd_parent))); - if ( dblock->fd_parent ) /* this is a leaf dblock */ - { - /* destroy flush dependency with parent iblock */ - if(H5AC_destroy_flush_dependency(dblock->fd_parent, - dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, \ - "unable to destroy flush dependency") - } - else /* this is a root dblock */ - { - /* destroy flush dependency with header */ - if(H5AC_destroy_flush_dependency(dblock->hdr, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, \ - "unable to destroy flush dependency") - - } - break; - - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "unknown action from metadata cache") - break; - } + ((NULL == dblock->parent) && (dblock->fd_parent))); + if(dblock->fd_parent) { /* this is a leaf dblock */ + /* destroy flush dependency with parent iblock */ + if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + } /* end if */ + else { /* this is a root dblock */ + /* destroy flush dependency with header */ + if(H5AC_destroy_flush_dependency(dblock->hdr, dblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + } /* end else */ + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + break; + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2063,11 +2010,11 @@ H5HF_cache_dblock_size(const H5F_t UNUSED *f, const H5HF_direct_t *dblock, size_ /*------------------------------------------------------------------------ - * Function: H5HF_cache_verify_hdr_descendants_clean + * Function: H5HF__cache_verify_hdr_descendants_clean * * Purpose: Sanity checking routine that verifies that all indirect * and direct blocks that are descendants of the supplied - * instance of H5HF_hdr_t are clean. Set *clean_ptr to + * instance of H5HF_hdr_t are clean. Set *clean to * TRUE if this is the case, and to FALSE otherwise. * * Return: Non-negative on success/Negative on failure @@ -2079,41 +2026,26 @@ H5HF_cache_dblock_size(const H5F_t UNUSED *f, const H5HF_direct_t *dblock, size_ */ #ifndef NDEBUG static herr_t -H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, - hid_t dxpl_id, - H5HF_hdr_t * hdr, - hbool_t *clean_ptr) +H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, hid_t dxpl_id, + H5HF_hdr_t * hdr, hbool_t *clean) { - hbool_t in_cache; - hbool_t type_ok; - hbool_t root_iblock_in_cache = FALSE; - hbool_t unprotect_root_iblock = FALSE; - unsigned hdr_status = 0; - unsigned root_iblock_status = 0; - unsigned root_dblock_status = 0; - H5HF_indirect_t * root_iblock = NULL; - haddr_t hdr_addr; - haddr_t root_iblock_addr = HADDR_UNDEF; - haddr_t root_dblock_addr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) + haddr_t hdr_addr; /* Address of header */ + unsigned hdr_status = 0; /* Header cache entry status */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_STATIC + + /* Sanity checks */ HDassert(f); HDassert(hdr); HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((const H5AC_class_t *)(hdr->cache_info.type) == \ - &(H5AC_FHEAP_HDR[0])); - HDassert(clean_ptr); - + HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); + HDassert(clean); hdr_addr = hdr->cache_info.addr; - HDassert(hdr_addr == hdr->heap_addr); - if ( H5AC_get_entry_status(f, hdr_addr, &hdr_status) < 0 ) - + if(H5AC_get_entry_status(f, hdr_addr, &hdr_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get hdr status") - HDassert(hdr_status & H5AC_ES__IN_CACHE); /* We have three basic scenarios we have to deal with: @@ -2146,64 +2078,50 @@ H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, * Since the former case is far and away the most common, we don't * worry too much about efficiency in the second case. */ - - if ( ( hdr->root_iblock ) || - ( ( hdr->man_dtable.curr_root_rows > 0 ) && - ( HADDR_UNDEF != hdr->man_dtable.table_addr ) ) ) { - - root_iblock = hdr->root_iblock; - - /* make note of the on disk address of the root iblock */ - - if ( root_iblock == NULL ) { - + if(hdr->root_iblock || + ((hdr->man_dtable.curr_root_rows > 0) && + (HADDR_UNDEF != hdr->man_dtable.table_addr))) { + H5HF_indirect_t *root_iblock = hdr->root_iblock; + haddr_t root_iblock_addr; + unsigned root_iblock_status = 0; + hbool_t root_iblock_in_cache; + + /* make note of the on disk address of the root iblock */ + if(root_iblock == NULL) /* hdr->man_dtable.table_addr must contain address of root * iblock. Check to see if it is in cache. If it is, * protect it and put its address in root_iblock. */ root_iblock_addr = hdr->man_dtable.table_addr; - - } else { - + else root_iblock_addr = root_iblock->addr; - } /* get the status of the root iblock */ HDassert(root_iblock_addr != HADDR_UNDEF); + if(H5AC_get_entry_status(f, root_iblock_addr, &root_iblock_status) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root iblock status") - if ( H5AC_get_entry_status(f, root_iblock_addr, - &root_iblock_status) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, \ - "can't get root iblock status") - - root_iblock_in_cache = ( (root_iblock_status & H5AC_ES__IN_CACHE) != 0 ); - + root_iblock_in_cache = ( (root_iblock_status & H5AC_ES__IN_CACHE) != 0); HDassert(root_iblock_in_cache || (root_iblock == NULL)); - if ( ! root_iblock_in_cache ) { /* we are done */ - - *clean_ptr = TRUE; - - } else if ( root_iblock_status & H5AC_ES__IS_DIRTY ) { - - *clean_ptr = FALSE; - - } else { /* must examine children */ + if(!root_iblock_in_cache) /* we are done */ + *clean = TRUE; + else if(root_iblock_status & H5AC_ES__IS_DIRTY) + *clean = FALSE; + else { /* must examine children */ + hbool_t unprotect_root_iblock = FALSE; /* At this point, the root iblock may be pinned, protected, * both, or neither, and we may or may not have a pointer * to root iblock in memory. * - * Before we call H5HF_cache_verify_iblock_descendants_clean(), + * Before we call H5HF__cache_verify_iblock_descendants_clean(), * we must ensure that the root iblock is either pinned or * protected or both, and that we have a pointer to it. * Do this as follows: */ - if ( root_iblock == NULL ) { /* we don't have ptr to root iblock */ - - if ( 0 == (root_iblock_status & H5AC_ES__IS_PROTECTED) ) { - + if(root_iblock == NULL) { /* we don't have ptr to root iblock */ + if(0 == (root_iblock_status & H5AC_ES__IS_PROTECTED)) { /* just protect the root iblock -- this will give us * the pointer we need to proceed, and ensure that * it is locked into the metadata cache for the @@ -2214,21 +2132,11 @@ H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, * in this case, since we know that the entry is in cache, * we can pass NULL udata. */ - - root_iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, - H5AC_FHEAP_IBLOCK, - root_iblock_addr, - NULL, H5AC_READ); - - if ( NULL == root_iblock ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, \ - "H5AC_protect() faild.") - + if(NULL == (root_iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") unprotect_root_iblock = TRUE; - - } else { - + } /* end if */ + else { /* the root iblock is protected, and we have no * legitimate way of getting a pointer to it. * @@ -2263,25 +2171,20 @@ H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, * code, I expect that we will use this approach until it * causes problems, or we think of a better way. */ - if ( H5AC_get_entry_ptr_from_addr(f, root_iblock_addr, - (void **)(&root_iblock)) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, \ - "H5AC_get_entry_ptr_from_addr() failed.") - + if(H5AC_get_entry_ptr_from_addr(f, root_iblock_addr, (void **)(&root_iblock)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() failed.") HDassert(root_iblock); - } - } else /* root_iblock != NULL */ { - + } /* end else */ + } /* end if */ + else { /* root_iblock != NULL */ /* we have the pointer to the root iblock. Protect it * if it is neither pinned nor protected -- otherwise we * are ready to go. */ H5HF_indirect_t * iblock = NULL; - if ( ( (root_iblock_status & H5AC_ES__IS_PINNED) == 0 ) && - ( (root_iblock_status & H5AC_ES__IS_PROTECTED) == 0 ) ) { - + if(((root_iblock_status & H5AC_ES__IS_PINNED) == 0) && + ((root_iblock_status & H5AC_ES__IS_PROTECTED) == 0)) { /* the root iblock is neither pinned nor protected -- hence * we must protect it before we proceed * @@ -2290,82 +2193,49 @@ H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, * in this case, since we know that the entry is in cache, * we can pass NULL udata. */ - - iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, - H5AC_FHEAP_IBLOCK, - root_iblock_addr, - NULL, H5AC_READ); - - if ( NULL == iblock ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, \ - "H5AC_protect() faild.") - + if(NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") unprotect_root_iblock = TRUE; - HDassert(iblock == root_iblock); - - } - } + } /* end if */ + } /* end else */ /* at this point, one way or another, the root iblock is locked * in memory for the duration of the call. Do some sanity checks, - * and then call H5HF_cache_verify_iblock_descendants_clean(). + * and then call H5HF__cache_verify_iblock_descendants_clean(). */ + HDassert(hdr->root_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(hdr->root_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(hdr->root_iblock->cache_info.magic == \ - H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((const H5AC_class_t *)(hdr->root_iblock->cache_info.type) \ - == &(H5AC_FHEAP_IBLOCK[0])); - - if ( H5HF_cache_verify_iblock_descendants_clean(f, dxpl_id, - root_iblock, &root_iblock_status, - clean_ptr) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "can't verify root iblock & descendants clean.") - + if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, root_iblock, &root_iblock_status, clean) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify root iblock & descendants clean.") /* unprotect the root indirect block if required */ - if ( unprotect_root_iblock ) { - + if(unprotect_root_iblock) { HDassert(root_iblock); - - if ( H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, - root_iblock_addr, root_iblock, - H5AC__NO_FLAGS_SET) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, \ - "H5AC_unprotect() faild.") - } - } - } else if ( ( hdr->man_dtable.curr_root_rows == 0 ) && - ( HADDR_UNDEF != hdr->man_dtable.table_addr ) ) { + if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, root_iblock_addr, root_iblock, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") + } /* end if */ + } /* end else */ + } /* end if */ + else if((hdr->man_dtable.curr_root_rows == 0) && + (HADDR_UNDEF != hdr->man_dtable.table_addr)) { + haddr_t root_dblock_addr; + unsigned root_dblock_status = 0; + hbool_t in_cache; + hbool_t type_ok; /* this is scenario 2 -- we have a root dblock */ - root_dblock_addr = hdr->man_dtable.table_addr; + if(H5AC_get_entry_status(f, root_dblock_addr, &root_dblock_status) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root dblock status") - if ( H5AC_get_entry_status(f, root_dblock_addr, - &root_dblock_status) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, \ - "can't get root dblock status") - - if ( root_dblock_status & H5AC_ES__IN_CACHE ) { - - if ( H5AC_verify_entry_type(f, root_dblock_addr, - &H5AC_FHEAP_DBLOCK[0], - &in_cache, &type_ok) < 0 ) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "can't check dblock type") - + if(root_dblock_status & H5AC_ES__IN_CACHE) { + if(H5AC_verify_entry_type(f, root_dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") HDassert(in_cache); - - if ( !type_ok ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "root dblock addr doesn't refer to a dblock?!?") + if(!type_ok) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock addr doesn't refer to a dblock?!?") /* If a root dblock is in cache, it must have a flush * dependency relationship with the header, and it @@ -2376,45 +2246,34 @@ H5HF_cache_verify_hdr_descendants_clean(H5F_t *f, * the root iblock is a child in some flush dependency * relationship. */ - if ( 0 == (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "root dblock in cache and not a flush dep child.") - - if ( 0 != (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "root dblock in cache and is a flush dep parent.") - - - *clean_ptr = ! (root_dblock_status & H5AC_ES__IS_DIRTY); - - } else { /* root dblock not in cache */ - - *clean_ptr = TRUE; - } - } else { + if(0 == (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and not a flush dep child.") + if(0 != (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and is a flush dep parent.") + + *clean = ! (root_dblock_status & H5AC_ES__IS_DIRTY); + } /* end if */ + else /* root dblock not in cache */ + *clean = TRUE; + } /* end else-if */ + else /* this is scenario 3 -- the fractal heap is empty, and we * have nothing to do. */ - *clean_ptr = TRUE; - } + *clean = TRUE; done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5HF_cache_verify_hdr_descendants_clean() */ - +} /* H5HF__cache_verify_hdr_descendants_clean() */ #endif /* NDEBUG */ /*------------------------------------------------------------------------ - * Function: H5HF_cache_verify_iblock_descendants_clean + * Function: H5HF__cache_verify_iblock_descendants_clean * * Purpose: Sanity checking routine that verifies that all indirect * and direct blocks that are decendents of the supplied - * instance of H5HF_indirect_t are clean. Set *clean_ptr + * instance of H5HF_indirect_t are clean. Set *clean * to TRUE if this is the case, and to FALSE otherwise. * * In passing, the function also does a cursory check to @@ -2433,7 +2292,7 @@ done: * met. * * Note that this function and - * H5HF_cache_verify_descendant_iblocks_clean() are + * H5HF__cache_verify_descendant_iblocks_clean() are * recursive co-routines. * * Return: Non-negative on success/Negative on failure @@ -2445,72 +2304,49 @@ done: */ #ifndef NDEBUG static herr_t -H5HF_cache_verify_iblock_descendants_clean(H5F_t *f, - hid_t dxpl_id, - H5HF_indirect_t * iblock, - unsigned * iblock_status_ptr, - hbool_t *clean_ptr) +H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, hid_t dxpl_id, + H5HF_indirect_t *iblock, unsigned *iblock_status, hbool_t *clean) { hbool_t has_dblocks = FALSE; hbool_t has_iblocks = FALSE; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(f); HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((const H5AC_class_t *)(iblock->cache_info.type) == \ - &(H5AC_FHEAP_IBLOCK[0])); - HDassert(iblock_status_ptr); - HDassert(clean_ptr); - HDassert(*clean_ptr); - - if ( ( *clean_ptr ) && - ( H5HF_cache_verify_iblocks_dblocks_clean(f, iblock, clean_ptr, - &has_dblocks) < 0 ) ) + HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + HDassert(iblock_status); + HDassert(clean); + HDassert(*clean); + + if((*clean) && H5HF__cache_verify_iblocks_dblocks_clean(f, iblock, clean, &has_dblocks) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify dblocks clean.") - if ( ( *clean_ptr ) && - ( H5HF_cache_verify_descendant_iblocks_clean(f, dxpl_id, iblock, - clean_ptr, &has_iblocks) < 0 ) ) + if((*clean) && H5HF__cache_verify_descendant_iblocks_clean(f, dxpl_id, iblock, clean, &has_iblocks) < 0) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify iblocks clean.") - if ( ( NULL == iblock_status_ptr ) && - ( H5AC_get_entry_status(f, iblock->addr, iblock_status_ptr) < 0 ) ) - + if((NULL == iblock_status) && H5AC_get_entry_status(f, iblock->addr, iblock_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") /* verify that flush dependency setup is plausible */ - - if ( 0 == (*iblock_status_ptr & H5AC_ES__IS_FLUSH_DEP_CHILD) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "iblock is not a flush dep child.") - - if ( ( ( has_dblocks || has_iblocks ) ) && - ( 0 == (*iblock_status_ptr & H5AC_ES__IS_FLUSH_DEP_PARENT) ) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "iblock has children and is not a flush dep parent.") - - if ( ( ( has_dblocks || has_iblocks ) ) && - ( 0 == (*iblock_status_ptr & H5AC_ES__IS_PINNED) ) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "iblock has children and is not pinned.") + if(0 == (*iblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock is not a flush dep child.") + if(((has_dblocks || has_iblocks)) && (0 == (*iblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT))) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock has children and is not a flush dep parent.") + if(((has_dblocks || has_iblocks)) && (0 == (*iblock_status & H5AC_ES__IS_PINNED))) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock has children and is not pinned.") done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5HF_cache_verify_iblock_descendants_clean() */ - +} /* H5HF__cache_verify_iblock_descendants_clean() */ #endif /* NDEBUG */ /*------------------------------------------------------------------------ - * Function: H5HF_cache_verify_iblocks_dblocks_clean + * Function: H5HF__cache_verify_iblocks_dblocks_clean * * Purpose: Sanity checking routine that attempts to verify that all * direct blocks pointed to by the supplied indirect block @@ -2538,71 +2374,53 @@ done: */ #ifndef NDEBUG static herr_t -H5HF_cache_verify_iblocks_dblocks_clean(H5F_t *f, - H5HF_indirect_t * iblock, - hbool_t *clean_ptr, - hbool_t *has_dblocks_ptr) +H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, H5HF_indirect_t *iblock, + hbool_t *clean, hbool_t *has_dblocks) { - hbool_t in_cache; - hbool_t type_ok; - unsigned i; unsigned num_direct_rows; unsigned max_dblock_index; - haddr_t dblock_addr; - unsigned dblock_status = 0; + unsigned i; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(f); HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(clean_ptr); - HDassert(*clean_ptr); - HDassert(has_dblocks_ptr); + HDassert(clean); + HDassert(*clean); + HDassert(has_dblocks); i = 0; - - num_direct_rows = - MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); - - HDassert(num_direct_rows <= iblock->nrows ); - - max_dblock_index = - (num_direct_rows * iblock->hdr->man_dtable.cparam.width) - 1; - - while ( ( *clean_ptr ) && ( i <= max_dblock_index ) ) { + num_direct_rows = MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); + HDassert(num_direct_rows <= iblock->nrows); + max_dblock_index = (num_direct_rows * iblock->hdr->man_dtable.cparam.width) - 1; + while((*clean) && (i <= max_dblock_index)) { + haddr_t dblock_addr; dblock_addr = iblock->ents[i].addr; + if(H5F_addr_defined(dblock_addr)) { + hbool_t in_cache; + hbool_t type_ok; - if ( H5F_addr_defined(dblock_addr) ) { - - if ( H5AC_verify_entry_type(f, dblock_addr, &H5AC_FHEAP_DBLOCK[0], - &in_cache, &type_ok) < 0 ) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "can't check dblock type") - - if ( in_cache ) { /* dblock is in cache */ - - if ( ! type_ok ) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "dblock addr doesn't refer to a dblock?!?") + if(H5AC_verify_entry_type(f, dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") - if ( H5AC_get_entry_status(f, dblock_addr, - &dblock_status) < 0 ) + if(in_cache) { /* dblock is in cache */ + unsigned dblock_status = 0; - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "can't get dblock status") + if(!type_ok) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock addr doesn't refer to a dblock?!?") - HDassert(dblock_status & H5AC_ES__IN_CACHE ); + if(H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status") + HDassert(dblock_status & H5AC_ES__IN_CACHE); - *has_dblocks_ptr = TRUE; - - if ( dblock_status & H5AC_ES__IS_DIRTY ) { - - *clean_ptr = FALSE; - } + *has_dblocks = TRUE; + if(dblock_status & H5AC_ES__IS_DIRTY) + *clean = FALSE; /* If a child dblock is in cache, it must have a flush * dependency relationship with this iblock, and it @@ -2613,33 +2431,26 @@ H5HF_cache_verify_iblocks_dblocks_clean(H5F_t *f, * the child iblock is a child in some flush dependency * relationship. */ - if ( 0 == (dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "dblock in cache and not a flush dep child.") + if(0 == (dblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and not a flush dep child.") - if ( 0 != (dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT) ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "dblock in cache and is a flush dep parent.") + if(0 != (dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock in cache and is a flush dep parent.") - } - } + } /* end if */ + } /* end if */ i++; - } + } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5HF_cache_verify_iblocks_dblocks_clean() */ - +} /* H5HF__cache_verify_iblocks_dblocks_clean() */ #endif /* NDEBUG */ /*------------------------------------------------------------------------ - * Function: H5HF_cache_verify_descendant_iblocks_clean + * Function: H5HF__cache_verify_descendant_iblocks_clean * * Purpose: Sanity checking routine that attempts to verify that all * direct blocks pointed to by the supplied indirect block @@ -2667,70 +2478,52 @@ done: */ #ifndef NDEBUG static herr_t -H5HF_cache_verify_descendant_iblocks_clean(H5F_t *f, - hid_t dxpl_id, - H5HF_indirect_t * iblock, - hbool_t *clean_ptr, - hbool_t *has_iblocks_ptr) +H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, hid_t dxpl_id, + H5HF_indirect_t *iblock, hbool_t *clean, hbool_t *has_iblocks) { - hbool_t unprotect_child_iblock; - unsigned i; unsigned first_iblock_index; unsigned last_iblock_index; unsigned num_direct_rows; - unsigned child_iblock_status = 0; - haddr_t child_iblock_addr; - H5HF_indirect_t * child_iblock_ptr; + unsigned i; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(f); HDassert(iblock); HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == &(H5AC_FHEAP_IBLOCK[0])); - HDassert(clean_ptr); - HDassert(*clean_ptr); - HDassert(has_iblocks_ptr); - - num_direct_rows = - MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); - - HDassert(num_direct_rows <= iblock->nrows ); + HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + HDassert(clean); + HDassert(*clean); + HDassert(has_iblocks); + num_direct_rows = MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); + HDassert(num_direct_rows <= iblock->nrows); first_iblock_index = num_direct_rows * iblock->hdr->man_dtable.cparam.width; - last_iblock_index = - (iblock->nrows * iblock->hdr->man_dtable.cparam.width) - 1; + last_iblock_index = (iblock->nrows * iblock->hdr->man_dtable.cparam.width) - 1; i = first_iblock_index; + while((*clean) && (i <= last_iblock_index)) { + haddr_t child_iblock_addr = iblock->ents[i].addr; - while ( ( *clean_ptr ) && ( i <= last_iblock_index ) ) { - - child_iblock_addr = iblock->ents[i].addr; - - if ( H5F_addr_defined(child_iblock_addr) ) { + if(H5F_addr_defined(child_iblock_addr)) { + unsigned child_iblock_status = 0; - if ( H5AC_get_entry_status(f, child_iblock_addr, - &child_iblock_status) < 0 ) + if(H5AC_get_entry_status(f, child_iblock_addr, &child_iblock_status) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, \ - "can't get iblock status") + if(child_iblock_status & H5AC_ES__IN_CACHE) { + *has_iblocks = TRUE; + if(child_iblock_status & H5AC_ES__IS_DIRTY) + *clean = FALSE; - if ( child_iblock_status & H5AC_ES__IN_CACHE ) { - - *has_iblocks_ptr = TRUE; - - if ( child_iblock_status & H5AC_ES__IS_DIRTY ) { - - *clean_ptr = FALSE; - } - - /* if the child iblock is in cache and *clean_ptr is TRUE, + /* if the child iblock is in cache and *clean is TRUE, * we must continue to explore down the fractal heap tree * structure to verify that all descendant blocks are either * clean, or not in the metadata cache. We do this with a * recursive call to - * H5HF_cache_verify_iblock_descendants_clean(). + * H5HF__cache_verify_iblock_descendants_clean(). * However, we can't make this call unless the child iblock * is somehow locked into the cache -- typically via either * pinning or protecting. @@ -2776,102 +2569,69 @@ H5HF_cache_verify_descendant_iblocks_clean(H5F_t *f, * expect that we will use this approach until it causes * problems, or we think of a better way. */ - if ( *clean_ptr ) { - - child_iblock_ptr = NULL; - unprotect_child_iblock = FALSE; + if(*clean) { + H5HF_indirect_t *child_iblock = NULL; + hbool_t unprotect_child_iblock = FALSE; - if ( 0 == (child_iblock_status & H5AC_ES__IS_PINNED)) { - + if(0 == (child_iblock_status & H5AC_ES__IS_PINNED)) { /* child iblock is not pinned */ - - if (0 == (child_iblock_status & H5AC_ES__IS_PROTECTED)){ - + if(0 == (child_iblock_status & H5AC_ES__IS_PROTECTED)) { /* child iblock is unprotected, and unpinned */ /* protect it. Note that the udata is only */ /* used in the load callback. While the */ /* fractal heap makes heavy use of the udata */ /* in this case, since we know that the */ /* entry is in cache, we can pass NULL udata */ - child_iblock_ptr = (H5HF_indirect_t *) - H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, - child_iblock_addr, - NULL, H5AC_READ); - - if ( NULL == child_iblock_ptr ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, \ - "H5AC_protect() faild.") + if(NULL == (child_iblock = (H5HF_indirect_t *) H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, child_iblock_addr, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() faild.") unprotect_child_iblock = TRUE; - - } else { - + } /* end if */ + else { /* child iblock is protected -- use */ /* H5AC_get_entry_ptr_from_addr() to get a */ /* pointer to the entry. This is very slimy -- */ /* come up with a better solution. */ - if ( H5AC_get_entry_ptr_from_addr(f, - child_iblock_addr, - (void **)(&child_iblock_ptr)) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, \ - "H5AC_get_entry_ptr_from_addr() faild.") - - HDassert ( child_iblock_ptr ); - } - } else { + if(H5AC_get_entry_ptr_from_addr(f, child_iblock_addr, (void **)(&child_iblock)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() faild.") + HDassert(child_iblock); + } /* end else */ + } /* end if */ + else { /* child iblock is pinned -- look it up in the */ /* parent iblocks child_iblocks array. */ - HDassert(iblock->child_iblocks); - - child_iblock_ptr = - iblock->child_iblocks[i - first_iblock_index]; - } + child_iblock = iblock->child_iblocks[i - first_iblock_index]; + } /* end else */ /* At this point, one way or another we should have * a pointer to the child iblock. Verify that we * that we have the correct one. */ - HDassert(child_iblock_ptr); - HDassert(child_iblock_ptr->cache_info.magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(child_iblock_ptr->cache_info.type == - H5AC_FHEAP_IBLOCK); - HDassert(child_iblock_ptr->addr == child_iblock_addr); + HDassert(child_iblock); + HDassert(child_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(child_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + HDassert(child_iblock->addr == child_iblock_addr); /* now make the recursive call */ - if ( H5HF_cache_verify_iblock_descendants_clean(f, dxpl_id, - child_iblock_ptr, &child_iblock_status, - clean_ptr) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, \ - "can't verify child iblock clean.") + if(H5HF__cache_verify_iblock_descendants_clean(f, dxpl_id, child_iblock, &child_iblock_status, clean) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify child iblock clean.") /* if we protected the child iblock, unprotect it now */ - if ( unprotect_child_iblock ) { - - if ( H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, - child_iblock_addr, child_iblock_ptr, - H5AC__NO_FLAGS_SET) < 0 ) - - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, \ - "H5AC_unprotect() faild.") + if(unprotect_child_iblock) { + if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, child_iblock_addr, child_iblock, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() faild.") - } - } - } - } + } /* end if */ + } /* end if */ + } /* end if */ + } /* end if */ i++; - } + } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5HF_cache_verify_descendant_iblocks_clean() */ - +} /* H5HF__cache_verify_descendant_iblocks_clean() */ #endif /* NDEBUG */ -- cgit v0.12 From 2e9d48a551045d958b193d9d7a9964ef18b75dda Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:10:46 -0500 Subject: [svn-r27081] Description: Clean up H5HL interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5HLcache.c | 43 ++++++++++++++++++++++--------------------- src/H5HLpkg.h | 6 +++--- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 6576284..d946815 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -121,7 +121,7 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ /*------------------------------------------------------------------------- - * Function: H5HL_fl_deserialize + * Function: H5HL__fl_deserialize * * Purpose: Deserialize the free list for a heap data block * @@ -134,13 +134,13 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5HL_fl_deserialize(H5HL_t *heap) +H5HL__fl_deserialize(H5HL_t *heap) { H5HL_free_t *fl = NULL, *tail = NULL; /* Heap free block nodes */ hsize_t free_block; /* Offset of free block */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(heap); @@ -188,11 +188,11 @@ done: fl = H5FL_FREE(H5HL_free_t, fl); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HL_fl_deserialize() */ +} /* end H5HL__fl_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5HL_fl_serialize + * Function: H5HL__fl_serialize * * Purpose: Serialize the free list for a heap data block * @@ -206,11 +206,11 @@ done: *------------------------------------------------------------------------- */ static void -H5HL_fl_serialize(const H5HL_t *heap) +H5HL__fl_serialize(const H5HL_t *heap) { H5HL_free_t *fl; /* Pointer to heap free list node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check arguments */ HDassert(heap); @@ -231,7 +231,7 @@ H5HL_fl_serialize(const H5HL_t *heap) } /* end for */ FUNC_LEAVE_NOAPI_VOID -} /* end H5HL_fl_serialize() */ +} /* end H5HL__fl_serialize() */ /*------------------------------------------------------------------------- @@ -300,11 +300,11 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space in memory for the heap */ if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure") /* Allocate the heap prefix */ if(NULL == (prfx = H5HL_prfx_new(heap))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix") /* Store the prefix's address & length */ heap->prfx_addr = udata->prfx_addr; @@ -315,8 +315,9 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Free list head */ H5F_DECODE_LENGTH_LEN(p, heap->free_block, udata->sizeof_size); - if(heap->free_block != H5HL_FREE_NULL && heap->free_block >= heap->dblk_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap free list") + + if((heap->free_block != H5HL_FREE_NULL) && (heap->free_block >= heap->dblk_size)) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap free list") /* Heap data address */ H5F_addr_decode_len(udata->sizeof_addr, &p, &(heap->dblk_addr)); @@ -349,7 +350,7 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) } /* end else */ /* Build free list */ - if(H5HL_fl_deserialize(heap) < 0) + if(H5HL__fl_deserialize(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") } /* end if */ else @@ -455,7 +456,7 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, } /* end if */ /* Serialize the free list into the heap data's image */ - H5HL_fl_serialize(heap); + H5HL__fl_serialize(heap); /* Copy the heap data block into the cache image */ HDmemcpy(p, heap->dblk_image, heap->dblk_size); @@ -634,7 +635,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(udata); @@ -644,7 +645,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space in memory for the heap data block */ if(NULL == (dblk = H5HL_dblk_new(udata->heap))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Check for heap still retaining image */ if(NULL == udata->heap->dblk_image) { @@ -657,7 +658,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap data block") /* Build free list */ - if(H5HL_fl_deserialize(udata->heap) < 0) + if(H5HL__fl_deserialize(udata->heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") } /* end if */ @@ -671,7 +672,7 @@ done: /* Release the [possibly partially initialized] local heap on errors */ if(!ret_value && dblk) if(H5HL_dblk_dest(dblk) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_datablock_load() */ @@ -714,7 +715,7 @@ H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL; /* Serialize the free list into the heap data's image */ - H5HL_fl_serialize(heap); + H5HL__fl_serialize(heap); /* Write the data block to the file */ if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0) @@ -754,7 +755,7 @@ H5HL_datablock_dest(H5F_t *f, void *_thing) FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ + /* Check arguments */ HDassert(dblk); HDassert(dblk->heap); HDassert(!dblk->heap->single_cache_obj); @@ -804,7 +805,7 @@ H5HL_datablock_clear(H5F_t *f, void *_thing, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ + /* Check arguments */ HDassert(dblk); /* Mark local heap data block as clean */ diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index bf9be2c..880cc05 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -114,9 +114,9 @@ struct H5HL_dblk_t { /* Struct for heap prefix */ struct H5HL_prfx_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - H5HL_t *heap; /* Pointer to heap for prefix */ + H5AC_info_t cache_info; /* Information for H5AC cache functions, */ + /* _must_ be first field in structure */ + H5HL_t *heap; /* Pointer to heap for prefix */ }; /* Callback information for loading local heap prefix from disk */ -- cgit v0.12 From 197fa23dae4262f07b9f79e40e4719298c0aefec Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:12:24 -0500 Subject: [svn-r27082] Description: Clean up H5O interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5Ocache.c | 88 ++++++++++++++++++++++++++------------------------------ src/H5Omessage.c | 42 +++++++++++++-------------- 2 files changed, 61 insertions(+), 69 deletions(-) diff --git a/src/H5Ocache.c b/src/H5Ocache.c index b1d94d8..3ccdf11 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -81,15 +81,15 @@ static herr_t H5O_cache_chk_clear(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_ static herr_t H5O_cache_chk_size(const H5F_t *f, const H5O_chunk_proxy_t *chk_proxy, size_t *size_ptr); /* Chunk proxy routines */ -static herr_t H5O_chunk_proxy_dest(H5O_chunk_proxy_t *chunk_proxy); +static herr_t H5O__chunk_proxy_dest(H5O_chunk_proxy_t *chunk_proxy); /* Chunk routines */ -static herr_t H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, +static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, H5O_common_cache_ud_t *udata, hbool_t *dirty); -static herr_t H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno); +static herr_t H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno); /* Misc. routines */ -static herr_t H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, +static herr_t H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont); @@ -193,7 +193,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate space for the object header data structure */ if(NULL == (oh = H5FL_CALLOC(H5O_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* File-specific, non-stored information */ oh->sizeof_size = H5F_SIZEOF_SIZE(udata->common.f); @@ -333,7 +333,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) buf = read_buf; /* Parse the first chunk */ - if(H5O_chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, buf, &(udata->common), &oh->cache_info.is_dirty) < 0) + if(H5O__chunk_deserialize(oh, udata->common.addr, oh->chunk0_size, buf, &(udata->common), &oh->cache_info.is_dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk") /* Note that we've loaded the object header from the file */ @@ -350,7 +350,7 @@ done: /* Release the [possibly partially initialized] object header on errors */ if(!ret_value && oh) if(H5O_free(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_load() */ @@ -480,7 +480,7 @@ H5O_assert(oh); HDassert((size_t)(p - oh->chunk[0].image) == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); /* Serialize messages for this chunk */ - if(H5O_chunk_serialize(f, oh, (unsigned)0) < 0) + if(H5O__chunk_serialize(f, oh, (unsigned)0) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize first object header chunk") /* Write the chunk out */ @@ -522,7 +522,7 @@ H5O_dest(H5F_t *f, H5O_t *oh) FUNC_ENTER_NOAPI_NOINIT - /* check args */ + /* Check arguments */ HDassert(oh); HDassert(oh->rc == 0); @@ -585,7 +585,7 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* check args */ + /* Check arguments */ HDassert(oh); #ifdef H5_HAVE_PARALLEL @@ -603,16 +603,13 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) for ( i = 0; i < oh->nchunks; i++ ) { - if ( H5O_chunk_serialize(f, oh, i) < 0 ) { - - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, - "unable to serialize object header chunk") - } + if(H5O__chunk_serialize(f, oh, i) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header chunk") } } #endif /* H5_HAVE_PARALLEL */ - /* Mark messages as clean */ + /* Mark messages stored with the object header (i.e. messages in chunk 0) as clean */ for(u = 0; u < oh->nmesgs; u++) oh->mesg[u].dirty = FALSE; @@ -722,7 +719,7 @@ H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) HDassert(udata->common.cont_msg_info); /* Parse the chunk */ - if(H5O_chunk_deserialize(udata->oh, udata->common.addr, udata->size, buf, &(udata->common), &chk_proxy->cache_info.is_dirty) < 0) + if(H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, buf, &(udata->common), &chk_proxy->cache_info.is_dirty) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk") /* Set the fields for the chunk proxy */ @@ -737,8 +734,8 @@ H5O_cache_chk_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) chk_proxy->oh = udata->oh; chk_proxy->chunkno = udata->chunkno; - /* Sanity check that the chunk representation we have in memory is the same - * as the one being brought in from disk. + /* Sanity check that the chunk representation we have in memory is + * the same as the one being brought in from disk. */ HDassert(0 == HDmemcmp(buf, chk_proxy->oh->chunk[chk_proxy->chunkno].image, chk_proxy->oh->chunk[chk_proxy->chunkno].size)); } /* end else */ @@ -757,7 +754,7 @@ done: /* Release the [possibly partially initialized] object header on errors */ if(!ret_value && chk_proxy) - if(H5O_chunk_proxy_dest(chk_proxy) < 0) + if(H5O__chunk_proxy_dest(chk_proxy) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk proxy") FUNC_LEAVE_NOAPI(ret_value) @@ -788,7 +785,7 @@ H5O_cache_chk_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* flush */ if(chk_proxy->cache_info.is_dirty) { /* Serialize messages for this chunk */ - if(H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) + if(H5O__chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header continuation chunk") /* Write the chunk out */ @@ -850,7 +847,7 @@ H5O_cache_chk_dest(H5F_t *f, H5O_chunk_proxy_t *chk_proxy) } /* end if */ /* Destroy object header chunk proxy */ - if(H5O_chunk_proxy_dest(chk_proxy) < 0) + if(H5O__chunk_proxy_dest(chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk proxy") done: @@ -903,18 +900,13 @@ H5O_cache_chk_clear(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* check args */ + /* Check arguments */ HDassert(chk_proxy); #ifdef H5_HAVE_PARALLEL - if ( ( chk_proxy->oh->cache_info.is_dirty ) && ( ! destroy ) ) { - - if ( H5O_chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0 ) { - - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, - "unable to serialize object header chunk") - } - } + if((chk_proxy->oh->cache_info.is_dirty) && (!destroy)) + if(H5O__chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header chunk") #endif /* H5_HAVE_PARALLEL */ /* Mark messages in chunk as clean */ @@ -966,7 +958,7 @@ H5O_cache_chk_size(const H5F_t UNUSED *f, const H5O_chunk_proxy_t *chk_proxy, si /*------------------------------------------------------------------------- - * Function: H5O_add_cont_msg + * Function: H5O__add_cont_msg * * Purpose: Add information from a continuation message to the list of * continuation messages in the object header @@ -981,12 +973,12 @@ H5O_cache_chk_size(const H5F_t UNUSED *f, const H5O_chunk_proxy_t *chk_proxy, si *------------------------------------------------------------------------- */ static herr_t -H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) +H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) { size_t contno; /* Continuation message index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cont_msg_info); @@ -1011,11 +1003,11 @@ H5O_add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_add_cont_msg() */ +} /* H5O__add_cont_msg() */ /*------------------------------------------------------------------------- - * Function: H5O_chunk_deserialize + * Function: H5O__chunk_deserialize * * Purpose: Deserialize a chunk for an object header * @@ -1029,7 +1021,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, +H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, H5O_common_cache_ud_t *udata, hbool_t *dirty) { const uint8_t *p; /* Pointer into buffer to decode */ @@ -1042,7 +1034,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, #endif /* NDEBUG */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(oh); @@ -1063,7 +1055,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, } /* end if */ /* Init the chunk data info */ - chunkno = oh->nchunks++; + chunkno = (unsigned)oh->nchunks++; oh->chunk[chunkno].gap = 0; if(chunkno == 0) { /* First chunk's 'image' includes room for the object header prefix */ @@ -1294,7 +1286,7 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, oh->mesg[curmesg].native = cont; /* Add to continuation messages left to interpret */ - if(H5O_add_cont_msg(udata->cont_msg_info, cont) < 0) + if(H5O__add_cont_msg(udata->cont_msg_info, cont) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't add continuation message") /* Mark the message & chunk as dirty if the message was changed by decoding */ @@ -1350,11 +1342,11 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_chunk_deserialize() */ +} /* H5O__chunk_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5O_chunk_serialize + * Function: H5O__chunk_serialize * * Purpose: Serialize a chunk for an object header * @@ -1368,13 +1360,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) +H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) { H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -1415,11 +1407,11 @@ H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_chunk_serialize() */ +} /* H5O__chunk_serialize() */ /*------------------------------------------------------------------------- - * Function: H5O_chunk_proxy_dest + * Function: H5O__chunk_proxy_dest * * Purpose: Destroy a chunk proxy object * @@ -1433,11 +1425,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_chunk_proxy_dest(H5O_chunk_proxy_t *chk_proxy) +H5O__chunk_proxy_dest(H5O_chunk_proxy_t *chk_proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(chk_proxy); diff --git a/src/H5Omessage.c b/src/H5Omessage.c index f70fa72..d361194 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -73,10 +73,10 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native); -static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +static herr_t H5O__msg_reset_real(const H5O_msg_class_t *type, void *native); +static herr_t H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/); -static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, +static herr_t H5O__copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags); @@ -224,7 +224,7 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if(H5O__copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG H5O_assert(oh); @@ -426,7 +426,7 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty } /* end if */ /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if(H5O__copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message") #ifdef H5O_DEBUG H5O_assert(oh); @@ -586,7 +586,7 @@ H5O_msg_reset(unsigned type_id, void *native) HDassert(type); /* Call the "real" reset routine */ - if(H5O_msg_reset_real(type, native) < 0) + if(H5O__msg_reset_real(type, native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header") done: @@ -595,7 +595,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_msg_reset_real + * Function: H5O__msg_reset_real * * Purpose: Some message data structures have internal fields that * need to be freed. This function does that if appropriate @@ -610,11 +610,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_msg_reset_real(const H5O_msg_class_t *type, void *native) +H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(type); @@ -630,7 +630,7 @@ H5O_msg_reset_real(const H5O_msg_class_t *type, void *native) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_reset_real() */ +} /* end H5O__msg_reset_real() */ /*------------------------------------------------------------------------- @@ -719,7 +719,7 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) HDassert(type); if(msg_native) { - H5O_msg_reset_real(type, msg_native); + H5O__msg_reset_real(type, msg_native); if(NULL != (type->free)) (type->free)(msg_native); else @@ -1049,7 +1049,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_msg_remove_cb + * Function: H5O__msg_remove_cb * * Purpose: Object header iterator callback routine to remove messages * of a particular type that match a particular sequence number, @@ -1064,14 +1064,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, +H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ htri_t try_remove = FALSE; /* Whether to try removing a message */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -1109,7 +1109,7 @@ H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_remove_cb() */ +} /* end H5O__msg_remove_cb() */ /*------------------------------------------------------------------------- @@ -1160,7 +1160,7 @@ H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, /* Iterate over the messages, deleting appropriate one(s) */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_msg_remove_cb; + op.u.lib_op = H5O__msg_remove_cb; if(H5O_msg_iterate_real(f, oh, type, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error iterating over messages") @@ -1950,7 +1950,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_copy_mesg + * Function: H5O__copy_mesg * * Purpose: Make a copy of the native object for an object header's * native message info @@ -1963,7 +1963,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, +H5O__copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags) { @@ -1972,7 +1972,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -1986,7 +1986,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Reset existing native information for the header's message */ - H5O_msg_reset_real(type, idx_msg->native); + H5O__msg_reset_real(type, idx_msg->native); /* Copy the native object for the message */ if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) @@ -2015,7 +2015,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_copy_mesg() */ +} /* end H5O__copy_mesg() */ /*------------------------------------------------------------------------- -- cgit v0.12 From 20aa56082576cbe9319759c808baf06bef55994f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:14:13 -0500 Subject: [svn-r27083] Description: Clean up H5SM interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5SMcache.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 9955f39..2e69899 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -13,6 +13,17 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5SMcache.c + * Nov 13 2006 + * James Laird + * + * Purpose: Implement shared message metadata cache methods. + * + *------------------------------------------------------------------------- + */ + /****************/ /* Module Setup */ /****************/ @@ -68,6 +79,7 @@ static herr_t H5SM_list_size(const H5F_t *f, const H5SM_list_t UNUSED *list, siz /*********************/ /* Package Variables */ /*********************/ + /* H5SM inherits cache-like properties from H5AC */ const H5AC_class_t H5AC_SOHM_TABLE[1] = {{ H5AC_SOHM_TABLE_ID, @@ -136,7 +148,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata) /* Allocate space for the master table in memory */ if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") /* Read number of indexes and version from file superblock */ table->num_indexes = H5F_SOHM_NINDEXES(f); @@ -172,7 +184,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *udata) /* Allocate space for the index headers in memory*/ if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes") /* Read in the index headers */ for(x = 0; x < table->num_indexes; ++x) { @@ -230,7 +242,7 @@ done: HDONE_ERROR(H5E_SOHM, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value && table) if(H5SM_table_free(table) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTFREE, NULL, "unable to destroy sohm table") + HDONE_ERROR(H5E_SOHM, H5E_CANTFREE, NULL, "unable to destroy sohm table") FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM_table_load() */ @@ -363,7 +375,7 @@ H5SM_table_dest(H5F_t UNUSED *f, H5SM_master_table_t* table) FUNC_ENTER_NOAPI_NOINIT - /* Sanity check */ + /* Check arguments */ HDassert(table); HDassert(table->indexes); @@ -429,7 +441,7 @@ H5SM_table_size(const H5F_t UNUSED *f, const H5SM_master_table_t *table, size_t { FUNC_ENTER_NOAPI_NOINIT_NOERR - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(table); HDassert(size_ptr); @@ -470,18 +482,17 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) FUNC_ENTER_NOAPI_NOINIT - /* Sanity check */ + /* Check arguments */ HDassert(udata->header); /* Allocate space for the SOHM list data structure */ if(NULL == (list = H5FL_MALLOC(H5SM_list_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") HDmemset(&list->cache_info, 0, sizeof(H5AC_info_t)); /* Allocate list in memory as an array*/ - if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, udata->header->list_max)) == NULL) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "file allocation failed for SOHM list") - + if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, udata->header->list_max))) + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "file allocation failed for SOHM list") list->header = udata->header; /* Wrap the local buffer for serialized list index info */ @@ -701,9 +712,7 @@ H5SM_list_clear(H5F_t *f, H5SM_list_t *list, hbool_t destroy) FUNC_ENTER_NOAPI_NOINIT - /* - * Check arguments. - */ + /* Check arguments */ HDassert(list); /* Reset the dirty flag. */ -- cgit v0.12 From 8be8a708a3ab5b84ef39ce1dca726ca1aa611af6 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 21:16:09 -0500 Subject: [svn-r27084] Description: Clean up cache tests, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5trace.c | 4 +- test/cache.c | 1342 +++++++++++++------------------------------------- test/cache_api.c | 58 ++- test/cache_common.c | 122 ++--- test/cache_common.h | 36 +- test/cache_tagging.c | 61 +-- testpar/t_cache.c | 367 ++++---------- 7 files changed, 549 insertions(+), 1441 deletions(-) diff --git a/src/H5trace.c b/src/H5trace.c index 6634a2a..e6a091c 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2348,7 +2348,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) unsigned long iul = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ fprintf(out, "%lu", iul); - asize[argno] = iul; + asize[argno] = (hssize_t)iul; } /* end else */ break; @@ -2372,7 +2372,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) unsigned long long iull = va_arg(ap, unsigned long long); /*lint !e732 Loss of sign not really occuring */ fprintf(out, "%llu", iull); - asize[argno] = iull; + asize[argno] = (hssize_t)iull; } /* end else */ break; diff --git a/test/cache.c b/test/cache.c index 8725b31..eb17fcc 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2984,7 +2984,6 @@ static unsigned check_flush_cache(void) { const char * fcn_name = "check_flush_cache"; - hbool_t show_progress = FALSE; H5F_t * file_ptr = NULL; TESTING("H5C_flush_cache() functionality"); @@ -2998,11 +2997,6 @@ check_flush_cache(void) if ( pass ) { - if ( show_progress ) { - - HDfprintf(stdout, "%s: reseting entries.\n", fcn_name); - } - reset_entries(); file_ptr = setup_cache((size_t)(2 * 1024 * 1024), @@ -3015,12 +3009,6 @@ check_flush_cache(void) if ( pass ) { - if ( show_progress ) { - - HDfprintf(stdout, "%s: calling check_flush_cache__empty_cache().\n", - fcn_name); - } - check_flush_cache__empty_cache(file_ptr); } @@ -3030,45 +3018,21 @@ check_flush_cache(void) if ( pass ) { - if ( show_progress ) { - - HDfprintf(stdout, "%s: calling check_flush_cache__single_entry().\n", - fcn_name); - } - check_flush_cache__single_entry(file_ptr); } if ( pass ) { - if ( show_progress ) { - - HDfprintf(stdout, "%s: calling check_flush_cache__multi_entry().\n", - fcn_name); - } - check_flush_cache__multi_entry(file_ptr); } if ( pass ) { - if ( show_progress ) { - - HDfprintf(stdout, "%s: calling check_flush_cache__flush_ops().\n", - fcn_name); - } - check_flush_cache__flush_ops(file_ptr); } if ( pass ) { - if ( show_progress ) { - - HDfprintf(stdout, "%s: calling takedown_cache().\n", - fcn_name); - } - takedown_cache(file_ptr, FALSE, FALSE); } @@ -6406,17 +6370,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 4, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -6504,17 +6468,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 4, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -6602,17 +6566,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -6732,17 +6696,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -6874,17 +6838,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -6903,17 +6867,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ FALSE, @@ -7093,17 +7057,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -7122,17 +7086,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -7210,7 +7174,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7239,7 +7203,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7369,17 +7333,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -7398,17 +7362,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 6, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ + /* op_code: type: idx: flag: size: order_ptr: */ { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -7486,7 +7450,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7515,7 +7479,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7671,7 +7635,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7700,7 +7664,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7808,7 +7772,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -7837,7 +7801,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* num_flush_ops = */ 1, /* flush_ops = */ /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, @@ -8072,17 +8036,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 4, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ FALSE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8101,17 +8065,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8130,17 +8094,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8159,17 +8123,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8188,17 +8152,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ FALSE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8217,17 +8181,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8246,17 +8210,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 4, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8519,17 +8483,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 4, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ FALSE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8548,17 +8512,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8577,17 +8541,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8606,17 +8570,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8635,17 +8599,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ FALSE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8664,17 +8628,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8693,17 +8657,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 4, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8833,17 +8797,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8862,17 +8826,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -8920,17 +8884,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -9031,17 +8995,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -9060,17 +9024,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -9118,17 +9082,17 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, /* num_flush_ops = */ 3, /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, /* expected_loaded = */ TRUE, /* expected_cleared = */ FALSE, /* expected_flushed = */ TRUE, @@ -9207,11 +9171,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, int check_size, struct fo_flush_entry_check check[]) { - const char * fcn_name = "check_flush_cache__flush_op_test"; H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - hbool_t show_progress = FALSE; - hbool_t verbose = FALSE; herr_t result; int i; int j; @@ -9223,12 +9184,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, test_num); #endif - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(1).\n", - fcn_name, test_num, (int)pass); - } - if ( cache_ptr == NULL ) { pass = FALSE; @@ -9256,12 +9211,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, failure_mssg = msg; } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(2).\n", - fcn_name, test_num, (int)pass); - } - i = 0; while ( ( pass ) && ( i < spec_size ) ) { @@ -9284,12 +9233,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i++; } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(3).\n", - fcn_name, test_num, (int)pass); - } - i = 0; while ( ( pass ) && ( i < check_size ) ) { @@ -9327,54 +9270,18 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i++; } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Setting up the test.\n", - fcn_name, test_num, (int)pass); - } - i = 0; while ( ( pass ) && ( i < spec_size ) ) { if ( spec[i].insert_flag ) { - if ( show_progress ) { - - HDfprintf(stdout, - "%s:%d: Inserting entry(%d,%d) with flags 0x%x.\n", - fcn_name, test_num, - (int)(spec[i].entry_type), - (int)(spec[i].entry_index), - (unsigned)spec[i].flags); - } - insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); } else { - if ( show_progress ) { - - HDfprintf(stdout, - "%s:%d: Protecting entry(%d,%d).\n", - fcn_name, test_num, - (int)(spec[i].entry_type), - (int)(spec[i].entry_index)); - } - protect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index); - if ( show_progress ) { - - HDfprintf(stdout, - "%s:%d: Unprotecting entry(%d,%d) with flags 0x%x ns = %d.\n", - fcn_name, test_num, - (int)(spec[i].entry_type), - (int)(spec[i].entry_index), - (unsigned)spec[i].flags, - (int)(spec[i].new_size)); - } - if(spec[i].resize_flag) resize_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].new_size, TRUE); @@ -9420,12 +9327,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Running the test.\n", - fcn_name, test_num, (int)pass); - } - if ( pass ) { result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, @@ -9441,11 +9342,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Checking test results(1).\n", - fcn_name, test_num, (int)pass); - } i = 0; while ( ( pass ) && ( i < spec_size ) ) @@ -9484,12 +9380,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i++; } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Checking test results(2).\n", - fcn_name, test_num, (int)pass); - } - if ( pass ) { i = 0; @@ -9608,12 +9498,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Checking test results(3).\n", - fcn_name, test_num, (int)pass); - } - if ( pass ) { if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 ) @@ -9642,13 +9526,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } /* clean up the cache to prep for the next test */ - - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(1).\n", - fcn_name, test_num, (int)pass); - } - if ( pass ) { result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, @@ -9668,16 +9545,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, ( cache_ptr->dirty_index_size != 0 ) ) { pass = FALSE; - - if ( verbose ) { - - HDfprintf(stdout, "%s:%d: il/is/cis/dis = %lld/%lld/%lld/%lld.\n", - fcn_name, test_num, - (long long)(cache_ptr->index_len), - (long long)(cache_ptr->index_size), - (long long)(cache_ptr->clean_index_size), - (long long)(cache_ptr->dirty_index_size)); - } HDsnprintf(msg, (size_t)128, "Unexpected cache len/size/cs/ds after cleanup in flush op test #%d.", test_num); @@ -9686,12 +9553,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(2).\n", - fcn_name, test_num, (int)pass); - } - i = 0; while ( ( pass ) && ( i < spec_size ) ) { @@ -9708,12 +9569,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i++; } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(3).\n", - fcn_name, test_num, (int)pass); - } - i = 0; while ( ( pass ) && ( i < check_size ) ) { @@ -9730,11 +9585,6 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i++; } - if ( show_progress ) { - - HDfprintf(stdout, "%s:%d:%d: Done.\n", fcn_name, test_num, (int)pass); - } - return; } /* check_flush_cache__flush_op_test() */ @@ -10893,8 +10743,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) static void check_flush_cache__single_entry(H5F_t * file_ptr) { - const char * fcn_name = "check_flush_cache__single_entry"; - hbool_t show_progress = FALSE; H5C_t * cache_ptr = file_ptr->shared->cache; if ( cache_ptr == NULL ) { @@ -10911,10 +10759,6 @@ check_flush_cache__single_entry(H5F_t * file_ptr) if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 1); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -10929,18 +10773,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 2); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -10955,18 +10791,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 3); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -10981,18 +10809,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 4); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11007,18 +10827,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 5); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11033,18 +10845,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 6); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11059,18 +10863,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 7); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11085,18 +10881,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 8); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11111,18 +10899,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 9); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11138,18 +10918,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 10); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11165,18 +10937,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 11); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11192,18 +10956,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 12); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11219,18 +10975,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 13); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11246,18 +10994,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 14); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11273,18 +11013,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 15); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11301,18 +11033,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 16); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11329,18 +11053,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 17); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11355,18 +11071,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 18); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11381,18 +11089,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 19); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11407,18 +11107,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 20); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11433,18 +11125,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 21); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11459,18 +11143,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 22); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11485,18 +11161,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 23); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11511,18 +11179,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 24); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11537,18 +11197,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 25); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11564,18 +11216,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 26); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11591,18 +11235,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 27); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11618,18 +11254,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 28); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11645,18 +11273,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 29); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11672,18 +11292,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 30); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11699,18 +11311,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 31); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11727,18 +11331,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 32); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11755,18 +11351,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 33); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11781,18 +11369,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 34); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11807,18 +11387,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 35); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11833,18 +11405,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 36); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11859,18 +11423,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 37); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11885,18 +11441,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 38); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11911,18 +11459,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 39); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11937,18 +11477,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 40); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11963,18 +11495,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 41); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -11990,18 +11514,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 42); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12017,18 +11533,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 43); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12044,18 +11552,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 44); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12071,18 +11571,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 45); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12098,18 +11590,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 46); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12125,18 +11609,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 47); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12153,18 +11629,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 48); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12181,18 +11649,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 49); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12207,18 +11667,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 50); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12233,18 +11685,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 51); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12259,18 +11703,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 52); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12285,18 +11721,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 53); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12311,18 +11739,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 54); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12337,18 +11757,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 55); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12363,18 +11775,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 56); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12389,18 +11793,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 57); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12416,18 +11812,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 58); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12443,18 +11831,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 59); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12470,18 +11850,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 60); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12497,18 +11869,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ FALSE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 61); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12524,18 +11888,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 62); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12551,18 +11907,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ TRUE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 63); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12579,18 +11927,10 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } if ( pass ) { - if ( show_progress ) { - HDfprintf(stdout, "%s: running test %d.\n", fcn_name, 64); - } - check_flush_cache__single_entry_test ( /* file_ptr */ file_ptr, @@ -12607,10 +11947,6 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* expected_flushed */ FALSE, /* expected_destroyed */ TRUE ); - - if ( show_progress ) { - HDfprintf(stdout, "%s: pass = %d.\n", fcn_name, (int)pass); - } } @@ -12957,11 +12293,6 @@ check_flush_cache__single_entry(H5F_t * file_ptr) i = 0; while ( ( pass ) && ( i < 256 ) ) { - - if ( show_progress ) { - HDfprintf(stdout, "%s: running pinned test %d.\n", fcn_name, i); - } - check_flush_cache__pinned_single_entry_test ( /* file_ptr */ file_ptr, @@ -13618,7 +12949,6 @@ check_get_entry_status(void) * * Modifications: * - * None. * *------------------------------------------------------------------------- */ @@ -13705,29 +13035,29 @@ check_expunge_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; - } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { + } else if ( !in_cache || is_dirty || is_protected || is_pinned ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected status 2."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 2."); + failure_mssg = msg; } else if ( ( ! entry_ptr->loaded ) || ( entry_ptr->cleared ) || ( entry_ptr->flushed ) || ( entry_ptr->destroyed ) ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); + failure_mssg = msg; - } + } } /* Expunge the entry and then verify that it is no longer in the cache. @@ -13749,29 +13079,29 @@ check_expunge_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; - } else if ( in_cache ) { + } else if ( in_cache ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected status 3."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 3."); + failure_mssg = msg; } else if ( ( ! entry_ptr->loaded ) || ( ! entry_ptr->cleared ) || ( entry_ptr->flushed ) || ( ! entry_ptr->destroyed ) ) { - pass = FALSE; - HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); - failure_mssg = msg; + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); + failure_mssg = msg; - } + } } /* now repeat the process with a different entry. On unprotect @@ -13791,14 +13121,14 @@ check_expunge_entry(void) &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; - } else if ( in_cache ) { + } else if ( in_cache ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); @@ -13813,7 +13143,7 @@ check_expunge_entry(void) HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); failure_mssg = msg; - } + } } /* protect the entry to force the cache to load it, and then unprotect @@ -13834,14 +13164,14 @@ check_expunge_entry(void) &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { + } else if ( !in_cache || !is_dirty || is_protected || is_pinned ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); @@ -13856,7 +13186,7 @@ check_expunge_entry(void) HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); failure_mssg = msg; - } + } } /* Expunge the entry and then verify that it is no longer in the cache. @@ -13879,14 +13209,14 @@ check_expunge_entry(void) &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; - } else if ( in_cache ) { + } else if ( in_cache ) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 6."); @@ -13901,7 +13231,7 @@ check_expunge_entry(void) HDsnprintf(msg, (size_t)128, "Unexpected entry history 6."); failure_mssg = msg; - } + } } if ( pass ) { @@ -14408,13 +13738,13 @@ check_move_entry(void) * * At present, we should do the following tests: * - * 1) move a clean, unprotected, unpinned entry. + * 1) Move a clean, unprotected, unpinned entry. * - * 2) move a dirty, unprotected, unpinned entry. + * 2) Move a dirty, unprotected, unpinned entry. * - * 3) move a clean, unprotected, pinned entry. + * 3) Move a clean, unprotected, pinned entry. * - * 4) move a dirty, unprotected, pinned entry. + * 4) Move a dirty, unprotected, pinned entry. * * In all cases, the entry should have moved to its * new location, and have been marked dirty if it wasn't @@ -14787,7 +14117,7 @@ check_resize_entry(void) base_addr = entries[LARGE_ENTRY_TYPE]; entry_ptr = &(base_addr[0]); - entry_size = LARGE_ENTRY_SIZE; + entry_size = LARGE_ENTRY_SIZE; } } @@ -15668,6 +14998,7 @@ check_resize_entry(void) } if ( pass ) { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DELETED_FLAG); @@ -15724,7 +15055,6 @@ check_resize_entry(void) * * Modifications: * - * None. * *------------------------------------------------------------------------- */ @@ -16542,6 +15872,7 @@ check_flush_protected_err(void) * * Modifications: * + * *------------------------------------------------------------------------- */ @@ -23360,6 +22691,7 @@ check_auto_cache_resize_disable(void) /* flush the cache and destroy all entries so we start from a known point */ flush_cache(file_ptr, TRUE, FALSE, FALSE); + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23586,6 +22918,7 @@ check_auto_cache_resize_disable(void) /* flush the cache and destroy all entries so we start from a known point */ flush_cache(file_ptr, TRUE, FALSE, FALSE); + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -23819,6 +23152,7 @@ check_auto_cache_resize_disable(void) /* flush the cache and destroy all entries so we start from a known point */ flush_cache(file_ptr, TRUE, FALSE, FALSE); + } if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -33778,5 +33112,5 @@ main(void) nerrs += check_notify_cb(); return(nerrs > 0); -} +} /* main() */ diff --git a/test/cache_api.c b/test/cache_api.c index 8f556be..51dda99 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -32,15 +32,15 @@ /* private function declarations: */ -static void check_fapl_mdc_api_calls(void); +static unsigned check_fapl_mdc_api_calls(void); -static void check_file_mdc_api_calls(void); +static unsigned check_file_mdc_api_calls(void); -static void mdc_api_call_smoke_check(int express_test); +static unsigned mdc_api_call_smoke_check(int express_test); -static void check_fapl_mdc_api_errs(void); +static unsigned check_fapl_mdc_api_errs(void); -static void check_file_mdc_api_errs(void); +static unsigned check_file_mdc_api_errs(void); /**************************************************************************/ @@ -67,7 +67,7 @@ static void check_file_mdc_api_errs(void); * *------------------------------------------------------------------------- */ -static void +static unsigned check_fapl_mdc_api_calls(void) { const char * fcn_name = "check_fapl_mdc_api_calls()"; @@ -489,6 +489,8 @@ check_fapl_mdc_api_calls(void) HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", fcn_name, failure_mssg); + return !pass; + } /* check_fapl_mdc_api_calls() */ @@ -516,7 +518,7 @@ check_fapl_mdc_api_calls(void) *------------------------------------------------------------------------- */ -static void +static unsigned check_file_mdc_api_calls(void) { const char * fcn_name = "check_file_mdc_api_calls()"; @@ -839,6 +841,8 @@ check_file_mdc_api_calls(void) HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", fcn_name, failure_mssg); + return !pass; + } /* check_file_mdc_api_calls() */ @@ -865,7 +869,7 @@ check_file_mdc_api_calls(void) #define NUM_DSETS 6 #define NUM_RANDOM_ACCESSES 200000 -static void +static unsigned mdc_api_call_smoke_check(int express_test) { const char * fcn_name = "mdc_api_call_smoke_check()"; @@ -1004,7 +1008,7 @@ mdc_api_call_smoke_check(int express_test) HDfprintf(stdout, " Long tests disabled.\n"); - return; + return 0; } pass = TRUE; @@ -1105,7 +1109,7 @@ mdc_api_call_smoke_check(int express_test) sprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); + dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1329,9 +1333,9 @@ mdc_api_call_smoke_check(int express_test) } n++; - } + /* close the file spaces we are done with */ i = 1; while ( ( pass ) && ( i < NUM_DSETS ) ) @@ -1450,7 +1454,6 @@ mdc_api_call_smoke_check(int express_test) } n++; - } /* close file space 0 */ @@ -1515,6 +1518,8 @@ mdc_api_call_smoke_check(int express_test) HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", fcn_name, failure_mssg); + return !pass; + } /* mdc_api_call_smoke_check() */ @@ -3015,7 +3020,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = *------------------------------------------------------------------------- */ -static void +static unsigned check_fapl_mdc_api_errs(void) { const char * fcn_name = "check_fapl_mdc_api_errs()"; @@ -3065,7 +3070,7 @@ check_fapl_mdc_api_errs(void) scratch.version = H5C__CURR_AUTO_SIZE_CTL_VER; if ( ( pass ) && - ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0 ) || + ( ( H5Pget_mdc_config(fapl_id, &scratch) < 0) || ( !CACHE_CONFIGS_EQUAL(default_config, scratch, TRUE, TRUE) ) ) ) { pass = FALSE; @@ -3167,6 +3172,8 @@ check_fapl_mdc_api_errs(void) HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", fcn_name, failure_mssg); + return !pass; + } /* check_fapl_mdc_api_errs() */ @@ -3186,7 +3193,7 @@ check_fapl_mdc_api_errs(void) *------------------------------------------------------------------------- */ -static void +static unsigned check_file_mdc_api_errs(void) { const char * fcn_name = "check_file_mdc_api_errs()"; @@ -3504,6 +3511,8 @@ check_file_mdc_api_errs(void) HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", fcn_name, failure_mssg); + return !pass; + } /* check_file_mdc_api_errs() */ @@ -3527,28 +3536,35 @@ check_file_mdc_api_errs(void) int main(void) { + unsigned nerrs = 0; int express_test; H5open(); express_test = GetTestExpress(); + printf("===================================\n"); + printf("Cache API tests\n"); + printf(" express_test = %d\n", express_test); + printf("===================================\n"); + + #if 1 - check_fapl_mdc_api_calls(); + nerrs += check_fapl_mdc_api_calls(); #endif #if 1 - check_file_mdc_api_calls(); + nerrs += check_file_mdc_api_calls(); #endif #if 1 - mdc_api_call_smoke_check(express_test); + nerrs += mdc_api_call_smoke_check(express_test); #endif #if 1 - check_fapl_mdc_api_errs(); + nerrs += check_fapl_mdc_api_errs(); #endif #if 1 - check_file_mdc_api_errs(); + nerrs += check_file_mdc_api_errs(); #endif - return(0); + return( nerrs > 0 ); } /* main() */ diff --git a/test/cache_common.c b/test/cache_common.c index 0231a11..7b1a158 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -151,7 +151,7 @@ static herr_t notify_size(H5F_t * f, void * thing, size_t * size_ptr); static herr_t notify_notify(H5C_notify_action_t action, void *thing); -test_entry_t * entries[NUMBER_OF_ENTRY_TYPES] = +test_entry_t *entries[NUMBER_OF_ENTRY_TYPES] = { pico_entries, nano_entries, @@ -166,7 +166,7 @@ test_entry_t * entries[NUMBER_OF_ENTRY_TYPES] = notify_entries }; -test_entry_t * orig_entries[NUMBER_OF_ENTRY_TYPES] = +test_entry_t *orig_entries[NUMBER_OF_ENTRY_TYPES] = { orig_pico_entries, orig_nano_entries, @@ -241,7 +241,7 @@ const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = NOTIFY_ALT_BASE_ADDR }; -const char * entry_type_names[NUMBER_OF_ENTRY_TYPES] = +const char *entry_type_names[NUMBER_OF_ENTRY_TYPES] = { "pico entries -- 1 B", "nano entries -- 4 B", @@ -375,7 +375,7 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, -/* address translation funtions: */ +/* address translation functions: */ /*------------------------------------------------------------------------- @@ -393,8 +393,8 @@ static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, */ void addr_to_type_and_index(haddr_t addr, - int32_t * type_ptr, - int32_t * index_ptr) + int32_t *type_ptr, + int32_t *index_ptr) { int i; int32_t type; @@ -453,52 +453,8 @@ addr_to_type_and_index(haddr_t addr, } /* addr_to_type_and_index() */ - -#if 0 /* This function has never been used, but we may want it - * some time. Lets keep it for now. - */ -/*------------------------------------------------------------------------- - * Function: type_and_index_to_addr - * - * Purpose: Given a type and index of an entry, compute the associated - * addr and return that value. - * - * Return: computed addr - * - * Programmer: John Mainzer - * 6/10/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -haddr_t -type_and_index_to_addr(int32_t type, - int32_t idx) -{ - haddr_t addr; - - HDassert( ( type >= 0 ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( idx >= 0 ) && ( idx <= max_indices[type] ) ); - - addr = base_addrs[type] + (((haddr_t)idx) * entry_sizes[type]); - - HDassert( addr == (entries[type])[idx].addr ); - - if ( (entries[type])[idx].at_main_addr ) { - - HDassert( addr == (entries[type])[idx].main_addr ); - - } else { - - HDassert( addr == (entries[type])[idx].alt_addr ); - } - - return(addr); -} /* type_and_index_to_addr() */ - -#endif +/* Call back functions: */ /*------------------------------------------------------------------------- @@ -522,9 +478,9 @@ type_and_index_to_addr(int32_t type, */ herr_t -check_write_permitted(const H5F_t UNUSED * f, +check_write_permitted(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, - hbool_t * write_permitted_ptr) + hbool_t *write_permitted_ptr) { HDassert( write_permitted_ptr ); @@ -1273,14 +1229,13 @@ notify_size(H5F_t * f, void * thing, size_t * size_ptr) * *------------------------------------------------------------------------- */ - static herr_t notify(H5C_notify_action_t action, void *thing) { test_entry_t * entry_ptr; - test_entry_t * base_addr; + test_entry_t *base_addr; - HDassert( thing ); + HDassert(thing); entry_ptr = (test_entry_t *)thing; base_addr = entries[entry_ptr->type]; @@ -1642,8 +1597,7 @@ execute_flush_op(H5F_t * file_ptr, break; case FLUSH_OP__MOVE: - move_entry(cache_ptr, op_ptr->type, op_ptr->idx, - op_ptr->flag); + move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); break; case FLUSH_OP__ORDER: @@ -1745,8 +1699,8 @@ reset_entries(void) { int j; - max_index = max_indices[i]; entry_size = entry_sizes[i]; + max_index = max_indices[i]; base_addr = entries[i]; orig_base_addr = orig_entries[i]; @@ -2693,7 +2647,6 @@ setup_cache(size_t max_cache_size, cache_ptr->ignore_tags = TRUE; H5C_stats__reset(cache_ptr); - ret_val = file_ptr; } @@ -2888,32 +2841,25 @@ flush_cache(H5F_t * file_ptr, verify_unprotected(); if(pass) { - H5C_t * cache_ptr = NULL; + H5C_t * cache_ptr; herr_t result = 0; HDassert(file_ptr); cache_ptr = file_ptr->shared->cache; - if(destroy_entries) { - + if(destroy_entries) result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); - } - else { - + else result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); - } - - if(dump_stats) { + if(dump_stats) H5C_stats(cache_ptr, "test cache", dump_detailed_stats); - } if(result < 0) { - pass = FALSE; failure_mssg = "error in H5C_flush_cache()."; } @@ -3016,24 +2962,19 @@ insert_entry(H5F_t * file_ptr, (int)(entry_ptr->addr != entry_ptr->header.addr)); #endif } - HDassert( entry_ptr->cache_ptr == NULL ); + HDassert(entry_ptr->cache_ptr == NULL); entry_ptr->cache_ptr = cache_ptr; - if ( insert_pinned ) { - - HDassert( entry_ptr->header.is_pinned ); - - } else { - - HDassert( ! ( entry_ptr->header.is_pinned ) ); - - } + if(insert_pinned) + HDassert(entry_ptr->header.is_pinned); + else + HDassert(!(entry_ptr->header.is_pinned)); entry_ptr->is_pinned = insert_pinned; entry_ptr->pinned_from_client = insert_pinned; - HDassert( entry_ptr->header.is_dirty ); - HDassert( ((entry_ptr->header).type)->id == type ); + HDassert(entry_ptr->header.is_dirty); + HDassert(((entry_ptr->header).type)->id == type); } return; @@ -3541,8 +3482,8 @@ unprotect_entry(H5F_t * file_ptr, HDassert( entry_ptr->header.is_protected ); HDassert( entry_ptr->is_protected ); - pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0 ); - unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0 ); + pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0); HDassert ( ! ( pin_flag_set && unpin_flag_set ) ); HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) ); @@ -3586,13 +3527,13 @@ unprotect_entry(H5F_t * file_ptr, if ( pin_flag_set ) { - HDassert ( entry_ptr->header.is_pinned ); + HDassert(entry_ptr->header.is_pinned); entry_ptr->pinned_from_client = TRUE; entry_ptr->is_pinned = TRUE; } else if ( unpin_flag_set ) { - HDassert ( entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache ); + HDassert(entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache); entry_ptr->pinned_from_client = FALSE; entry_ptr->is_pinned = entry_ptr->pinned_from_cache; @@ -4245,7 +4186,7 @@ row_major_scan_backward(H5F_t * file_ptr, if ( ( pass ) && ( (idx + lag) >= 0 ) && ( ( idx + lag) <= max_indices[type] ) ) { - switch ( (idx + lag) %4 ) { + switch ( (idx + lag) % 4 ) { case 0: if ( (entries[type])[idx+lag].is_dirty ) { @@ -4274,7 +4215,7 @@ row_major_scan_backward(H5F_t * file_ptr, } break; - case 3: /* we just did an insrt */ + case 3: /* we just did an insert */ unprotect_entry(file_ptr, type, idx + lag, H5C__DELETED_FLAG); break; @@ -5113,7 +5054,6 @@ check_and_validate_cache_hit_rate(hid_t file_id, int64_t min_accesses, double min_hit_rate) { - /* const char * fcn_name = "check_and_validate_cache_hit_rate()"; */ herr_t result; int64_t cache_hits = 0; int64_t cache_accesses = 0; @@ -5247,7 +5187,6 @@ check_and_validate_cache_size(hid_t file_id, int32_t * cur_num_entries_ptr, hbool_t dump_data) { - /* const char * fcn_name = "check_and_validate_cache_size()"; */ herr_t result; size_t expected_max_size; size_t max_size; @@ -5434,7 +5373,6 @@ validate_mdc_config(hid_t file_id, hbool_t compare_init, int test_num) { - /* const char * fcn_name = "validate_mdc_config()"; */ static char msg[256]; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; diff --git a/test/cache_common.h b/test/cache_common.h index 1165de4..a309fa4 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -314,19 +314,19 @@ typedef struct test_entry_t hbool_t destroyed; /* entry has been destroyed since the * last time it was reset. */ - int flush_dep_par_type; /* Entry type of flush dependency parent */ - int flush_dep_par_idx; /* Index of flush dependency parent */ - uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; + int flush_dep_par_type; /* Entry type of flush dependency parent */ + int flush_dep_par_idx; /* Index of flush dependency parent */ + uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; /* flush dependency heights of flush * dependency children */ - unsigned flush_dep_height; /* flush dependency height of entry */ - hbool_t pinned_from_client; /* entry was pinned by client call */ - hbool_t pinned_from_cache; /* entry was pinned by cache internally */ - unsigned flush_order; /* Order that entry was flushed in */ + unsigned flush_dep_height; /* flush dependency height of entry */ + hbool_t pinned_from_client; /* entry was pinned by client call */ + hbool_t pinned_from_cache; /* entry was pinned by cache internally */ + unsigned flush_order; /* Order that entry was flushed in */ - unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */ - unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */ + unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */ + unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */ } test_entry_t; /* The following are cut down test versions of the hash table manipulation @@ -410,6 +410,7 @@ if ( ( (cache_ptr) == NULL ) || \ } \ } + /* Macros used in H5AC level tests */ #define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ @@ -424,26 +425,26 @@ if ( ( (cache_ptr) == NULL ) || \ ( (a).set_initial_size == (b).set_initial_size ) ) && \ ( ( ! cmp_init_size ) || \ ( (a).initial_size == (b).initial_size ) ) && \ - ( (a).min_clean_fraction == (b).min_clean_fraction ) && \ + ( DBL_REL_EQUAL((a).min_clean_fraction, (b).min_clean_fraction, 0.00001 ) ) && \ ( (a).max_size == (b).max_size ) && \ ( (a).min_size == (b).min_size ) && \ ( (a).epoch_length == (b).epoch_length ) && \ ( (a).incr_mode == (b).incr_mode ) && \ - ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \ - ( (a).increment == (b).increment ) && \ + ( DBL_REL_EQUAL((a).lower_hr_threshold, (b).lower_hr_threshold, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).increment, (b).increment, 0.00001 ) ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ - ( (a).flash_multiple == (b).flash_multiple ) && \ - ( (a).flash_threshold == (b).flash_threshold ) && \ + ( DBL_REL_EQUAL((a).flash_multiple, (b).flash_multiple, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).flash_threshold, (b).flash_threshold, 0.00001 ) ) && \ ( (a).decr_mode == (b).decr_mode ) && \ - ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ - ( (a).decrement == (b).decrement ) && \ + ( DBL_REL_EQUAL((a).upper_hr_threshold, (b).upper_hr_threshold, 0.00001 ) ) && \ + ( DBL_REL_EQUAL((a).decrement, (b).decrement, 0.00001 ) ) && \ ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ ( (a).max_decrement == (b).max_decrement ) && \ ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ - ( (a).empty_reserve == (b).empty_reserve ) && \ + ( DBL_REL_EQUAL((a).empty_reserve, (b).empty_reserve, 0.00001 ) ) && \ ( (a).dirty_bytes_threshold == (b).dirty_bytes_threshold ) && \ ( (a).metadata_write_strategy == (b).metadata_write_strategy ) ) @@ -538,7 +539,6 @@ herr_t check_write_permitted(const H5F_t * f, hid_t dxpl_id, hbool_t * write_permitted_ptr); - /* callback table extern */ extern const H5C_class_t types[NUMBER_OF_ENTRY_TYPES]; diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 30ca1de..9209f6d 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -117,91 +117,91 @@ print_entry_type_to_screen(int id) switch (id) { case 0: - printf("B-tree Node"); + printf("B-tree Node(0)"); break; case 1: - printf("Symbol Table Node"); + printf("Symbol Table Node(1)"); break; case 2: - printf("Local Heap Prefix"); + printf("Local Heap Prefix(2)"); break; case 3: - printf("Local Heap Data Block"); + printf("Local Heap Data Block(3)"); break; case 4: - printf("Global Heap"); + printf("Global Heap(4)"); break; case 5: - printf("Object Header"); + printf("Object Header(5)"); break; case 6: - printf("Object Header Chunk"); + printf("Object Header Chunk(6)"); break; case 7: - printf("v2 B-tree Header"); + printf("v2 B-tree Header(7)"); break; case 8: - printf("v2 B-tree Internal Node"); + printf("v2 B-tree Internal Node(8)"); break; case 9: - printf("v2 B-tree Leaf Node"); + printf("v2 B-tree Leaf Node(9)"); break; case 10: - printf("Fractal Heap Header"); + printf("Fractal Heap Header(10)"); break; case 11: - printf("Fractal Heap Direct Block"); + printf("Fractal Heap Direct Block(11)"); break; case 12: - printf("Fractal Heap Indirect Block"); + printf("Fractal Heap Indirect Block(12)"); break; case 13: - printf("Free Space Header"); + printf("Free Space Header(13)"); break; case 14: - printf("Free Space Section"); + printf("Free Space Section(14)"); break; case 15: - printf("Shared Object Header Message Master Table"); + printf("Shared Object Header Message Master Table(15)"); break; case 16: - printf("Shared Message Index Stored As A List"); + printf("Shared Message Index Stored As A List(16)"); break; case 17: - printf("Extensible Array Header"); + printf("Extensible Array Header(17)"); break; case 18: - printf("Extensible Array Index Block"); + printf("Extensible Array Index Block(18)"); break; case 19: - printf("Extensible Array Super Block"); + printf("Extensible Array Super Block(19)"); break; case 20: - printf("Extensible Array Data Block"); + printf("Extensible Array Data Block(20)"); break; case 21: - printf("Extensible Array Data Block Page"); + printf("Extensible Array Data Block Page(21)"); break; case 22: - printf("Chunk Proxy"); + printf("Chunk Proxy(22)"); break; case 23: - printf("Fixed Array Header"); + printf("Fixed Array Header(23)"); break; case 24: - printf("Fixed Array Data Block"); + printf("Fixed Array Data Block(24)"); break; case 25: - printf("Fixed Array Data Block Page"); + printf("Fixed Array Data Block Page(25)"); break; case 26: - printf("File Superblock"); + printf("File Superblock(26)"); break; case 27: - printf("Test Entry"); + printf("Test Entry(27)"); break; case 28: - printf("Number of Types"); + printf("Number of Types(28)"); break; default: printf("*Unknown*"); @@ -434,7 +434,8 @@ static int verify_tag(hid_t fid, int id, haddr_t tag) } /* for */ - if (found == FALSE) TEST_ERROR; + if (found == FALSE) + TEST_ERROR; return 0; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index f526a8b..d36f34f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -20,31 +20,22 @@ #include "h5test.h" #include "testpar.h" -#include "H5Iprivate.h" -#include "H5ACprivate.h" - -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ - -#include "H5Cpkg.h" #define H5AC_PACKAGE /*suppress error about including H5ACpkg */ +#define H5C_PACKAGE /*suppress error about including H5Cpkg */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ #include "H5ACpkg.h" +#include "H5Cpkg.h" +#include "H5Fpkg.h" +#include "H5Iprivate.h" -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#include "H5Fpkg.h" int nerrors = 0; int failures = 0; hbool_t verbose = TRUE; /* used to control error messages */ -#if 0 -/* So far we haven't needed this, but that may change. - * Keep it around for now - */ -hid_t noblock_dxpl_id=(-1); -#endif #define NFILENAME 2 #define PARATESTFILE filenames[0] @@ -169,7 +160,7 @@ struct datum hbool_t global_pinned; hbool_t local_pinned; hbool_t cleared; - hbool_t flushed; + hbool_t flushed; int reads; int writes; int index; @@ -466,20 +457,20 @@ static hbool_t trace_file_check(int metadata_write_strategy); #ifdef NOT_USED /***************************************************************************** * - * Function: print_stats() + * Function: print_stats() * - * Purpose: Print the rudementary stats maintained by t_cache. + * Purpose: Print the rudementary stats maintained by t_cache. * - * This is a debugging function, which will not normally - * be run as part of t_cache. + * This is a debugging function, which will not normally + * be run as part of t_cache. * - * Return: void + * Return: void * - * Programmer: JRM -- 4/17/06 + * Programmer: JRM -- 4/17/06 * * Modifications: * - * None. + * None. * *****************************************************************************/ @@ -487,16 +478,16 @@ static void print_stats(void) { HDfprintf(stdout, - "%d: datum clears / pinned clears / destroys = %ld / %ld / %ld\n", + "%d: datum clears / pinned clears / destroys = %ld / %ld / %ld\n", world_mpi_rank, datum_clears, datum_pinned_clears, - datum_destroys ); + datum_destroys ); HDfprintf(stdout, - "%d: datum flushes / pinned flushes / loads = %ld / %ld / %ld\n", + "%d: datum flushes / pinned flushes / loads = %ld / %ld / %ld\n", world_mpi_rank, datum_flushes, datum_pinned_flushes, - datum_loads ); + datum_loads ); HDfprintf(stdout, - "%d: pins: global / global dirty / local = %ld / %ld / %ld\n", - world_mpi_rank, global_pins, global_dirty_pins, local_pins); + "%d: pins: global / global dirty / local = %ld / %ld / %ld\n", + world_mpi_rank, global_pins, global_dirty_pins, local_pins); HDfflush(stdout); return; @@ -504,6 +495,7 @@ print_stats(void) } /* print_stats() */ #endif /* NOT_USED */ + /***************************************************************************** * * Function: reset_stats() @@ -793,7 +785,7 @@ init_data(void) data[i].global_pinned = FALSE; data[i].local_pinned = FALSE; data[i].cleared = FALSE; - data[i].flushed = FALSE; + data[i].flushed = FALSE; data[i].reads = 0; data[i].writes = 0; data[i].index = i; @@ -883,12 +875,7 @@ do_express_test(void) * * Programmer: JRM -- 5/10/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - static void do_sync(void) { @@ -960,12 +947,7 @@ do_sync(void) * * Programmer: JRM -- 1/3/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - static int get_max_nerrors(void) { @@ -1105,7 +1087,6 @@ recv_mssg(struct mssg_t *mssg_ptr, * Added the add_req_to_tag parameter and supporting code. * *****************************************************************************/ - static hbool_t send_mssg(struct mssg_t *mssg_ptr, hbool_t add_req_to_tag) @@ -1250,7 +1231,7 @@ setup_derived_types(void) } /* setup_derived_types */ - + /***************************************************************************** * * Function: takedown_derived_types() @@ -1264,12 +1245,7 @@ setup_derived_types(void) * * Programmer: JRM -- 12/22/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - static hbool_t takedown_derived_types(void) { @@ -1311,12 +1287,7 @@ takedown_derived_types(void) * * Programmer: JRM -- 5/5/10 * - * Modifications: - * - * None. - * *****************************************************************************/ - static hbool_t reset_server_counters(void) { @@ -1394,7 +1365,6 @@ reset_server_counters(void) * Updated for sync message. * *****************************************************************************/ - static hbool_t server_main(void) { @@ -1593,11 +1563,11 @@ serve_read_request(struct mssg_t * mssg_ptr) success = FALSE; if ( verbose ) { HDfprintf(stdout, - "%d:%s: proc %d read invalid entry. idx/base_addr = %d/0x%llx.\n", - world_mpi_rank, fcn_name, - mssg_ptr->src, + "%d:%s: proc %d read invalid entry. idx/base_addr = %d/%a.\n", + world_mpi_rank, fcn_name, + mssg_ptr->src, target_index, - (long long)(data[target_index].base_addr)); + data[target_index].base_addr); } } else { @@ -1648,7 +1618,7 @@ serve_read_request(struct mssg_t * mssg_ptr) } /* serve_read_request() */ - + /***************************************************************************** * * Function: serve_sync_request() @@ -1669,12 +1639,7 @@ serve_read_request(struct mssg_t * mssg_ptr) * * Programmer: JRM -- 5/10/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - static hbool_t serve_sync_request(struct mssg_t * mssg_ptr) { @@ -2678,58 +2643,66 @@ load_datum(H5F_t UNUSED *f, world_mpi_rank, fcn_name); } #if 0 /* This has been useful debugging code -- keep it for now. */ - if ( mssg.req != READ_REQ_REPLY_CODE ) { - - HDfprintf(stdout, "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", - world_mpi_rank, fcn_name, (int)(mssg.req)); - } + if ( mssg.req != READ_REQ_REPLY_CODE ) { - if ( mssg.src != world_server_mpi_rank ) { + HDfprintf(stdout, + "%d:%s: mssg.req != READ_REQ_REPLY_CODE.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.req = %d.\n", + world_mpi_rank, fcn_name, (int)(mssg.req)); + } - HDfprintf(stdout, "%d:%s: mssg.src != world_server_mpi_rank.\n", - world_mpi_rank, fcn_name); - } + if ( mssg.src != world_server_mpi_rank ) { - if ( mssg.dest != world_mpi_rank ) { + HDfprintf(stdout, + "%d:%s: mssg.src != world_server_mpi_rank.\n", + world_mpi_rank, fcn_name); + } - HDfprintf(stdout, "%d:%s: mssg.dest != world_mpi_rank.\n", - world_mpi_rank, fcn_name); - } + if ( mssg.dest != world_mpi_rank ) { - if ( mssg.base_addr != entry_ptr->base_addr ) { + HDfprintf(stdout, + "%d:%s: mssg.dest != world_mpi_rank.\n", + world_mpi_rank, fcn_name); + } - HDfprintf(stdout, - "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", - world_mpi_rank, fcn_name, mssg.base_addr); - HDfprintf(stdout, "%d:%s: entry_ptr->base_addr = %a.\n", - world_mpi_rank, fcn_name, entry_ptr->base_addr); - } + if ( mssg.base_addr != entry_ptr->base_addr ) { + + HDfprintf(stdout, + "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", + world_mpi_rank, fcn_name, mssg.base_addr); + HDfprintf(stdout, + "%d:%s: entry_ptr->base_addr = %a.\n", + world_mpi_rank, fcn_name, + entry_ptr->base_addr); + } - if ( mssg.len != entry_ptr->len ) { + if ( mssg.len != entry_ptr->len ) { - HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", - world_mpi_rank, fcn_name); - HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", - world_mpi_rank, fcn_name, mssg.len); - } + HDfprintf(stdout, + "%d:%s: mssg.len != entry_ptr->len.\n", + world_mpi_rank, fcn_name); + HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", + world_mpi_rank, fcn_name, mssg.len); + } - if ( mssg.ver < entry_ptr->ver ) { + if ( mssg.ver < entry_ptr->ver ) { - HDfprintf(stdout, "%d:%s: mssg.ver < entry_ptr->ver.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, + "%d:%s: mssg.ver < entry_ptr->ver.\n", + world_mpi_rank, fcn_name); + } - if ( mssg.magic != MSSG_MAGIC ) { + if ( mssg.magic != MSSG_MAGIC ) { - HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", - world_mpi_rank, fcn_name); - } + HDfprintf(stdout, "%d:%s: mssg.magic != MSSG_MAGIC.\n", + world_mpi_rank, fcn_name); + } #endif /* JRM */ - } else { + + } else { entry_ptr->ver = mssg.ver; entry_ptr->header.is_dirty = FALSE; @@ -2803,7 +2776,7 @@ size_datum(H5F_t UNUSED * f, } /* size_datum() */ - + /*****************************************************************************/ /************************** test utility functions ***************************/ /*****************************************************************************/ @@ -2821,12 +2794,7 @@ size_datum(H5F_t UNUSED * f, * Programmer: John Mainzer * 07/11/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - static void expunge_entry(H5F_t * file_ptr, int32_t idx) @@ -2887,7 +2855,7 @@ expunge_entry(H5F_t * file_ptr, } /* expunge_entry() */ - + /***************************************************************************** * Function: insert_entry() * @@ -2909,7 +2877,6 @@ expunge_entry(H5F_t * file_ptr, * any pins must be global pins. * *****************************************************************************/ - static void insert_entry(H5C_t * cache_ptr, H5F_t * file_ptr, @@ -2998,7 +2965,7 @@ insert_entry(H5C_t * cache_ptr, } /* insert_entry() */ - + /***************************************************************************** * Function: local_pin_and_unpin_random_entries() * @@ -3012,10 +2979,7 @@ insert_entry(H5C_t * cache_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - static void local_pin_and_unpin_random_entries(H5F_t * file_ptr, int min_idx, @@ -3118,7 +3082,7 @@ local_pin_random_entry(H5F_t * file_ptr, } /* local_pin_random_entry() */ - + /***************************************************************************** * Function: local_unpin_all_entries() * @@ -3131,10 +3095,7 @@ local_pin_random_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - static void local_unpin_all_entries(H5F_t * file_ptr, hbool_t via_unprotect) @@ -3160,7 +3121,7 @@ local_unpin_all_entries(H5F_t * file_ptr, } /* local_unpin_all_entries() */ - + /***************************************************************************** * Function: local_unpin_next_pinned_entry() * @@ -3176,10 +3137,7 @@ local_unpin_all_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 4/12/06 * - * Modifications: - * *****************************************************************************/ - static int local_unpin_next_pinned_entry(H5F_t * file_ptr, int start_idx, @@ -3222,7 +3180,7 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr, } /* local_unpin_next_pinned_entry() */ - + /***************************************************************************** * Function: lock_and_unlock_random_entries() * @@ -3237,10 +3195,7 @@ local_unpin_next_pinned_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 1/12/06 * - * Modifications: - * *****************************************************************************/ - static void lock_and_unlock_random_entries(H5F_t * file_ptr, int min_idx, @@ -3273,7 +3228,7 @@ lock_and_unlock_random_entries(H5F_t * file_ptr, } /* lock_and_unlock_random_entries() */ - + /***************************************************************************** * Function: lock_and_unlock_random_entry() * @@ -3287,10 +3242,7 @@ lock_and_unlock_random_entries(H5F_t * file_ptr, * Programmer: John Mainzer * 1/4/06 * - * Modifications: - * *****************************************************************************/ - static void lock_and_unlock_random_entry(H5F_t * file_ptr, int min_idx, @@ -3320,7 +3272,7 @@ lock_and_unlock_random_entry(H5F_t * file_ptr, } /* lock_and_unlock_random_entry() */ - + /***************************************************************************** * Function: lock_entry() * @@ -3340,7 +3292,6 @@ lock_and_unlock_random_entry(H5F_t * file_ptr, * datum. * *****************************************************************************/ - static void lock_entry(H5F_t * file_ptr, int32_t idx) @@ -3400,7 +3351,6 @@ lock_entry(H5F_t * file_ptr, * 4/14/06 * *****************************************************************************/ - static void mark_entry_dirty(int32_t idx) { @@ -3442,7 +3392,7 @@ mark_entry_dirty(int32_t idx) } /* mark_entry_dirty() */ - + /***************************************************************************** * Function: pin_entry() * @@ -3455,10 +3405,7 @@ mark_entry_dirty(int32_t idx) * Programmer: John Mainzer * 4/11/06 * - * Modifications: - * *****************************************************************************/ - static void pin_entry(H5F_t * file_ptr, int32_t idx, @@ -3512,8 +3459,8 @@ pin_entry(H5F_t * file_ptr, } /* pin_entry() */ - #ifdef H5_METADATA_TRACE_FILE + /***************************************************************************** * Function: pin_protected_entry() * @@ -3527,12 +3474,7 @@ pin_entry(H5F_t * file_ptr, * Programmer: John Mainzer * 01/04/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - static void pin_protected_entry(int32_t idx, hbool_t global) @@ -3793,7 +3735,7 @@ reset_server_counts(void) } /* reset_server_counts() */ - + /***************************************************************************** * Function: resize_entry() * @@ -3808,12 +3750,7 @@ reset_server_counts(void) * Programmer: John Mainzer * 7/11/06 * - * Modifications: - * - * None - * *****************************************************************************/ - static void resize_entry(int32_t idx, size_t new_size) @@ -4070,8 +4007,7 @@ setup_cache_for_test(hid_t * fid_ptr, if ( success ) { - if ( H5AC_set_sync_point_done_callback(cache_ptr, verify_writes) != - SUCCEED ) { + if ( H5AC_set_sync_point_done_callback(cache_ptr, verify_writes) != SUCCEED ) { nerrors++; if ( verbose ) { @@ -4215,7 +4151,7 @@ verify_writes(int num_writes, } /* verify_writes() */ - + /***************************************************************************** * * Function: setup_rand() @@ -4235,7 +4171,6 @@ verify_writes(int num_writes, * Modified function to facilitate setting predefined seeds. * *****************************************************************************/ - static void setup_rand(void) { @@ -4282,7 +4217,7 @@ setup_rand(void) } /* setup_rand() */ - + /***************************************************************************** * * Function: take_down_cache() @@ -4298,12 +4233,7 @@ setup_rand(void) * * Programmer: JRM -- 1/4/06 * - * Modifications: - * - * None. - * *****************************************************************************/ - static hbool_t take_down_cache(hid_t fid) { @@ -4760,7 +4690,7 @@ verify_total_writes(int expected_total_writes) } /* verify_total_writes() */ - + /***************************************************************************** * Function: unlock_entry() * @@ -4779,7 +4709,6 @@ verify_total_writes(int expected_total_writes) * Updated for the new local_len field in datum. * *****************************************************************************/ - void unlock_entry(H5F_t * file_ptr, int32_t idx, @@ -4847,7 +4776,7 @@ unlock_entry(H5F_t * file_ptr, } /* unlock_entry() */ - + /***************************************************************************** * Function: unpin_entry() * @@ -4866,7 +4795,6 @@ unlock_entry(H5F_t * file_ptr, * Added assertion that entry is pinned on entry. * *****************************************************************************/ - static void unpin_entry(H5F_t * file_ptr, int32_t idx, @@ -5716,7 +5644,6 @@ smoke_check_3(int metadata_write_strategy) { const char * fcn_name = "smoke_check_3()"; hbool_t success = TRUE; - int cp = 0; int i; int max_nerrors; int min_count; @@ -5749,18 +5676,12 @@ smoke_check_3(int metadata_write_strategy) break; } - /* 0 */ - if ( verbose ) { HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); } - nerrors = 0; init_data(); reset_stats(); if ( world_mpi_rank == world_server_mpi_rank ) { - /* 1 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - if ( ! server_main() ) { /* some error occured in the server -- report failure */ @@ -5770,15 +5691,9 @@ smoke_check_3(int metadata_write_strategy) world_mpi_rank, fcn_name); } } - - /* 2 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} } else /* run the clients */ { - /* 1 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy) ) { @@ -5791,9 +5706,6 @@ smoke_check_3(int metadata_write_strategy) } } - /* 2 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - min_count = 100 / ((file_mpi_rank + 1) * (file_mpi_rank + 1)); max_count = min_count + 50; @@ -5808,9 +5720,6 @@ smoke_check_3(int metadata_write_strategy) } } - /* 3 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - min_count = 100 / ((file_mpi_rank + 2) * (file_mpi_rank + 2)); max_count = min_count + 50; @@ -5850,9 +5759,6 @@ smoke_check_3(int metadata_write_strategy) } - /* 4 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - /* flush the file to be sure that we have no problems flushing * pinned entries @@ -5865,9 +5771,6 @@ smoke_check_3(int metadata_write_strategy) } } - /* 5 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - min_idx = 0; max_idx = ((virt_num_data_entries / 10) / @@ -5902,9 +5805,6 @@ smoke_check_3(int metadata_write_strategy) } } - /* 6 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - min_idx = 0; max_idx = ((virt_num_data_entries / 10) / ((file_mpi_rank + 3) * (file_mpi_rank + 3))) - 1; @@ -5921,9 +5821,6 @@ smoke_check_3(int metadata_write_strategy) min_idx, max_idx, 0, 100); } - /* 7 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - /* we can't move pinned entries, so release any local pins now. */ local_unpin_all_entries(file_ptr, FALSE); @@ -5941,9 +5838,6 @@ smoke_check_3(int metadata_write_strategy) min_count, max_count); } - /* 8 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - /* ...and then move them back. */ for ( i = (virt_num_data_entries / 2) - 1; i >= 0; i-- ) { @@ -5955,9 +5849,6 @@ smoke_check_3(int metadata_write_strategy) min_count, max_count); } - /* 9 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - /* finally, do some dirty lock/unlocks while we give the cache * a chance t reduce its size. */ @@ -5980,9 +5871,6 @@ smoke_check_3(int metadata_write_strategy) } } - /* 10 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - /* release any local pins before we take down the cache. */ local_unpin_all_entries(file_ptr, FALSE); @@ -5998,9 +5886,6 @@ smoke_check_3(int metadata_write_strategy) } } - /* 11 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} - /* verify that all instances of datum are back where the started * and are clean. */ @@ -6036,9 +5921,6 @@ smoke_check_3(int metadata_write_strategy) } } } - - /* 12 */ - if ( verbose ) {HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++);} } max_nerrors = get_max_nerrors(); @@ -6400,7 +6282,6 @@ smoke_check_5(int metadata_write_strategy) { const char * fcn_name = "smoke_check_5()"; hbool_t success = TRUE; - int cp = 0; int i; int max_nerrors; hid_t fid = -1; @@ -6430,20 +6311,12 @@ smoke_check_5(int metadata_write_strategy) } - /* 0 */ - if ( verbose ) { HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); } - nerrors = 0; init_data(); reset_stats(); if ( world_mpi_rank == world_server_mpi_rank ) { - /* 1 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - if ( ! server_main() ) { /* some error occured in the server -- report failure */ @@ -6453,20 +6326,10 @@ smoke_check_5(int metadata_write_strategy) world_mpi_rank, fcn_name); } } - - /* 2 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } } else /* run the clients */ { - /* 1 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy) ) { @@ -6479,21 +6342,11 @@ smoke_check_5(int metadata_write_strategy) } } - /* 2 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - for ( i = 0; i < (virt_num_data_entries / 2); i++ ) { insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); } - /* 3 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - /* flush the file so we can lock known clean entries. */ if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { nerrors++; @@ -6503,11 +6356,6 @@ smoke_check_5(int metadata_write_strategy) } } - /* 4 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - for ( i = 0; i < (virt_num_data_entries / 4); i++ ) { lock_entry(file_ptr, i); @@ -6531,11 +6379,6 @@ smoke_check_5(int metadata_write_strategy) } } - /* 5 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - for ( i = (virt_num_data_entries / 2) - 1; i >= (virt_num_data_entries / 4); i-- ) @@ -6560,11 +6403,6 @@ smoke_check_5(int metadata_write_strategy) unpin_entry(file_ptr, i, TRUE, FALSE, FALSE); } - /* 6 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - if ( fid >= 0 ) { if ( ! take_down_cache(fid) ) { @@ -6577,11 +6415,6 @@ smoke_check_5(int metadata_write_strategy) } } - /* 7 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - /* verify that all instance of datum are back where the started * and are clean. */ @@ -6592,11 +6425,6 @@ smoke_check_5(int metadata_write_strategy) HDassert( ! (data[i].dirty) ); } - /* 8 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } - /* compose the done message */ mssg.req = DONE_REQ_CODE; mssg.src = world_mpi_rank; @@ -6621,11 +6449,6 @@ smoke_check_5(int metadata_write_strategy) } } } - - /* 9 */ - if ( verbose ) { - HDfprintf(stderr, "%d: cp = %d\n", world_mpi_rank, cp++); - } } max_nerrors = get_max_nerrors(); @@ -7079,7 +6902,7 @@ trace_file_check(int metadata_write_strategy) } /* trace_file_check() */ - + /***************************************************************************** * * Function: main() @@ -7092,12 +6915,7 @@ trace_file_check(int metadata_write_strategy) * * Programmer: JRM -- 12/23/05 * - * Modifications: - * - * None. - * *****************************************************************************/ - int main(int argc, char **argv) { @@ -7123,7 +6941,8 @@ main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n"); + printf("%d:Failed to turn off atexit processing. Continue.\n", + mpi_rank); }; H5open(); -- cgit v0.12 From 8060c37ef471233e09cfe7d54de04d560b9de744 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 15 May 2015 09:38:38 -0500 Subject: [svn-r27087] Add changes for debug flags --- config/cmake/HDFCompilerFlags.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 6f37a48..56d17bf 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -3,7 +3,10 @@ #----------------------------------------------------------------------------- if (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -ftrapv -fno-common") + set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -fno-common") + endif () else (CMAKE_BUILD_TYPE MATCHES Debug) set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) @@ -13,7 +16,10 @@ if (CMAKE_COMPILER_IS_GNUCC) endif (CMAKE_COMPILER_IS_GNUCC) if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_BUILD_TYPE MATCHES Debug) - set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99 -ftrapv -fno-common") + set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrapv -fno-common") + endif () else (CMAKE_BUILD_TYPE MATCHES Debug) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -std=c99") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) -- cgit v0.12 From bf53b8c95c62bb359c2671870412f1e045ee1d59 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Fri, 15 May 2015 11:49:23 -0500 Subject: [svn-r27089] move private functions from H5A.c to H5Aint.c --- src/H5A.c | 266 ----------------------------------------------------------- src/H5Aint.c | 263 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Apkg.h | 3 + 3 files changed, 266 insertions(+), 266 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 3b993ec..a20f730 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -63,9 +63,6 @@ typedef struct H5A_iter_cb1 { /* Local Prototypes */ /********************/ -static herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id); -static herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id); -static ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf); /*********************/ /* Package Variables */ @@ -608,120 +605,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5A__write - PURPOSE - Actually write out data to an attribute - USAGE - herr_t H5A__write (attr, mem_type, buf) - H5A_t *attr; IN: Attribute to write - const H5T_t *mem_type; IN: Memory datatype of buffer - const void *buf; IN: Buffer of data to write - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function writes a complete attribute to disk. ---------------------------------------------------------------------------*/ -static herr_t -H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) -{ - uint8_t *tconv_buf = NULL; /* datatype conv buffer */ - hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */ - uint8_t *bkg_buf = NULL; /* temp conversion buffer */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute */ - H5T_path_t *tpath = NULL; /* conversion information*/ - hid_t src_id = -1, dst_id = -1;/* temporary type atoms */ - size_t src_type_size; /* size of source type */ - size_t dst_type_size; /* size of destination type*/ - size_t buf_size; /* desired buffer size */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, attr->oloc.addr, FAIL) - - HDassert(attr); - HDassert(mem_type); - HDassert(buf); - - /* Get # of elements for attribute's dataspace */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); - - /* If there's actually data elements for the attribute, make a copy of the data passed in */ - if(nelmts > 0) { - /* Get the memory and file datatype sizes */ - src_type_size = H5T_GET_SIZE(mem_type); - dst_type_size = H5T_GET_SIZE(attr->shared->dt); - - /* Convert memory buffer into disk buffer */ - /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") - - /* Check for type conversion required */ - if(!H5T_path_noop(tpath)) { - if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 || - (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") - - /* Get the maximum buffer size needed and allocate it */ - buf_size = nelmts * MAX(src_type_size, dst_type_size); - if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") - if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") - - /* Copy the user's data into the buffer for conversion */ - HDmemcpy(tconv_buf, buf, (src_type_size * nelmts)); - - /* Perform datatype conversion */ - if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") - - /* Free the previous attribute data buffer, if there is one */ - if(attr->shared->data) - attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data); - - /* Set the pointer to the attribute data to the converted information */ - attr->shared->data = tconv_buf; - tconv_owned = TRUE; - } /* end if */ - /* No type conversion necessary */ - else { - HDassert(dst_type_size == src_type_size); - - /* Allocate the attribute buffer, if there isn't one */ - if(attr->shared->data == NULL) - if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Copy the attribute data into the user's buffer */ - HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts)); - } /* end else */ - - /* Modify the attribute in the object header */ - if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute") - } /* end if */ - -done: - /* Release resources */ - if(src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(tconv_buf && !tconv_owned) - tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); - if(bkg_buf) - bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - - FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* H5A__write() */ - - -/*-------------------------------------------------------------------------- - NAME H5Aread PURPOSE Read in data from an attribute @@ -765,109 +648,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5A__read - PURPOSE - Actually read in data from an attribute - USAGE - herr_t H5A__read (attr, mem_type, buf) - H5A_t *attr; IN: Attribute to read - const H5T_t *mem_type; IN: Memory datatype of buffer - void *buf; IN: Buffer for data to read - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function reads a complete attribute from disk. ---------------------------------------------------------------------------*/ -static herr_t -H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) -{ - uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ - uint8_t *bkg_buf = NULL; /* background buffer */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute*/ - H5T_path_t *tpath = NULL; /* type conversion info */ - hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/ - size_t src_type_size; /* size of source type */ - size_t dst_type_size; /* size of destination type */ - size_t buf_size; /* desired buffer size */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_STATIC - - HDassert(attr); - HDassert(mem_type); - HDassert(buf); - - /* Create buffer for data to store on disk */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); - - if(nelmts > 0) { - /* Get the memory and file datatype sizes */ - src_type_size = H5T_GET_SIZE(attr->shared->dt); - dst_type_size = H5T_GET_SIZE(mem_type); - - /* Check if the attribute has any data yet, if not, fill with zeroes */ - if(attr->obj_opened && !attr->shared->data) - HDmemset(buf, 0, (dst_type_size * nelmts)); - else { /* Attribute exists and has a value */ - /* Convert memory buffer into disk buffer */ - /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type, NULL, NULL, dxpl_id, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") - - /* Check for type conversion required */ - if(!H5T_path_noop(tpath)) { - if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 || - (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") - - /* Get the maximum buffer size needed and allocate it */ - buf_size = nelmts * MAX(src_type_size, dst_type_size); - if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Copy the attribute data into the buffer for conversion */ - HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); - - /* Perform datatype conversion. */ - if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") - - /* Copy the converted data into the user's buffer */ - HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts)); - } /* end if */ - /* No type conversion necessary */ - else { - HDassert(dst_type_size == src_type_size); - - /* Copy the attribute data into the user's buffer */ - HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts)); - } /* end else */ - } /* end else */ - } /* end if */ - -done: - /* Release resources */ - if(src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if(tconv_buf) - tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); - if(bkg_buf) - bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5A__read() */ - - -/*-------------------------------------------------------------------------- - NAME H5Aget_space PURPOSE Gets a copy of the dataspace for an attribute @@ -1027,52 +807,6 @@ done: } /* H5Aget_name() */ -/*-------------------------------------------------------------------------- - NAME - H5A__get_name - PURPOSE - Private function for H5Aget_name. Gets a copy of the name for an - attribute - RETURNS - This function returns the length of the attribute's name (which may be - longer than 'buf_size') on success or negative for failure. - DESCRIPTION - This function retrieves the name of an attribute for an attribute ID. - Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string - terminator. If the name of the attribute is longer than 'buf_size'-1, - the string terminator is stored in the last position of the buffer to - properly terminate the string. ---------------------------------------------------------------------------*/ -static ssize_t -H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) -{ - size_t copy_len, nbytes; - ssize_t ret_value; - - FUNC_ENTER_STATIC_NOERR - - /* get the real attribute length */ - nbytes = HDstrlen(attr->shared->name); - HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/ - - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(buf_size - 1, nbytes); - - /* Copy all/some of the name */ - if(buf && copy_len > 0) { - HDmemcpy(buf, attr->shared->name, copy_len); - - /* Terminate the string */ - buf[copy_len]='\0'; - } /* end if */ - - /* Set return value */ - ret_value = (ssize_t)nbytes; - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5A_get_name() */ - - /*------------------------------------------------------------------------- * Function: H5Aget_name_by_idx * diff --git a/src/H5Aint.c b/src/H5Aint.c index 84f7ecd..9012f6d 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -468,6 +468,269 @@ done: } /* H5A_open_by_name() */ +/*-------------------------------------------------------------------------- + NAME + H5A__read + PURPOSE + Actually read in data from an attribute + USAGE + herr_t H5A__read (attr, mem_type, buf) + H5A_t *attr; IN: Attribute to read + const H5T_t *mem_type; IN: Memory datatype of buffer + void *buf; IN: Buffer for data to read + RETURNS + Non-negative on success/Negative on failure + + DESCRIPTION + This function reads a complete attribute from disk. +--------------------------------------------------------------------------*/ +herr_t +H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) +{ + uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ + uint8_t *bkg_buf = NULL; /* background buffer */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute*/ + H5T_path_t *tpath = NULL; /* type conversion info */ + hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/ + size_t src_type_size; /* size of source type */ + size_t dst_type_size; /* size of destination type */ + size_t buf_size; /* desired buffer size */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(attr); + HDassert(mem_type); + HDassert(buf); + + /* Create buffer for data to store on disk */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); + + if(nelmts > 0) { + /* Get the memory and file datatype sizes */ + src_type_size = H5T_GET_SIZE(attr->shared->dt); + dst_type_size = H5T_GET_SIZE(mem_type); + + /* Check if the attribute has any data yet, if not, fill with zeroes */ + if(attr->obj_opened && !attr->shared->data) + HDmemset(buf, 0, (dst_type_size * nelmts)); + else { /* Attribute exists and has a value */ + /* Convert memory buffer into disk buffer */ + /* Set up type conversion function */ + if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type, NULL, NULL, dxpl_id, FALSE))) + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") + + /* Check for type conversion required */ + if(!H5T_path_noop(tpath)) { + if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 || + (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + + /* Get the maximum buffer size needed and allocate it */ + buf_size = nelmts * MAX(src_type_size, dst_type_size); + if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Copy the attribute data into the buffer for conversion */ + HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); + + /* Perform datatype conversion. */ + if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") + + /* Copy the converted data into the user's buffer */ + HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts)); + } /* end if */ + /* No type conversion necessary */ + else { + HDassert(dst_type_size == src_type_size); + + /* Copy the attribute data into the user's buffer */ + HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts)); + } /* end else */ + } /* end else */ + } /* end if */ + +done: + /* Release resources */ + if(src_id >= 0 && H5I_dec_ref(src_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(tconv_buf) + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); + if(bkg_buf) + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5A__read() */ + + +/*-------------------------------------------------------------------------- + NAME + H5A__write + PURPOSE + Actually write out data to an attribute + USAGE + herr_t H5A__write (attr, mem_type, buf) + H5A_t *attr; IN: Attribute to write + const H5T_t *mem_type; IN: Memory datatype of buffer + const void *buf; IN: Buffer of data to write + RETURNS + Non-negative on success/Negative on failure + + DESCRIPTION + This function writes a complete attribute to disk. +--------------------------------------------------------------------------*/ +herr_t +H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) +{ + uint8_t *tconv_buf = NULL; /* datatype conv buffer */ + hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */ + uint8_t *bkg_buf = NULL; /* temp conversion buffer */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + H5T_path_t *tpath = NULL; /* conversion information*/ + hid_t src_id = -1, dst_id = -1;/* temporary type atoms */ + size_t src_type_size; /* size of source type */ + size_t dst_type_size; /* size of destination type*/ + size_t buf_size; /* desired buffer size */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, attr->oloc.addr, FAIL) + + HDassert(attr); + HDassert(mem_type); + HDassert(buf); + + /* Get # of elements for attribute's dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); + + /* If there's actually data elements for the attribute, make a copy of the data passed in */ + if(nelmts > 0) { + /* Get the memory and file datatype sizes */ + src_type_size = H5T_GET_SIZE(mem_type); + dst_type_size = H5T_GET_SIZE(attr->shared->dt); + + /* Convert memory buffer into disk buffer */ + /* Set up type conversion function */ + if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt, NULL, NULL, dxpl_id, FALSE))) + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") + + /* Check for type conversion required */ + if(!H5T_path_noop(tpath)) { + if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 || + (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + + /* Get the maximum buffer size needed and allocate it */ + buf_size = nelmts * MAX(src_type_size, dst_type_size); + if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Copy the user's data into the buffer for conversion */ + HDmemcpy(tconv_buf, buf, (src_type_size * nelmts)); + + /* Perform datatype conversion */ + if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") + + /* Free the previous attribute data buffer, if there is one */ + if(attr->shared->data) + attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data); + + /* Set the pointer to the attribute data to the converted information */ + attr->shared->data = tconv_buf; + tconv_owned = TRUE; + } /* end if */ + /* No type conversion necessary */ + else { + HDassert(dst_type_size == src_type_size); + + /* Allocate the attribute buffer, if there isn't one */ + if(attr->shared->data == NULL) + if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Copy the attribute data into the user's buffer */ + HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts)); + } /* end else */ + + /* Modify the attribute in the object header */ + if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute") + } /* end if */ + +done: + /* Release resources */ + if(src_id >= 0 && H5I_dec_ref(src_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(tconv_buf && !tconv_owned) + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); + if(bkg_buf) + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); + + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) +} /* H5A__write() */ + + +/*-------------------------------------------------------------------------- + NAME + H5A__get_name + PURPOSE + Private function for H5Aget_name. Gets a copy of the name for an + attribute + RETURNS + This function returns the length of the attribute's name (which may be + longer than 'buf_size') on success or negative for failure. + DESCRIPTION + This function retrieves the name of an attribute for an attribute ID. + Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string + terminator. If the name of the attribute is longer than 'buf_size'-1, + the string terminator is stored in the last position of the buffer to + properly terminate the string. +--------------------------------------------------------------------------*/ +ssize_t +H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) +{ + size_t copy_len, nbytes; + ssize_t ret_value; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* get the real attribute length */ + nbytes = HDstrlen(attr->shared->name); + HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/ + + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(buf_size - 1, nbytes); + + /* Copy all/some of the name */ + if(buf && copy_len > 0) { + HDmemcpy(buf, attr->shared->name, copy_len); + + /* Terminate the string */ + buf[copy_len]='\0'; + } /* end if */ + + /* Set return value */ + ret_value = (ssize_t)nbytes; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5A__get_name() */ + + /*------------------------------------------------------------------------- * Function: H5A_get_space * diff --git a/src/H5Apkg.h b/src/H5Apkg.h index f656214..d3fcd53 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -206,6 +206,9 @@ H5_DLL herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char const char *new_attr_name, hid_t lapl_id, hid_t dxpl_id); H5_DLL htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, hid_t lapl_id, hid_t dxpl_id); +H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id); +H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id); +H5_DLL ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf); /* Attribute "dense" storage routines */ H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo); -- cgit v0.12