Re: [RFC PATCH 1/3] filemap: convert page_endio to folio_endio

From: Matthew Wilcox
Date: Fri Mar 17 2023 - 11:32:21 EST


On Thu, Mar 16, 2023 at 11:04:54AM +0100, Pankaj Raghav wrote:
> - /* clean up. */
> - while ((page = readahead_page(rac))) {
> - page_endio(page, false, ret);
> - put_page(page);
> + while ((folio = readahead_folio(rac))) {
> + folio_clear_uptodate(folio);
> + folio_set_error(folio);
> + folio_unlock(folio);
> + }
> + return;
> + }
> +
> + while ((folio = readahead_folio(rac))) {
> + folio_mark_uptodate(folio);
> + folio_unlock(folio);
> }

readahead_folio() is a bit too heavy-weight for that, IMO. I'd do this
as;

while ((folio = readahead_folio(rac))) {
if (!ret)
folio_mark_uptodate(folio);
folio_unlock(folio);
}

(there's no need to call folio_set_error(), nor folio_clear_uptodate())