Skip to content

Commit 49bb2b8

Browse files
Matthew Wilcox (Oracle)Jaegeuk Kim
authored andcommitted
f2fs: Pass a folio to f2fs_cache_compressed_page()
The only caller already has a folio so pass it in. f2fs_cache_compressed_page() is not used outside compress.c so make it static. This requires a forward declaration (or would require rearranging this file, but I've chosen not to do that for readability of the diff). Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 8591db2 commit 49bb2b8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

fs/f2fs/compress.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ void f2fs_decompress_cluster(struct decompress_io_ctx *dic, bool in_task)
793793
f2fs_decompress_end_io(dic, ret, in_task);
794794
}
795795

796+
static void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi,
797+
struct folio *folio, nid_t ino, block_t blkaddr);
798+
796799
/*
797800
* This is called when a page of a compressed cluster has been read from disk
798801
* (or failed to be read from disk). It checks whether this page was the last
@@ -810,7 +813,7 @@ void f2fs_end_read_compressed_page(struct folio *folio, bool failed,
810813
if (failed)
811814
WRITE_ONCE(dic->failed, true);
812815
else if (blkaddr && in_task)
813-
f2fs_cache_compressed_page(sbi, &folio->page,
816+
f2fs_cache_compressed_page(sbi, folio,
814817
dic->inode->i_ino, blkaddr);
815818

816819
if (atomic_dec_and_test(&dic->remaining_pages))
@@ -1918,8 +1921,8 @@ void f2fs_invalidate_compress_pages_range(struct f2fs_sb_info *sbi,
19181921
invalidate_mapping_pages(COMPRESS_MAPPING(sbi), blkaddr, blkaddr + len - 1);
19191922
}
19201923

1921-
void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
1922-
nid_t ino, block_t blkaddr)
1924+
static void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi,
1925+
struct folio *folio, nid_t ino, block_t blkaddr)
19231926
{
19241927
struct folio *cfolio;
19251928
int ret;
@@ -1952,7 +1955,7 @@ void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
19521955

19531956
folio_set_f2fs_data(cfolio, ino);
19541957

1955-
memcpy(folio_address(cfolio), page_address(page), PAGE_SIZE);
1958+
memcpy(folio_address(cfolio), folio_address(folio), PAGE_SIZE);
19561959
folio_mark_uptodate(cfolio);
19571960
f2fs_folio_put(cfolio, true);
19581961
}

fs/f2fs/f2fs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4525,8 +4525,6 @@ void f2fs_destroy_compress_cache(void);
45254525
struct address_space *COMPRESS_MAPPING(struct f2fs_sb_info *sbi);
45264526
void f2fs_invalidate_compress_pages_range(struct f2fs_sb_info *sbi,
45274527
block_t blkaddr, unsigned int len);
4528-
void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
4529-
nid_t ino, block_t blkaddr);
45304528
bool f2fs_load_compressed_folio(struct f2fs_sb_info *sbi, struct folio *folio,
45314529
block_t blkaddr);
45324530
void f2fs_invalidate_compress_pages(struct f2fs_sb_info *sbi, nid_t ino);
@@ -4581,8 +4579,6 @@ static inline int __init f2fs_init_compress_cache(void) { return 0; }
45814579
static inline void f2fs_destroy_compress_cache(void) { }
45824580
static inline void f2fs_invalidate_compress_pages_range(struct f2fs_sb_info *sbi,
45834581
block_t blkaddr, unsigned int len) { }
4584-
static inline void f2fs_cache_compressed_page(struct f2fs_sb_info *sbi,
4585-
struct page *page, nid_t ino, block_t blkaddr) { }
45864582
static inline bool f2fs_load_compressed_folio(struct f2fs_sb_info *sbi,
45874583
struct folio *folio, block_t blkaddr) { return false; }
45884584
static inline void f2fs_invalidate_compress_pages(struct f2fs_sb_info *sbi,

0 commit comments

Comments
 (0)