Re: [RFC] [PATCH] Dirty pages in the page cache

Eric W. Biederman (ebiederm+eric@npwt.net)
13 Jan 1998 05:59:30 -0600


>>>>> "ST" == Stephen C Tweedie <sct@dcs.ed.ac.uk> writes:

ST> Hi,
ST> On 12 Jan 1998 21:49:38 -0600, ebiederm+eric@npwt.net (Eric W. Biederman) said:

>> My primary target (besides my own fs) when I designed it was
>> filesystems with compressed files. That needs seperate caching of
>> the file data, and what is written to the disk. Something the page
>> cache is good at.

ST> True. Of course, you _could_ do this by modifying the buffer cache at
ST> write() time, but by deferring that operation you can batch up your
ST> writes and hopefully compress more efficiently.

Exactly. Hopefully that is enough so compressed writes can be done at
other than iput time, and the current e2compr codes does now. That
should help reduce fragmentation.

>> update_page can set do the filesystem specific setup of just how it is
>> to be done and set the dirty_bit, and then write_page will be called
>> when the dirty bit is set. So it is still optional, and the specifics
>> are controlled by the individual filesystems.

ST> Yes, but only as long as the whole mechanism is entirely under
ST> filesystem control.

The VFS controlls the cache and the FS controls what's in it and where
it goes.

ST> Overloading the page->buffer entry, as you mentioned earlier, is a good
ST> way to give the fs some way to maintain that information. Beyond that
ST> it is up to the fs itself to track the information it needs to complete
ST> the write_page(). The VFS has _got_ to call the filesystem directly
ST> when a write() occurs, so that it can maintain the handles/dirents/
ST> credentials/whatever-else-it-needs to complete the write.
ST> mmap(MAP_SHARED) can't do this directly, of course.

Currently mmap(MAP_SHARED) calls write when a page is found to be
dirty in the page tables. This write will be essentially then just to
set the page cache dirty bit, and update extra information. So no
need to change that. And hey we probably gain a little efficiency,
having the page cached already.

O.K. Then I guess the basic task is a follows.
For writepage (which really hasn't been used yet). Revert that to use
an inode (instead of a dentry).

Reimplement the buffer_head pointer as a generic pointer, with a flag
that says it's a buffer_head pointer.

Update my current patch to these changes.

Test it.

Send it to Linus?

Buffer cache changes, and ext2 support, and other filesystems.
Once the basic code is in place.

Can I count on you for some of this last part. I don't know the
buffer cache well enough to make the needed changes, and it seems you
do.

Eric