[reiserfs-list] Re: [OpenAFS-devel] more on the 2.2.18pre17 SMP cpu hog/etc.

Derek Atkins warlord@MIT.EDU
02 Dec 2000 15:33:58 -0500

I don't know anything about reiserfs, but I can explain what AFS is
doing.  Basically, the afsd user-space process does an opendir() on
the cache directory.  Then it iterates through the files looking for
the cache files (they are all numbered, and the cachefile number is
stored in the filename).  For each cache file, it stores the inode
number (obtained from dirp->d_ino from readdir()) associated that that
cache file number (obtained from dirp->d_name).

Later, the afsd user-space calls into the kernel, iterating through
the cachefiles.  For each cachefile, it calls into the kernel with the
inode number which is obtained as described in the previous paragraph.

The current interface does not have room for any other information to
be passed along to the kernel.  Granted, we could change that.
However, we would need to find the packing locality from user-space in
order to pass it down into kernel space.  Is the packing locality
available through the dirent structure?  If so, what structure member
do I use?

Alternatively, I suppose we could perform an 'open' or a 'stat' of the
cache file from user-space (using the filename) in order to pull the
file into the kernel inode cache before passing the information along
to the kernel.  That might be a more portable way of doing it,
assuming a 'stat()' is sufficient to bring the inode into kernel cache
so that iget() can easily grab it.

Chris, would a stat() be sufficient to bring inode into the cache and
bypass the slow lookup?  (I'm going to assume that there is enough
kernel memory to cache all the cacheinodes).

Nathan, can you add this code to afsd and see if it fixes your problem
on your home machine?  Add this in afsd/afsd.c (around line 587):

	if (vFileNum >= 0) {
	     * Found a valid data cache filename.  Remember this file's
	     *  inode and bump the number of files found.
            /* Stat the file, to bring the inode into the kernel cache */
            struct stat sb;
            sprintf (fileToDelete, "%s", currp->d_name);
            stat (fullpn_FileToDelete, &sb);
	    inode_for_V[vFileNum] = currp->d_ino;


Chris Mason <mason@suse.com> writes:

> Ok, the problem is that AFS is calling iget, so it probably needs special
> code to deal with reiserfs.
> For reiserfs to find an inode on disk, it needs the inode number of the
> file, and the packing locality.  This is usually (but not always) the inode
> number of the parent directory.  Calling iget is fine when the inode is
> already in memory, otherwise the reiserfs code goes into a very slow, very
> ugly search (the search_by_objectid call) to fill in the other 32 bits of
> information needed to find the file.
> So, can AFS store more information about the file in a filehandle of some
> kind?  If so, we can give you code to fill in the packing locality for iget.
> -chris
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo.cgi/openafs-devel

       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/      PP-ASEL      N1NWH
       warlord@MIT.EDU                        PGP key available