freebsd-nq/sys/ufs/ufs
David Malone 527f5ce021 Two minor changes to dirhash, which result in some marginal benchmark
improvements.

1) If deleting an entry results in a chain of deleted slots ending in an
   empty slot, then we can be a bit more aggressive about marking slots as
   empty.

2) The last stage of the FNV hash is to xor the last byte of data
   into the hash. This means that filenames which differ only in
   the last byte will be placed close to one another in the hash
   table, which forms longer chains. To work around this common
   case, we also hash in the address of the dirhash structure.

     news/cancel = news/articles/control/cancel for a tradspool inn server
     squid2 = squid level 2 directory (dirs called 00->FF)
     squid3 = squid level 3 directory (files called 00001F00->00001FFF)

                             mean #probes for
                  home dir  mh inbox  news/cancel  tmp    squid2  squid3
old   successful  1.02      3.19      4.07         1.10    7.85   2.06
new   successful  1.04      1.32      1.27         1.04    1.93   1.17

old unsuccessful  1.08      4.50      5.37         1.17   10.76   2.69
new unsuccessful  1.08      1.73      1.64         1.17    2.89   1.37

Reviewed by:	iedowse
MFC after:	2 weeks
2002-03-20 17:58:02 +00:00
..
acl.h Remove __P. 2002-03-19 22:40:48 +00:00
dinode.h Remove di_inumber since LFS is long gone. 2002-02-10 00:55:49 +00:00
dir.h
dirhash.h Return a locked struct buf from ufsdirhash_lookup() to avoid one 2001-07-13 20:50:38 +00:00
extattr.h o Update copyright dates. 2001-11-01 21:37:07 +00:00
inode.h The addition of i_dirhash to struct inode pushed RELENG_4's 2001-09-24 18:29:20 +00:00
quota.h Remove __P. 2002-03-19 22:40:48 +00:00
README.acls Use 'mkdir -p /.attribute/system' instead of breaking it into 2001-11-30 15:32:07 +00:00
README.extattr Use 'mkdir -p /.attribute/system' instead of breaking it into 2001-11-30 15:21:20 +00:00
ufs_acl.c Add new errno ``ENOATTR''. 2002-03-07 15:13:44 +00:00
ufs_bmap.c Introduce the new 64-bit size disk block, daddr64_t. Change 2002-03-15 18:49:47 +00:00
ufs_dirhash.c Two minor changes to dirhash, which result in some marginal benchmark 2002-03-20 17:58:02 +00:00
ufs_extattr.c Remove references to vm_zone.h and switch over to the new uma API. 2002-03-20 08:48:07 +00:00
ufs_extern.h Remove __P. 2002-03-19 22:40:48 +00:00
ufs_ihash.c Add a flags parameter to VFS_VGET to pass through the desired 2002-03-17 01:25:47 +00:00
ufs_inode.c When downgrading a filesystem from read-write to read-only, operations 2002-01-15 07:17:12 +00:00
ufs_lookup.c Add a flags parameter to VFS_VGET to pass through the desired 2002-03-17 01:25:47 +00:00
ufs_quota.c Remove __P. 2002-03-19 22:40:48 +00:00
ufs_readwrite.c cleanup readability syntax prior to ongoing b_resid work commits. 2002-03-06 00:44:30 +00:00
ufs_vfsops.c Add a flags parameter to VFS_VGET to pass through the desired 2002-03-17 01:25:47 +00:00
ufs_vnops.c Remove __P. 2002-03-19 22:40:48 +00:00
ufsmount.h Remove __P. 2002-03-19 22:40:48 +00:00

$FreeBSD$

  UFS Extended Attributes Copyright

The UFS Extended Attributes implementation is copyright Robert Watson, and
is made available under a Berkeley-style license.

  About UFS Extended Attributes

Extended attributes allow the association of additional arbitrary
meta-data with files and directories.  Extended attributes are defined in
the form name=value, where name is an nul-terminated string in the style
of a filename, and value is a binary blob of zero or more bytes. The UFS
extended attribute service layers support for extended attributes onto a
backing file, in the style of the quota implementation, meaning that it
requires no underlying format changes in the file system.  This design
choice exchanges simplicity, usability and easy deployment for
performance.  When defined, extended attribute names exist in a series of
disjoint namespaces: currently, two namespaces are defined:
EXTATTR_NAMESPACE_SYSTEM and EXTATTR_NAMESPACE_USER.  The primary
distinction lies in the protection model: USER EAs are protected using the
normal inode protections, whereas SYSTEM EAs require privilege to access
or modify.

  Using UFS Extended Attributes

Support for UFS extended attributes may be enabled by adding:

	options UFS_EXTATTR

to your kernel configuration file.  This allows UFS-based file systems to
support extended attributes, but requires manual administration of EAs
using the extattrctl tool, including the starting of EA support for each
file system, and the enabling of individual attributes for the file
system.  The extattrctl utility may be used to initialize backing files
before first use, to start and stop EA service on a file system, and to
enable and disable named attributes.  The command lines for extattrctl
take the following forms:

  extattrctl start [path]
  extattrctl stop [path]
  extattrctl initattr [-f] [-p path] [attrsize] [attrfile]
  extattrctl enable [path] [attrnamespace] [attrname] [attrfile]
  extattrctl disable [path] [attrnamespace] [attrname]

In each case, [path] is used to indicate the mounted file system on which
to perform the operation.  [attrnamespace] refers to the namespace in
which the attribute is being manipulated, and may be "system" or "user".  
The [attrname] is the attribute name to use for the operation. The
[attrfile] argument specifies the attribute backing file to use. When
using the "initattr" function to initialize a backing file, the maximum
size of attribute data must be defined in bytes using the [attrsize]
field.  Optionally, the [-p path] argument may be used to indicate to
extattrctl that it should pre-allocate space for EA data, rather than
creating a sparse backing file.  This prevents attribute operations from
failing in low disk-space conditions (which can be important when EAs are
used for security purposes), but pre-allocation will consume space
proportional to the product of the defined maximum attribute size and
number of attributes on the specified file system.

Manual configuration increases administrative overhead, but also
introduces the possibility of race conditions during file system mount, if
EAs are used to support other features, as starting the EAs manually is
not atomic with the mount operation.  To address this problem, an
additional kernel option may be defined to auto-start EAs on a UFS file
system based on special directories at mount-time:

	options UFS_EXTATTR_AUTOSTART

If this option is defined, UFS will search for a ".attribute"
sub-directory of the file system root during the mount operation.  If it
is found, EA support will be started for the file system.  UFS will then
search for "system" and "user" sub-directories of the ".attribute"
directory for any potential backing files, and enable an EA for each valid
backing file with the name of the backing file as the attribute name.  
For example, by creating the following tree, the two EAs,
posix1e.acl_access and posix1e.acl_default will be enabled in the system
namespace of the root file system, reserving space for attribute data:

  mkdir -p /.attribute/system
  cd /.attribute/system
  extattrctl initattr -p / 388 posix1e.acl_access
  extattrctl initattr -p / 388 posix1e.acl_default

On the next mount of the root file system, the attributes will be
automatically started.