<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE> The Venus kernel interface: The minicache and downcalls </TITLE> <LINK HREF="kernel-venus-protocol-6.html" REL=next> <LINK HREF="kernel-venus-protocol-4.html" REL=previous> <LINK HREF="kernel-venus-protocol.html#toc5" REL=contents> </HEAD> <BODY> <A HREF="kernel-venus-protocol-6.html">Next</A> <A HREF="kernel-venus-protocol-4.html">Previous</A> <A HREF="kernel-venus-protocol.html#toc5">Contents</A> <HR> <H2><A NAME="s5">5. The minicache and downcalls </A></H2> <P> <P>The Coda FS Driver can cache results of <CODE>lookup</CODE> and <CODE>access</CODE> 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. <P>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 <B>cnodes</B>. <P>The current minicache implementations have cache entries which record the following: <OL> <LI> the name of the file</LI> <LI> the cnode of the directory containing the object</LI> <LI> a list of CodaCred's for which the lookup is permitted.</LI> <LI> the cnode of the object</LI> </OL> <P>The <CODE>lookup</CODE> 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. <P>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. <P> <H2><A NAME="ss5.1">5.1 INVALIDATE</A> </H2> <P> <P>No information is available on this call. <P> <H2><A NAME="ss5.2">5.2 FLUSH</A> </H2> <P> <P><B>Arguments</B> None <P><B>Summary</B> Flush the name cache entirely. <P><B>Description</B> 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. <P> <H2><A NAME="ss5.3">5.3 PURGEUSER</A> </H2> <P> <P><B>Arguments</B> <PRE> struct cfs_purgeuser_out {/* CFS_PURGEUSER is a venus->kernel call */ struct CodaCred cred; } cfs_purgeuser; </PRE> <P><B>Description</B> Remove all entries in the cache carrying the Cred. This call is issued when tokes for a user expire or are flushed. <P> <H2><A NAME="ss5.4">5.4 ZAPFILE</A> </H2> <P> <P><B>Arguments</B> <PRE> struct cfs_zapfile_out { /* CFS_ZAPFILE is a venus->kernel call */ ViceFid CodaFid; } cfs_zapfile; </PRE> <P><B>Description</B> 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. <P><B>NOTE</B> Call is not named correctly in NetBSD and Mach. The minicache <CODE>zapfile</CODE> routine takes different arguments. Linux does not implement the invalidation of attributes correctly. <P> <P> <H2><A NAME="ss5.5">5.5 ZAPDIR</A> </H2> <P> <P><B>Arguments</B> <PRE> struct cfs_zapdir_out { /* CFS_ZAPDIR is a venus->kernel call */ ViceFid CodaFid; } cfs_zapdir; </PRE> <P><B>Description</B> Remove all entries in the cache lying in a directory <CODE>CodaFid</CODE>, and all children of this directory. This call is issed when Venus receives a callback on the directory. <P> <H2><A NAME="ss5.6">5.6 ZAPVNODE</A> </H2> <P> <P><B>Arguments</B> <PRE> struct cfs_zapvnode_out { /* CFS_ZAPVNODE is a venus->kernel call */ struct CodaCred cred; ViceFid VFid; } cfs_zapvnode; </PRE> <P><B>Description</B> Remove all entries in the cache carrying the <CODE>cred</CODE> and <CODE>VFid</CODE> as in the arguments. This downcall is probably never issued. <P> <H2><A NAME="ss5.7">5.7 PURGEFID</A> </H2> <P> <P><B>Summary</B> <P><B>Arguments</B> <PRE> struct cfs_purgefid_out { /* CFS_PURGEFID is a venus->kernel call */ ViceFid CodaFid; } cfs_purgefid; </PRE> <P><B>Description</B> 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. <P> <P> <H2><A NAME="ss5.8">5.8 REPLACE</A> </H2> <P> <P><B>Summary</B> Replace the Fid's for a collection of names. <P><B>Arguments</B> <PRE> struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ ViceFid NewFid; ViceFid OldFid; } cfs_replace; </PRE> <P><B>Description</B> 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. <P>\newpage <HR> <A HREF="kernel-venus-protocol-6.html">Next</A> <A HREF="kernel-venus-protocol-4.html">Previous</A> <A HREF="kernel-venus-protocol.html#toc5">Contents</A> </BODY> </HTML>