From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Jan Kara <jack@suse.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
"Fabio M . De Francesco" <fmdefrancesco@gmail.com>
Subject: [PATCH 03/10] ext2: Add ext2_get_folio()
Date: Thu, 21 Sep 2023 21:07:40 +0100 [thread overview]
Message-ID: <20230921200746.3303942-3-willy@infradead.org> (raw)
In-Reply-To: <20230921200746.3303942-1-willy@infradead.org>
Convert ext2_get_page() into ext2_get_folio() and keep the original
function around as a temporary wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ext2/dir.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 03867381eec2..5c1b7bded535 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -180,34 +180,46 @@ static bool ext2_check_folio(struct folio *folio, int quiet, char *kaddr)
}
/*
- * Calls to ext2_get_page()/ext2_put_page() must be nested according to the
- * rules documented in kmap_local_page()/kunmap_local().
+ * Calls to ext2_get_folio()/folio_release_kmap() must be nested according
+ * to the rules documented in kmap_local_folio()/kunmap_local().
*
- * NOTE: ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page()
- * and should be treated as a call to ext2_get_page() for nesting purposes.
+ * NOTE: ext2_find_entry() and ext2_dotdot() act as a call
+ * to folio_release_kmap() and should be treated as a call to
+ * folio_release_kmap() for nesting purposes.
*/
-static void *ext2_get_page(struct inode *dir, unsigned long n,
- int quiet, struct page **page)
+static void *ext2_get_folio(struct inode *dir, unsigned long n,
+ int quiet, struct folio **foliop)
{
struct address_space *mapping = dir->i_mapping;
struct folio *folio = read_mapping_folio(mapping, n, NULL);
- void *page_addr;
+ void *kaddr;
if (IS_ERR(folio))
return ERR_CAST(folio);
- page_addr = kmap_local_folio(folio, 0);
+ kaddr = kmap_local_folio(folio, 0);
if (unlikely(!folio_test_checked(folio))) {
- if (!ext2_check_folio(folio, quiet, page_addr))
+ if (!ext2_check_folio(folio, quiet, kaddr))
goto fail;
}
- *page = &folio->page;
- return page_addr;
+ *foliop = folio;
+ return kaddr;
fail:
- ext2_put_page(&folio->page, page_addr);
+ folio_release_kmap(folio, kaddr);
return ERR_PTR(-EIO);
}
+static void *ext2_get_page(struct inode *dir, unsigned long n,
+ int quiet, struct page **pagep)
+{
+ struct folio *folio;
+ void *kaddr = ext2_get_folio(dir, n, quiet, &folio);
+
+ if (!IS_ERR(kaddr))
+ *pagep = &folio->page;
+ return kaddr;
+}
+
/*
* NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
*
--
2.40.1
next prev parent reply other threads:[~2023-09-21 20:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 20:07 [PATCH 01/10] highmem: Add folio_release_kmap() Matthew Wilcox (Oracle)
2023-09-21 20:07 ` [PATCH 02/10] ext2: Convert ext2_check_page to ext2_check_folio Matthew Wilcox (Oracle)
2023-10-03 10:40 ` Jan Kara
2023-10-03 10:52 ` Jan Kara
2023-10-05 18:27 ` Matthew Wilcox
2023-10-03 11:02 ` Jan Kara
2023-09-21 20:07 ` Matthew Wilcox (Oracle) [this message]
2023-09-21 20:07 ` [PATCH 04/10] ext2: Convert ext2_readdir to use a folio Matthew Wilcox (Oracle)
2023-09-21 20:07 ` [PATCH 05/10] ext2: Convert ext2_add_link() " Matthew Wilcox (Oracle)
2023-09-21 20:07 ` [PATCH 06/10] ext2: Convert ext2_empty_dir() " Matthew Wilcox (Oracle)
2023-09-21 20:07 ` [PATCH 07/10] ext2: Handle large block size directories in ext2_delete_entry() Matthew Wilcox (Oracle)
2023-10-25 18:17 ` Jan Kara
2023-09-21 20:07 ` [PATCH 08/10] ext2: Convert ext2_unlink() and ext2_rename() to use folios Matthew Wilcox (Oracle)
2023-10-25 18:20 ` Jan Kara
2023-09-21 20:07 ` [PATCH 09/10] ext2: Convert ext2_make_empty() to use a folio Matthew Wilcox (Oracle)
2023-10-03 10:41 ` [PATCH 01/10] highmem: Add folio_release_kmap() Jan Kara
2023-10-03 11:55 ` Matthew Wilcox
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=20230921200746.3303942-3-willy@infradead.org \
--to=willy@infradead.org \
--cc=fmdefrancesco@gmail.com \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@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).