Re: Clusters with buffers

Stephen C. Tweedie (sct@dcs.ed.ac.uk)
12 May 1997 21:50:59 +0100


Rani Assaf <assaf@efrei.fr> writes:

> [Sorry to ask here but I've been searching for a solution for the last 4
> days]
>
> In the 2.0.xx tree, there used to be a function generate_cluster()
> providing a mechanism to read contiguous disk blocks into buffers mapped
> in the same memory page. This call disappeared in the 2.1.xx.
>
> What's the new mechanism to do this? I've looked at the ext2 fs code but
> couldn't figure it out.

All of the clustering code was removed in 2.1 (and indeed from
2.0.30). It is no longer necessary: since 1.3.50, Linux has used the
new page cache as the primary route to the filesystem, and that
automatically clusters IOs into page-sized chunks.

The generic_file_read() function, in mm/filemap.c, does the IO by
calling a function chain which ultimately calls brw_page() to perform
the block device IO. brw_page() fakes up a set of clustered
buffer_heads which reference the required blocks in the page, and
submits these to ll_rw_block(). As a result, the low-level rw_block
routine automatically sees a nicely clustered set of buffers for the
IO.

Cheers,
Stephen.