git: sbin/hammer: Make hammer show properly print '*' for elements that match directive

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Fri Mar 20 08:53:47 PDT 2015


commit edcc81367d0db0fcc368d69238683f756c9a17de
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Fri Mar 20 22:09:51 2015 +0900

    sbin/hammer: Make hammer show properly print '*' for elements that match directive
    
    - hammer show command (running with lo:objid directive specified)
      goes back to normal iteration once it matches the directive as
      explained in e7f926a5, however it should not do 'search = NULL;'.
      This commit adds a field btree_search::normal to do it right.
    
    - The problem with 'search = NULL;' is that when there are many files
      in a directory (e.g. dragonfly bsd source), different leaf nodes
      of the same depth could happen to have inodes and dirents with the
      same lo:objid. In this case it prints '*' only for matched records
      located under the first leaf node because by the time it comes to
      the second leaf node the pointer has been set to NULL and
      NULL won't print '*' (see line 169 and 174 of cmd_show.c).
    
    - In the following example it is expected that both leaf node 29
      and 30 print '*' for its records that match 00000001:00000001036af6f7,
      but the result is it only prints for those under leaf node 29.
      This commit does that right.
    
      show 800000005b14d000 lo 00000001 obj_id 00000001036af6f7 depth 0
      <snip>
           NODE 800000005b04e000 cnt=37 p=800000005b14e000 type=I depth=2 mirror 00000001040192b0 fill=z8:182=92% {
      G------ ELM  0 L lo=00000001 obj=000000010354f711 rt=01 key=0000000000000000 ot=00
      <snip>
      G------ ELM 29 L lo=00000001 obj=00000001036af6e9 rt=01 key=0000000000000000 ot=00
                       tids 0000000104018910:0000000000000000 suboff=8000000020fb1000 mirror 0000000104018a50  *
      G------ ELM 30 L lo=00000001 obj=00000001036af6f7 rt=11 key=66ea1f6ab72c0000 ot=00
                       tids 0000000104018a50:0000000000000000 suboff=800000005b079000 mirror 0000000104018a50  *

Summary of changes:
 sbin/hammer/cmd_show.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/edcc81367d0db0fcc368d69238683f756c9a17de


-- 
DragonFly BSD source repository



More information about the Commits mailing list