From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Dave Kleikamp <shaggy@kernel.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
jfs-discussion@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 09/13] jfs: Convert page_to_mp to folio_to_mp
Date: Thu, 1 Feb 2024 22:45:58 +0000 [thread overview]
Message-ID: <20240201224605.4055895-10-willy@infradead.org> (raw)
In-Reply-To: <20240201224605.4055895-1-willy@infradead.org>
Access folio->private directly instead of testing the page private flag.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/jfs/jfs_metapage.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 2eb9db0184c1..59729b9dd76f 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -80,11 +80,13 @@ struct meta_anchor {
};
#define mp_anchor(page) ((struct meta_anchor *)page_private(page))
-static inline struct metapage *page_to_mp(struct page *page, int offset)
+static inline struct metapage *folio_to_mp(struct folio *folio, int offset)
{
- if (!PagePrivate(page))
+ struct meta_anchor *anchor = folio->private;
+
+ if (!anchor)
return NULL;
- return mp_anchor(page)->mp[offset >> L2PSIZE];
+ return anchor->mp[offset >> L2PSIZE];
}
static inline int insert_metapage(struct folio *folio, struct metapage *mp)
@@ -144,9 +146,9 @@ static inline void dec_io(struct folio *folio, void (*handler) (struct folio *))
}
#else
-static inline struct metapage *page_to_mp(struct page *page, int offset)
+static inline struct metapage *folio_to_mp(struct folio *folio, int offset)
{
- return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL;
+ return folio->private;
}
static inline int insert_metapage(struct folio *folio, struct metapage *mp)
@@ -303,7 +305,7 @@ static void last_write_complete(struct folio *folio)
unsigned int offset;
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
- mp = page_to_mp(&folio->page, offset);
+ mp = folio_to_mp(folio, offset);
if (mp && test_bit(META_io, &mp->flag)) {
if (mp->lsn)
remove_from_logsync(mp);
@@ -359,7 +361,7 @@ static int metapage_write_folio(struct folio *folio,
folio_start_writeback(folio);
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
- mp = page_to_mp(&folio->page, offset);
+ mp = folio_to_mp(folio, offset);
if (!mp || !test_bit(META_dirty, &mp->flag))
continue;
@@ -526,7 +528,7 @@ static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask)
int offset;
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
- mp = page_to_mp(&folio->page, offset);
+ mp = folio_to_mp(folio, offset);
if (!mp)
continue;
@@ -620,7 +622,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
folio_lock(folio);
}
- mp = page_to_mp(&folio->page, page_offset);
+ mp = folio_to_mp(folio, page_offset);
if (mp) {
if (mp->logical_size != size) {
jfs_error(inode->i_sb,
@@ -804,7 +806,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)
if (IS_ERR(folio))
continue;
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
- mp = page_to_mp(&folio->page, offset);
+ mp = folio_to_mp(folio, offset);
if (!mp)
continue;
if (mp->index < addr)
--
2.43.0
next prev parent reply other threads:[~2024-02-01 22:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 22:45 [PATCH 00/13] JFS folio conversion Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 01/13] jfs: Convert metapage_read_folio to use folio APIs Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 02/13] jfs: Convert metapage_writepage to metapage_write_folio Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 03/13] jfs: Convert __get_metapage to use a folio Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 04/13] jfs: Convert insert_metapage() to take " Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 05/13] jfs; Convert release_metapage to use " Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 06/13] jfs: Convert drop_metapage and remove_metapage to take " Matthew Wilcox (Oracle)
2024-02-02 17:18 ` kernel test robot
2024-02-05 11:29 ` kernel test robot
2024-02-01 22:45 ` [PATCH 07/13] jfs: Convert dec_io " Matthew Wilcox (Oracle)
2024-02-01 22:45 ` [PATCH 08/13] jfs; Convert __invalidate_metapages to use " Matthew Wilcox (Oracle)
2024-02-01 22:45 ` Matthew Wilcox (Oracle) [this message]
2024-02-01 22:45 ` [PATCH 10/13] jfs: Convert inc_io and mp_anchor to take " Matthew Wilcox (Oracle)
2024-02-03 1:53 ` kernel test robot
2024-02-01 22:46 ` [PATCH 11/13] jfs: Convert force_metapage to use " Matthew Wilcox (Oracle)
2024-02-01 22:46 ` [PATCH 12/13] jfs: Change metapage->page to metapage->folio Matthew Wilcox (Oracle)
2024-02-01 22:46 ` [PATCH 13/13] fs: Remove i_blocks_per_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=20240201224605.4055895-10-willy@infradead.org \
--to=willy@infradead.org \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shaggy@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).