freebsd-dev/cmd
Matthew Ahrens d586964141 Illumos #3641 compressed block histograms with zdb
This patch is a zdb extension of the '-b' option, producing a histogram
of the physical compressed block sizes per DMU object type on disk. The
'-bbbb' option to zdb will uncover this new feature; here's an example
usage on a new pool and snippet of the output it generates:

    # zpool create tank /dev/vd{b,c,d}
    # dd bs=1k  if=/dev/urandom of=/tank/1kfile  count=1
    # dd bs=3k  if=/dev/urandom of=/tank/3kfile  count=1
    # dd bs=64k if=/dev/urandom of=/tank/64kfile count=1
    # zdb -bbbb tank
    ...
         3  68.0K   68.0K   68.0K   22.7K    1.00    34.26  ZFS plain file
    psize (in 512-byte sectors): number of blocks
                              2:      1 *
                              3:      0
                              4:      0
                              5:      0
                              6:      1 *
                              7:      0
    ...
                            127:      0
                            128:      1 *
    ...

The blocks are also broken down by their indirection level. Expanding on
the above example:

    # zfs set recordsize=1k tank
    # dd bs=1k if=/dev/urandom of=/tank/2x1kfile count=2
    # zdb -bbbb tank
    ...
         1    16K      1K      2K      2K   16.00     1.02      L1 ZFS plain file
    psize (in 512-byte sectors): number of blocks
                              2:      1 *
         5  70.0K   70.0K   70.0K   14.0K    1.00    35.71      L0 ZFS plain file
    psize (in 512-byte sectors): number of blocks
                              2:      3 ***
                              3:      0
                              4:      0
                              5:      0
                              6:      1 *
                              7:      0
    ...
                            127:      0
                            128:      1 *
         6  86.0K   71.0K   72.0K   12.0K    1.21    36.73  ZFS plain file
    psize (in 512-byte sectors): number of blocks
                              2:      4 ****
                              3:      0
                              4:      0
                              5:      0
                              6:      1 *
                              7:      0
    ...
                            127:      0
                            128:      1 *
    ...

There's now a single 1K L1 block which is the indirect block needed for
the '2x1kfile' file just created, as well as two more 1K L0 blocks from
the same file.

This can be used to get a distribution of the block sizes used within
the pool, on a per object type basis.

References:
  https://illumos.org/issues/3641
  https://github.com/illumos/illumos-gate/commit/490d05b

Ported by: Tim Chase <tim@chase2k.com>
Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Boris Protopopov <boris.protopopov@me.com>
Closes #2456
2014-07-16 11:52:46 -07:00
..
arcstat sighandler() should take 2 arguments 2014-03-20 11:03:46 -07:00
dbufstat Python 3 fixes 2013-11-08 14:30:29 -08:00
fsck_zfs Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
mount_zfs Add full SELinux support 2013-12-19 10:37:31 -08:00
vdev_id vdev_id: support per-channel slot mappings 2014-01-17 11:17:54 -08:00
zdb Illumos #3641 compressed block histograms with zdb 2014-07-16 11:52:46 -07:00
zed Replace zed_file_create_dirs() with mkdirp() 2014-04-09 13:32:54 -07:00
zfs Only automatically mount a clone when 'canmount == on'. 2014-06-06 12:30:35 -07:00
zhack Add missing libzfs_core to Makefiles 2013-11-20 15:44:15 -08:00
zinject Make command line guid parsing more tolerant 2014-04-02 13:10:08 -07:00
zpios Fix error message in zpios 2014-01-29 15:11:56 -08:00
zpool Add information about the -o option to zpool replace 2014-06-27 08:31:07 -07:00
zstreamdump Remove superfluous statement 2014-05-30 17:02:37 -07:00
ztest ztest: Switch to LWP rwlock interface 2014-05-01 15:53:58 -07:00
zvol_id cstyle: Resolve C style issues 2013-12-18 16:46:35 -08:00
Makefile.am Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00