double read confusion

Peter J. Braam (braam@cs.cmu.edu)
Sat, 17 Apr 1999 20:29:12 -0400 (EDT)


Hi,

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

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

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

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

The converse, first writing and then reading seems to be fine, since
brw_page (which would be invoked by the read after the write) first checks
the buffer cache.

Surely I'm missing something. Thanks for the explanation!

- Peter -

-
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/