Re: [PATCH] VFS: Pagecache usage optimization on pagesize !=blocksize environment

From: Andrew Morton
Date: Wed May 21 2008 - 03:39:30 EST


On Wed, 21 May 2008 00:19:30 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

>
> I guess a suitable fix might be to implement the above using a new
> address_space_operations callback:
>
> if (PagePrivate(page) && aops->is_partially_uptodate) {

This is a bit presumptuous. A filesytem could in theory be able to
work out if a section of a page is uptodate without necessarily
maintaining per-page metadata at page.private.

So one really should just do

if (aops->is_partially_uptodate)

however it's hard to conceive how a filesystem could sanely do this
_without_ putting data at page.private, so the PagePrivate() test could
perhaps be retained as a microoptimisation, as long as it is suitably
commented.

otoh, non-zero aops->is_partially_uptodate might well be less common
than non-zero PagePrivate(), so perhaps these should be tested in the
other order. Not sure.

> if (aops->is_partially_uptodate(page, desc, offset))
> <OK, we can copy the data>
>
> then implement a generic_file_is_partially_uptodate() in fs/buffer.c

Make that block_is_partially_uptodate().

> and wire that up in the filesystems.
>
> Note that things like network filesystems can then implement this also.

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