Hi,

On Mon, 2005-03-07 at 23:50, Andrew Morton wrote:

> truncate_inode_pages_range() seems to dtrt here.  Can we do it in the same
> manner in invalidate_inode_pages2_range()?
> 
> 
> Something like:

> -                     if (page->mapping != mapping || page->index > end) {
> +                     page_index = page->index;
> +                     if (page_index > end) {
> +                             next = page_index;
> +                             unlock_page(page);
> +                             break;
> +                     }
> +                     if (page->mapping != mapping) {
>                               unlock_page(page);
>                               continue;
>                       }

Yes, breaking early seems fine for this.  But don't we need to test
page->mapping == mapping again with the page lock held before we can
reliably break on page_index?

I think it should be OK just to move the page->mapping != mapping test
above the page>index > end test.  Sure, if all the pages have been
stolen by the time we see them, then we'll repeat without advancing
"next"; but we're still making progress in that case because pages that
were previously in this mapping *have* been removed, just by a different
process.  If we're really concerned about that case we can play the
trick that invalidate_mapping_pages() tries and do a "next++" in that
case.

--Stephen

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

Reply via email to