netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, linux-afs@lists.infradead.org,
	linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: [PATCH 01/13] afs: Convert pagevec to folio_batch in afs_extend_writeback()
Date: Wed, 21 Jun 2023 17:45:45 +0100	[thread overview]
Message-ID: <20230621164557.3510324-2-willy@infradead.org> (raw)
In-Reply-To: <20230621164557.3510324-1-willy@infradead.org>

Removes a folio->page->folio conversion for each folio that's involved.
More importantly, removes one of the last few uses of a pagevec.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/afs/write.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/afs/write.c b/fs/afs/write.c
index 18ccb613dff8..6e68c70d0b22 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -465,7 +465,7 @@ static void afs_extend_writeback(struct address_space *mapping,
 				 bool caching,
 				 unsigned int *_len)
 {
-	struct pagevec pvec;
+	struct folio_batch fbatch;
 	struct folio *folio;
 	unsigned long priv;
 	unsigned int psize, filler = 0;
@@ -476,7 +476,7 @@ static void afs_extend_writeback(struct address_space *mapping,
 	unsigned int i;
 
 	XA_STATE(xas, &mapping->i_pages, index);
-	pagevec_init(&pvec);
+	folio_batch_init(&fbatch);
 
 	do {
 		/* Firstly, we gather up a batch of contiguous dirty pages
@@ -535,7 +535,7 @@ static void afs_extend_writeback(struct address_space *mapping,
 				stop = false;
 
 			index += folio_nr_pages(folio);
-			if (!pagevec_add(&pvec, &folio->page))
+			if (!folio_batch_add(&fbatch, folio))
 				break;
 			if (stop)
 				break;
@@ -545,14 +545,14 @@ static void afs_extend_writeback(struct address_space *mapping,
 			xas_pause(&xas);
 		rcu_read_unlock();
 
-		/* Now, if we obtained any pages, we can shift them to being
+		/* Now, if we obtained any folios, we can shift them to being
 		 * writable and mark them for caching.
 		 */
-		if (!pagevec_count(&pvec))
+		if (!folio_batch_count(&fbatch))
 			break;
 
-		for (i = 0; i < pagevec_count(&pvec); i++) {
-			folio = page_folio(pvec.pages[i]);
+		for (i = 0; i < folio_batch_count(&fbatch); i++) {
+			folio = fbatch.folios[i];
 			trace_afs_folio_dirty(vnode, tracepoint_string("store+"), folio);
 
 			if (!folio_clear_dirty_for_io(folio))
@@ -565,7 +565,7 @@ static void afs_extend_writeback(struct address_space *mapping,
 			folio_unlock(folio);
 		}
 
-		pagevec_release(&pvec);
+		folio_batch_release(&fbatch);
 		cond_resched();
 	} while (!stop);
 
-- 
2.39.2


  reply	other threads:[~2023-06-21 16:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 16:45 [PATCH 00/13] Remove pagevecs Matthew Wilcox (Oracle)
2023-06-21 16:45 ` Matthew Wilcox (Oracle) [this message]
2023-06-21 16:45 ` [PATCH 02/13] mm: Add __folio_batch_release() Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 03/13] scatterlist: Add sg_set_folio() Matthew Wilcox (Oracle)
2023-07-30 11:01   ` Zhu Yanjun
2023-07-30 11:18     ` Matthew Wilcox
2023-07-30 13:57       ` Zhu Yanjun
2023-07-30 21:42         ` Matthew Wilcox
2023-08-18  7:05           ` Zhu Yanjun
2023-06-21 16:45 ` [PATCH 04/13] i915: Convert shmem_sg_free_table() to use a folio_batch Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 05/13] drm: Convert drm_gem_put_pages() " Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 06/13] mm: Remove check_move_unevictable_pages() Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 07/13] pagevec: Rename fbatch_count() Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 08/13] i915: Convert i915_gpu_error to use a folio_batch Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 09/13] net: Convert sunrpc from pagevec to folio_batch Matthew Wilcox (Oracle)
2023-06-21 17:50   ` Chuck Lever
2023-06-21 16:45 ` [PATCH 10/13] mm: Remove struct pagevec Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 11/13] mm: Rename invalidate_mapping_pagevec to mapping_try_invalidate Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 12/13] mm: Remove references to pagevec Matthew Wilcox (Oracle)
2023-06-21 16:45 ` [PATCH 13/13] mm: Remove unnecessary pagevec includes Matthew Wilcox (Oracle)

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=20230621164557.3510324-2-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.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).