hammer2 - Complete core hardlink support work
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 17 May 2012 08:36:51 +0000 (01:36 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 17 May 2012 08:53:05 +0000 (01:53 -0700)
commit99535653ccb7716d134cce6e0a9c44ddb4e193d6
treee10e97c217c289788ef02bb7e2fb4fbd7d9d29b7
parent2b4ac3bc0504cf78ff043d21c4966d9d71661cf1
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
match.

* 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.
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_disk.h
sys/vfs/hammer2/hammer2_inode.c
sys/vfs/hammer2/hammer2_subr.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/hammer2/hammer2_vnops.c