Submit #2761
closed[PATCH] sbin/hammer: remove obsolete "spike" code from hammer show command
Description
This patch removes spike related code from print_btree_node(). The idea of spike type node (HAMMER_BTREE_TYPE_SPIKE_XXX) within the hammer btree has been removed since 47197d71536907482d2d215e222600eed3aedc0e in 2008. Prior to 47197d71 there was a special case where a leaf node's element was a spike node, and such data structure required hammer show command recursively call hammer_cmd_show() (see 47197d71 -- sbin/hammer/cmd_show.c).
Since now that spike node is gone, calling print_btree_node() with int spike=1 (in addition to int spike=0 case) is no longer relevant as spike=1 goes down through btree doing nothing. spike=1 currently does nothing to result because it neither goes to "if (spike 0) { ..." block nor recursively calls hammer_cmd_show(). This patch simply gets rid of spike code as well as fixing indents for "if (spike 0) { ..." block, and nothing else.
Following test shows there is no diff between two results. Note that I've reverted a commit ffb1cc63 (on top of this patch at my local git work branch) only for this test so the output format equals that of 4.0 inbox binary which was built prior to ffb1cc63. This patch itself applies to the latest upstream master.
\# uname -r
4.0-RELEASE
creat fs and poplulate fs with bunch of inode/dentry/data.
\# mkdir -p /HAMMER
\# newfs_hammer -L TEST /dev/ad1 /dev/ad2 /dev/ad3 > /dev/null
\# mount_hammer /dev/ad1:/dev/ad2:/dev/ad3 /HAMMER
\# cd /HAMMER
\# git clone git://git.dragonflybsd.org/dragonfly.git > /dev/null
\# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > /dev/null
\# cd
try the original /sbin/hammer and this patch
\# umount /HAMMER
\# mount_hammer /dev/ad1:/dev/ad2:/dev/ad3 /HAMMER
\# /sbin/hammer -f /dev/ad1:/dev/ad2:/dev/ad3 show > out1
\# umount /HAMMER
\# mount_hammer /dev/ad1:/dev/ad2:/dev/ad3 /HAMMER
\# ~/work/dragonfly/sbin/hammer/hammer -f /dev/ad1:/dev/ad2:/dev/ad3 show > out2
compare results
\# grep ELM ./out1 | wc -l
330370
\# grep ELM ./out2 | wc -l
330370
\# diff out1 out2
\#
try the original /sbin/hammer and this patch with localization:obj_id specified
\# umount /HAMMER
\# mount_hammer /dev/ad1:/dev/ad2:/dev/ad3 /HAMMER
\# /sbin/hammer -f /dev/ad1:/dev/ad2:/dev/ad3 show 00000001:0000000102c8eef7 > out1
\# umount /HAMMER
\# mount_hammer /dev/ad1:/dev/ad2:/dev/ad3 /HAMMER
\# ~/work/dragonfly/sbin/hammer/hammer -f /dev/ad1:/dev/ad2:/dev/ad3 show 00000001:0000000102c8eef7 > out2
compare results
\# grep ELM out1 | wc -l
200971
\# grep ELM out2 | wc -l
200971
\# diff out1 out2
\#
Files