From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org
Subject: [PATCH 3/4] nilfs2: Convert nilfs_recovery_copy_block() to take a folio
Date: Wed, 2 Oct 2024 16:00:33 +0100 [thread overview]
Message-ID: <20241002150036.1339475-4-willy@infradead.org> (raw)
In-Reply-To: <20241002150036.1339475-1-willy@infradead.org>
Use memcpy_to_folio() instead of open-coding it, and use offset_in_folio()
in case anybody wants to use nilfs2 on a device with large blocks.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/nilfs2/recovery.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index 21d81097a89f..1c665a32f002 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -481,19 +481,16 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
static int nilfs_recovery_copy_block(struct the_nilfs *nilfs,
struct nilfs_recovery_block *rb,
- loff_t pos, struct page *page)
+ loff_t pos, struct folio *folio)
{
struct buffer_head *bh_org;
- size_t from = pos & ~PAGE_MASK;
- void *kaddr;
+ size_t from = offset_in_folio(folio, pos);
bh_org = __bread(nilfs->ns_bdev, rb->blocknr, nilfs->ns_blocksize);
if (unlikely(!bh_org))
return -EIO;
- kaddr = kmap_local_page(page);
- memcpy(kaddr + from, bh_org->b_data, bh_org->b_size);
- kunmap_local(kaddr);
+ memcpy_to_folio(folio, from, bh_org->b_data, bh_org->b_size);
brelse(bh_org);
return 0;
}
@@ -531,7 +528,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
goto failed_inode;
}
- err = nilfs_recovery_copy_block(nilfs, rb, pos, &folio->page);
+ err = nilfs_recovery_copy_block(nilfs, rb, pos, folio);
if (unlikely(err))
goto failed_page;
--
2.43.0
next prev parent reply other threads:[~2024-10-02 15:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 15:00 [PATCH 0/4] nilfs2: Finish folio conversion Matthew Wilcox (Oracle)
2024-10-02 15:00 ` [PATCH 1/4] nilfs2: Remove nilfs_writepage Matthew Wilcox (Oracle)
2024-10-03 11:47 ` Ryusuke Konishi
2024-10-02 15:00 ` [PATCH 2/4] nilfs2: Convert nilfs_page_count_clean_buffers() to take a folio Matthew Wilcox (Oracle)
2024-10-03 11:51 ` Ryusuke Konishi
2024-10-02 15:00 ` Matthew Wilcox (Oracle) [this message]
2024-10-03 11:54 ` [PATCH 3/4] nilfs2: Convert nilfs_recovery_copy_block() " Ryusuke Konishi
2024-10-02 15:00 ` [PATCH 4/4] nilfs2: Convert metadata aops from writepage to writepages Matthew Wilcox (Oracle)
2024-10-03 11:49 ` Ryusuke Konishi
2024-10-02 15:40 ` [PATCH 0/4] nilfs2: Finish folio conversion Ryusuke Konishi
2024-10-03 12:20 ` Ryusuke Konishi
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=20241002150036.1339475-4-willy@infradead.org \
--to=willy@infradead.org \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-fsdevel@vger.kernel.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).