git: sbin/hammer: Make hammer blockmap ignore zone=15 unless -vv

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Mon Mar 21 13:36:32 PDT 2016


commit 320e300762007b5ce193a2bc349f149baffc1751
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Mon Mar 21 19:12:08 2016 +0900

    sbin/hammer: Make hammer blockmap ignore zone=15 unless -vv
    
    hammer blockmap ignoring UNAVAIL blockmaps for layer1 entries
    is default behavior, but ignoring UNAVAIL zones for layer2 is
    not default behavior. hammer blockmap will print bunch of lines
    with zone=15 (HAMMER_ZONE_UNAVAIL_INDEX) unless the volume size
    is (4*n)TB or somewhere close to but smaller than (4*n)TB.
    
    This commit makes it suppress zone=15 unless -vv or more,
    which also means this commit changes default behavior of this
    command.
    
    Suppressing zone=15 means it ignores layer2 entries mapped to
    beyond the volume capacity. This is useful if the purpose of
    running hammer blockmap is only to see blockmap mappings for
    available (physically existing) big-blocks, and the volume is
    much smaller than 4TB. This way you don't get to see bunch of
    zone=15 that don't really tell you anything other than crc.
    
    This is usually faster and smaller too, though real users will
    almost never use this command anyway.
    
      volume #0 layer1 #0
      0   111GB            4TB
      |---|----------------|
       <-> <-------------->
        |   zone=15
        zone=4,3,8,9,10,11
    
      volume #1 layer1 #0 (layer1 #1024)
      0   111GB            4TB
      |---|----------------|
       <-> <-------------->
        |   zone=15
        zone=4,8,9,10,11
    
      volume #2 layer1 #0 (layer1 #2048)
      0   111GB            4TB
      |---|----------------|
       <-> <-------------->
        |   zone=15
        zone=4,8,9,10,11
    
      # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 | grep DEVICE
      Volume 0 DEVICE /dev/da1        size 111.79GB
      Volume 1 DEVICE /dev/da2        size 111.79GB
      Volume 2 DEVICE /dev/da3        size 111.79GB
      # time hammer -v -f /dev/da1:/dev/da2:/dev/da3 blockmap > out1
      hammer -v -f /dev/da1:/dev/da2:/dev/da3 blockmap > out1  0.10s user 0.02s system 60% cpu 0.205 total
      # time hammer -vv -f /dev/da1:/dev/da2:/dev/da3 blockmap > out2
      hammer -vv -f /dev/da1:/dev/da2:/dev/da3 blockmap > out2  2.10s user 0.99s system 87% cpu 3.519 total
      # ls -lh out1 out2
      -rw-r--r--  1 root  wheel   5.8M Mar 21 20:10 out1
      -rw-r--r--  1 root  wheel   215M Mar 21 20:10 out2
    
    Not too much difference if the volume is large enough.
    Using 4.5TiB volume means hammer blockmap -vv can suppress
    zone=15 for approximately 3.5TiB of address space from output,
    but it contains blockmaps for 4.5TiB by default.
    
      volume #0 layer1 #0/#1
      0                    4TB 4.5TB            8TB
      |--------------------|---|----------------|
       <----------------------> <-------------->
        zone=4,3,8,9,10,11       zone=15
    
      # newfs_hammer -L TEST /dev/da4 | grep DEVICE
      Volume 0 DEVICE /dev/da4        size   4.55TB
      # time hammer -v -f /dev/da4 blockmap > out1
      hammer -v -f /dev/da4 blockmap > out1  0.95s user 0.24s system 68% cpu 1.755 total
      # time hammer -vv -f /dev/da4 blockmap > out2
      hammer -vv -f /dev/da4 blockmap > out2  1.66s user 0.49s system 89% cpu 2.385 total
      # ls -lh out1 out2
      -rw-r--r--  1 root  wheel    81M Mar 21 20:18 out1
      -rw-r--r--  1 root  wheel   143M Mar 21 20:19 out2

Summary of changes:
 sbin/hammer/cmd_blockmap.c | 4 ++++
 1 file changed, 4 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/320e300762007b5ce193a2bc349f149baffc1751


-- 
DragonFly BSD source repository


More information about the Commits mailing list