git: hammer2 - hook up aggregate stats

Matthew Dillon dillon at
Wed May 27 16:23:20 PDT 2015

commit 29cbd7e5bb57f35203ae0be16d2b01dfdc4d59b0
Author: Matthew Dillon <dillon at>
Date:   Wed May 27 16:04:24 2015 -0700

    hammer2 - hook up aggregate stats
    * Keep track of data and inode use for the entire sub-tree in the
      blockref.  Since H2 is a copy-on-write filesystem, this winds up
      being trivial now that we have room in the blockref to store the
      Tracking is synchronized by the filesystem flush and requires no
      additonal I/O.  If you've just written something and want to check
      use, you do have to 'sync' first (or wait for the normal filesystem
    * Gives hammer2 the ability to report inode and data use for a
      sub-tree without having to traverse it.
    * Actual data storage use is reported, not cumulative logical file
      size, so the user can immediately see the effects of e.g. compression
      and data block size selection by the filesystem.
    * hammer2 stat <file_or_dir> will report use as of the most recent
      filesystem sync.
      PATH                            ncp  data-use inode-use comp kaddr
      /mnt/src00               0    0.86GB     41818 comp=lz4:default check=crc32
      /mnt/src00/Makefile_upg* 0   24.00KB         0 comp=lz4:default check=crc32
      /mnt/src00/bin           0    2.63MB       476 comp=lz4:default check=crc32
      /mnt/src00/contrib       0  169.98MB     15198 comp=lz4:default check=crc32
      /mnt/src00/lib           0   29.82MB      3617 comp=lz4:default check=crc32
      ls -la /mnt/src00/
      ... 1 dillon  wheel  90795 Apr 29 21:23 /mnt/src00/
      In the media dump we find that H2 was able to compress the 90KB file into a 16KB block and an 8KB block (the low byte
      of the data offset is the storage radix), for 24KB total.  And indeed, the
      stats from the hammer2 stat command above indicate 24KB of storage used
      for that file.
          data.0   0000000043d8800e 0000000000000000/16 mir=0000000000000025
    			mod=000000000000001b (meth 22)
          data.1   0000000043d84c0d 0000000000010000/16 mir=0000000000000025
    			mod=000000000000001b (meth 22)

Summary of changes:
 sbin/hammer2/cmd_debug.c        |  5 ++++-
 sbin/hammer2/cmd_stat.c         |  6 +++---
 sys/vfs/hammer2/hammer2_chain.c | 22 ++++++++++++++++++++++
 sys/vfs/hammer2/hammer2_ioctl.c | 12 +++++++-----
 sys/vfs/hammer2/hammer2_ioctl.h |  2 ++
 5 files changed, 38 insertions(+), 9 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list