Subject: Re: Misc layerfs questions
To: Bill Studenmund <>
From: de SAINT LEGER Rodolphe <>
List: tech-kern
Date: 02/26/2002 15:26:43
On Mon, 25 Feb 2002 15:21:12 -0800 (PST)
Bill Studenmund <> wrote:


> 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)

> For now I'd suggest writing your own layer_node_create() and your own
> layer_node_alloc(). The current routines weren't designed for fan-in
> layered fs's. Later, we can see about changing the create and allocate
> routines.

I found the trick for now (including hash values).

> In principle, each time you do this, you have to go to /unionfs's root.
> If you are lucky, one of the intermediate nodes might still be around, so
> you don't have to go all the way up. But since some node intensive things
> can clean out the vnode cache, you can't be sure. And you can't stop even
> if you find some nodes unless they have shadow dirs.

I agree with you with the 'only needed shadow directories', it's lot of work. I'm going too hear your advise for the moment as I'm not familiar enough to vfs and layerfs, but I'll try to make code that may be easily upgraded to such a feature.

but what do you mean by a clean out of the vnode cache ?

is it the namecache buffer ? As far as I looked in the original union filesystem, every pathname is saved in the union_vnode struct. This is what I'm going to do (I say this after looking in the getcwd code) for shadow directories that are not (temporarly) created.

if it's about the vnode structs, after another look in the union filesystem, I've seen that it keeps references to parents directories in it's structures (parent vnodes are VREFed), can such vnodes dissapear or been reclaimed for other things ?