linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 14/12] mm: remove the skip_page argument to read_pages
Date: Thu, 31 Mar 2022 05:35:55 -0700	[thread overview]
Message-ID: <YkWgK+PJM/6r48Gt@infradead.org> (raw)
In-Reply-To: <20220330144930.315951-1-willy@infradead.org>

From: Christoph Hellwig <hch@lst.de>

The skip_page argument to read_pages controls if rac->_index is
incremented before returning from the function.  Just open code that in
the callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 mm/readahead.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/mm/readahead.c b/mm/readahead.c
index 05207a663801f..2e5c695b303d7 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -142,14 +142,14 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
 }
 EXPORT_SYMBOL_GPL(file_ra_state_init);
 
-static void read_pages(struct readahead_control *rac, bool skip_page)
+static void read_pages(struct readahead_control *rac)
 {
 	const struct address_space_operations *aops = rac->mapping->a_ops;
 	struct page *page;
 	struct blk_plug plug;
 
 	if (!readahead_count(rac))
-		goto out;
+		return;
 
 	blk_start_plug(&plug);
 
@@ -179,10 +179,6 @@ static void read_pages(struct readahead_control *rac, bool skip_page)
 	blk_finish_plug(&plug);
 
 	BUG_ON(readahead_count(rac));
-
-out:
-	if (skip_page)
-		rac->_index++;
 }
 
 /**
@@ -235,7 +231,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
 			 * have a stable reference to this page, and it's
 			 * not worth getting one just for that.
 			 */
-			read_pages(ractl, true);
+			read_pages(ractl);
+			ractl->_index++;
 			i = ractl->_index + ractl->_nr_pages - index - 1;
 			continue;
 		}
@@ -246,7 +243,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
 		if (filemap_add_folio(mapping, folio, index + i,
 					gfp_mask) < 0) {
 			folio_put(folio);
-			read_pages(ractl, true);
+			read_pages(ractl);
+			ractl->_index++;
 			i = ractl->_index + ractl->_nr_pages - index - 1;
 			continue;
 		}
@@ -260,7 +258,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
 	 * uptodate then the caller will launch readpage again, and
 	 * will then handle the error.
 	 */
-	read_pages(ractl, false);
+	read_pages(ractl);
 	filemap_invalidate_unlock_shared(mapping);
 	memalloc_nofs_restore(nofs);
 }
@@ -534,7 +532,7 @@ void page_cache_ra_order(struct readahead_control *ractl,
 		ra->async_size += index - limit - 1;
 	}
 
-	read_pages(ractl, false);
+	read_pages(ractl);
 
 	/*
 	 * If there were already pages in the page cache, then we may have
-- 
2.30.2


  parent reply	other threads:[~2022-03-31 12:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 14:49 [PATCH 00/12] Additional patches for 5.18 Matthew Wilcox (Oracle)
2022-03-30 14:49 ` [PATCH 01/12] readahead: Remove read_cache_pages() Matthew Wilcox (Oracle)
2022-03-30 14:51   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 02/12] fs: Remove ->readpages address space operation Matthew Wilcox (Oracle)
2022-03-30 14:51   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 03/12] iomap: Simplify is_partially_uptodate a little Matthew Wilcox (Oracle)
2022-03-30 14:52   ` Christoph Hellwig
2022-03-30 16:00     ` Matthew Wilcox
2022-03-31 12:33       ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 04/12] fs: Remove read_actor_t Matthew Wilcox (Oracle)
2022-03-30 14:52   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 05/12] fs, net: Move read_descriptor_t to net.h Matthew Wilcox (Oracle)
2022-03-30 14:52   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 06/12] fs: Pass an iocb to generic_perform_write() Matthew Wilcox (Oracle)
2022-03-30 14:49 ` [PATCH 07/12] filemap: Remove AOP_FLAG_CONT_EXPAND Matthew Wilcox (Oracle)
2022-03-30 14:52   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 08/12] ext4: Correct ext4_journalled_dirty_folio() conversion Matthew Wilcox (Oracle)
2022-03-30 14:53   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 09/12] f2fs: Correct f2fs_dirty_data_folio() conversion Matthew Wilcox (Oracle)
2022-03-30 14:53   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 10/12] f2fs: Get the superblock from the mapping instead of the page Matthew Wilcox (Oracle)
2022-03-30 14:49 ` [PATCH 11/12] ntfs: Correct mark_ntfs_record_dirty() folio conversion Matthew Wilcox (Oracle)
2022-03-30 14:53   ` Christoph Hellwig
2022-03-30 14:49 ` [PATCH 12/12] btrfs: Remove a use of PAGE_SIZE in btrfs_invalidate_folio() Matthew Wilcox (Oracle)
2022-03-30 14:53   ` Christoph Hellwig
2022-03-31 12:35 ` [PATCH 13/12] mm: remove the pages argument to read_pages Christoph Hellwig
2022-03-31 13:50   ` Matthew Wilcox
2022-03-31 12:35 ` Christoph Hellwig [this message]
2022-03-31 23:32 ` [PATCH 00/12] Additional patches for 5.18 Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YkWgK+PJM/6r48Gt@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).