Re: double read confusion

Eric W. Biederman (ebiederm+eric@ccr.net)
18 Apr 1999 16:57:44 -0500


>>>>> "PB" == Peter J Braam <braam@cs.cmu.edu> writes:

PB> Hi,
PB> I'm confused about reading and then writing files (say for ext2).

PB> Suppose we first read block 1 in a file. Generic_readpage adds the data
PB> to the inode page cache using brw_page. It uses some temporary
PB> buffers that are not hashed.

PB> Assume that next we want to write in block 1, then ext2_getblk, calls
PB> inode_getblk, which calls getblk, and, unless I'm mistaken, we go back
PB> to the _disk_ to read the block.

Yes. But only if we aren't writing the full block.

PB> My confusion is about the following: why can't we share page cache
PB> data with the buffer cache, eliminating the extra i/o?

Because it is more work. There are no real good reasons.

We also have what I suspect is more significant in practice.
Double buffering of our data between the page cache and the buffer cache.
This causes copying and other overhead that can problematic.

For 2.3 for normal file data we will no longer use the buffer cache
so all of this should go away.

Eric

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/