git: hammer2 - Adjust blockref to create an embedded area, start dirent work

Matthew Dillon dillon at
Mon Jul 24 19:21:52 PDT 2017

commit 6d9d83d8169ddea0b9680b376a850934a456bb55
Author: Matthew Dillon <dillon at>
Date:   Sun Jul 23 00:57:20 2017 -0700

    hammer2 - Adjust blockref to create an embedded area, start dirent work
    * Create a type-specific embedded area in the blockref structure.  Move
      data_count and inode_count into the new area.  The blockref structure
      size does not change.
    * Adjust code to access data_count and inode_count conditionally for
      BREF_TYPE_INODE, DATA, and INDIRECT types only.
    * Now that we have abandoned embedding inodes directly in directories for
      normal operation, start working on removing HAMMER2_OBJTYPE_HARDLINK and
      creating a real directory entry abstraction.
      The real directory entry abstraction will allow directory entries to be
      directly embedded in blockref structures, without requiring a data
      reference for any filename <= 64 bytes.  This will be accomplished by
      using the new embedded area in the blockref for the directory entry
      header and the check area for the filename (up to 64 bytes).
      This will significantly improve directory compactness and I/O efficiency
      by reducing the directory entry overhead from 1152 bytes (1024 + 128) to
      just 128 bytes and guaranteeing locality since the blockrefs are
      collected together in indirect blocks.  Another nice facet is that since
      inodes can embed up to four direct blockrefs, any directory with <=
      4 entries in it can embed those entries in the directory inode itself.
      So small directories will wind up being VERY compact.
      We haven't entirely abandoned embedding inodes in directories as
      directory entries.  In fact, the feature is still used for superroot
      entries, and may be allowed in the future mixed into normal directories
      for 'special' non-hardlinkable directory inodes for quota control,
      snapshot, and (NFS) export purposes.

Summary of changes:
 sbin/newfs_hammer2/newfs_hammer2.8 | 26 +++++++++++--------
 sys/vfs/hammer2/hammer2_chain.c    | 52 +++++++++++++++++++++++++++-----------
 sys/vfs/hammer2/hammer2_disk.h     | 44 ++++++++++++++++++++++++++++++--
 sys/vfs/hammer2/hammer2_ioctl.c    | 14 +++++++---
 sys/vfs/hammer2/hammer2_vfsops.c   | 18 ++-----------
 sys/vfs/hammer2/hammer2_vnops.c    |  7 +++--
 6 files changed, 112 insertions(+), 49 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list