summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-08 15:26:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-08 15:26:04 (GMT)
commit5c2b09a88ce07acb9fc04cf0945292140e1770d9 (patch)
treea17de415168aab7e39c33d41b47e042fca4683d0 /src/H5B.c
parent8b6abe7b2db42b95ca7caadf1deb97c628d5054b (diff)
downloadhdf5-5c2b09a88ce07acb9fc04cf0945292140e1770d9.zip
hdf5-5c2b09a88ce07acb9fc04cf0945292140e1770d9.tar.gz
hdf5-5c2b09a88ce07acb9fc04cf0945292140e1770d9.tar.bz2
[svn-r8626] Purpose:
Code optimization Description: Avoid pushing errors on error stack when an object is not found in a B-tree. Sometimes we are just checking if the object exists before we insert it into the B-tree and the higher levels in the library should be responsible for determining if not finding the object in B-tree is really an error. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel too minor to require h5committest
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/H5B.c b/src/H5B.c
index cf285fa..4faef9a 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -470,7 +470,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt)
if (bt->key[i].nkey) {
if ((bt->type->encode) (f, bt, bt->key[i].rkey,
bt->key[i].nkey) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
}
bt->key[i].dirty = FALSE;
}
@@ -490,7 +490,8 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt)
* for the final unchanged children.
*/
if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, bt->page)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk")
+
bt->cache_info.dirty = FALSE;
bt->ndirty = 0;
}
@@ -646,7 +647,15 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
}
}
if (cmp)
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
+#ifdef OLD_WAY
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree key not found")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
/*
* Follow the link to the subtree or to the data node.
@@ -654,10 +663,26 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
assert(idx < bt->nchildren);
if (bt->level > 0) {
if (H5B_find(f, dxpl_id, type, bt->child[idx], udata) < 0)
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
+#ifdef OLD_WAY
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in subtree")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
} else {
if ((type->found) (f, dxpl_id, bt->child[idx], bt->key[idx].nkey, udata, bt->key[idx+1].nkey) < 0)
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
+#ifdef OLD_WAY
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
}
done:
@@ -825,9 +850,11 @@ H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr
if (H5F_addr_defined(old_bt->right)) {
if (NULL == (tmp_bt = H5AC_find(f, dxpl_id, H5AC_BT, old_bt->right, type, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling")
+
tmp_bt->cache_info.dirty = TRUE;
tmp_bt->left = *new_addr_p;
}
+
old_bt->right = *new_addr_p;
done: