git: sys/vfs/hammer: Don't try to reblock everything on volume-del

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sat Aug 22 10:53:23 PDT 2015


commit 7ef2d7b30fef99b5d4821a94f0ccc129e03af494
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Fri Aug 21 21:13:40 2015 +0900

    sys/vfs/hammer: Don't try to reblock everything on volume-del
    
    Add volume# option to reblock ioctl and use that on hammer
    volume-del instead of trying to reblock every data/node that
    the reblocker has faced.
    
    This is only used internally by hammer volume-del ioctl when
    it finds the volume-to-remove is not empty and needs to get
    reblocked. hammer reblock command does not provide an option
    to specify volume# since it shouldn't be necessary for users
    in general.
    
    This makes huge difference as it cuts extra and unnecessary
    i/o from reblocking, especially when the volume to remove
    only has small amount data in it. The following examples show
    much of the time spent on reblocking on volume-del comes from
    unnecessary i/o. Example1 spent most of the time moving data
    in /dev/da1 which wasn't necessary.
    
    Example 1 - before this commit
      # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 >/dev/null
      # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
      # dd if=/dev/zero of=/HAMMER/out bs=1000000 count=120000 >/dev/null 2>&1
      # sync; sync; sync; sync
      # df -Th /HAMMER
      Filesystem  Type     Size   Used  Avail Capacity  Mounted on
      TEST        hammer   334G   112G   222G    34%    /HAMMER
      # hammer -f /dev/da1:/dev/da2:/dev/da3 blockmap | grep -A2 layer1
        layer1 4000000000000000 @2000000000800000 blocks-free 0
              4000000000000000 zone=4  app=8388608 free=0
              4000000000800000 zone=4  app=8388608 free=0
      --
        layer1 4010000000000000 @2010000000000000 blocks-free 14145
              4010000000000000 zone=4  app=8388608 free=0
              4010000000800000 zone=10 app=8388608 free=0
      --
        layer1 4020000000000000 @2020000000000000 blocks-free 14268
              4020000000000000 zone=4  app=8388608 free=0
              4020000000800000 zone=0  app=0       free=8388608
    	  /* /dev/da1 is 100% used
    	     /dev/da2 is partially used
    	     /dev/da3 is 0% used */
      # hammer volume-blkdevs /HAMMER
      /dev/da1:/dev/da2:/dev/da3
      # time hammer volume-del /dev/da2 /HAMMER
    
      real    14m29.119s
      user    0m0.000s
      sys     7m14.388s
      # hammer volume-blkdevs /HAMMER
      /dev/da1:/dev/da3
    
    Example 2 - with this commit
      # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 >/dev/null
      # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
      # dd if=/dev/zero of=/HAMMER/out bs=1000000 count=120000 >/dev/null 2>&1
      # sync; sync; sync; sync
      # df -Th /HAMMER
      Filesystem  Type     Size   Used  Avail Capacity  Mounted on
      TEST        hammer   334G   112G   222G    34%    /HAMMER
      # hammer -f /dev/da1:/dev/da2:/dev/da3 blockmap | grep -A2 layer1
        layer1 4000000000000000 @2000000000800000 blocks-free 0
              4000000000000000 zone=4  app=8388608 free=0
              4000000000800000 zone=4  app=8388608 free=0
      --
        layer1 4010000000000000 @2010000000000000 blocks-free 14145
              4010000000000000 zone=4  app=8388608 free=0
              4010000000800000 zone=10 app=8388608 free=0
      --
        layer1 4020000000000000 @2020000000000000 blocks-free 14268
              4020000000000000 zone=4  app=8388608 free=0
              4020000000800000 zone=0  app=0       free=8388608
    	  /* /dev/da1 is 100% used
    	     /dev/da2 is partially used
    	     /dev/da3 is 0% used */
      # hammer volume-blkdevs /HAMMER
      /dev/da1:/dev/da2:/dev/da3
      # time hammer volume-del /dev/da2 /HAMMER
    
      real    0m8.139s
      user    0m0.000s
      sys     0m4.177s
      # hammer volume-blkdevs /HAMMER
      /dev/da1:/dev/da3

Summary of changes:
 sbin/hammer/cmd_reblock.c       |  1 +
 sys/vfs/hammer/hammer_ioctl.h   |  3 ++-
 sys/vfs/hammer/hammer_reblock.c | 18 ++++++++++++++++++
 sys/vfs/hammer/hammer_volume.c  |  5 +++++
 4 files changed, 26 insertions(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7ef2d7b30fef99b5d4821a94f0ccc129e03af494


-- 
DragonFly BSD source repository



More information about the Commits mailing list