On Sun, May 28, 2000 at 01:51:29PM -0400, Thomas Bushnell, BSG wrote:
>
> > 2) Not writing to directory records through the disk pager at all (clipping
> > the disk pager to the meta data area). This requires to use the directory
> > file pager in write_node, for example by using diskfs_node_rdwr. Is this
> > acceptable performance wise? This solution would require me to make the
> > directory's node and record offset accesible to the file node, which has all
> > sort of nasty problems attached to it, although it is not much worse than
> > the current problem of making the directory record offset within disk image
> > accesible to the file node.
>
> This is exactly what I would suggest doing; it's the most natural
> thing to do.
Thanks, there is a slight catch here, though, and I would appreciate your
advice.
To get the filemap for the disk pager, I need to lock the directory node.
Most read_nodes come (through diskfs_cached_lookup) from diskfs_lookup_hard,
which holds the directory lock. However, some come from name-cache.c or
fsys-getfile from libdiskfs, and I think only the former holds the parent
directory node (though I am not sure if it really does in all possible
cases).
So, the question arises what to do. If the dir is already locked *and* the
call comes from lookup_hard (or even from any lookup, I am not sure), I can
use ifind() in inode.c to get the node. If it comes from fsys-getfile.c (and
from a cached lookup??), I must do a normal diskfs_cached_lookup.
To fix the lookup_hard issue, I can use a special copy of diskfs_cached_lookup
from diskfs_lookup_hard, which passes the dir filemap buffer to read_node
(read_node then knows that the lock is already held).
Everything else calls diskfs_cached_lookup and will make read_node acquiring
a reference before calling get_filemap.
However, I still get deadlocks when the name cache is involved. Is there a
reliable way to know if diskfs already holds a lock to the parent dir node?
Or is it always the case that the parent dir is locked except in
fsys_getfile, and it is sufficient for me to override fsys-getfile to lock
the parent dir before calling diskfs_cached_lookup?
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]