shithub: riscv

ref: e2224a90bb2455993363efe52e005b2fe9c78cdd
dir: /sys/doc/fs/p5/

View raw version
.SH
The read-ahead processes
.PP
There are a set of file system processes,
.CW rah ,
that wait for messages consisting of a device and block
address.
When a message comes in,
the process reads the specified block from the device.
This is done by calling
.CW getbuf
and
.CW putbuf .
The purpose of this is the hope that these blocks
will be used later and that they will reside in the
buffer cache long enough not to be discarded before
they are used.
.PP
The messages to the read-ahead processes are
generated by the server processes.
The server processes maintain a relative block mark in every
open file.
Whenever an open file reads that relative block,
the next 110 block addresses of the file are sent
to the read-ahead processes and
the relative block mark is advanced by 100.
The initial relative block is set to 1.
If the file is opened and
only a few bytes are read,
then no anticipating reads are performed
since the relative block mark is set to 1
and only block offset 0 is read.
This is to prevent some
fairly common action such as
.Ex
	file *
.Ee
from swamping the file system with read-ahead
requests that will never be used.