sys/vfs/hammer: make btree_search() climb up btree slightly faster
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Thu, 8 Jan 2015 15:13:59 +0000 (00:13 +0900)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Tue, 20 Jan 2015 15:28:32 +0000 (16:28 +0100)
- 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

index 88f60d7..28faab6 100644 (file)
@@ -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;