On Mon, Nov 02, 2020 at 06:43:10PM +0000, Matthew Wilcox (Oracle) wrote: > We don't need to get the page lock again; we just need to wait for > the I/O to finish, so use wait_on_page_locked_killable() like the > other callers of ->readpage. As that isn't entirely obvious, what about adding a comment next to the wait_on_page_locked_killable call to document it? > > + error = wait_on_page_locked_killable(page); > if (error) > return error; > + if (PageUptodate(page)) > + return 0; > + if (!page->mapping) /* page truncated */ > + return AOP_TRUNCATED_PAGE; > + shrink_readahead_size_eio(&file->f_ra); > + return -EIO; You might notice a theme here, but I hate having the fast path exit early without a good reason, so I'd be much happier with: if (!PageUptodate(page)) { if (!page->mapping) /* page truncated */ return AOP_TRUNCATED_PAGE; shrink_readahead_size_eio(&file->f_ra); return -EIO; } return 0;