git: hammer2 hammer2 - Complete core hardlink support work

Matthew Dillon dillon at
Thu May 17 01:53:16 PDT 2012

commit 99535653ccb7716d134cce6e0a9c44ddb4e193d6
Author: Matthew Dillon <dillon at>
Date:   Thu May 17 01:36:51 2012 -0700

    hammer2 - Complete core hardlink support work
    This implements core hardlink support for hammer2.  In order to maintain the
    strict bottom-up block modification hierarchy for the chains hardlinks must
    be implemented with special forwarding inodes.
    When a hardlink is created (nlinks 1->2) the file is replaced with a
    forwarding entry and then recreated as a special hidden directory entry
    indexed by its inode number at a higher directory level which is common
    to all hardlinks to that file.
    The forwarding entry simply specifies the inode number, thus our ability to
    trivially snapshot a PFS is retained.
    Since the real inode is indexed at a higher common directory locating the
    real inode simply requires iterating parent directories until we find a
    * Default vfs.hammer2.hardlink_enable to 1 (enabled).
    * Track and adjust nlinks.
    * Implement OBJTYPE_HARDLINK forwarding directory entry, hidden inode,
      vnode->v_data inode replacement for the nlinks 1->2 case, and hidden
      inode deletion for the nlinks 1->0 case.
    * The deconsolidation for the nlinks 2->1 case is not yet implemented.

Summary of changes:
 sys/vfs/hammer2/hammer2.h        |   16 +-
 sys/vfs/hammer2/hammer2_chain.c  |    6 +-
 sys/vfs/hammer2/hammer2_disk.h   |    2 +-
 sys/vfs/hammer2/hammer2_inode.c  |  432 ++++++++++++++++++++++++++++++++++----
 sys/vfs/hammer2/hammer2_subr.c   |    7 +-
 sys/vfs/hammer2/hammer2_vfsops.c |    2 +-
 sys/vfs/hammer2/hammer2_vnops.c  |   47 +++--
 7 files changed, 442 insertions(+), 70 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list