Hi,

the linux code didn't reveal much to me, they seem to store the address
of the directory entry as the inode. This has the problem that renaming the
file (possibly moving the dirent address) invalidates the inode number.
Not good for us (we use the inode number for caching, for example).

The other direction seems to work, though. Currently, in the node cache, I
hold the dirent (directory entry) address in disk_image. Now, because FAT
hasn't links, I need to implement diskfs_rename_dir anyway. Beside moving
the actual directory entries, this could also adjust the node cache, holding
a lock on the node caches content (diskfs_node_refcnt_lock).

I doubt that this will suffice, though. In isofs (and thus current fatfs),
the cache consists of all nodes read so far. However, it makes sense only to
cache a couple (ext2fs caches 512). So there are nodes which are not cached.
So I will need to be able to get the dirent address to a node without going 
through the cache (cleaner anyway). Lemme see... I think one can make a
diskfs_cached_lookup to get the same node again, and check its dirent
address.[1]

However, it looks as though there is no way around it: I need a lock that
is hold during diskfs_rename_dir resp. while figuring out the dirent address of
a node, because in a well behaving filesystem, directory entries and files
are decoupled by inodes, while in FAT they are not. The lock avoids a race
between renaming a file and node-updating it.

[1]Alternatively I could keep track of start_cluster (the current "inode"
value in fatfs) and dirent address correlation (keeping a pseudo inode
table in memory). As updating inodes occures quite frequently, this seems
to be a good advice performance wise. I would need a lock on this table, of
course. This would be very similar to the cache, so I could just use that as
well, which means I am back to the beginning of my email :)

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org Check Key server 
Marcus Brinkmann              GNU    http://www.gnu.org    for public PGP Key 
[EMAIL PROTECTED],     [EMAIL PROTECTED]    PGP Key ID 36E7CD09
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       [EMAIL PROTECTED]

Reply via email to