From 0863ac16fd0d571fc90d1d6a3d2e5669dc552a9c Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Thu, 8 Jan 2015 21:29:12 +0900 Subject: [PATCH] sys/vfs/hammer: fix comments regarding obsolete "spike" code This patch fixes comments regarding "spike" code that only existed in early days of hammer development. The spike comments have been left unchanged even after the code was removed in 47197d71536907482d2d215e222600eed3aedc0e. This patch is kernel cleanup in addition to userspace cleanup http://bugs.dragonflybsd.org/issues/2761. These two patches get rid of spike code at least in grep level. \# git checkout master git Already on 'master' \# git pull Already up-to-date. \# grep -nrIi spike sys/vfs/hammer sbin/hammer sys/vfs/hammer/hammer_cursor.c:645: * a spike then the current node must be a leaf node. sys/vfs/hammer/hammer_btree.c:1011: * the spike), but ENOSPC is returned. sys/vfs/hammer/hammer_btree.c:1318: * to a leaf to provide the spike code with a good point sys/vfs/hammer/hammer_btree.c:1463: * (ENOENT) or spike (ENOSPC) operation. sys/vfs/hammer/hammer_btree.c:1794: * Spikes are made up of two leaf elements which cannot be sbin/hammer/cmd_show.c:49: int depth, int spike, hammer_tid_t mirror_tid, sbin/hammer/cmd_show.c:113: int depth, int spike, hammer_tid_t mirror_tid, sbin/hammer/cmd_show.c:146: if (spike == 0) { sbin/hammer/cmd_show.c:225: search, depth + 1, spike, \# git checkout -b test Switched to a new branch 'test' \# git am ./0001-sbin-hammer-remove-obsolete-spike-code-from-hammer-s.patch Applying: sbin/hammer: remove obsolete "spike" code from hammer show command \# git am ./0001-sys-vfs-hammer-fix-comments-regarding-obsolete-spike.patch Applying: sys/vfs/hammer: fix comments regarding obsolete "spike" code \# grep -nrIi spike sys/vfs/hammer sbin/hammer \# --- sys/vfs/hammer/hammer_btree.c | 13 ++++--------- sys/vfs/hammer/hammer_cursor.c | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/sys/vfs/hammer/hammer_btree.c b/sys/vfs/hammer/hammer_btree.c index 6165ae5..88f60d7 100644 --- a/sys/vfs/hammer/hammer_btree.c +++ b/sys/vfs/hammer/hammer_btree.c @@ -1007,8 +1007,7 @@ hammer_btree_delete(hammer_cursor_t cursor) * * INSERTIONS: The search will split full nodes and leaves on its way down * and guarentee that the leaf it ends up on is not full. If we run out - * of space the search continues to the leaf (to position the cursor for - * the spike), but ENOSPC is returned. + * of space the search continues to the leaf, but ENOSPC is returned. * * The search is only guarenteed to end up on a leaf if an error code of 0 * is returned, or if inserting and an error code of ENOENT is returned. @@ -1314,9 +1313,8 @@ btree_search(hammer_cursor_t cursor, int flags) * prepend and append an empty leaf node in order to make * the boundary correction. * - * If we run out of space we set enospc and continue on - * to a leaf to provide the spike code with a good point - * of entry. + * If we run out of space we set enospc but continue on + * to a leaf. */ if ((flags & HAMMER_CURSOR_INSERT) && enospc == 0) { if (btree_node_is_full(node)) { @@ -1460,7 +1458,7 @@ failed: /* * We reached a leaf but did not find the key we were looking for. * If this is an insert we will be properly positioned for an insert - * (ENOENT) or spike (ENOSPC) operation. + * (ENOENT) or unable to insert (ENOSPC). */ error = enospc ? ENOSPC : ENOENT; done: @@ -1790,9 +1788,6 @@ btree_split_leaf(hammer_cursor_t cursor) * right to try to optimize node fill and flag it. If we hit * that same leaf again our heuristic failed and we don't try * to optimize node fill (it could lead to a degenerate case). - * - * Spikes are made up of two leaf elements which cannot be - * safely split. */ leaf = cursor->node; ondisk = leaf->ondisk; diff --git a/sys/vfs/hammer/hammer_cursor.c b/sys/vfs/hammer/hammer_cursor.c index c71ff8f..b87f635 100644 --- a/sys/vfs/hammer/hammer_cursor.c +++ b/sys/vfs/hammer/hammer_cursor.c @@ -641,8 +641,7 @@ hammer_cursor_down(hammer_cursor_t cursor) /* * Ok, push down into elm. If elm specifies an internal or leaf - * node the current node must be an internal node. If elm specifies - * a spike then the current node must be a leaf node. + * node the current node must be an internal node. */ switch(elm->base.btype) { case HAMMER_BTREE_TYPE_INTERNAL: -- 1.7.1