[OpenAFS-devel] Some doubts with Kernel Module data structures

Matt W. Benjamin matt@linuxbox.com
Sat, 22 May 2010 12:34:06 -0400 (EDT)


hi,

----- "Sanket Agarwal" <sanket@sanketagarwal.com> wrote:

> I am looking into the core data structures of OpenAFS kernel module
> for clients, of which I find that struct dcache and struct fcache will
> be most important. I wish to ask you a few questions here:

struct vcache

> 
> 1. One thing that I am not able to understand on the afs caching part
> is what exactly is afs cached if I have a miss. Is that we afs cache
> the whole file from the Volume Server ?

from the file server; the openafs cm caches segments, not whole files, and in fact afs programs do often call these "chunks," as perhaps you noticed...

> Well that seems very
> unreasonable because a large file then can never be read!

it might be unreasonable, but the openafs cm does not do this

> Okay
> assuming it is that we afs cache chunks of some specified size.

no need to assume it, that's what the cm in fact does

> 2. What exactly does a struct dcache points to ? Is it a specific
> chunk 

yes

> and is this chunk size same as that of Page size of pages in the
> memory(which the kernel will ultimately load as pages in the memory).

no, typically a chunk is 64k, but you can set an alternate chunk size when the cm is started, see AFSD(8)

> Or is it that dcache points to a specific file and keeps track of all
> it's chunks ?

a struct vcache is a cache entry for a specific file, it may or may not be up to date (see cache state flags);  there may or may not be cached segments of any specific file; if there are, each is associated with a struct dcache

> 3. What is the role played by the structure struct fcache, what does
> it point to ?

I'm not a dcache expert, but cribbing from the code, it looks as if an fcache is involved with representing chunks in the cm's persistent file cache

> 4. I see that dcache is stored in the memory but fcache is disk saved
> on disk( where , along with the afs cache ?) And why such a decision.
> 
> Cheers
> Sanket
> 

There are papers from CMU which offer some insight into the choices that were made at different stages of AFS development.  An -older- stage of the cm design is discussed in this

http://www.cs.cmu.edu/afs/cs/project/coda-www/ResearchWebPages/docdir/s11.pdf

There is some discussion of cache structure (including struct fcache, surprisingly), here:

http://web.mit.edu/lugao/MacData/afs/dev.mit.edu/user/warlord/OldFiles/openafs-test/src/doc/pdf/fscm-ispec.pdf

-- 

Matt Benjamin

The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI  48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309