git: hammer2 - Initial HARDLINK -> DIRENT replacement code

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Jul 24 19:21:52 PDT 2017


commit da0cdd33148ab3e3c227355de759c595c533841a
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Jul 24 19:05:33 2017 -0700

    hammer2 - Initial HARDLINK -> DIRENT replacement code
    
    * Initial removal of the vestiges of the old embedded inode code.  Inodes
      were moved to the root directory long ago but directories still contain
      dummy OBJTYPE_HARDLINK inodes instead of real directory entries to point
      to the moved inodes.  These inodes ate 1024 bytes of disk space for each
      directory entry.
    
    * Remove the dummy OBJTYPE_HARDLINK inodes and replace with new
      BREF_TYPE_DIRENT blockrefs.  These blockrefs represent directory
      entries, and the entire dirent will fit in the blockref (requiring
      no data ref) if the filename is <= 64 bytes.
    
    * This new DIRENT mechanic significantly improves performance and reduces
      storage overage vs the previous mechanicn, for obvious reasons.
    
      Directory entries are now 128 bytes instead of 1024 bytes, and since they
      are collected together in indirect blocks or (if <= 4 entries) simply
      placed in the 4 blockrefs embedded in the directory inode, the related
      I/O tends to be fairly optimal.
    
      Only directory entries whos filenames are > 64 bytes long require an
      additional data block reference.  For now, due to other constraints,
      we use the minimum H2 allocation size of 1KB for these, so certainly
      space is wasted.  But in real life there aren't actually a whole lot
      of filenames that are that long so it should be fine.

Summary of changes:
 lib/libstand/hammer2.c             | 134 ++++++++++++++++++-----
 sbin/hammer2/cmd_debug.c           |  47 ++++++---
 sbin/hammer2/subs.c                |   2 -
 sys/vfs/hammer2/hammer2.h          |  25 +++--
 sys/vfs/hammer2/hammer2_bulkfree.c |   1 +
 sys/vfs/hammer2/hammer2_chain.c    | 211 +++++++++++++++++++++++++++----------
 sys/vfs/hammer2/hammer2_disk.h     |  15 +--
 sys/vfs/hammer2/hammer2_flush.c    |  10 ++
 sys/vfs/hammer2/hammer2_freemap.c  |  21 +++-
 sys/vfs/hammer2/hammer2_inode.c    | 192 +++++++++++++++++++++++++++++----
 sys/vfs/hammer2/hammer2_io.c       |   1 +
 sys/vfs/hammer2/hammer2_ioctl.c    |  11 +-
 sys/vfs/hammer2/hammer2_strategy.c |   4 +-
 sys/vfs/hammer2/hammer2_subr.c     |  24 +++--
 sys/vfs/hammer2/hammer2_synchro.c  |  46 ++++----
 sys/vfs/hammer2/hammer2_vfsops.c   |   1 +
 sys/vfs/hammer2/hammer2_vnops.c    |  82 +++++++-------
 sys/vfs/hammer2/hammer2_xops.c     | 180 +++++++++++++++++--------------
 18 files changed, 709 insertions(+), 298 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/da0cdd33148ab3e3c227355de759c595c533841a


-- 
DragonFly BSD source repository


More information about the Commits mailing list