A guide for hackers.
InterMezzo has two software components: the kernel module Presto and the user level cache manager and file server Lento.
Presto is a file system module in the kernel and receives requests from the VFS layer. In processing these requests it may contact Lento for two reasons:
Lento may contact the kernel module to inform it that a permit has been revoked.
The management of the update journals is the core of Lento and understanding the fabric of reintegrating and forwarding these is the topic of this section.
Journals are dispatched from the kernel to lento every few seconds or when a journal page is full. Lento receives these through an Upcall Wheel, which is responsible for reading from /dev/presto, unpacking the kernel buffers and extracting opcodes and parameters from the upcall packet Filter::Upcall.
The UpcallWheel is owned by the ReqDispatcher and we are interested in the case in which a Journal upcall is received by the ReqHandler.
When this happens the ReqHandler calls Lento::Journal::Unpack on the journal buffer contained in the upcall. The journal unpack routine goes through the buffer and builds operation records one by one, and finally calls the function Journal::PassToCML on each of these records.
PassToCML finds the volume resposible for handling this upcall (for rename there is more than one volume involved) and calls the Lento::CML::process_XXX routine which looks at the record. Mostly this appends the record to the CML but there is a substantial amount of special treatments to deal with the following cases:
Lento needs to know where to pick up an aborted reintegration or update forward. On the server, a table is maintained of Replicators. A Replicator belongs to a Client and Volume class. The Replicator knows
The CML is dispatched through the CML::dispatch method, which is a frontend to send_CML. Dispatch makes a distinction between running on the server (where the replist attribute of the Volume is defined) and on the client.
The different methods of calling distpatch are:
InterMezzo is targetted to be usable as a root file system. This poses some delicate issues, namely that the file system is initially mounted by init(8), which does so without parsing /etc/fstab. Additionally, the file system made available must be accessible before Lento is running.
To allow mounting an InterMezzo file system as root, we have included
a kernel patch that allows a kernel commandline argument
rootfstype. This can be passed through bootloaders such as lilo,
for example set append = "rootfstype=InterMezzo"
, in
/etc/lilo.conf. Of course in this case InterMezzo needs to be
compiled into the kernel, unless one uses an initial ramdisk to load
the file system module.
Secondly, we set a flag on the pseudo device, called no_filter which indicates to the kernel to skip cache validation, which generally involves Lento. By setting this flag, the file system is accessible for read only use.
Before the file system can be made available for read-write use, a mount option needs to be passed that marks the volume and the path at which the cache is mounted. These flags are contained in /etc/fstab and can be passed by the remount file system operation. After remount has passed the correct flags for the cache mountpoint and volume, the file system is available read-write.
Finally, Lento will be started by the system initialization scripts.
Lento will clear the no_filter
flag - now the cache is validated
before it is used, and Lento will propagate the updates made to the
cache since the file system became read-write, at remount time.
To summarize, boot with the root file system of type InterMezzo,
use the rootfstype
boot argument, pass options through the remount
call. After the system initialization scripts have run the remount,
the file system is available read/write, even before Lento has
started.