From a9fd59b8032d8b40869dd1ff92c0b44dff59ed87 Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Fri, 9 Jan 2015 00:13:59 +0900 Subject: [PATCH] sys/vfs/hammer: make btree_search() climb up btree slightly faster - This cleanup patch lets cursor climb up deep/fat btree slightly faster (lightweight), if not slower. - Remove a duplicate check that traces back to a moment where there was btree_node_is_almost_full() and the differentiation was needed. Closes: #2765 --- sys/vfs/hammer/hammer_btree.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/vfs/hammer/hammer_btree.c b/sys/vfs/hammer/hammer_btree.c index 88f60d719e..28faab64d2 100644 --- a/sys/vfs/hammer/hammer_btree.c +++ b/sys/vfs/hammer/hammer_btree.c @@ -1116,14 +1116,9 @@ btree_search(hammer_cursor_t cursor, int flags) * (If inserting we aren't doing an as-of search so we don't have * to worry about create_check). */ - while ((flags & HAMMER_CURSOR_INSERT) && enospc == 0) { - if (cursor->node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL) { - if (btree_node_is_full(cursor->node->ondisk) == 0) - break; - } else { - if (btree_node_is_full(cursor->node->ondisk) ==0) - break; - } + while (flags & HAMMER_CURSOR_INSERT) { + if (btree_node_is_full(cursor->node->ondisk) == 0) + break; if (cursor->node->ondisk->parent == 0 || cursor->parent->ondisk->count != HAMMER_BTREE_INT_ELMS) { break; -- 2.41.0