git: hammer2 - Refactor dedup, fixes, optimizations

Matthew Dillon dillon at
Thu Aug 24 03:49:09 PDT 2017

commit 3d4f397a6161517fc47af871d6b9cbcc5e6b9443
Author: Matthew Dillon <dillon at>
Date:   Thu Aug 24 03:38:37 2017 -0700

    hammer2 - Refactor dedup, fixes, optimizations
    * Refactor the dedup code, reducing tracking complexity.  Also note that
      we cannot really depend on VM page caching for dedup tests.  Document why
      using bread() is better.
    * Use a larger dedup heuristic table to improve dedup matching.
    * Improve hammer2_io_getquick(), fix a bug where the dedup_delete code
      was improperly using it and could sometimes miss a dio structure due
      to the underlying buffer not being fully cached.
    * Cap out at 16KB indirect blocks, instead of 64KB indirect blocks.  This
      significantly reduces meta-data overheads.
    * For now remove IO invalidation, it was causing corruption due to bugs.
      This means that deleted meta-data will be flushed.  However, a certain
      amount of meta-data does not get immediately instantiated and file data
      chains are not instantiated unless the buffer cache gets flushed, so
      temporary files are still pretty cheap.
    * Try to improve DIO's LRU recycling.
    * Fix a brelse() that was supposed to be a bqrelse().  This improves
      meta-data caching which is desirable for dedup.
    * Implement the 'always_compress' sysctl which disables the H2 compression
      heuristic that tries to detect uncompressable data.  If set, H2 will always
      try to compress.

Summary of changes:
 sbin/hammer2/hammer2.8             |  28 ++++++
 sys/vfs/hammer2/hammer2.h          |  34 +++++---
 sys/vfs/hammer2/hammer2_bulkfree.c |  56 +++++++-----
 sys/vfs/hammer2/hammer2_chain.c    |  57 +++++++-----
 sys/vfs/hammer2/hammer2_flush.c    |  28 +++---
 sys/vfs/hammer2/hammer2_io.c       | 170 ++++++++++++++++++------------------
 sys/vfs/hammer2/hammer2_strategy.c | 172 ++++++++++++++++++++++++++++++-------
 sys/vfs/hammer2/hammer2_vfsops.c   |   8 ++
 8 files changed, 368 insertions(+), 185 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list