On Wed, 10 May 2000, Erez Zadok wrote:
> IMHO the BSD hacks to libc support unionfs were ugly. To write unionfs,
> they used the existing nullfs "template", but then they had to modify the
> VFS *and* other user-land stuff.
I was not talking about unionfs. union-mount is pretty different and I
don't think that stacking is a valid answer here.
> It depends what you mean by "reasonable way" and "good way". I've done it
> in my prototype implementation of unionfs which uses fan-out stackable f/s:
>
> (1) you read directory 1, and store the names you see in a hash table.
> (2) as you read each entry from subsequent directories, you check if it's in
> the hash table. If it is, skip it; if it's not, add it to the getdents
> output buf, and add the entry to the hash-table.
>
> This was a simple design and easy to implement. Yes it added overhead to
> readdir(2) but not as much as you'd think. It was certainly not "horribly
> slow", nor did it chew up lots of ram. I tried it on several directories
> with several dozen entries each (i.e., typical directory sizes), not on
> directories with thousands or more entries.
Now do it for dozen of directories in a union, with a 2--60 entries each
(typical load for devfs-via-union). And put it under the use /dev gets.