Next Previous Contents

## 5. The minicache and downcalls

The Coda FS Driver can cache results of `lookup` and `access` upcalls, to limit the frequency of upcalls. Upcalls carry a price since a process context switch needs to take place. The counterpart of caching the information is that Venus will notify the FS Driver that cached entries must be flushed or renamed.

The kernel code generally has to maintain a structure which links the internal file handles (called vnodes in BSD, inodes in Linux and FileHandles in Windows) with the ViceFid's which Venus maintains. The reason is that frequent translations back and forth are needed in order to make upcalls and use the results of upcalls. Such linking objects are called cnodes.

The current minicache implementations have cache entries which record the following:

1. the name of the file
2. the cnode of the directory containing the object
3. a list of CodaCred's for which the lookup is permitted.
4. the cnode of the object

The `lookup` call in the Coda FS Driver may request the cnode of the desired object from the cache, by passing it's name, directory and the CodaCred's of the caller. The cache will return the cnode or indicate that it cannot be found. The Coda FS Driver must be careful to invalidate cache entries when it modifies or removes objects.

When Venus obtains information that indicates that cache entries are no longer valid, it will make a downcall to the kernel. Downcalls are intercepted by the Coda FS Driver and lead to cache invalidations of the kind described below. The Coda FS Driver does not return an error unless the downcall data could not be read into kernel memory.

## 5.1 INVALIDATE

No information is available on this call.

## 5.2 FLUSH

Arguments None

Summary Flush the name cache entirely.

Description Venus issues this call upon startup and when it dies. This is to prevent stale cache information being held. Some operating systems allow the kernel name cache to be switched off dynamically. When this is done, this downcall is made.

## 5.3 PURGEUSER

Arguments

            struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */
                struct CodaCred cred;
            } cfs_purgeuser;

Description Remove all entries in the cache carrying the Cred. This call is issued when tokes for a user expire or are flushed.

## 5.4 ZAPFILE

Arguments

            struct cfs_zapfile_out {  /* CFS_ZAPFILE is a venus->kernel call */
                ViceFid CodaFid;
            } cfs_zapfile;

Description Remove all entries which have the (dir vnode, name) pair. This is issued as a result of an invalidation of cached attributes of a vnode.

NOTE Call is not named correctly in NetBSD and Mach. The minicache `zapfile` routine takes different arguments. Linux does not implement the invalidation of attributes correctly.

## 5.5 ZAPDIR

Arguments

            struct cfs_zapdir_out {   /* CFS_ZAPDIR is a venus->kernel call */
                ViceFid CodaFid;
            } cfs_zapdir;

Description Remove all entries in the cache lying in a directory `CodaFid`, and all children of this directory. This call is issed when Venus receives a callback on the directory.

## 5.6 ZAPVNODE

Arguments

            struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */
                struct CodaCred cred;
                ViceFid VFid;
            } cfs_zapvnode;

Description Remove all entries in the cache carrying the `cred` and `VFid` as in the arguments. This downcall is probably never issued.

## 5.7 PURGEFID

Summary

Arguments

            struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */
                ViceFid CodaFid;
            } cfs_purgefid;

Description Flush the attribute for the file. If it is a dir (odd vnode), purge its children from the namecache remove the file from the namecache.

## 5.8 REPLACE

Summary Replace the Fid's for a collection of names.

Arguments

            struct cfs_replace_out { /* cfs_replace is a venus->kernel call */
                ViceFid NewFid;
                ViceFid OldFid;
            } cfs_replace;

Description This routine replaces a ViceFid in the name cache with another. It is added to allow Venus during reintegration to replace locally allocated temp fids while disconnected with global fids even when the reference count on those fids are not zero.

\newpage

Next Previous Contents