summaryrefslogtreecommitdiffstats
path: root/src/H5B2hdr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-02-17 15:38:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-02-17 15:38:54 (GMT)
commitfd79bc3c1ae13f1fad8d3e1f7c26b610a3f5baa3 (patch)
tree03bbf1041f3cab0772720b2563f84407ef370833 /src/H5B2hdr.c
parentb28b5fade93c4e72e045469481cde81c01f956cf (diff)
downloadhdf5-fd79bc3c1ae13f1fad8d3e1f7c26b610a3f5baa3.zip
hdf5-fd79bc3c1ae13f1fad8d3e1f7c26b610a3f5baa3.tar.gz
hdf5-fd79bc3c1ae13f1fad8d3e1f7c26b610a3f5baa3.tar.bz2
[svn-r26191] Description:
Track the min & max keys for a v2 B-tree, so it can more efficiently determine if a key is present in the B-tree. Tested on: Mac OSX/64 10.10.2 (amazon) w/parallel & serial Linux/32 2.6.x (jam) w/serial
Diffstat (limited to 'src/H5B2hdr.c')
-rw-r--r--src/H5B2hdr.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 443a2e5..452a35d 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -166,7 +166,7 @@ HDmemset(hdr->page, 0, hdr->node_size);
hdr->node_info[0].cum_max_nrec = hdr->node_info[0].max_nrec;
hdr->node_info[0].cum_max_nrec_size = 0;
if(NULL == (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
hdr->node_info[0].node_ptr_fac = NULL;
/* Allocate array of pointers to internal node native keys */
@@ -250,7 +250,7 @@ H5B2_hdr_alloc(H5F_t *f)
/* Allocate space for the shared information */
if(NULL == (hdr = H5FL_CALLOC(H5B2_hdr_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header")
/* Assign non-zero information */
hdr->f = f;
@@ -298,19 +298,19 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam,
/* Allocate v2 B-tree header */
if(NULL == (hdr = H5B2_hdr_alloc(f)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header")
+ 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)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
/* Allocate space for the header on disk */
if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->hdr_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
/* Cache the new B-tree node */
if(H5AC_insert_entry(f, dxpl_id, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache")
/* Set address of v2 B-tree header to return */
ret_value = hdr->addr;
@@ -398,15 +398,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5B2_hdr_fuse_incr
+ * Function: H5B2_hdr_fuse_incr
*
- * Purpose: Increment file reference count on shared v2 B-tree header
+ * Purpose: Increment file reference count on shared v2 B-tree header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED (Can't fail)
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Oct 27 2009
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 27 2009
*
*-------------------------------------------------------------------------
*/
@@ -426,15 +426,15 @@ H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr)
/*-------------------------------------------------------------------------
- * Function: H5B2_hdr_fuse_decr
+ * Function: H5B2_hdr_fuse_decr
*
- * Purpose: Decrement file reference count on shared v2 B-tree header
+ * Purpose: Decrement file reference count on shared v2 B-tree header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: The file's reference count after the decrement. (Can't fail)
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Oct 27 2009
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 27 2009
*
*-------------------------------------------------------------------------
*/
@@ -542,6 +542,16 @@ H5B2_hdr_free(H5B2_hdr_t *hdr)
hdr->node_info = H5FL_SEQ_FREE(H5B2_node_info_t, hdr->node_info);
} /* end if */
+ /* Release the min & max record info, if set */
+ if(hdr->min_native_rec) {
+ HDfree(hdr->min_native_rec);
+ hdr->min_native_rec = NULL;
+ } /* end if */
+ if(hdr->max_native_rec) {
+ HDfree(hdr->max_native_rec);
+ hdr->max_native_rec = NULL;
+ } /* end if */
+
/* Free B-tree header info */
hdr = H5FL_FREE(H5B2_hdr_t, hdr);