Re: Checking page_count(page) in invalidate_complete_page

Andrew Morton
2006-09-27T08:25:43Z

On Wed, 27 Sep 2006 14:47:26 +1000
Nick Piggin <nickpiggin@yahoo.com.au> wrote:

> truncate_inode_pages will a) throw away everything including dirty
> pages, and b) probably be fairly
> racy unless the inode's i_size (for normal files) is modified.
>
> We really want to make an invalidation that works properly for you.
>
> If you can guarantee that a pagecache page can never get mapped to a
> user mapping (eg. perhaps for
> directories and symlinks) and also ensure that you don't dirty it via
> the filesystem, then you don't
> have to worry about it becoming dirty, so we can skip the checks Andrew
> has added and maybe add a
> WARN_ON(PageDirty()).

None of that is true for when invalidate_inode_pages2() is used by
block-backed direct-io.

We should fix it for that application..