Cache Manager

Assar Westerlund assar at sics.se
Sun Mar 22 16:11:34 CET 1998


wwshen at eecs.umich.edu writes:
> > No, many programs will get confused if files are changed while they
> > are reading (or executing them) so the local programs will not see the 
> > modifications before the file is closed.
> > 
> 
>     I think there is some conflict between them according to my
> understanding.

I'm not sure where the conflict is?

When you read a file you also get a `callback promise' meaning that
the file server will tell you before changing that file.

When writing a file the file server will first callback to all processes
that have that file cached and saying in effect `this file will now be
changed'.

This allows you to know that your cached copy is up-to-date.

> > The procedure is something like this: (simplified)
> > 
> >  - The application program does a syscall, (on a file from arla)
>                                               ^^^^^^^^^^^^^^^^^^^^
>  					      What does this mean?

When you call a syscall like `lstat', the kernel will first figure out
from what file system the file you're referenpcing belongs.  It could
be nfs, ufs, mfs, or arla.  Then the kernel will call the relevant
function from that file system.

> >  - The syscall is interpreted by the kernel,
> 
>      So this is not implemented by you, right?

Right.

> >  - The kernel find out on which filesystem the file is, (our filesystem is xfs)
>  
>      So this in not implemented by you, but you need to provide
> some information to the kernel so that it can switch to the
> appropriate filsystem, right? Where is this file and functions?

The files are xfs/<system>/xfs_vnodeops.c and xfs/<system>/xfs_vfsops.c.

> >  - The kernel calls a VFS-operation om that filesystem, (xfs)
> >     (in most cases xfs already has the file in the local cache, but
> >      let's say it doesn't)
> 
>       I think VFS is Virtual File System, which is used to reference
> the file entries but independent on the low implementation.

Yes

> But I dont know what is the difference between the VFS operation and
> vnode operation.

The VFS operations are operations performed on a file system, eg
mount, unmount, statfs, etc.

The vnode operations are performed on a particular vnode.  This could
be getattr, open, ...

Usually both of these are called the VFS.

> I think at the mount point there is a mount structre connecting a
> list of vnode related to this mount point.

Yes.

> Is that the function xfs_mount doing?

No, what the xfs_mount function does is to add a new file system to
the list of mounted filesystems (that is shown for example by mount).

> Again, how can kernel call the function in xfs_vfsops.c and
> xfs_vnodeops.c.

The function `xfs_install_filesys' will add the list of pointers to
functions (xfs_vfsops) to the list of known filesystems in the
kernel.  Then the kernel can call any of these be referencing the
function pointer.

/assar





More information about the Arla-drinkers mailing list