Re: [PATCH 13/21] iomap: Convert readahead and readpage to use a folio

From: Christoph Hellwig
Date: Tue Nov 02 2021 - 03:20:53 EST


On Mon, Nov 01, 2021 at 08:39:21PM +0000, Matthew Wilcox (Oracle) wrote:
> for (done = 0; done < length; done += ret) {
> - if (ctx->cur_page && offset_in_page(iter->pos + done) == 0) {
> - if (!ctx->cur_page_in_bio)
> - unlock_page(ctx->cur_page);
> - put_page(ctx->cur_page);
> - ctx->cur_page = NULL;
> + if (ctx->cur_folio &&
> + offset_in_folio(ctx->cur_folio, iter->pos + done) == 0) {
> + if (!ctx->cur_folio_in_bio)
> + folio_unlock(ctx->cur_folio);
> + ctx->cur_folio = NULL;

Where did the put_page here disappear to?

> @@ -403,10 +403,9 @@ void iomap_readahead(struct readahead_control *rac, const struct iomap_ops *ops)
>
> if (ctx.bio)
> submit_bio(ctx.bio);
> - if (ctx.cur_page) {
> - if (!ctx.cur_page_in_bio)
> - unlock_page(ctx.cur_page);
> - put_page(ctx.cur_page);
> + if (ctx.cur_folio) {
> + if (!ctx.cur_folio_in_bio)
> + folio_unlock(ctx.cur_folio);

... and here?