hammer2 - hook up aggregate stats
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 27 May 2015 23:04:24 +0000 (16:04 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 27 May 2015 23:21:35 +0000 (16:21 -0700)
commit29cbd7e5bb57f35203ae0be16d2b01dfdc4d59b0
tree753085d0619a202b5d18dd4df517cb927d3f71d2
parent5cebbe36266c384e5bb3f6a9a2364cdd7d750fe1
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
  info.

  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
  flush).

* 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/Makefile_upgrade.inc
  ... 1 dillon  wheel  90795 Apr 29 21:23 /mnt/src00/Makefile_upgrade.inc

  In the media dump we find that H2 was able to compress the 90KB
  Makefile_upgrade.inc 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)
sbin/hammer2/cmd_debug.c
sbin/hammer2/cmd_stat.c
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_ioctl.c
sys/vfs/hammer2/hammer2_ioctl.h