On Wed, Oct 11, 2006 at 10:38:31AM -0700, Linus Torvalds wrote:
>
>
> On Wed, 11 Oct 2006, Nick Piggin wrote:
> >
> > I mean filemap_nopage does *two* synchronous reads when finding a !uptodate
> > page. This is despite the comment saying that it retries once on error.
>
> Ahh.
>
> Yes, now that you point to the actual code, that does look ugly.
>
> I think it's related to the
>
> ClearPageError(page);
>
> thing, and probably related to that function being rather old and having
> gone through several re-organizations. I suspect we used to fall through
> to the error handling code regardless of whether we did the read ourselves
> etc.
Yeah, it may have even been a mismerge at some point in time.
> Are you saying that something like this would be preferable?
I think so, it is neater and clearer. I actually didn't even bother relocking
and checking the page again on readpage error so got rid of quite a bit of
code.
>
> Linus
>
> ---
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 3464b68..e5ecf42 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1496,6 +1496,8 @@ page_not_uptodate:
> goto success;
> }
>
> + /* Clear any potential old errors, and try to read.. */
> + ClearPageError(page);
> error = mapping->a_ops->readpage(file, page);
> if (!error) {
> wait_on_page_locked(page);
> @@ -1526,21 +1528,12 @@ page_not_uptodate:
> unlock_page(page);
> goto success;
> }
> - ClearPageError(page);
> - error = mapping->a_ops->readpage(file, page);
> - if (!error) {
> - wait_on_page_locked(page);
> - if (PageUptodate(page))
> - goto success;
> - } else if (error == AOP_TRUNCATED_PAGE) {
> - page_cache_release(page);
> - goto retry_find;
> - }
>
> /*
> * Things didn't work out. Return zero to tell the
> * mm layer so, possibly freeing the page cache page first.
> */
> + unlock_page(page);
> shrink_readahead_size_eio(file, ra);
> page_cache_release(page);
> return NOPAGE_SIGBUS;
-
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/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]