Skip to content

Commit 501bb98

Browse files
Matthew Wilcox (Oracle)kleikamp
authored andcommitted
jfs: Convert page_to_mp to folio_to_mp
Access folio->private directly instead of testing the page private flag. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
1 parent f86a3a1 commit 501bb98

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

fs/jfs/jfs_metapage.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ struct meta_anchor {
8080
};
8181
#define mp_anchor(page) ((struct meta_anchor *)page_private(page))
8282

83-
static inline struct metapage *page_to_mp(struct page *page, int offset)
83+
static inline struct metapage *folio_to_mp(struct folio *folio, int offset)
8484
{
85-
if (!PagePrivate(page))
85+
struct meta_anchor *anchor = folio->private;
86+
87+
if (!anchor)
8688
return NULL;
87-
return mp_anchor(page)->mp[offset >> L2PSIZE];
89+
return anchor->mp[offset >> L2PSIZE];
8890
}
8991

9092
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 *))
144146
}
145147

146148
#else
147-
static inline struct metapage *page_to_mp(struct page *page, int offset)
149+
static inline struct metapage *folio_to_mp(struct folio *folio, int offset)
148150
{
149-
return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL;
151+
return folio->private;
150152
}
151153

152154
static inline int insert_metapage(struct folio *folio, struct metapage *mp)
@@ -303,7 +305,7 @@ static void last_write_complete(struct folio *folio)
303305
unsigned int offset;
304306

305307
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
306-
mp = page_to_mp(&folio->page, offset);
308+
mp = folio_to_mp(folio, offset);
307309
if (mp && test_bit(META_io, &mp->flag)) {
308310
if (mp->lsn)
309311
remove_from_logsync(mp);
@@ -359,7 +361,7 @@ static int metapage_write_folio(struct folio *folio,
359361
folio_start_writeback(folio);
360362

361363
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
362-
mp = page_to_mp(&folio->page, offset);
364+
mp = folio_to_mp(folio, offset);
363365

364366
if (!mp || !test_bit(META_dirty, &mp->flag))
365367
continue;
@@ -526,7 +528,7 @@ static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask)
526528
int offset;
527529

528530
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
529-
mp = page_to_mp(&folio->page, offset);
531+
mp = folio_to_mp(folio, offset);
530532

531533
if (!mp)
532534
continue;
@@ -620,7 +622,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
620622
folio_lock(folio);
621623
}
622624

623-
mp = page_to_mp(&folio->page, page_offset);
625+
mp = folio_to_mp(folio, page_offset);
624626
if (mp) {
625627
if (mp->logical_size != size) {
626628
jfs_error(inode->i_sb,
@@ -804,7 +806,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)
804806
if (IS_ERR(folio))
805807
continue;
806808
for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) {
807-
mp = page_to_mp(&folio->page, offset);
809+
mp = folio_to_mp(folio, offset);
808810
if (!mp)
809811
continue;
810812
if (mp->index < addr)

0 commit comments

Comments
 (0)