Re: [PATCH] [11/19] HWPOISON: Refactor truncate to allow direct truncating of page v2

Nick Piggin
2009-08-05T14:01:47Z

On Wed, Aug 05, 2009 at 03:46:08PM +0200, Andi Kleen wrote:
> On Wed, Aug 05, 2009 at 12:20:08PM +0200, Nick Piggin wrote:
> > > truncate_complete_page(struct address_space *mapping, struct page *page)
> > > {
> > > if (page->mapping != mapping)
> > > - return;
> > > + return -EIO;
> >
> > Hmm, at this point, the page must have been removed from pagecache,
> > so I don't know if you need to pass an error back?
>
> It could be reused, which would be bad for us?

I haven't brought up the caller at this point, but IIRC you had
the page locked and mapping confirmed at this point anyway so
it would never be an error for your code.

Probably it would be nice to just force callers to verify the page.
Normally IMO it is much nicer and clearer to do it at the time the
page gets locked, unless there is good reason otherwise.