git: hammer2 - freemap part 4, misc fixes

Matthew Dillon dillon at
Thu Jun 13 00:19:04 PDT 2013

commit 93f3933ac3e2ad37a7ba775663c711b13588f147
Author: Matthew Dillon <dillon at>
Date:   Thu Jun 13 00:11:04 2013 -0700

    hammer2 - freemap part 4, misc fixes
    * Revamp the freemap a bit.  Remove Layer 0.  Layer 1 is now the LEAF.
      2GB of media storage is now represented by a single 64KB Layer 1 block.
      Synchronize the FREEMAP document with the current thinking.
      The Layer 1 block contains 1024x64 entries.  Each entry represents 2MBytes
      of media storage.  These entries are no longer blockrefs pointing to
      Layer 0 but are instead terminal structures.
    * Each entry represents a 16KB allocation granularity in 2 bits and has
      128 bit pairs (256 bits total), plus additional information to represent
      the 2MBytes of storage.
      Fine-grained allocations are supported via an iterator field, currently
      allowing fine-grained allocations down to 1KB and potentially expandable
      in the future to even smaller allocation sizes.
    * Fix a SMP race in voldata handling during flush.  The freemap portion of
      voldata could be updated during crc calculations due to hmp->fchain not
      being held locked, causing random volume header/backups to fail their CRC
      test on remount.
    * Add missing BUF_KERNPROC() when chain->bp is replaced.  Fixes a kernel
      lock ownership assertion.
    * Add freezone/radix fields to the inode_data structure.  Each inode can
      accomodate four fields.  The fields are not yet utilized.  Current thinking
      is to use them to optimize the bulk free-scan for freeing blocks.

Summary of changes:
 sbin/hammer2/cmd_debug.c          |  36 ++-
 sbin/hammer2/cmd_stat.c           |   2 +-
 sys/vfs/hammer2/FREEMAP           | 198 ++++++++----
 sys/vfs/hammer2/hammer2_chain.c   |  17 +-
 sys/vfs/hammer2/hammer2_disk.h    | 146 +++++----
 sys/vfs/hammer2/hammer2_flush.c   |  45 ++-
 sys/vfs/hammer2/hammer2_freemap.c | 629 +++++++++++++++++---------------------
 sys/vfs/hammer2/hammer2_subr.c    |   8 +-
 8 files changed, 581 insertions(+), 500 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list