freebsd-nq/sys/fs
Poul-Henning Kamp e606a3c63e Rewamp DEVFS internals pretty severely [1].
Give DEVFS a proper inode called struct cdev_priv.  It is important
to keep in mind that this "inode" is shared between all DEVFS
mountpoints, therefore it is protected by the global device mutex.

Link the cdev_priv's into a list, protected by the global device
mutex.  Keep track of each cdev_priv's state with a flag bit and
of references from mountpoints with a dedicated usecount.

Reap the benefits of much improved kernel memory allocator and the
generally better defined device driver APIs to get rid of the tables
of pointers + serial numbers, their overflow tables,  the atomics
to muck about in them and all the trouble that resulted in.

This makes RAM the only limit on how many devices we can have.

The cdev_priv is actually a super struct containing the normal cdev
as the "public" part, and therefore allocation and freeing has moved
to devfs_devs.c from kern_conf.c.

The overall responsibility is (to be) split such that kern/kern_conf.c
is the stuff that deals with drivers and struct cdev and fs/devfs
handles filesystems and struct cdev_priv and their private liason
exposed only in devfs_int.h.

Move the inode number from cdev to cdev_priv and allocate inode
numbers properly with unr.  Local dirents in the mountpoints
(directories, symlinks) allocate inodes from the same pool to
guarantee against overlaps.

Various other fields are going to migrate from cdev to cdev_priv
in the future in order to hide them.  A few fields may migrate
from devfs_dirent to cdev_priv as well.

Protect the DEVFS mountpoint with an sx lock instead of lockmgr,
this lock also protects the directory tree of the mountpoint.

Give each mountpoint a unique integer index, allocated with unr.
Use it into an array of devfs_dirent pointers in each cdev_priv.
Initially the array points to a single element also inside cdev_priv,
but as more devfs instances are mounted, the array is extended with
malloc(9) as necessary when the filesystem populates its directory
tree.

Retire the cdev alias lists, the cdev_priv now know about all the
relevant devfs_dirents (and their vnodes) and devfs_revoke() will
pick them up from there.  We still spelunk into other mountpoints
and fondle their data without 100% good locking.  It may make better
sense to vector the revoke event into the tty code and there do a
destroy_dev/make_dev on the tty's devices, but that's for further
study.

Lots of shuffling of stuff and churn of bits for no good reason[2].

XXX: There is still nothing preventing the dev_clone EVENTHANDLER
from being invoked at the same time in two devfs mountpoints.  It
is not obvious what the best course of action is here.

XXX: comment out an if statement that lost its body, until I can
find out what should go there so it doesn't do damage in the meantime.

XXX: Leave in a few extra malloc types and KASSERTS to help track
down any remaining issues.

Much testing provided by:		Kris
Much confusion caused by (races in):	md(4)

[1] You are not supposed to understand anything past this point.

[2] This line should simplify life for the peanut gallery.
2005-09-19 19:56:48 +00:00
..
cd9660 - restore the ability to mount cd9660 filesystems as root by inverting 2005-08-14 04:19:36 +00:00
coda Merge the dev_clone and dev_clone_cred event handlers into a single 2005-08-08 19:55:32 +00:00
deadfs - Deadfs may now use the standard vop lock, get rid of dead_lock(). 2005-03-13 12:06:20 +00:00
devfs Rewamp DEVFS internals pretty severely [1]. 2005-09-19 19:56:48 +00:00
fdescfs Remove the need to forward declare statics by moving them around. 2005-08-10 07:08:14 +00:00
fifofs Assert that (vp) is locked in fifo_close(), since we rely on the 2005-09-18 10:44:50 +00:00
hpfs Unbreak hpfs/ntfs/udf/ext2fs/reiserfs mounting. 2005-09-03 20:23:41 +00:00
msdosfs Ensure the full value is written into inode variables. 2005-09-07 10:32:58 +00:00
ntfs Cast bf_sysid to const char * when passing it to strncmp(), because 2005-09-11 16:02:14 +00:00
nullfs Handle a race condition where NULLFS vnode can be cleaned while threads 2005-09-15 19:21:26 +00:00
nwfs Do not dereference dvp pointer before doing a NULL check. 2005-05-11 19:08:38 +00:00
portalfs - We no longer have to bother with PDIRUNLOCK, lookup() handles it for us. 2005-03-28 09:34:36 +00:00
procfs Jumbo-commit to enhance 32 bit application support on 64 bit kernels. 2005-06-30 07:49:22 +00:00
pseudofs Eliminate an unnecessary bcopy(). 2005-08-12 12:22:05 +00:00
smbfs Staticize a symbol used only in this file. 2005-05-06 20:47:09 +00:00
udf Unbreak hpfs/ntfs/udf/ext2fs/reiserfs mounting. 2005-09-03 20:23:41 +00:00
umapfs - Update vfs_root implementations to match the new prototype. None of 2005-03-24 07:36:16 +00:00
unionfs Remove public declarations of variables that were forgotten when they were 2005-08-10 07:10:02 +00:00