On 7/9/25 01:03, Matthew Wilcox (Oracle) wrote: > All callers now have a folio so pass it in. Also remove the test for > the private flag; it is redundant with checking folio->private for being > NULL. > > Signed-off-by: Matthew Wilcox (Oracle) <wi...@infradead.org> > --- > fs/f2fs/compress.c | 14 ++++++-------- > fs/f2fs/data.c | 10 +++++----- > fs/f2fs/f2fs.h | 4 ++-- > 3 files changed, 13 insertions(+), 15 deletions(-) > > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c > index 5847d22a5833..24c7489b7427 100644 > --- a/fs/f2fs/compress.c > +++ b/fs/f2fs/compress.c > @@ -71,17 +71,15 @@ static pgoff_t start_idx_of_cluster(struct compress_ctx > *cc) > return cc->cluster_idx << cc->log_cluster_size; > } > > -bool f2fs_is_compressed_page(struct page *page) > +bool f2fs_is_compressed_page(struct folio *folio) > { > - if (!PagePrivate(page)) > + if (!folio->private) > return false; > - if (!page_private(page)) > - return false; > - if (page_private_nonpointer(page)) > + if (folio_test_f2fs_nonpointer(folio))
Hi Matthew, Is this indicate if folio->private is non-zero, Private flag must have been set in the folio? Something like below function, if folio->private is true, we don't need to set Private flag again after update folio->private, since it assumes it should have been set previously? Is my understanding correct? +static inline void folio_set_f2fs_##name(struct folio *folio) \ +{ \ + unsigned long v = (1UL << PAGE_PRIVATE_NOT_POINTER) | \ + (1UL << PAGE_PRIVATE_##flagname); \ + if (!folio->private) \ + folio_attach_private(folio, (void *)v); \ + else { \ + v |= (unsigned long)folio->private; \ + folio->private = (void *)v; \ + } \ +} \ Thanks, > return false; > > - f2fs_bug_on(F2FS_P_SB(page), > - *((u32 *)page_private(page)) != F2FS_COMPRESSED_PAGE_MAGIC); > + f2fs_bug_on(F2FS_F_SB(folio), > + *((u32 *)folio->private) != F2FS_COMPRESSED_PAGE_MAGIC); > return true; > } > > @@ -1478,7 +1476,7 @@ void f2fs_compress_write_end_io(struct bio *bio, struct > folio *folio) > struct f2fs_sb_info *sbi = bio->bi_private; > struct compress_io_ctx *cic = folio->private; > enum count_type type = WB_DATA_TYPE(folio, > - f2fs_is_compressed_page(page)); > + f2fs_is_compressed_page(folio)); > int i; > > if (unlikely(bio->bi_status != BLK_STS_OK)) > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index cf2c146944bf..116482adf591 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -142,7 +142,7 @@ static void f2fs_finish_read_bio(struct bio *bio, bool > in_task) > bio_for_each_folio_all(fi, bio) { > struct folio *folio = fi.folio; > > - if (f2fs_is_compressed_page(&folio->page)) { > + if (f2fs_is_compressed_page(folio)) { > if (ctx && !ctx->decompression_attempted) > f2fs_end_read_compressed_page(folio, true, 0, > in_task); > @@ -186,7 +186,7 @@ static void f2fs_verify_bio(struct work_struct *work) > bio_for_each_folio_all(fi, bio) { > struct folio *folio = fi.folio; > > - if (!f2fs_is_compressed_page(&folio->page) && > + if (!f2fs_is_compressed_page(folio) && > !fsverity_verify_page(&folio->page)) { > bio->bi_status = BLK_STS_IOERR; > break; > @@ -239,7 +239,7 @@ static void f2fs_handle_step_decompress(struct > bio_post_read_ctx *ctx, > bio_for_each_folio_all(fi, ctx->bio) { > struct folio *folio = fi.folio; > > - if (f2fs_is_compressed_page(&folio->page)) > + if (f2fs_is_compressed_page(folio)) > f2fs_end_read_compressed_page(folio, false, blkaddr, > in_task); > else > @@ -337,7 +337,7 @@ static void f2fs_write_end_io(struct bio *bio) > } > > #ifdef CONFIG_F2FS_FS_COMPRESSION > - if (f2fs_is_compressed_page(&folio->page)) { > + if (f2fs_is_compressed_page(folio)) { > f2fs_compress_write_end_io(bio, folio); > continue; > } > @@ -561,7 +561,7 @@ static bool __has_merged_page(struct bio *bio, struct > inode *inode, > if (IS_ERR(target)) > continue; > } > - if (f2fs_is_compressed_page(&target->page)) { > + if (f2fs_is_compressed_page(target)) { > target = f2fs_compress_control_folio(target); > if (IS_ERR(target)) > continue; > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 68535b917a3a..48b15e44a41c 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -4474,7 +4474,7 @@ enum cluster_check_type { > CLUSTER_COMPR_BLKS, /* return # of compressed blocks in a cluster */ > CLUSTER_RAW_BLKS /* return # of raw blocks in a cluster */ > }; > -bool f2fs_is_compressed_page(struct page *page); > +bool f2fs_is_compressed_page(struct folio *folio); > struct folio *f2fs_compress_control_folio(struct folio *folio); > int f2fs_prepare_compress_overwrite(struct inode *inode, > struct page **pagep, pgoff_t index, void **fsdata); > @@ -4543,7 +4543,7 @@ void f2fs_invalidate_compress_pages(struct f2fs_sb_info > *sbi, nid_t ino); > sbi->compr_saved_block += diff; \ > } while (0) > #else > -static inline bool f2fs_is_compressed_page(struct page *page) { return > false; } > +static inline bool f2fs_is_compressed_page(struct folio *folio) { return > false; } > static inline bool f2fs_is_compress_backend_ready(struct inode *inode) > { > if (!f2fs_compressed_file(inode)) _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel