git: hammer2 - performance pass

Matthew Dillon dillon at
Wed Sep 20 23:55:02 PDT 2017

commit 6aaf5cb056c245e31c88b76173b180ac450e9a64
Author: Matthew Dillon <dillon at>
Date:   Wed Sep 20 23:49:51 2017 -0700

    hammer2 - performance pass
    * Get rid of vfs.hammer2.cluster_write and stop using cluster_write()
      for the block device I/O.  This coupled into common unlock/lock
      situations on chains which would acquire and retire the DIO, and
      usually thus also the underlying buffer, many times before it
      really needed to be committed.
      This greatly reduces unnecessary writes to disk.
    * Increase HAMMER2_FLUSH_DEPTH_LIMIT to 60.  It was set to 10 for
      debugging purposes.  This created an O(N^2) overhead situation
      in hammer2_flush().  20,000 dirty inodes would translate to
      30 million chain scans, resulting in cpu-bound stalls for long
      periods of time.
      Fixing this value reduces a 20,000 dirty inode flush to around
      200,000 chain scans (100x faster).
    * Use hammer2_chain_ref_hold() and hammer2_chain_drop_unhold()
      to reduce the amount of buffer cache buffer cycling that occurs
      during a flush, by retaining the DIO associated with a parent
      chain across its unlock/recurse/relock sequence.
      The number of buffers held locked is limited by the flush recursion

Summary of changes:
 sys/vfs/hammer2/hammer2.h        |  1 -
 sys/vfs/hammer2/hammer2_flush.c  | 57 +++++++++++++++++++++++++++++++++++++---
 sys/vfs/hammer2/hammer2_io.c     | 29 ++++++++++++++------
 sys/vfs/hammer2/hammer2_vfsops.c |  3 ---
 4 files changed, 74 insertions(+), 16 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list