xref: /plan9/sys/doc/fs/p5 (revision 6aeb1f0c04d990a2469d1ed5385e6b7f18c098d6)
1.SH
2The read-ahead processes
3.PP
4There are a set of file system processes,
5.CW rah ,
6that wait for messages consisting of a device and block
7address.
8When a message comes in,
9the process reads the specified block from the device.
10This is done by calling
11.CW getbuf
12and
13.CW putbuf .
14The purpose of this is the hope that these blocks
15will be used later and that they will reside in the
16buffer cache long enough not to be discarded before
17they are used.
18.PP
19The messages to the read-ahead processes are
20generated by the server processes.
21The server processes maintain a relative block mark in every
22open file.
23Whenever an open file reads that relative block,
24the next 110 block addresses of the file are sent
25to the read-ahead processes and
26the relative block mark is advanced by 100.
27The initial relative block is set to 1.
28If the file is opened and
29only a few bytes are read,
30then no anticipating reads are performed
31since the relative block mark is set to 1
32and only block offset 0 is read.
33This is to prevent some
34fairly common action such as
35.Ex
36	file *
37.Ee
38from swamping the file system with read-ahead
39requests that will never be used.
40