Subject: Re: Misc layerfs questions
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 02/26/2002 18:17:13
On Tue, Feb 26, 2002 at 03:26:43PM +0100, de SAINT LEGER Rodolphe wrote:
My tuppence - I've the code for a union fs that supports up to 32
layers lurking. I last ported it to UnixWare 7 (so it is SMP clean).
I keep intending getting it running on netbsd....
(Technically this code is owned by the company I worked for at
the time.... but it was never shipped as a product. We used it
for our source / build tree.)
I would certainly only create directories when you need to
put something in them. You can also delete the empty ones.
Also use sensible permissions - the current umask and the
callers permissions on the real parent directory.
> > No, UNION is for the union file system. It is used in the readdir routines
> > to make sure that we look in the right places. MNT_UNION is for mount -o
> > union. It's kinda confusing.
>
> The sys/kern seems to have some specific union code to read directories
> (also sys/compat/common)
A horrid hack - I'm not ever sure it works for large directories.
Doing it properly in the union FS is O(n^2) on the number of layers.
However since most directories are short it is usually O(n).
Dunno about netbsd's caches. I held a kernel tree for my active
vnodes - including held references to appropriate underlying
directory vnodes.
NFS support does get hairy! Especially if you want to be a client
and server at the same time.
Also remember that the 'inode' numbers you return in a directory
read must be unique for YOUR filesystem. You cannot blindly
return the inode number of the underlying FS. Programs like
mkisofs use the device/inode number to detect linked files.
I also seem to remember that 'make' needs you to return a 'correct'
timestamp when stat()ing a directory.
David
--
David Laight: david@l8s.co.uk