Skip to content

Commit a824388

Browse files
Matthew Wilcox (Oracle)Jaegeuk Kim
authored andcommitted
f2fs: Use a folio in f2fs_is_cp_guaranteed()
Convert the passed page to a folio and use it throughout. Removes a use of fscrypt_is_bounce_page(), which we're trying to remove. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 4ecaf58 commit a824388

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

fs/f2fs/data.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ void f2fs_destroy_bioset(void)
4747
bioset_exit(&f2fs_bioset);
4848
}
4949

50-
bool f2fs_is_cp_guaranteed(struct page *page)
50+
bool f2fs_is_cp_guaranteed(const struct page *page)
5151
{
52-
struct address_space *mapping = page_folio(page)->mapping;
52+
const struct folio *folio = page_folio(page);
53+
struct address_space *mapping = folio->mapping;
5354
struct inode *inode;
5455
struct f2fs_sb_info *sbi;
5556

56-
if (fscrypt_is_bounce_page(page))
57-
return page_private_gcing(fscrypt_pagecache_page(page));
57+
if (fscrypt_is_bounce_folio(folio))
58+
return folio_test_f2fs_gcing(fscrypt_pagecache_folio(folio));
5859

5960
inode = mapping->host;
6061
sbi = F2FS_I_SB(inode);
@@ -65,7 +66,7 @@ bool f2fs_is_cp_guaranteed(struct page *page)
6566
return true;
6667

6768
if ((S_ISREG(inode->i_mode) && IS_NOQUOTA(inode)) ||
68-
page_private_gcing(page))
69+
folio_test_f2fs_gcing(folio))
6970
return true;
7071
return false;
7172
}

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi);
39903990
*/
39913991
int __init f2fs_init_bioset(void);
39923992
void f2fs_destroy_bioset(void);
3993-
bool f2fs_is_cp_guaranteed(struct page *page);
3993+
bool f2fs_is_cp_guaranteed(const struct page *page);
39943994
int f2fs_init_bio_entry_cache(void);
39953995
void f2fs_destroy_bio_entry_cache(void);
39963996
void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,

include/linux/fscrypt.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,13 @@ static inline struct page *fscrypt_pagecache_page(struct page *bounce_page)
332332
return (struct page *)page_private(bounce_page);
333333
}
334334

335-
static inline bool fscrypt_is_bounce_folio(struct folio *folio)
335+
static inline bool fscrypt_is_bounce_folio(const struct folio *folio)
336336
{
337337
return folio->mapping == NULL;
338338
}
339339

340-
static inline struct folio *fscrypt_pagecache_folio(struct folio *bounce_folio)
340+
static inline
341+
struct folio *fscrypt_pagecache_folio(const struct folio *bounce_folio)
341342
{
342343
return bounce_folio->private;
343344
}
@@ -518,12 +519,13 @@ static inline struct page *fscrypt_pagecache_page(struct page *bounce_page)
518519
return ERR_PTR(-EINVAL);
519520
}
520521

521-
static inline bool fscrypt_is_bounce_folio(struct folio *folio)
522+
static inline bool fscrypt_is_bounce_folio(const struct folio *folio)
522523
{
523524
return false;
524525
}
525526

526-
static inline struct folio *fscrypt_pagecache_folio(struct folio *bounce_folio)
527+
static inline
528+
struct folio *fscrypt_pagecache_folio(const struct folio *bounce_folio)
527529
{
528530
WARN_ON_ONCE(1);
529531
return ERR_PTR(-EINVAL);

0 commit comments

Comments
 (0)