libc - Add 'xlink' chflags
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 17 Nov 2015 23:19:42 +0000 (15:19 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 17 Nov 2015 23:52:55 +0000 (15:52 -0800)
commitb6222364e241f64d64a813e7558a7499ad9242ea
treea6d161ef330a08177d8d9d8c1f55f76b12f960f6
parentfa6e846f31bb4e1ca0093c707bd2d2080526939c
libc - Add 'xlink' chflags

* Add the xlink flag.  This will be used by hammer2 to demark boundaries
  where cross-link hardlinks will not be allowed.  In otherwords, this tells
  hammer2 how far up the directory tree it has to store the inode used for
  a hardlink.

* Automatically set the xlink flag for /*, /usr/*, and /var/*.

* Note that for the case where all hardlinks are situated in the same
  directory, hammer2 will place the hardlink inode in that directory.
  It is when hardlinks cross directories that hammer2 has to emplace the
  target inode in some parent directory where it can find it.  This is
  where the xlink flag helps.

  It is not required to use the xlink flag, but if you have cross-directory
  hardlinks in hammer2 and you do not use the flag the inodes for those
  hardlinks will be consolidated at the root of the mount which will have
  obvious performance issues and cause snapshots of subdirectories to be
  imprecise because they won't cover the hardlink target.

* Represents a trade-off for a very difficult problem that I haven't been
  able to solve.  While HAMMER2 can easily calculate a common parent
  directory for the hardlink target inode when hardlinks are created or
  deleted or renamed, problems arise when a directory in the directory
  path leading from that point to the hardlink is radically moved within
  the larger directory hierarchy, breaking the ability for hammer2 to locate
  the hardlink target using the above method.

  Rather than force hardlinks to be stored in the root of the mount, which
  reduces the usefulness of subdirectory snapshots, this new mechanism is
  being added to give the sysop the ability to retain nearly all the
  advantages of hardlinks without losing the ability to snapshot reasonable
  subdirectory elements.
etc/Makefile
lib/libc/gen/strtofflags.c
sys/sys/stat.h