[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: buffer and page caching



Hi,

On Wed, Feb 27, 2002 at 09:30:20AM +0100, chacron1 wrote:
 
> I would like to know why ext3 uses both page caching and buffer caching, and if
> unification is planed in the furture ?

It is nearly all unified already.

Both ext2 and ext3 work the same way for the most part here --- they
use the page cache for caching data, and the buffer cache for caching
metadata.  ext2 in current versions has been taught to use the page
cache for directories, but still uses the buffer cache for other
metadata such as inodes and bitmaps.

> It seems that page caching is now generic for file system in 2.4 , so ext3 use
> it.
> But  buffers seems also be used  for data and metadata accesses as i see
> that   __block_commit_write() is called by ext3_commit_write() /
> generic_commit_write()
> whatever the journaled / ordered / ...  mode.

That's not quite right.  In 2.4, *all* filesystem writes are done via
buffer_heads --- there simply isn't any other way to talk to the IO
subsystem.  However, for objects in the page cache, the buffer_heads
actually refer to the same memory as the page cache object underneath.
These buffer_heads are not actually in the buffer cache --- if you do
a buffer lookup on them, you will not find them.  Rather, they are
buffer_heads belonging to the page cache.

> What are the impact/advantages on performances if these two levels of cache are
> used together ?

They are never used together in ext2 or in ext3 in 2.4.  In 2.2, that
was not true --- filesystem writes would copy the data from the page
cache to the buffer cache, so we'd get double-buffering.  In 2.4,
writes of page cache data do not result in any extra copies.  The
buffer_heads are only there as labels for the outstanding physical IO
pending on the page cache data: they don't actually represent an extra
copy of the data.

Cheers,
 Stephen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]