Project

General

Profile

Submit #2755

[PATCH] sbin/hammer: fix counter-intuitive output of hammer show command

Added by tkusumi about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Userland
Target version:
Start date:
01/01/2015
Due date:
% Done:

100%


Description

hammer show command should show "ELM .." line with following arg order (2), instead of existing arg order (1).
(1) printf("obj=%016jx key=%016jx lo=%08x rt=%02x ot=%02x\n",
(2) printf("lo=%08x obj=%016jx rt=%02x key=%016jx ot=%02x\n",

Since hammer_btree_cmp() compares hammer_base_elm members in 'localization -> obj_id -> rec_type -> key' order, the userspace command should show the structure in that order as well. (1) is counter-intuitive since lower priority members (on cmp) are shown before higher ones which makes it difficult to see how this fs locates nodes. Following test script shows difference.

----------
\# cat ./test1.sh
\#!/usr/local/bin/bash

\# mount hammer
newfs_hammer -L TEST /dev/ad1 /dev/ad2 /dev/ad3 >/dev/null
mount_hammer /dev/ad1:/dev/ad2:/dev/ad3 /HAMMER

\# creat files
cd /HAMMER
for x in 0 1 2; do
touch test${x}.out
done

\# mount pfs and creat files
mkdir -p /HAMMER/pfs
for name in aaa bbb ccc; do
hammer pfs-master /HAMMER/pfs/${name} >/dev/null
mkdir -p /HAMMER/${name}
mount_null /HAMMER/pfs/${name} /HAMMER/${name}
cd /HAMMER/${name}
for x in 0 1 2; do
touch test${x}.out
done
done

sync; sleep 1
sync; sleep 1
sync; sleep 1
$1 -f /dev/ad1:/dev/ad2:/dev/ad3 show | grep ELM
----------
(1) using existing command
\# ./test1.sh /sbin/hammer
G------ ELM 0 R obj=0000000000000001 key=0000000000000000 lo=00000001 rt=01 ot=01
G------ ELM 1 R obj=0000000000000001 key=2fbba4ed8b560000 lo=00000001 rt=11 ot=01
G------ ELM 2 R obj=0000000000000001 key=37a05a0d40d00000 lo=00000001 rt=11 ot=02
G------ ELM 3 R obj=0000000000000001 key=4065cf0d8f680000 lo=00000001 rt=11 ot=01
G------ ELM 4 R obj=0000000000000001 key=449d4a7b54000000 lo=00000001 rt=11 ot=02
G------ ELM 5 R obj=0000000000000001 key=4da5faf169700000 lo=00000001 rt=11 ot=02
G------ ELM 6 R obj=0000000000000001 key=511b5de50cfe0000 lo=00000001 rt=11 ot=01
G------ ELM 7 R obj=0000000000000001 key=7007732d832a0000 lo=00000001 rt=11 ot=01
G------ ELM 8 R obj=000000010000057d key=0000000000000000 lo=00000001 rt=01 ot=01
G------ ELM 9 R obj=00000001000005bd key=0000000000000000 lo=00000001 rt=01 ot=02
G------ ELM 10 R obj=0000000100000603 key=0000000000000000 lo=00000001 rt=01 ot=01
G------ ELM 11 R obj=0000000100000624 key=0000000000000000 lo=00000001 rt=01 ot=02
G------ ELM 12 R obj=000000010000066d key=0000000000000000 lo=00000001 rt=01 ot=02
G------ ELM 13 R obj=0000000100000688 key=0000000000000000 lo=00000001 rt=01 ot=01
G------ ELM 14 R obj=0000000100000688 key=2fbba4ed8b560000 lo=00000001 rt=11 ot=07
G------ ELM 15 R obj=0000000100000688 key=4065cf0d8f680000 lo=00000001 rt=11 ot=07
G------ ELM 16 R obj=0000000100000688 key=7007732d832a0000 lo=00000001 rt=11 ot=07
G------ ELM 17 R obj=0000000100000780 key=0000000000000000 lo=00000001 rt=01 ot=01
G------ ELM 18 R obj=000000010000857d key=0000000000000000 lo=00000001 rt=01 ot=07
G------ ELM 19 R obj=0000000100008603 key=0000000000000000 lo=00000001 rt=01 ot=07
G------ ELM 20 R obj=0000000100008780 key=0000000000000000 lo=00000001 rt=01 ot=07
G------ ELM 21 R obj=0000000000000001 key=0000000000000000 lo=00000002 rt=15 ot=00
G------ ELM 22 R obj=0000000000000001 key=0000000000010000 lo=00000002 rt=15 ot=01
G------ ELM 23 R obj=0000000000000001 key=0000000000020000 lo=00000002 rt=15 ot=01
G------ ELM 24 R obj=0000000000000001 key=0000000000030000 lo=00000002 rt=15 ot=01
G------ ELM 25 R obj=0000000000000001 key=0000000000000000 lo=00010001 rt=01 ot=01
G------ ELM 26 R obj=0000000000000001 key=37a05a0d40d00000 lo=00010001 rt=11 ot=02
G------ ELM 27 R obj=0000000000000001 key=449d4a7b54000000 lo=00010001 rt=11 ot=02
G------ ELM 28 R obj=0000000000000001 key=4da5faf169700000 lo=00010001 rt=11 ot=02
G------ ELM 29 R obj=00000001000105bd key=0000000000000000 lo=00010001 rt=01 ot=02
G------ ELM 30 R obj=0000000100010624 key=0000000000000000 lo=00010001 rt=01 ot=02
G------ ELM 31 R obj=000000010001066d key=0000000000000000 lo=00010001 rt=01 ot=02
G------ ELM 32 R obj=0000000000000001 key=0000000000000000 lo=00020001 rt=01 ot=01
G------ ELM 33 R obj=0000000000000001 key=37a05a0d40d00000 lo=00020001 rt=11 ot=02
G------ ELM 34 R obj=0000000000000001 key=449d4a7b54000000 lo=00020001 rt=11 ot=02
G------ ELM 35 R obj=0000000000000001 key=4da5faf169700000 lo=00020001 rt=11 ot=02
G------ ELM 36 R obj=00000001000185bd key=0000000000000000 lo=00020001 rt=01 ot=02
G------ ELM 37 R obj=0000000100018624 key=0000000000000000 lo=00020001 rt=01 ot=02
G------ ELM 38 R obj=000000010001866d key=0000000000000000 lo=00020001 rt=01 ot=02
G------ ELM 39 R obj=0000000000000001 key=0000000000000000 lo=00030001 rt=01 ot=01
G------ ELM 40 R obj=0000000000000001 key=37a05a0d40d00000 lo=00030001 rt=11 ot=02
G------ ELM 41 R obj=0000000000000001 key=449d4a7b54000000 lo=00030001 rt=11 ot=02
G------ ELM 42 R obj=0000000000000001 key=4da5faf169700000 lo=00030001 rt=11 ot=02
G------ ELM 43 R obj=00000001000205bd key=0000000000000000 lo=00030001 rt=01 ot=02
G------ ELM 44 R obj=0000000100020624 key=0000000000000000 lo=00030001 rt=01 ot=02
G------ ELM 45 R obj=000000010002066d key=0000000000000000 lo=00030001 rt=01 ot=02

(2) with this commit
\# ./test1.sh ~/work/dragonfly/sbin/hammer/hammer
G------ ELM 1 R lo=00000001 obj=0000000000000001 rt=11 key=2fbba4ed8b560000 ot=01
G------ ELM 2 R lo=00000001 obj=0000000000000001 rt=11 key=37a05a0d40d00000 ot=02
G------ ELM 3 R lo=00000001 obj=0000000000000001 rt=11 key=4065cf0d8f680000 ot=01
G------ ELM 4 R lo=00000001 obj=0000000000000001 rt=11 key=449d4a7b54000000 ot=02
G------ ELM 5 R lo=00000001 obj=0000000000000001 rt=11 key=4da5faf169700000 ot=02
G------ ELM 6 R lo=00000001 obj=0000000000000001 rt=11 key=511b5de50cfe0000 ot=01
G------ ELM 7 R lo=00000001 obj=0000000000000001 rt=11 key=7007732d832a0000 ot=01
G------ ELM 8 R lo=00000001 obj=000000010000057d rt=01 key=0000000000000000 ot=01
G------ ELM 9 R lo=00000001 obj=00000001000005bd rt=01 key=0000000000000000 ot=02
G------ ELM 10 R lo=00000001 obj=0000000100000603 rt=01 key=0000000000000000 ot=01
G------ ELM 11 R lo=00000001 obj=0000000100000624 rt=01 key=0000000000000000 ot=02
G------ ELM 12 R lo=00000001 obj=000000010000066d rt=01 key=0000000000000000 ot=02
G------ ELM 13 R lo=00000001 obj=0000000100000688 rt=01 key=0000000000000000 ot=01
G------ ELM 14 R lo=00000001 obj=0000000100000688 rt=11 key=2fbba4ed8b560000 ot=07
G------ ELM 15 R lo=00000001 obj=0000000100000688 rt=11 key=4065cf0d8f680000 ot=07
G------ ELM 16 R lo=00000001 obj=0000000100000688 rt=11 key=7007732d832a0000 ot=07
G------ ELM 17 R lo=00000001 obj=0000000100000780 rt=01 key=0000000000000000 ot=01
G------ ELM 18 R lo=00000001 obj=000000010000857d rt=01 key=0000000000000000 ot=07
G------ ELM 19 R lo=00000001 obj=0000000100008603 rt=01 key=0000000000000000 ot=07
G------ ELM 20 R lo=00000001 obj=0000000100008780 rt=01 key=0000000000000000 ot=07
G------ ELM 21 R lo=00000002 obj=0000000000000001 rt=15 key=0000000000000000 ot=00
G------ ELM 22 R lo=00000002 obj=0000000000000001 rt=15 key=0000000000010000 ot=01
G------ ELM 23 R lo=00000002 obj=0000000000000001 rt=15 key=0000000000020000 ot=01
G------ ELM 24 R lo=00000002 obj=0000000000000001 rt=15 key=0000000000030000 ot=01
G------ ELM 25 R lo=00010001 obj=0000000000000001 rt=01 key=0000000000000000 ot=01
G------ ELM 26 R lo=00010001 obj=0000000000000001 rt=11 key=37a05a0d40d00000 ot=02
G------ ELM 27 R lo=00010001 obj=0000000000000001 rt=11 key=449d4a7b54000000 ot=02
G------ ELM 28 R lo=00010001 obj=0000000000000001 rt=11 key=4da5faf169700000 ot=02
G------ ELM 29 R lo=00010001 obj=00000001000105bd rt=01 key=0000000000000000 ot=02
G------ ELM 30 R lo=00010001 obj=0000000100010624 rt=01 key=0000000000000000 ot=02
G------ ELM 31 R lo=00010001 obj=000000010001066d rt=01 key=0000000000000000 ot=02
G------ ELM 32 R lo=00020001 obj=0000000000000001 rt=01 key=0000000000000000 ot=01
G------ ELM 33 R lo=00020001 obj=0000000000000001 rt=11 key=37a05a0d40d00000 ot=02
G------ ELM 34 R lo=00020001 obj=0000000000000001 rt=11 key=449d4a7b54000000 ot=02
G------ ELM 35 R lo=00020001 obj=0000000000000001 rt=11 key=4da5faf169700000 ot=02
G------ ELM 36 R lo=00020001 obj=00000001000185bd rt=01 key=0000000000000000 ot=02
G------ ELM 37 R lo=00020001 obj=0000000100018624 rt=01 key=0000000000000000 ot=02
G------ ELM 38 R lo=00020001 obj=000000010001866d rt=01 key=0000000000000000 ot=02
G------ ELM 39 R lo=00030001 obj=0000000000000001 rt=01 key=0000000000000000 ot=01
G------ ELM 40 R lo=00030001 obj=0000000000000001 rt=11 key=37a05a0d40d00000 ot=02
G------ ELM 41 R lo=00030001 obj=0000000000000001 rt=11 key=449d4a7b54000000 ot=02
G------ ELM 42 R lo=00030001 obj=0000000000000001 rt=11 key=4da5faf169700000 ot=02
G------ ELM 43 R lo=00030001 obj=00000001000205bd rt=01 key=0000000000000000 ot=02
G------ ELM 44 R lo=00030001 obj=0000000100020624 rt=01 key=0000000000000000 ot=02
G------ ELM 45 R lo=00030001 obj=000000010002066d rt=01 key=0000000000000000 ot=02

Associated revisions

Revision 331e9727 (diff)
Added by tkusumi about 2 years ago

sbin/hammer: fix counter-intuitive output of hammer show command

- Change 'hammer show' ELM output to match the comparison order in the
RB tree cmp functions.

Closes: #2755

Revision 49bff301 (diff)
Added by tkusumi about 2 years ago

sbin/hammer: fix counter-intuitive output of hammer show command

- Change 'hammer show' ELM output to match the comparison order in the
RB tree cmp functions.

Closes: #2755

History

#1 Updated by tuxillo about 2 years ago

  • Target version set to 4.2.x

Grab

#2 Updated by tuxillo about 2 years ago

  • Assignee set to tuxillo

#3 Updated by tkusumi about 2 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF