Re: [PATCH 7/7] readahead: basic support of interleaved reads

Rusty Russell
2007-07-21T07:25:10Z

On Sat, 2007-07-21 at 12:43 +0800, Fengguang Wu wrote:
> plain text document attachment (readahead-interleaved-reads.patch)
> This is a simplified version of the pagecache context based readahead.
> It handles the case of multiple threads reading on the same fd and invalidating
> each others' readahead state. It does the trick by scanning the pagecache and
> recovering the current read stream's readahead status.
>
> The algorithm works in a opportunistic way, in that it do not try to detect
> interleaved reads _actively_, which requires a probe into the page cache(which
> means a little more overheads for random reads). It only tries to handle a
> previously started sequential readahead whose state was overwritten by
> another concurrent stream, and it can do this job pretty well.

Hi Fengguang,

This is really clever!

Only one slight complaint: I wonder if "radix_tree_scan_hole" could be
expressed as "radix_tree_extent_size" which return the number of
populated indices up to "max_scan". Returning a length seems more
intuitive to me (and I think gets rid of the wraparound error case?)

Cheers,
Rusty.