xref: /plan9/sys/doc/fs/p5 (revision 6aeb1f0c04d990a2469d1ed5385e6b7f18c098d6)
1219b2ee8SDavid du Colombier.SH
2219b2ee8SDavid du ColombierThe read-ahead processes
3219b2ee8SDavid du Colombier.PP
4219b2ee8SDavid du ColombierThere are a set of file system processes,
5219b2ee8SDavid du Colombier.CW rah ,
6219b2ee8SDavid du Colombierthat wait for messages consisting of a device and block
7219b2ee8SDavid du Colombieraddress.
8219b2ee8SDavid du ColombierWhen a message comes in,
9219b2ee8SDavid du Colombierthe process reads the specified block from the device.
10219b2ee8SDavid du ColombierThis is done by calling
11219b2ee8SDavid du Colombier.CW getbuf
12219b2ee8SDavid du Colombierand
13219b2ee8SDavid du Colombier.CW putbuf .
14219b2ee8SDavid du ColombierThe purpose of this is the hope that these blocks
15219b2ee8SDavid du Colombierwill be used later and that they will reside in the
16219b2ee8SDavid du Colombierbuffer cache long enough not to be discarded before
17219b2ee8SDavid du Colombierthey are used.
18219b2ee8SDavid du Colombier.PP
19219b2ee8SDavid du ColombierThe messages to the read-ahead processes are
20219b2ee8SDavid du Colombiergenerated by the server processes.
21219b2ee8SDavid du ColombierThe server processes maintain a relative block mark in every
22219b2ee8SDavid du Colombieropen file.
23219b2ee8SDavid du ColombierWhenever an open file reads that relative block,
24219b2ee8SDavid du Colombierthe next 110 block addresses of the file are sent
25219b2ee8SDavid du Colombierto the read-ahead processes and
26219b2ee8SDavid du Colombierthe relative block mark is advanced by 100.
27219b2ee8SDavid du ColombierThe initial relative block is set to 1.
28219b2ee8SDavid du ColombierIf the file is opened and
29219b2ee8SDavid du Colombieronly a few bytes are read,
30219b2ee8SDavid du Colombierthen no anticipating reads are performed
31219b2ee8SDavid du Colombiersince the relative block mark is set to 1
32219b2ee8SDavid du Colombierand only block offset 0 is read.
33219b2ee8SDavid du ColombierThis is to prevent some
34219b2ee8SDavid du Colombierfairly common action such as
35*6aeb1f0cSDavid du Colombier.Ex
36219b2ee8SDavid du Colombier	file *
37*6aeb1f0cSDavid du Colombier.Ee
38219b2ee8SDavid du Colombierfrom swamping the file system with read-ahead
39219b2ee8SDavid du Colombierrequests that will never be used.
40