Request size and last read readahead window respectively Figure 166 How the kernel determines the readahead window depending on the request size

Let's go back to ondemand_readahead, which has to set the readahead window with the help of these auxiliary functions. Three cases are most essential:

1. The current offset is either at the end of the previous readahead window or at the end of the interval that was synchronously read in. In both cases, the kernel assumes sequential read access, and uses get_next_ra_size to compute the new window size as discussed.

2. If the readahead marker was hit, but the previous readahead state does not predict this, then most likely two or more concurrent streams perform interleaved reads on the file — and invalidate each other's readahead state in the process. The kernel constructs a new reada-head window that suits all readers.

3. If (among others) first read access on a file is performed or a cache miss has happened, a new readahead window is set up with get_init_ra_size.

Continue reading here: Info

Was this article helpful?

0 0