git: hammer2 - live dedup, cleanup

Matthew Dillon dillon at
Sat Aug 29 23:52:12 PDT 2015

commit 3f01ebaaf512c09685f0f7b8bfec3b47bbd1e72a
Author: Matthew Dillon <dillon at>
Date:   Sat Aug 29 20:02:14 2015 -0700

    hammer2 - live dedup, cleanup
    * First attempt at a live dedup.  The H2 strategy code now caches
      {data_off, crc} info to track recently accessed data blocks.  The
      cache is checked in the strategy_write code after device-level
      block encoding.  If we get a cache hit, the disk block is compared
      against the write data and reused if it matches.
    * This 'live' dedup should catch most typical 'cp' or 'cpdup' style
      commands.  There will also be a bulk dedup capable of catching
    * Note that 'df' output might be a bit confusing because the 'Used'
      field represents the topology and does not take into account dedups.
      'Avail' is calculated from the actual freemap.  To make things look
      right the total disk size is adjusted upward so it matches
      Used+Avail.  This mechanism will likely change.
      Here is an example with one copy of /usr/src and 13 copies of /usr/src.
      The first copy eats around 872MB, and a 'du' will show each copy eating
      about the same.  But because of dedup each subsequent copy actually only
      eats around 160MB as you can see from the 'Avail' field:
        test40# df -h /mnt
        Filesystem                             Size   Used  Avail Capacity
        /dev/serno/WD-WX51A82J2299.s1f at LOCAL    99G   934M    99G     1%
        Filesystem                             Size   Used  Avail Capacity
        /dev/serno/WD-WX51A82J2299.s1f at LOCAL   106G   8.5G    97G     8%
    * Rename hammer2_bulkscan.c to hammer2_bulkfree.c since that is
      basically all it does.
    * Move the synchronization code to its own file, hammer2_synchro.c.
      (note: This code is currently in rip-up mode and will not operate

Summary of changes:
 sys/vfs/hammer2/Makefile                           |   3 +-
 sys/vfs/hammer2/hammer2.h                          |  79 +-
 .../{hammer2_bulkscan.c => hammer2_bulkfree.c}     |   2 +-
 sys/vfs/hammer2/hammer2_chain.c                    |  62 +-
 sys/vfs/hammer2/hammer2_flush.c                    |   2 +-
 sys/vfs/hammer2/hammer2_freemap.c                  |  16 +-
 sys/vfs/hammer2/hammer2_inode.c                    |  10 +-
 sys/vfs/hammer2/hammer2_io.c                       | 203 ++++-
 sys/vfs/hammer2/hammer2_ioctl.c                    |   2 +-
 sys/vfs/hammer2/hammer2_strategy.c                 | 199 ++++-
 .../{hammer2_thread.c => hammer2_synchro.c}        | 881 +--------------------
 sys/vfs/hammer2/hammer2_thread.c                   | 807 +------------------
 sys/vfs/hammer2/hammer2_vfsops.c                   |   9 +
 sys/vfs/hammer2/hammer2_vnops.c                    |   3 +
 sys/vfs/hammer2/hammer2_xops.c                     |  12 +-
 15 files changed, 506 insertions(+), 1784 deletions(-)
 rename sys/vfs/hammer2/{hammer2_bulkscan.c => hammer2_bulkfree.c} (99%)
 copy sys/vfs/hammer2/{hammer2_thread.c => hammer2_synchro.c} (50%)

DragonFly BSD source repository

More information about the Commits mailing list