linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Christian Brauner <brauner@kernel.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org,
	linux-btrfs@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-mm@kvack.org
Subject: [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios
Date: Wed,  2 Oct 2024 05:01:04 +0100	[thread overview]
Message-ID: <20241002040111.1023018-3-willy@infradead.org> (raw)
In-Reply-To: <20241002040111.1023018-1-willy@infradead.org>

Use folio APIs instead of page APIs.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/nilfs2/page.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 9c0b7cddeaae..16bb82cdbc07 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -98,16 +98,16 @@ void nilfs_forget_buffer(struct buffer_head *bh)
  */
 void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
 {
-	void *kaddr0, *kaddr1;
+	void *saddr, *daddr;
 	unsigned long bits;
-	struct page *spage = sbh->b_page, *dpage = dbh->b_page;
+	struct folio *sfolio = sbh->b_folio, *dfolio = dbh->b_folio;
 	struct buffer_head *bh;
 
-	kaddr0 = kmap_local_page(spage);
-	kaddr1 = kmap_local_page(dpage);
-	memcpy(kaddr1 + bh_offset(dbh), kaddr0 + bh_offset(sbh), sbh->b_size);
-	kunmap_local(kaddr1);
-	kunmap_local(kaddr0);
+	saddr = kmap_local_folio(sfolio, bh_offset(sbh));
+	daddr = kmap_local_folio(dfolio, bh_offset(dbh));
+	memcpy(daddr, saddr, sbh->b_size);
+	kunmap_local(daddr);
+	kunmap_local(saddr);
 
 	dbh->b_state = sbh->b_state & NILFS_BUFFER_INHERENT_BITS;
 	dbh->b_blocknr = sbh->b_blocknr;
@@ -121,13 +121,13 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
 		unlock_buffer(bh);
 	}
 	if (bits & BIT(BH_Uptodate))
-		SetPageUptodate(dpage);
+		folio_mark_uptodate(dfolio);
 	else
-		ClearPageUptodate(dpage);
+		folio_clear_uptodate(dfolio);
 	if (bits & BIT(BH_Mapped))
-		SetPageMappedToDisk(dpage);
+		folio_set_mappedtodisk(dfolio);
 	else
-		ClearPageMappedToDisk(dpage);
+		folio_clear_mappedtodisk(dfolio);
 }
 
 /**
-- 
2.43.0


  parent reply	other threads:[~2024-10-02  4:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02  4:01 [PATCH 0/6] Filesystem page flags cleanup Matthew Wilcox (Oracle)
2024-10-02  4:01 ` [PATCH 1/6] fs: Move clearing of mappedtodisk to buffer.c Matthew Wilcox (Oracle)
2024-10-03 12:10   ` Jan Kara
2024-10-03 14:19     ` Matthew Wilcox
2024-10-02  4:01 ` Matthew Wilcox (Oracle) [this message]
2024-10-02 13:11   ` [PATCH 2/6] nilfs2: Convert nilfs_copy_buffer() to use folios Ryusuke Konishi
2024-10-02  4:01 ` [PATCH 3/6] mm: Remove PageMappedToDisk Matthew Wilcox (Oracle)
2024-10-03 12:11   ` Jan Kara
2024-10-02  4:01 ` [PATCH 4/6] btrfs: Switch from using the private_2 flag to owner_2 Matthew Wilcox (Oracle)
2024-10-03 17:09   ` Josef Bacik
2024-10-02  4:01 ` [PATCH 5/6] ceph: Remove call to PagePrivate2() Matthew Wilcox (Oracle)
2024-10-02  4:01 ` [PATCH 6/6] migrate: Remove references to Private2 Matthew Wilcox (Oracle)
2024-10-03 12:13   ` Jan Kara
2024-10-04  7:24 ` [PATCH 0/6] Filesystem page flags cleanup Christian Brauner

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=20241002040111.1023018-3-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=brauner@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nilfs@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).