Major namecache work primarily to support NULLFS.
authorMatthew Dillon <dillon@dragonflybsd.org>
Fri, 27 Oct 2006 04:56:34 +0000 (04:56 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Fri, 27 Oct 2006 04:56:34 +0000 (04:56 +0000)
commit28623bf96348e242220bd887d979bcc6543aa7f3
tree2ed050e3733b081eb9c59dcfcf14e6bb53d58008
parent5bfd75caae8a554d0b79291940c4c0dff9aebaba
Major namecache work primarily to support NULLFS.

* Move the nc_mount field out of the namecache{} record and use a new
  namecache handle structure called nchandle { mount, ncp } for all
  API accesses to the namecache.

* Remove all mount point linkages from the namecache topology.  Each mount
  now has its own namecache topology rooted at the root of the mount point.

  Mount points are flagged in their underlying filesystem's namecache
  topology but instead of linking the mount into the topology, the flag
  simply triggers a mountlist scan to locate the mount.  ".." is handled
  the same way... when the root of a topology is encountered the scan
  can traverse to the underlying filesystem via a field stored in the
  mount structure.

* Ref the mount structure based on the number of nchandle structures
  referencing it, and do not kfree() the mount structure during a forced
  unmount if refs remain.

These changes have the following effects:

* Traversal across mount points no longer require locking of any sort,
  preventing process blockages occuring in one mount from leaking across
  a mount point to another mount.

* Aliased namespaces such as occurs with NULLFS no longer duplicate the
  namecache topology of the underlying filesystem.  Instead, a NULLFS
  mount simply shares the underlying topology (differentiating between
  it and the underlying topology by the fact that the name cache
  handles { mount, ncp } contain NULLFS's mount pointer.

  This saves an immense amount of memory and allows NULLFS to be used
  heavily within a system without creating any adverse impact on kernel
  memory or performance.

* Since the namecache topology for a NULLFS mount is shared with the
  underyling mount, the namecache records are in fact the same records
  and thus full coherency between the NULLFS mount and the underlying
  filesystem is maintained by design.

* Future efforts, such as a unionfs or shadow fs implementation, now
  have a mount structure to work with.  The new API is a lot more
  flexible then the old one.
46 files changed:
sys/emulation/linux/linux_misc.c
sys/emulation/linux/linux_stats.c
sys/emulation/linux/linux_util.c
sys/kern/imgact_elf.c
sys/kern/init_main.c
sys/kern/kern_acl.c
sys/kern/kern_descrip.c
sys/kern/kern_exec.c
sys/kern/kern_jail.c
sys/kern/kern_shutdown.c
sys/kern/uipc_usrreq.c
sys/kern/vfs_cache.c
sys/kern/vfs_conf.c
sys/kern/vfs_default.c
sys/kern/vfs_jops.c
sys/kern/vfs_journal.c
sys/kern/vfs_nlookup.c
sys/kern/vfs_syscalls.c
sys/kern/vfs_vnops.c
sys/kern/vfs_vopops.c
sys/sys/file.h
sys/sys/filedesc.h
sys/sys/jail.h
sys/sys/kern_syscall.h
sys/sys/mount.h
sys/sys/namecache.h
sys/sys/nlookup.h
sys/sys/vfsops.h
sys/sys/vnode.h
sys/vfs/gnu/ext2fs/ext2_vfsops.c
sys/vfs/hpfs/hpfs_vfsops.c
sys/vfs/isofs/cd9660/cd9660_rrip.c
sys/vfs/isofs/cd9660/cd9660_vfsops.c
sys/vfs/msdosfs/msdosfs_vfsops.c
sys/vfs/nfs/nfs_serv.c
sys/vfs/nfs/nfs_subs.c
sys/vfs/nfs/nfs_syscalls.c
sys/vfs/nfs/nfs_vnops.c
sys/vfs/ntfs/ntfs_vfsops.c
sys/vfs/nullfs/null_vfsops.c
sys/vfs/nullfs/null_vnops.c
sys/vfs/udf/udf_vfsops.c
sys/vfs/ufs/ffs_vfsops.c
sys/vfs/union/union_vfsops.c
sys/vm/vm_swap.c
usr.bin/fstat/fstat.c