All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	ntfs3@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: [PATCH 07/10] ntfs3: Convert reading $AttrDef to use folios
Date: Wed, 17 Apr 2024 18:09:35 +0100	[thread overview]
Message-ID: <20240417170941.797116-8-willy@infradead.org> (raw)
In-Reply-To: <20240417170941.797116-1-willy@infradead.org>

This is now large folio safe, although we're not enabling
large folios yet.  It does eliminate a use of kmap().

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

diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 71dfeb0c4323..f6a9ab0f5cad 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -1429,18 +1429,22 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
 		goto put_inode_out;
 	}
 
-	for (done = idx = 0; done < bytes; done += PAGE_SIZE, idx++) {
+	done = idx = 0;
+	while (done < bytes) {
 		unsigned long tail = bytes - done;
-		struct page *page = ntfs_map_page(inode->i_mapping, idx);
+		struct folio *folio = read_mapping_folio(inode->i_mapping,
+				idx, NULL);
 
-		if (IS_ERR(page)) {
-			err = PTR_ERR(page);
+		if (IS_ERR(folio)) {
+			err = PTR_ERR(folio);
 			ntfs_err(sb, "Failed to read $AttrDef (%d).", err);
 			goto put_inode_out;
 		}
-		memcpy(Add2Ptr(t, done), page_address(page),
-		       min(PAGE_SIZE, tail));
-		ntfs_unmap_page(page);
+		memcpy_from_folio(Add2Ptr(t, done), folio, 0,
+				min(tail, folio_size(folio)));
+		done += folio_size(folio);
+		idx += folio_nr_pages(folio);
+		folio_put(folio);
 
 		if (!idx && ATTR_STD != t->type) {
 			ntfs_err(sb, "$AttrDef is corrupted.");
-- 
2.43.0


  parent reply	other threads:[~2024-04-17 17:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 17:09 [PATCH 00/10] ntfs3: Convert (most of) ntfs3 to use folios Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 01/10] ntfs3: Convert ntfs_read_folio to use a folio Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 02/10] ntfs3: Convert ntfs_write_begin " Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 03/10] ntfs3: Convert attr_data_read_resident() to take " Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 04/10] ntfs3: Convert ntfs_write_end() to work on " Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 05/10] ntfs3: Convert attr_data_write_resident to use " Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 06/10] ntfs3: Convert attr_make_nonresident " Matthew Wilcox (Oracle)
2024-04-17 17:09 ` Matthew Wilcox (Oracle) [this message]
2024-04-17 17:09 ` [PATCH 08/10] ntfs3: Use a folio to read UpCase Matthew Wilcox (Oracle)
2024-04-17 17:32   ` Matthew Wilcox
2024-04-19  0:30   ` kernel test robot
2024-04-19  1:12   ` kernel test robot
2024-04-17 17:09 ` [PATCH 09/10] ntfs3: Remove inode_write_data() Matthew Wilcox (Oracle)
2024-04-17 17:09 ` [PATCH 10/10] ntfs3: Remove ntfs_map_page and ntfs_unmap_page 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=20240417170941.797116-8-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.