On Wed, May 10, 2000 at 01:33:11AM +0200, Marcus Brinkmann wrote:
> Hi,
> 
> maybe my ramblings will be useful for other inodeless fs implementations
> later.
> 
> 3. Making up inode numbers on the way:
> Simply start with 1 and go up for every new file cached. This could be
> called "virtual inodes". The problem is that there is per se no efficient way
> to regain the virtual inode numbers from the file information, when looking it
> up (The answer to the question: Do we have the file "foobar" in the cache?).
> So, this violates the meaningfulness of the cache_id, but, as it turns out,
> in a repairable way.
> 

I know how much everyone seems to hate C++ around here, but the Map template
provides a fairly elegant solution to this problem.  It would be very simple
to store the "virtual inode" value in a Map of:

Map[char* file-name] -> virtual_inode

Since that construct is not available, perhaps a tree structure of some kind,
arranged in the lexicographic ordering of the file names (including paths).  
This insures a unique key for each file, but perhaps there will be speed
issues.

> It turns out that a filesystem with simple data structures can be more
> complicated to implement. We learn that adding a bit complexity to the data
> structures (like inodes) can lead to more efficient and easier to implement
> operations on the data. ;)

A very interesting observation (counterintuitive, too!).  Just goes to
show that one can take the KISS (Keep It Simple, Stupid) principal can
be taken too far. :-)

-Brent

Reply via email to