f2fs folio conversions for v6.15
Subsystems (5)
Matthew Wilcox (Oracle)
maintainercover f2fs folio conversions for v6.15
More f2fs folio conversions. This time I'm focusing on removing accesses to page->mapping as well as getting rid of accesses to old APIs. f2fs was the last user of wait_for_stable_page(), grab_cache_page_write_begin() and wait_on_page_locked(), so I've included those removals in this series too.
Matthew Wilcox (Oracle) (27):
f2fs: Add f2fs_folio_wait_writeback()
mm: Remove wait_for_stable_page()
f2fs: Add f2fs_folio_put()
f2fs: Convert f2fs_flush_inline_data() to use a folio
f2fs: Convert f2fs_sync_node_pages() to use a folio
f2fs: Pass a folio to flush_dirty_inode()
f2fs: Convert f2fs_fsync_node_pages() to use a folio
f2fs: Convert last_fsync_dnode() to use a folio
f2fs: Return a folio from last_fsync_dnode()
f2fs: Add f2fs_grab_cache_folio()
mm: Remove grab_cache_page_write_begin()
f2fs: Use a folio in __get_node_page()
f2fs: Use a folio in do_write_page()
f2fs: Convert f2fs_write_end_io() to use a folio_iter
f2fs: Mark some functions as taking a const page pointer
f2fs: Convert f2fs_in_warm_node_list() to take a folio
f2fs: Add f2fs_get_node_folio()
f2fs: Use a folio throughout f2fs_truncate_inode_blocks()
f2fs: Use a folio throughout __get_meta_page()
f2fs: Hoist the page_folio() call to the start of
f2fs_merge_page_bio()
f2fs: Add f2fs_get_read_data_folio()
f2fs: Add f2fs_get_lock_data_folio()
f2fs: Convert move_data_page() to use a folio
f2fs: Convert truncate_partial_data_page() to use a folio
f2fs: Convert gc_data_segment() to use a folio
f2fs: Add f2fs_find_data_folio()
mm: Remove wait_on_page_locked()
fs/f2fs/checkpoint.c | 26 ++-- fs/f2fs/data.c | 130 ++++++++++--------- fs/f2fs/f2fs.h | 90 +++++++++---- fs/f2fs/file.c | 24 ++-- fs/f2fs/gc.c | 42 +++--- fs/f2fs/node.c | 279 ++++++++++++++++++++-------------------- fs/f2fs/node.h | 6 +- fs/f2fs/segment.c | 26 ++-- include/linux/pagemap.h | 9 -- mm/filemap.c | 2 +- mm/folio-compat.c | 14 -- 11 files changed, 338 insertions(+), 310 deletions(-)
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 1/27 f2fs: Add f2fs_folio_wait_writeback()
Convert f2fs_wait_on_page_writeback() to f2fs_folio_wait_writeback() and add a compatibiility wrapper. Replaces five calls to compound_head() with one.
--- fs/f2fs/f2fs.h | 6 ++++-- fs/f2fs/segment.c | 19 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-)
fs/f2fs/f2fs.h +4 -2
@@ -3760,8 +3760,10 @@ int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, struct f2fs_io_info *fio);void f2fs_update_device_state (struct f2fs_sb_info *sbi,nid_t ino,block_t blkaddr,unsigned int blkcnt); -void f2fs_wait_on_page_writeback (struct page *page, -enum page_type type,bool ordered,bool locked); +void f2fs_folio_wait_writeback (struct folio *folio,enum page_type type, +bool ordered,bool locked); +#define f2fs_wait_on_page_writeback (page, type, ordered, locked) \ + f2fs_folio_wait_writeback(page_folio(page), type, ordered, locked)void f2fs_wait_on_block_writeback (struct inode *inode,block_t blkaddr);void f2fs_wait_on_block_writeback_range (struct inode *inode,block_t blkaddr,block_t len);
fs/f2fs/segment.c +9 -10
@@ -4154,22 +4154,21 @@ void f2fs_replace_block(struct f2fs_sb_info *sbi, struct dnode_of_data *dn,f2fs_update_data_blkaddr (dn, new_addr); } -void f2fs_wait_on_page_writeback (struct page *page, -enum page_type type,bool ordered,bool locked) +void f2fs_folio_wait_writeback (struct folio *folio,enum page_type type, +bool ordered,bool locked) { -if (folio_test_writeback (page_folio (page))) { -struct f2fs_sb_info *sbi =F2FS_P_SB (page); +if (folio_test_writeback (folio)) { +struct f2fs_sb_info *sbi =F2FS_F_SB (folio);/* submit cached LFS IO */ -f2fs_submit_merged_write_cond (sbi,NULL , page,0 , type); +f2fs_submit_merged_write_cond (sbi,NULL , &folio->page,0 , type);/* submit cached IPU IO */ -f2fs_submit_merged_ipu_write (sbi,NULL , page); +f2fs_submit_merged_ipu_write (sbi,NULL , &folio->page);if (ordered) { -wait_on_page_writeback (page); -f2fs_bug_on (sbi, locked && -folio_test_writeback (page_folio (page))); +folio_wait_writeback (folio); +f2fs_bug_on (sbi, locked &&folio_test_writeback (folio)); }else { -wait_for_stable_page (page); +folio_wait_stable (folio); } } }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 2/27 mm: Remove wait_for_stable_page()
In reply to Matthew Wilcox (Oracle)The last caller has been converted to call folio_wait_stable(), so we can remove this wrapper.
--- include/linux/pagemap.h | 1 - mm/folio-compat.c | 6 ------ 2 files changed, 7 deletions(-)
include/linux/pagemap.h +0 -1
@@ -1256,7 +1256,6 @@ void folio_wait_writeback(struct folio *folio);int folio_wait_writeback_killable (struct folio *folio);void end_page_writeback (struct page *page);void folio_end_writeback (struct folio *folio); -void wait_for_stable_page (struct page *page);void folio_wait_stable (struct folio *folio);void __folio_mark_dirty (struct folio *folio,struct address_space *,int warn);void folio_account_cleaned (struct folio *folio,struct bdi_writeback *wb);
mm/folio-compat.c +0 -6
@@ -28,12 +28,6 @@ void wait_on_page_writeback(struct page *page) }EXPORT_SYMBOL_GPL (wait_on_page_writeback); -void wait_for_stable_page (struct page *page) -{ -return folio_wait_stable (page_folio (page)); -} -EXPORT_SYMBOL_GPL (wait_for_stable_page); -void mark_page_accessed (struct page *page) {folio_mark_accessed (page_folio (page));
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 3/27 f2fs: Add f2fs_folio_put()
In reply to Matthew Wilcox (Oracle)Convert f2fs_put_page() to f2fs_folio_put() and add a wrapper. Replaces three calls to compound_head() with one.
--- fs/f2fs/f2fs.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/f2fs/f2fs.h +10 -5
@@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page(return pagecache_get_page (mapping, index, fgp_flags, gfp_mask); } -static inline void f2fs_put_page (struct page *page,int unlock) +static inline void f2fs_folio_put (struct folio *folio,bool unlock) { -if (!page) +if (!folio)return ;if (unlock) { -f2fs_bug_on (F2FS_P_SB (page), !PageLocked (page)); -unlock_page (page); +f2fs_bug_on (F2FS_F_SB (folio), !folio_test_locked (folio)); +folio_unlock (folio); } -put_page (page); +folio_put (folio); +} + +static inline void f2fs_put_page (struct page *page,int unlock) +{ +f2fs_folio_put (page_folio (page), unlock); }static inline void f2fs_put_dnode (struct dnode_of_data *dn)
Signature · 1 line
2.47.2
Jaegeuk Kim
maintainerRe: [PATCH 03/27] f2fs: Add f2fs_folio_put()
Quoted 25 lines · Matthew Wilcox (Oracle)
Convert
f2fs_put_page()tof2fs_folio_put()and add a wrapper. Replaces three calls tocompound_head()with one.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/f2fs.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)fs/f2fs/f2fs.h +2
-3@@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page(return pagecache_get_page (mapping, index, fgp_flags, gfp_mask); } -static inline void f2fs_put_page (struct page *page,int unlock) +static inline void f2fs_folio_put (struct folio *folio,bool unlock) { -if (!page) +if (!folio)return ;if (unlock) { -f2fs_bug_on (F2FS_P_SB (page), !PageLocked (page));
fs/f2fs/f2fs.h static inline struct page *f2fs_pagecache_get_page( · line 2822
Quoted 10 lines
fs/f2fs/f2fs.h +7
-2-unlock_page (page); +f2fs_bug_on (F2FS_F_SB (folio), !folio_test_locked (folio)); +folio_unlock (folio); } -put_page (page); +folio_put (folio); +} + +static inline void f2fs_put_page (struct page *page,int unlock) +{
I got a kernel panic, since there are still several places to pass a null page pointer, which feeds to page_folio() which doesn't expect the null.
Applying this can avoid the panic.
if (!page) return;
Quoted 7 lines
fs/f2fs/f2fs.h +1
-0+f2fs_folio_put (page_folio (page), unlock); }static inline void f2fs_put_dnode (struct dnode_of_data *dn)Signature · 1 line
2.47.2
Jaegeuk Kim
maintainerRe: [PATCH 03/27] f2fs: Add f2fs_folio_put()
Hi Matthew,
Quoted 40 lines · Jaegeuk Kim
Quoted 25 lines · Matthew Wilcox (Oracle)
Convert
f2fs_put_page()tof2fs_folio_put()and add a wrapper. Replaces three calls tocompound_head()with one.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/f2fs.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)fs/f2fs/f2fs.h +2
-3@@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page(return pagecache_get_page (mapping, index, fgp_flags, gfp_mask); } -static inline void f2fs_put_page (struct page *page,int unlock) +static inline void f2fs_folio_put (struct folio *folio,bool unlock) { -if (!page) +if (!folio)return ;if (unlock) { -f2fs_bug_on (F2FS_P_SB (page), !PageLocked (page));fs/f2fs/f2fs.h static inline struct page *f2fs_pagecache_get_page( · line 2822
Quoted 10 lines
fs/f2fs/f2fs.h +7
-2-unlock_page (page); +f2fs_bug_on (F2FS_F_SB (folio), !folio_test_locked (folio)); +folio_unlock (folio); } -put_page (page); +folio_put (folio); +} + +static inline void f2fs_put_page (struct page *page,int unlock) +{I got a kernel panic, since there are still several places to pass a null page pointer, which feeds to
page_folio()which doesn't expect the null.
Quoted 4 lines
Applying this can avoid the panic.
if (!page) return;
Please let me know, if you want me to apply this to your patch directly, or post v2.
Thanks,
Quoted 8 lines
Quoted 8 lines
fs/f2fs/f2fs.h +1
-0+f2fs_folio_put (page_folio (page), unlock); }static inline void f2fs_put_dnode (struct dnode_of_data *dn)Signature · 1 line
2.47.2
Re: [PATCH 03/27] f2fs: Add f2fs_folio_put()
Quoted 43 lines · Jaegeuk Kim
Hi Matthew,
Quoted 40 lines · Jaegeuk Kim
Quoted 25 lines · Matthew Wilcox (Oracle)
Convert
f2fs_put_page()tof2fs_folio_put()and add a wrapper. Replaces three calls tocompound_head()with one.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/f2fs.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)fs/f2fs/f2fs.h +2
-3@@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page(return pagecache_get_page (mapping, index, fgp_flags, gfp_mask); } -static inline void f2fs_put_page (struct page *page,int unlock) +static inline void f2fs_folio_put (struct folio *folio,bool unlock) { -if (!page) +if (!folio)return ;if (unlock) { -f2fs_bug_on (F2FS_P_SB (page), !PageLocked (page));fs/f2fs/f2fs.h static inline struct page *f2fs_pagecache_get_page( · line 2822
Quoted 10 lines
fs/f2fs/f2fs.h +7
-2-unlock_page (page); +f2fs_bug_on (F2FS_F_SB (folio), !folio_test_locked (folio)); +folio_unlock (folio); } -put_page (page); +folio_put (folio); +} + +static inline void f2fs_put_page (struct page *page,int unlock) +{I got a kernel panic, since there are still several places to pass a null page pointer, which feeds to
page_folio()which doesn't expect the null.
Quoted 7 lines
Quoted 4 lines
Applying this can avoid the panic.
if (!page) return;Please let me know, if you want me to apply this to your patch directly, or post v2.
I applied the fix into your patch. Thanks.
Quoted 11 lines
Thanks,
Quoted 8 lines
Quoted 8 lines
fs/f2fs/f2fs.h +1
-0+f2fs_folio_put (page_folio (page), unlock); }static inline void f2fs_put_dnode (struct dnode_of_data *dn)Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 4/27 f2fs: Convert f2fs_flush_inline_data() to use a folio
In reply to Matthew Wilcox (Oracle)Use the folio APIs where they exist. Saves several hidden calls to compound_head(). Also removes a reference to page->mapping.
--- fs/f2fs/node.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
fs/f2fs/node.c +13 -18
@@ -1951,32 +1951,27 @@ void f2fs_flush_inline_data(struct f2fs_sb_info *sbi)int i;for (i =0 ; i < nr_folios; i++) { -struct page *page = &fbatch.folios[i]->page; +struct folio *folio = fbatch.folios[i]; -if (!IS_INODE (page)) +if (!IS_INODE (&folio->page))continue ; -lock_page (page); +folio_lock (folio); -if (unlikely (page->mapping !=NODE_MAPPING (sbi))) { -continue_unlock: -unlock_page (page); -continue ; - } - -if (!PageDirty (page)) { -/* someone wrote it for us */ - goto continue_unlock; - } +if (unlikely (folio->mapping !=NODE_MAPPING (sbi))) + goto unlock; +if (!folio_test_dirty (folio)) + goto unlock;/* flush inline_data, if it's async context. */ -if (page_private_inline (page)) { -clear_page_private_inline (page); -unlock_page (page); -flush_inline_data (sbi,ino_of_node (page)); +if (page_private_inline (&folio->page)) { +clear_page_private_inline (&folio->page); +folio_unlock (folio); +flush_inline_data (sbi,ino_of_node (&folio->page));continue ; } -unlock_page (page); +unlock: +folio_unlock (folio); }folio_batch_release (&fbatch);cond_resched ();
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 5/27 f2fs: Convert f2fs_sync_node_pages() to use a folio
In reply to Matthew Wilcox (Oracle)Use the folio APIs where they exist. Saves several hidden calls to compound_head(). Also removes a reference to page->mapping.
--- fs/f2fs/node.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
fs/f2fs/node.c +22 -22
@@ -2000,7 +2000,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,int i;for (i =0 ; i < nr_folios; i++) { -struct page *page = &fbatch.folios[i]->page; +struct folio *folio = fbatch.folios[i];bool submitted = false;/* give a priority to WB_SYNC threads */
@@ -2016,27 +2016,27 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,* 1. dentry dnodes * 2. file dnodes */ -if (step ==0 &&IS_DNODE (page)) +if (step ==0 &&IS_DNODE (&folio->page))continue ; -if (step ==1 && (!IS_DNODE (page) || -is_cold_node (page))) +if (step ==1 && (!IS_DNODE (&folio->page) || +is_cold_node (&folio->page)))continue ; -if (step ==2 && (!IS_DNODE (page) || - !is_cold_node (page))) +if (step ==2 && (!IS_DNODE (&folio->page) || + !is_cold_node (&folio->page)))continue ; lock_node:if (wbc->sync_mode ==WB_SYNC_ALL ) -lock_page (page); -else if (!trylock_page (page)) +folio_lock (folio); +else if (!folio_trylock (folio))continue ; -if (unlikely (page->mapping !=NODE_MAPPING (sbi))) { +if (unlikely (folio->mapping !=NODE_MAPPING (sbi))) { continue_unlock: -unlock_page (page); +folio_unlock (folio);continue ; } -if (!PageDirty (page)) { +if (!folio_test_dirty (folio)) {/* someone wrote it for us */ goto continue_unlock; }
@@ -2046,29 +2046,29 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, goto write_node;/* flush inline_data */ -if (page_private_inline (page)) { -clear_page_private_inline (page); -unlock_page (page); -flush_inline_data (sbi,ino_of_node (page)); +if (page_private_inline (&folio->page)) { +clear_page_private_inline (&folio->page); +folio_unlock (folio); +flush_inline_data (sbi,ino_of_node (&folio->page)); goto lock_node; }/* flush dirty inode */ -if (IS_INODE (page) &&flush_dirty_inode (page)) +if (IS_INODE (&folio->page) &&flush_dirty_inode (&folio->page)) goto lock_node; write_node: -f2fs_wait_on_page_writeback (page,NODE , true, true); +f2fs_folio_wait_writeback (folio,NODE , true, true); -if (!clear_page_dirty_for_io (page)) +if (!folio_clear_dirty_for_io (folio)) goto continue_unlock; -set_fsync_mark (page,0 ); -set_dentry_mark (page,0 ); +set_fsync_mark (&folio->page,0 ); +set_dentry_mark (&folio->page,0 ); - ret =__write_node_page (page, false, &submitted, + ret =__write_node_page (&folio->page, false, &submitted, wbc, do_balance, io_type,NULL );if (ret) -unlock_page (page); +folio_unlock (folio);else if (submitted) nwritten++;
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 6/27 f2fs: Pass a folio to flush_dirty_inode()
In reply to Matthew Wilcox (Oracle)Its one caller now has a folio; pass it in and do page conversions where necessary inside flush_dirty_inode(). Saves two hidden calls to compound_head().
--- fs/f2fs/node.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/f2fs/node.c +6 -6
@@ -1920,18 +1920,18 @@ static int f2fs_match_ino(struct inode *inode, unsigned long ino, void *data)return 1 ; } -static bool flush_dirty_inode (struct page *page) +static bool flush_dirty_inode (struct folio *folio) { -struct f2fs_sb_info *sbi =F2FS_P_SB (page); +struct f2fs_sb_info *sbi =F2FS_F_SB (folio);struct inode *inode; -nid_t ino =ino_of_node (page); +nid_t ino =ino_of_node (&folio->page); inode =find_inode_nowait (sbi->sb, ino, f2fs_match_ino,NULL );if (!inode)return false; -f2fs_update_inode (inode, page); -unlock_page (page); +f2fs_update_inode (inode, &folio->page); +folio_unlock (folio);iput (inode);return true;
@@ -2054,7 +2054,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, }/* flush dirty inode */ -if (IS_INODE (&folio->page) &&flush_dirty_inode (&folio->page)) +if (IS_INODE (&folio->page) &&flush_dirty_inode (folio)) goto lock_node; write_node:f2fs_folio_wait_writeback (folio,NODE , true, true);
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 7/27 f2fs: Convert f2fs_fsync_node_pages() to use a folio
In reply to Matthew Wilcox (Oracle)Use the folio APIs where they exist. Saves several hidden calls to compound_head(). Also removes a reference to page->mapping.
--- fs/f2fs/node.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-)
fs/f2fs/node.c +24 -24
@@ -1804,7 +1804,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,int i;for (i =0 ; i < nr_folios; i++) { -struct page *page = &fbatch.folios[i]->page; +struct folio *folio = fbatch.folios[i];bool submitted = false;if (unlikely (f2fs_cp_error (sbi))) {
@@ -1814,63 +1814,63 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, goto out; } -if (!IS_DNODE (page) || !is_cold_node (page)) +if (!IS_DNODE (&folio->page) || !is_cold_node (&folio->page))continue ; -if (ino_of_node (page) != ino) +if (ino_of_node (&folio->page) != ino)continue ; -lock_page (page); +folio_lock (folio); -if (unlikely (page->mapping !=NODE_MAPPING (sbi))) { +if (unlikely (folio->mapping !=NODE_MAPPING (sbi))) { continue_unlock: -unlock_page (page); +folio_unlock (folio);continue ; } -if (ino_of_node (page) != ino) +if (ino_of_node (&folio->page) != ino) goto continue_unlock; -if (!PageDirty (page) && page != last_page) { +if (!folio_test_dirty (folio) && &folio->page != last_page) {/* someone wrote it for us */ goto continue_unlock; } -f2fs_wait_on_page_writeback (page,NODE , true, true); +f2fs_folio_wait_writeback (folio,NODE , true, true); -set_fsync_mark (page,0 ); -set_dentry_mark (page,0 ); +set_fsync_mark (&folio->page,0 ); +set_dentry_mark (&folio->page,0 ); -if (!atomic || page == last_page) { -set_fsync_mark (page,1 ); +if (!atomic || &folio->page == last_page) { +set_fsync_mark (&folio->page,1 );percpu_counter_inc (&sbi->rf_node_block_count); -if (IS_INODE (page)) { +if (IS_INODE (&folio->page)) {if (is_inode_flag_set (inode,FI_DIRTY_INODE )) -f2fs_update_inode (inode, page); -set_dentry_mark (page, +f2fs_update_inode (inode, &folio->page); +set_dentry_mark (&folio->page,f2fs_need_dentry_mark (sbi, ino)); }/* may be written by other thread */ -if (!PageDirty (page)) -set_page_dirty (page); +if (!folio_test_dirty (folio)) +folio_mark_dirty (folio); } -if (!clear_page_dirty_for_io (page)) +if (!folio_clear_dirty_for_io (folio)) goto continue_unlock; - ret =__write_node_page (page, atomic && - page == last_page, + ret =__write_node_page (&folio->page, atomic && + &folio->page == last_page, &submitted, wbc, true,FS_NODE_IO , seq_id);if (ret) { -unlock_page (page); +folio_unlock (folio);f2fs_put_page (last_page,0 );break ; }else if (submitted) { nwritten++; } -if (page == last_page) { -f2fs_put_page (page,0 ); +if (&folio->page == last_page) { +f2fs_folio_put (folio, false); marked = true;break ; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 8/27 f2fs: Convert last_fsync_dnode() to use a folio
In reply to Matthew Wilcox (Oracle)Use the folio APIs where they exist. Saves several hidden calls to compound_head(). Also removes a reference to page->mapping.
--- fs/f2fs/node.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
fs/f2fs/node.c +16 -16
@@ -1565,7 +1565,7 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) {pgoff_t index;struct folio_batch fbatch; -struct page *last_page =NULL ; +struct folio *last_folio =NULL ;int nr_folios;folio_batch_init (&fbatch);
@@ -1577,45 +1577,45 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)int i;for (i =0 ; i < nr_folios; i++) { -struct page *page = &fbatch.folios[i]->page; +struct folio *folio = fbatch.folios[i];if (unlikely (f2fs_cp_error (sbi))) { -f2fs_put_page (last_page,0 ); +f2fs_folio_put (last_folio, false);folio_batch_release (&fbatch);return ERR_PTR (-EIO ); } -if (!IS_DNODE (page) || !is_cold_node (page)) +if (!IS_DNODE (&folio->page) || !is_cold_node (&folio->page))continue ; -if (ino_of_node (page) != ino) +if (ino_of_node (&folio->page) != ino)continue ; -lock_page (page); +folio_lock (folio); -if (unlikely (page->mapping !=NODE_MAPPING (sbi))) { +if (unlikely (folio->mapping !=NODE_MAPPING (sbi))) { continue_unlock: -unlock_page (page); +folio_unlock (folio);continue ; } -if (ino_of_node (page) != ino) +if (ino_of_node (&folio->page) != ino) goto continue_unlock; -if (!PageDirty (page)) { +if (!folio_test_dirty (folio)) {/* someone wrote it for us */ goto continue_unlock; } -if (last_page) -f2fs_put_page (last_page,0 ); +if (last_folio) +f2fs_folio_put (last_folio, false); -get_page (page); - last_page = page; -unlock_page (page); +folio_get (folio); + last_folio = folio; +folio_unlock (folio); }folio_batch_release (&fbatch);cond_resched (); } -return last_page; +return &last_folio->page; } static int __write_node_page(struct page *page, bool atomic, bool *submitted,
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 9/27 f2fs: Return a folio from last_fsync_dnode()
In reply to Matthew Wilcox (Oracle)Convert last_page to last_folio in f2fs_fsync_node_pages() and use folio APIs where they exist. Saves a few hidden calls to compound_head().
--- fs/f2fs/node.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
fs/f2fs/node.c +17 -17
@@ -1561,7 +1561,7 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)iput (inode); } -static struct page *last_fsync_dnode (struct f2fs_sb_info *sbi,nid_t ino) +static struct folio *last_fsync_dnode (struct f2fs_sb_info *sbi,nid_t ino) {pgoff_t index;struct folio_batch fbatch;
@@ -1615,7 +1615,7 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)folio_batch_release (&fbatch);cond_resched (); } -return &last_folio->page; +return last_folio; } static int __write_node_page(struct page *page, bool atomic, bool *submitted,
@@ -1783,16 +1783,16 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,pgoff_t index;struct folio_batch fbatch;int ret =0 ; -struct page *last_page =NULL ; +struct folio *last_folio =NULL ;bool marked = false;nid_t ino = inode->i_ino;int nr_folios;int nwritten =0 ;if (atomic) { - last_page =last_fsync_dnode (sbi, ino); -if (IS_ERR_OR_NULL (last_page)) -return PTR_ERR_OR_ZERO (last_page); + last_folio =last_fsync_dnode (sbi, ino); +if (IS_ERR_OR_NULL (last_folio)) +return PTR_ERR_OR_ZERO (last_folio); } retry:folio_batch_init (&fbatch);
@@ -1808,7 +1808,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,bool submitted = false;if (unlikely (f2fs_cp_error (sbi))) { -f2fs_put_page (last_page,0 ); +f2fs_folio_put (last_folio, false);folio_batch_release (&fbatch); ret = -EIO ; goto out;
@@ -1829,7 +1829,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,if (ino_of_node (&folio->page) != ino) goto continue_unlock; -if (!folio_test_dirty (folio) && &folio->page != last_page) { +if (!folio_test_dirty (folio) && folio != last_folio) {/* someone wrote it for us */ goto continue_unlock; }
@@ -1839,7 +1839,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,set_fsync_mark (&folio->page,0 );set_dentry_mark (&folio->page,0 ); -if (!atomic || &folio->page == last_page) { +if (!atomic || folio == last_folio) {set_fsync_mark (&folio->page,1 );percpu_counter_inc (&sbi->rf_node_block_count);if (IS_INODE (&folio->page)) {
@@ -1858,18 +1858,18 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, goto continue_unlock; ret =__write_node_page (&folio->page, atomic && - &folio->page == last_page, + folio == last_folio, &submitted, wbc, true,FS_NODE_IO , seq_id);if (ret) {folio_unlock (folio); -f2fs_put_page (last_page,0 ); +f2fs_folio_put (last_folio, false);break ; }else if (submitted) { nwritten++; } -if (&folio->page == last_page) { +if (folio == last_folio) {f2fs_folio_put (folio, false); marked = true;break ;
@@ -1883,11 +1883,11 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, }if (!ret && atomic && !marked) {f2fs_debug (sbi,"Retry to write fsync mark: ino=%u, idx=%lx" , - ino,page_folio (last_page)->index); -lock_page (last_page); -f2fs_wait_on_page_writeback (last_page,NODE , true, true); -set_page_dirty (last_page); -unlock_page (last_page); + ino, last_folio->index); +folio_lock (last_folio); +f2fs_folio_wait_writeback (last_folio,NODE , true, true); +folio_mark_dirty (last_folio); +folio_unlock (last_folio); goto retry; } out:
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 10/27 f2fs: Add f2fs_grab_cache_folio()
In reply to Matthew Wilcox (Oracle)Convert f2fs_grab_cache_page() into f2fs_grab_cache_folio() and add a wrapper. Removes several calls to deprecated functions.
--- fs/f2fs/f2fs.h | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-)
fs/f2fs/f2fs.h +25 -12
@@ -2767,33 +2767,46 @@ static inline s64 valid_inode_count(struct f2fs_sb_info *sbi)return percpu_counter_sum_positive (&sbi->total_valid_inode_count); } -static inline struct page *f2fs_grab_cache_page (struct address_space *mapping, -pgoff_t index,bool for_write) +static inline struct folio *f2fs_grab_cache_folio (struct address_space *mapping, +pgoff_t index,bool for_write) { -struct page *page; +struct folio *folio;unsigned int flags;if (IS_ENABLED (CONFIG_F2FS_FAULT_INJECTION )) { +fgf_t fgf_flags; +if (!for_write) - page =find_get_page_flags (mapping, index, -FGP_LOCK |FGP_ACCESSED ); + fgf_flags =FGP_LOCK |FGP_ACCESSED ;else - page =find_lock_page (mapping, index); -if (page) -return page; + fgf_flags =FGP_LOCK ; + folio =__filemap_get_folio (mapping, index, fgf_flags,0 ); +if (!IS_ERR (folio)) +return folio;if (time_to_inject (F2FS_M_SB (mapping),FAULT_PAGE_ALLOC )) -return NULL ; +return ERR_PTR (-ENOMEM ); }if (!for_write) -return grab_cache_page (mapping, index); +return filemap_grab_folio (mapping, index); flags =memalloc_nofs_save (); - page =grab_cache_page_write_begin (mapping, index); + folio =__filemap_get_folio (mapping, index,FGP_WRITEBEGIN , +mapping_gfp_mask (mapping));memalloc_nofs_restore (flags); -return page; +return folio; +} + +static inline struct page *f2fs_grab_cache_page (struct address_space *mapping, +pgoff_t index,bool for_write) +{ +struct folio *folio =f2fs_grab_cache_folio (mapping, index, for_write); + +if (IS_ERR (folio)) +return NULL ; +return &folio->page; } static inline struct page *f2fs_pagecache_get_page(
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 11/27 mm: Remove grab_cache_page_write_begin()
In reply to Matthew Wilcox (Oracle)All callers have now been converted to use folios, so remove this compatibility wrapper.
--- include/linux/pagemap.h | 3 --- mm/folio-compat.c | 8 -------- 2 files changed, 11 deletions(-)
include/linux/pagemap.h +0 -3
@@ -990,9 +990,6 @@ unsigned filemap_get_folios_contig(struct address_space *mapping,unsigned filemap_get_folios_tag (struct address_space *mapping,pgoff_t *start,pgoff_t end,xa_mark_t tag,struct folio_batch *fbatch); -struct page *grab_cache_page_write_begin (struct address_space *mapping, -pgoff_t index); -/* * Returns locked page at given index in given cache, creating it if needed. */
mm/folio-compat.c +0 -8
@@ -84,11 +84,3 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,return folio_file_page (folio, index); }EXPORT_SYMBOL (pagecache_get_page); - -struct page *grab_cache_page_write_begin (struct address_space *mapping, -pgoff_t index) -{ -return pagecache_get_page (mapping, index,FGP_WRITEBEGIN , -mapping_gfp_mask (mapping)); -} -EXPORT_SYMBOL (grab_cache_page_write_begin);
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 12/27 f2fs: Use a folio in __get_node_page()
In reply to Matthew Wilcox (Oracle)Retrieve a folio from the page cache and use it throughout. Saves six hidden calls to compound_head() and removes a reference to page->mapping.
--- fs/f2fs/node.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
fs/f2fs/node.c +18 -18
@@ -1452,7 +1452,7 @@ void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)static struct page *__get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid,struct page *parent,int start) { -struct page *page; +struct folio *folio;int err;if (!nid)
@@ -1460,11 +1460,11 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,if (f2fs_check_nid_range (sbi, nid))return ERR_PTR (-EINVAL ); repeat: - page =f2fs_grab_cache_page (NODE_MAPPING (sbi), nid, false); -if (!page) -return ERR_PTR (-ENOMEM ); + folio =f2fs_grab_cache_folio (NODE_MAPPING (sbi), nid, false); +if (IS_ERR (folio)) +return ERR_CAST (folio); - err =read_node_page (page,0 ); + err =read_node_page (&folio->page,0 );if (err <0 ) { goto out_put_err; }else if (err ==LOCKED_PAGE ) {
@@ -1475,40 +1475,40 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,if (parent)f2fs_ra_node_pages (parent, start +1 ,MAX_RA_NODE ); -lock_page (page); +folio_lock (folio); -if (unlikely (page->mapping !=NODE_MAPPING (sbi))) { -f2fs_put_page (page,1 ); +if (unlikely (folio->mapping !=NODE_MAPPING (sbi))) { +f2fs_folio_put (folio, true); goto repeat; } -if (unlikely (!PageUptodate (page))) { +if (unlikely (!folio_test_uptodate (folio))) { err = -EIO ; goto out_err; } -if (!f2fs_inode_chksum_verify (sbi, page)) { +if (!f2fs_inode_chksum_verify (sbi, &folio->page)) { err = -EFSBADCRC ; goto out_err; } page_hit: -if (likely (nid ==nid_of_node (page))) -return page; +if (likely (nid ==nid_of_node (&folio->page))) +return &folio->page;f2fs_warn (sbi,"inconsistent node block, nid:%lu, node_footer[nid:%u,ino:%u,ofs:%u,cpver:%llu,blkaddr:%u]" , - nid,nid_of_node (page),ino_of_node (page), -ofs_of_node (page),cpver_of_node (page), -next_blkaddr_of_node (page)); + nid,nid_of_node (&folio->page),ino_of_node (&folio->page), +ofs_of_node (&folio->page),cpver_of_node (&folio->page), +next_blkaddr_of_node (&folio->page));set_sbi_flag (sbi,SBI_NEED_FSCK );f2fs_handle_error (sbi,ERROR_INCONSISTENT_FOOTER ); err = -EFSCORRUPTED ; out_err: -ClearPageUptodate (page); +folio_clear_uptodate (folio); out_put_err:/* ENOENT comes from read_node_page which is not an error. */ if (err != -ENOENT ) -f2fs_handle_page_eio (sbi,page_folio (page),NODE ); -f2fs_put_page (page,1 ); +f2fs_handle_page_eio (sbi, folio,NODE ); +f2fs_folio_put (folio, true);return ERR_PTR (err); }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 13/27 f2fs: Use a folio in do_write_page()
In reply to Matthew Wilcox (Oracle)Convert fio->page to a folio then use it where folio APIs exist. Removes a reference to page->mapping and a hidden call to compound_head().
--- fs/f2fs/segment.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +3 -2
@@ -3902,6 +3902,7 @@ static int log_type_to_seg_type(enum log_type type)static void do_write_page (struct f2fs_summary *sum,struct f2fs_io_info *fio) { +struct folio *folio =page_folio (fio->page);enum log_type type =__get_segment_type (fio);int seg_type =log_type_to_seg_type (type); bool keep_order = (f2fs_lfs_mode(fio->sbi) &&
@@ -3912,9 +3913,9 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)if (f2fs_allocate_data_block (fio->sbi, fio->page, fio->old_blkaddr, &fio->new_blkaddr, sum, type, fio)) { -if (fscrypt_inode_uses_fs_layer_crypto (fio->page->mapping->host)) +if (fscrypt_inode_uses_fs_layer_crypto (folio->mapping->host))fscrypt_finalize_bounce_page (&fio->encrypted_page); -end_page_writeback (fio->page); +folio_end_writeback (folio);if (f2fs_in_warm_node_list (fio->sbi, fio->page))f2fs_del_fsync_node_entry (fio->sbi, fio->page); goto out;
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 14/27 f2fs: Convert f2fs_write_end_io() to use a folio_iter
In reply to Matthew Wilcox (Oracle)Iterate over each folio in the bio instead of each page. Follow the pattern in ext4 for handling bounce folios. Removes a few calls to compound_head() and references to page->mapping.
--- fs/f2fs/data.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
fs/f2fs/data.c +21 -15
@@ -319,8 +319,7 @@ static void f2fs_read_end_io(struct bio *bio)static void f2fs_write_end_io (struct bio *bio) {struct f2fs_sb_info *sbi; -struct bio_vec *bvec; -struct bvec_iter_all iter_all; +struct folio_iter fi;iostat_update_and_unbind_ctx (bio); sbi = bio->bi_private;
@@ -328,34 +327,41 @@ static void f2fs_write_end_io(struct bio *bio)if (time_to_inject (sbi,FAULT_WRITE_IO )) bio->bi_status =BLK_STS_IOERR ; -bio_for_each_segment_all (bvec, bio, iter_all) { -struct page *page = bvec->bv_page; -enum count_type type =WB_DATA_TYPE (page, false); +bio_for_each_folio_all (fi, bio) { +struct folio *folio = fi.folio; +enum count_type type; -fscrypt_finalize_bounce_page (&page); +if (fscrypt_is_bounce_folio (folio)) { +struct folio *io_folio = folio; + + folio =fscrypt_pagecache_folio (io_folio); +fscrypt_free_bounce_page (&io_folio->page); + }#ifdef CONFIG_F2FS_FS_COMPRESSION -if (f2fs_is_compressed_page (page)) { -f2fs_compress_write_end_io (bio, page); +if (f2fs_is_compressed_page (&folio->page)) { +f2fs_compress_write_end_io (bio, &folio->page);continue ; }#endif + type =WB_DATA_TYPE (&folio->page, false); +if (unlikely (bio->bi_status)) { -mapping_set_error (page->mapping, -EIO ); +mapping_set_error (folio->mapping, -EIO );if (type ==F2FS_WB_CP_DATA )f2fs_stop_checkpoint (sbi, true,STOP_CP_REASON_WRITE_FAIL ); } -f2fs_bug_on (sbi, page->mapping ==NODE_MAPPING (sbi) && -page_folio (page)->index !=nid_of_node (page)); +f2fs_bug_on (sbi, folio->mapping ==NODE_MAPPING (sbi) && + folio->index !=nid_of_node (&folio->page));dec_page_count (sbi, type); -if (f2fs_in_warm_node_list (sbi, page)) -f2fs_del_fsync_node_entry (sbi, page); -clear_page_private_gcing (page); -end_page_writeback (page); +if (f2fs_in_warm_node_list (sbi, &folio->page)) +f2fs_del_fsync_node_entry (sbi, &folio->page); +clear_page_private_gcing (&folio->page); +folio_end_writeback (folio); }if (!get_pages (sbi,F2FS_WB_CP_DATA ) &&wq_has_sleeper (&sbi->cp_wait))
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 15/27 f2fs: Mark some functions as taking a const page pointer
In reply to Matthew Wilcox (Oracle)The compiler can make some optimisations if we tell it that a function call doesn't change this memory.
--- fs/f2fs/f2fs.h | 2 +- fs/f2fs/node.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/f2fs/f2fs.h +1 -1
@@ -2017,7 +2017,7 @@ static inline struct f2fs_checkpoint *F2FS_CKPT(struct f2fs_sb_info *sbi)return (struct f2fs_checkpoint *)(sbi->ckpt); } -static inline struct f2fs_node *F2FS_NODE (struct page *page) +static inline struct f2fs_node *F2FS_NODE (const struct page *page) {return (struct f2fs_node *)page_address (page); }
fs/f2fs/node.h +3 -3
@@ -248,7 +248,7 @@ static inline nid_t nid_of_node(struct page *node_page)return le32_to_cpu (rn->footer.nid); } -static inline unsigned int ofs_of_node (struct page *node_page) +static inline unsigned int ofs_of_node (const struct page *node_page) {struct f2fs_node *rn =F2FS_NODE (node_page);unsigned flag =le32_to_cpu (rn->footer.flag);
@@ -342,7 +342,7 @@ static inline bool is_recoverable_dnode(struct page *page)* `- indirect node ((6 + 2N) + (N - 1)(N + 1)) * `- direct node */ -static inline bool IS_DNODE (struct page *node_page) +static inline bool IS_DNODE (const struct page *node_page) {unsigned int ofs =ofs_of_node (node_page);
@@ -389,7 +389,7 @@ static inline nid_t get_nid(struct page *p, int off, bool i)* - Mark cold data pages in page cache */ -static inline int is_node (struct page *page,int type) +static inline int is_node (const struct page *page,int type) {struct f2fs_node *rn =F2FS_NODE (page);return le32_to_cpu (rn->footer.flag) &BIT (type);
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 16/27 f2fs: Convert f2fs_in_warm_node_list() to take a folio
In reply to Matthew Wilcox (Oracle)All its callers now have access to a folio, so pass it in. Removes an access to page->mapping.
--- fs/f2fs/data.c | 2 +- fs/f2fs/f2fs.h | 3 ++- fs/f2fs/node.c | 8 ++++---- fs/f2fs/segment.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-)
fs/f2fs/data.c +1 -1
@@ -358,7 +358,7 @@ static void f2fs_write_end_io(struct bio *bio) folio->index != nid_of_node(&folio->page));dec_page_count (sbi, type); -if (f2fs_in_warm_node_list (sbi, &folio->page)) +if (f2fs_in_warm_node_list (sbi, folio))f2fs_del_fsync_node_entry (sbi, &folio->page);clear_page_private_gcing (&folio->page);folio_end_writeback (folio);
fs/f2fs/f2fs.h +2 -1
@@ -3667,7 +3667,8 @@ struct node_info;int f2fs_check_nid_range (struct f2fs_sb_info *sbi,nid_t nid);bool f2fs_available_free_memory (struct f2fs_sb_info *sbi,int type); -bool f2fs_in_warm_node_list (struct f2fs_sb_info *sbi,struct page *page); +bool f2fs_in_warm_node_list (struct f2fs_sb_info *sbi, +const struct folio *folio);void f2fs_init_fsync_node_info (struct f2fs_sb_info *sbi);void f2fs_del_fsync_node_entry (struct f2fs_sb_info *sbi,struct page *page);void f2fs_reset_fsync_node_info (struct f2fs_sb_info *sbi);
fs/f2fs/node.c +4 -4
@@ -310,10 +310,10 @@ static unsigned int __gang_lookup_nat_set(struct f2fs_nm_info *nm_i, start, nr); } -bool f2fs_in_warm_node_list (struct f2fs_sb_info *sbi,struct page *page) +bool f2fs_in_warm_node_list (struct f2fs_sb_info *sbi,const struct folio *folio) { -return NODE_MAPPING (sbi) == page->mapping && -IS_DNODE (page) &&is_cold_node (page); +return NODE_MAPPING (sbi) == folio->mapping && +IS_DNODE (&folio->page) &&is_cold_node (&folio->page); }void f2fs_init_fsync_node_info (struct f2fs_sb_info *sbi)
@@ -1694,7 +1694,7 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, fio.op_flags |=REQ_PREFLUSH |REQ_FUA ;/* should add to global list before clearing PAGECACHE status */ -if (f2fs_in_warm_node_list (sbi, page)) { +if (f2fs_in_warm_node_list (sbi, folio)) { seq =f2fs_add_fsync_node_entry (sbi, page);if (seq_id) *seq_id = seq;
fs/f2fs/segment.c +1 -1
@@ -3916,7 +3916,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)if (fscrypt_inode_uses_fs_layer_crypto (folio->mapping->host))fscrypt_finalize_bounce_page (&fio->encrypted_page);folio_end_writeback (folio); -if (f2fs_in_warm_node_list (fio->sbi, fio->page)) +if (f2fs_in_warm_node_list (fio->sbi, folio))f2fs_del_fsync_node_entry (fio->sbi, fio->page); goto out; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 17/27 f2fs: Add f2fs_get_node_folio()
In reply to Matthew Wilcox (Oracle)Change __get_node_page() to return a folio and convert back to a page in f2fs_get_node_page() and f2fs_get_node_page_ra().
--- fs/f2fs/f2fs.h | 1 + fs/f2fs/node.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-)
fs/f2fs/f2fs.h +1 -0
@@ -3689,6 +3689,7 @@ struct page *f2fs_new_inode_page(struct inode *inode);struct page *f2fs_new_node_page (struct dnode_of_data *dn,unsigned int ofs);void f2fs_ra_node_page (struct f2fs_sb_info *sbi,nid_t nid);struct page *f2fs_get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid); +struct folio *f2fs_get_node_folio (struct f2fs_sb_info *sbi,pgoff_t nid);struct page *f2fs_get_node_page_ra (struct page *parent,int start);int f2fs_move_node_page (struct page *node_page,int gc_type);void f2fs_flush_inline_data (struct f2fs_sb_info *sbi);
fs/f2fs/node.c +13 -5
@@ -1449,7 +1449,7 @@ void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)f2fs_put_page (apage, err ?1 :0 ); } -static struct page *__get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid, +static struct folio *__get_node_folio (struct f2fs_sb_info *sbi,pgoff_t nid,struct page *parent,int start) {struct folio *folio;
@@ -1462,7 +1462,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, repeat: folio =f2fs_grab_cache_folio (NODE_MAPPING (sbi), nid, false);if (IS_ERR (folio)) -return ERR_CAST (folio); +return folio; err =read_node_page (&folio->page,0 );if (err <0 ) {
@@ -1493,7 +1493,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, } page_hit:if (likely (nid ==nid_of_node (&folio->page))) -return &folio->page; +return folio; f2fs_warn(sbi, "inconsistent node block, nid:%lu, node_footer[nid:%u,ino:%u,ofs:%u,cpver:%llu,blkaddr:%u]", nid, nid_of_node(&folio->page), ino_of_node(&folio->page),
@@ -1512,17 +1512,25 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,return ERR_PTR (err); } +struct folio *f2fs_get_node_folio (struct f2fs_sb_info *sbi,pgoff_t nid) +{ +return __get_node_folio (sbi, nid,NULL ,0 ); +} +struct page *f2fs_get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid) { -return __get_node_page (sbi, nid,NULL ,0 ); +struct folio *folio =__get_node_folio (sbi, nid,NULL ,0 ); + +return &folio->page; }struct page *f2fs_get_node_page_ra (struct page *parent,int start) {struct f2fs_sb_info *sbi =F2FS_P_SB (parent);nid_t nid =get_nid (parent, start, false); +struct folio *folio =__get_node_folio (sbi, nid, parent, start); -return __get_node_page (sbi, nid, parent, start); +return &folio->page; }static void flush_inline_data (struct f2fs_sb_info *sbi,nid_t ino)
Signature · 1 line
2.47.2
Chao Yu
maintainerRe: [PATCH 17/27] f2fs: Add f2fs_get_node_folio()
Quoted 56 lines · Matthew Wilcox (Oracle)
Change
__get_node_page()to return a folio and convert back to a page inf2fs_get_node_page()andf2fs_get_node_page_ra().Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/f2fs.h | 1 + fs/f2fs/node.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-)fs/f2fs/f2fs.h +1
-0@@ -3689,6 +3689,7 @@ struct page *f2fs_new_inode_page(struct inode *inode);struct page *f2fs_new_node_page (struct dnode_of_data *dn,unsigned int ofs);void f2fs_ra_node_page (struct f2fs_sb_info *sbi,nid_t nid);struct page *f2fs_get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid); +struct folio *f2fs_get_node_folio (struct f2fs_sb_info *sbi,pgoff_t nid);struct page *f2fs_get_node_page_ra (struct page *parent,int start);int f2fs_move_node_page (struct page *node_page,int gc_type);void f2fs_flush_inline_data (struct f2fs_sb_info *sbi);fs/f2fs/node.c +3
-3@@ -1449,7 +1449,7 @@ void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)f2fs_put_page (apage, err ?1 :0 ); } -static struct page *__get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid, +static struct folio *__get_node_folio (struct f2fs_sb_info *sbi,pgoff_t nid,struct page *parent,int start) {struct folio *folio;@@ -1462,7 +1462,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, repeat: folio =f2fs_grab_cache_folio (NODE_MAPPING (sbi), nid, false);if (IS_ERR (folio)) -return ERR_CAST (folio); +return folio; err =read_node_page (&folio->page,0 );if (err <0 ) {@@ -1493,7 +1493,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, } page_hit:if (likely (nid ==nid_of_node (&folio->page))) -return &folio->page; +return folio; f2fs_warn(sbi, "inconsistent node block, nid:%lu, node_footer[nid:%u,ino:%u,ofs:%u,cpver:%llu,blkaddr:%u]", nid, nid_of_node(&folio->page), ino_of_node(&folio->page),@@ -1512,17 +1512,25 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,return ERR_PTR (err); }
fs/f2fs/node.c static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1523
Quoted 10 lines
fs/f2fs/node.c +7
-1+struct folio *f2fs_get_node_folio (struct f2fs_sb_info *sbi,pgoff_t nid) +{ +return __get_node_folio (sbi, nid,NULL ,0 ); +} +struct page *f2fs_get_node_page (struct f2fs_sb_info *sbi,pgoff_t nid) { -return __get_node_page (sbi, nid,NULL ,0 ); +struct folio *folio =__get_node_folio (sbi, nid,NULL ,0 ); +
if (IS_ERR(folio)) return ERR_CAST(folio));
fs/f2fs/node.c static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1532
Quoted 9 lines
fs/f2fs/node.c +2
-0+return &folio->page; }struct page *f2fs_get_node_page_ra (struct page *parent,int start) {struct f2fs_sb_info *sbi =F2FS_P_SB (parent);nid_t nid =get_nid (parent, start, false); +struct folio *folio =__get_node_folio (sbi, nid, parent, start);
if (IS_ERR(folio)) return ERR_CAST(folio));
Quoted 5 lines
fs/f2fs/node.c +1
-1-return __get_node_page (sbi, nid, parent, start); +return &folio->page; }static void flush_inline_data (struct f2fs_sb_info *sbi,nid_t ino)
Matthew Wilcox
maintainerRe: [PATCH 17/27] f2fs: Add f2fs_get_node_folio()
Quoted 8 lines · Chao Yu
fs/f2fs/node.c static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1523
Quoted 5 lines
struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) {fs/f2fs/node.c +2
-1-return __get_node_page (sbi, nid,NULL ,0 ); +struct folio *folio =__get_node_folio (sbi, nid,NULL ,0 ); +if (IS_ERR(folio)) return ERR_CAST(folio));
No need. It's the same result, we use this pattern extensively, and this is a temporary wrapper that has to go away in the next six to nine months anyway.
Matthew Wilcox
maintainerRe: [PATCH 17/27] f2fs: Add f2fs_get_node_folio()
In reply to Chao YuQuoted 10 lines · Chao Yu
fs/f2fs/node.c static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1523
Quoted 5 lines
struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) {fs/f2fs/node.c +2
-1-return __get_node_page (sbi, nid,NULL ,0 ); +struct folio *folio =__get_node_folio (sbi, nid,NULL ,0 ); +if (IS_ERR(folio)) return ERR_CAST(folio));Review
Quoted 1 line
(quoted diff) +1
-0+ return &folio->page;
No need. It'll probably generate the saame code (or if not, it'll generate worse code) and this wrapper function has to be deleted in the next six to nine months anyway. We use this idiom extensively.
Chao Yu
maintainerRe: [PATCH 17/27] f2fs: Add f2fs_get_node_folio()
Quoted 10 lines · Matthew Wilcox
Quoted 9 lines · Chao Yu
fs/f2fs/node.c static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, · line 1523
Quoted 5 lines
struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) {fs/f2fs/node.c +2
-1-return __get_node_page (sbi, nid,NULL ,0 ); +struct folio *folio =__get_node_folio (sbi, nid,NULL ,0 ); +if (IS_ERR(folio)) return ERR_CAST(folio));
Quoted 5 lines
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +1
-0+ return &folio->page;No need. It'll probably generate the saame code (or if not, it'll generate worse code) and this wrapper function has to be deleted in the next six to nine months anyway. We use this idiom extensively.
Oh, correct, seems return value '&folio->page' is equal to value of folio as I checked.
Thanks,
Matthew Wilcox (Oracle)
maintainerPATCH 18/27 f2fs: Use a folio throughout f2fs_truncate_inode_blocks()
In reply to Matthew Wilcox (Oracle)Use f2fs_get_node_folio() to get a folio and use it throughout. Remove a few calls to compound_head() and a reference to page->mapping.
--- fs/f2fs/node.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
fs/f2fs/node.c +16 -16
@@ -1130,7 +1130,7 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)unsigned int nofs =0 ;struct f2fs_inode *ri;struct dnode_of_data dn; -struct page *page; +struct folio *folio;trace_f2fs_truncate_inode_blocks_enter (inode, from);
@@ -1140,16 +1140,16 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)return level; } - page =f2fs_get_node_page (sbi, inode->i_ino); -if (IS_ERR (page)) { -trace_f2fs_truncate_inode_blocks_exit (inode,PTR_ERR (page)); -return PTR_ERR (page); + folio =f2fs_get_node_folio (sbi, inode->i_ino); +if (IS_ERR (folio)) { +trace_f2fs_truncate_inode_blocks_exit (inode,PTR_ERR (folio)); +return PTR_ERR (folio); } -set_new_dnode (&dn, inode, page,NULL ,0 ); -unlock_page (page); +set_new_dnode (&dn, inode, &folio->page,NULL ,0 ); +folio_unlock (folio); - ri =F2FS_INODE (page); + ri =F2FS_INODE (&folio->page);switch (level) {case 0 :case 1 :
@@ -1178,7 +1178,7 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from) skip_partial:while (cont) { - dn.nid =get_nid (page, offset[0 ], true); + dn.nid =get_nid (&folio->page, offset[0 ], true);switch (offset[0 ]) {case NODE_DIR1_BLOCK :case NODE_DIR2_BLOCK :
@@ -1199,7 +1199,7 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)BUG (); }if (err == -ENOENT ) { -set_sbi_flag (F2FS_P_SB (page),SBI_NEED_FSCK ); +set_sbi_flag (F2FS_F_SB (folio),SBI_NEED_FSCK );f2fs_handle_error (sbi,ERROR_INVALID_BLKADDR );f2fs_err_ratelimited (sbi, "truncate node fail, ino:%lu, nid:%u, "
@@ -1210,18 +1210,18 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from) }if (err <0 ) goto fail; -if (offset[1 ] ==0 &&get_nid (page, offset[0 ], true)) { -lock_page (page); -BUG_ON (page->mapping !=NODE_MAPPING (sbi)); -set_nid (page, offset[0 ],0 , true); -unlock_page (page); +if (offset[1 ] ==0 &&get_nid (&folio->page, offset[0 ], true)) { +folio_lock (folio); +BUG_ON (folio->mapping !=NODE_MAPPING (sbi)); +set_nid (&folio->page, offset[0 ],0 , true); +folio_unlock (folio); } offset[1 ] =0 ; offset[0 ]++; nofs += err; } fail: -f2fs_put_page (page,0 ); +f2fs_folio_put (folio, false);trace_f2fs_truncate_inode_blocks_exit (inode, err);return err >0 ?0 : err; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 19/27 f2fs: Use a folio throughout __get_meta_page()
In reply to Matthew Wilcox (Oracle)Use f2fs_grab_cache_folio() to get a folio and use it throughout, removing seven calls to compound_head() and a reference to page->mapping.
--- fs/f2fs/checkpoint.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
fs/f2fs/checkpoint.c +13 -13
@@ -58,7 +58,7 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index, bool is_meta) {struct address_space *mapping =META_MAPPING (sbi); -struct page *page; +struct folio *folio;struct f2fs_io_info fio = { .sbi = sbi, .type =META ,
@@ -74,37 +74,37 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,if (unlikely (!is_meta)) fio.op_flags &= ~REQ_META ; repeat: - page =f2fs_grab_cache_page (mapping, index, false); -if (!page) { + folio =f2fs_grab_cache_folio (mapping, index, false); +if (IS_ERR (folio)) {cond_resched (); goto repeat; } -if (PageUptodate (page)) +if (folio_test_uptodate (folio)) goto out; - fio.page = page; + fio.page = &folio->page; err =f2fs_submit_page_bio (&fio);if (err) { -f2fs_put_page (page,1 ); +f2fs_folio_put (folio, true);return ERR_PTR (err); }f2fs_update_iostat (sbi,NULL ,FS_META_READ_IO ,F2FS_BLKSIZE ); -lock_page (page); -if (unlikely (page->mapping != mapping)) { -f2fs_put_page (page,1 ); +folio_lock (folio); +if (unlikely (folio->mapping != mapping)) { +f2fs_folio_put (folio, true); goto repeat; } -if (unlikely (!PageUptodate (page))) { -f2fs_handle_page_eio (sbi,page_folio (page),META ); -f2fs_put_page (page,1 ); +if (unlikely (!folio_test_uptodate (folio))) { +f2fs_handle_page_eio (sbi, folio,META ); +f2fs_folio_put (folio, true);return ERR_PTR (-EIO ); } out: -return page; +return &folio->page; }struct page *f2fs_get_meta_page (struct f2fs_sb_info *sbi,pgoff_t index)
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 20/27 f2fs: Hoist the page_folio() call to the start of f2fs_merge_page_bio()
In reply to Matthew Wilcox (Oracle)Remove one call to compound_head() and a reference to page->mapping by calling page_folio() early on.
--- fs/f2fs/data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/f2fs/data.c +4 -4
@@ -888,6 +888,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)struct bio *bio = *fio->bio;struct page *page = fio->encrypted_page ? fio->encrypted_page : fio->page; +struct folio *folio =page_folio (fio->page);if (!f2fs_is_valid_blkaddr (fio->sbi, fio->new_blkaddr,__is_meta_io (fio) ?META_GENERIC :DATA_GENERIC ))
@@ -901,8 +902,8 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) alloc_new:if (!bio) { bio =__bio_alloc (fio,BIO_MAX_VECS ); -f2fs_set_bio_crypt_ctx (bio, fio->page->mapping->host, -page_folio (fio->page)->index, fio,GFP_NOIO ); +f2fs_set_bio_crypt_ctx (bio, folio->mapping->host, + folio->index, fio,GFP_NOIO );add_bio_entry (fio->sbi, bio, page, fio->temp); }else {
@@ -911,8 +912,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) }if (fio->io_wbc) -wbc_account_cgroup_owner (fio->io_wbc,page_folio (fio->page), -PAGE_SIZE ); +wbc_account_cgroup_owner (fio->io_wbc, folio,folio_size (folio));inc_page_count (fio->sbi,WB_DATA_TYPE (page, false));
Signature · 1 line
2.47.2
Chao Yu
maintainerRe: [PATCH 20/27] f2fs: Hoist the page_folio() call to the start of f2fs_merge_page_bio()
Quoted 13 lines · Matthew Wilcox (Oracle)
Remove one call to
compound_head()and a reference topage->mappingby callingpage_folio()early on.Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)fs/f2fs/data.c +0
-0
fs/f2fs/data.c int f2fs_merge_page_bio(struct f2fs_io_info *fio) · line 894
Quoted 7 lines
fs/f2fs/data.c +1
-0@@ -888,6 +888,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)struct bio *bio = *fio->bio;struct page *page = fio->encrypted_page ? fio->encrypted_page : fio->page; +struct folio *folio =page_folio (fio->page);if (!f2fs_is_valid_blkaddr (fio->sbi, fio->new_blkaddr,__is_meta_io (fio) ?META_GENERIC :DATA_GENERIC ))
Minor thing, missed to change below line:
trace_f2fs_submit_folio_bio(page_folio(page), fio);
can be cleaned up to:
trace_f2fs_submit_folio_bio(folio, fio);
Thanks,
Quoted 21 lines
fs/f2fs/data.c +3
-4@@ -901,8 +902,8 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) alloc_new:if (!bio) { bio =__bio_alloc (fio,BIO_MAX_VECS ); -f2fs_set_bio_crypt_ctx (bio, fio->page->mapping->host, -page_folio (fio->page)->index, fio,GFP_NOIO ); +f2fs_set_bio_crypt_ctx (bio, folio->mapping->host, + folio->index, fio,GFP_NOIO );add_bio_entry (fio->sbi, bio, page, fio->temp); }else {@@ -911,8 +912,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) }if (fio->io_wbc) -wbc_account_cgroup_owner (fio->io_wbc,page_folio (fio->page), -PAGE_SIZE ); +wbc_account_cgroup_owner (fio->io_wbc, folio,folio_size (folio));inc_page_count (fio->sbi,WB_DATA_TYPE (page, false));
Matthew Wilcox (Oracle)
maintainerPATCH 21/27 f2fs: Add f2fs_get_read_data_folio()
In reply to Matthew Wilcox (Oracle)Convert f2fs_get_read_data_page() into f2fs_get_read_data_folio() and add a compatibility wrapper. Saves seven hidden calls to compound_head().
--- fs/f2fs/data.c | 35 +++++++++++++++++------------------ fs/f2fs/f2fs.h | 14 ++++++++++++-- 2 files changed, 29 insertions(+), 20 deletions(-)
fs/f2fs/data.c +17 -18
@@ -1203,18 +1203,17 @@ int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index)return err; } -struct page *f2fs_get_read_data_page (struct inode *inode,pgoff_t index, -blk_opf_t op_flags,bool for_write, -pgoff_t *next_pgofs) +struct folio *f2fs_get_read_data_folio (struct inode *inode,pgoff_t index, +blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs) {struct address_space *mapping = inode->i_mapping;struct dnode_of_data dn; -struct page *page; +struct folio *folio;int err; - page =f2fs_grab_cache_page (mapping, index, for_write); -if (!page) -return ERR_PTR (-ENOMEM ); + folio =f2fs_grab_cache_folio (mapping, index, for_write); +if (IS_ERR (folio)) +return folio;if (f2fs_lookup_read_extent_cache_block (inode, index, &dn.data_blkaddr)) {
@@ -1249,9 +1248,9 @@ struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index, goto put_err; } got_it: -if (PageUptodate (page)) { -unlock_page (page); -return page; +if (folio_test_uptodate (folio)) { +folio_unlock (folio); +return folio; }/*
@@ -1262,21 +1261,21 @@ struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index,* f2fs_init_inode_metadata. */ if (dn.data_blkaddr ==NEW_ADDR ) { -zero_user_segment (page,0 ,PAGE_SIZE ); -if (!PageUptodate (page)) -SetPageUptodate (page); -unlock_page (page); -return page; +folio_zero_segment (folio,0 ,folio_size (folio)); +if (!folio_test_uptodate (folio)) +folio_mark_uptodate (folio); +folio_unlock (folio); +return folio; } - err =f2fs_submit_page_read (inode,page_folio (page), dn.data_blkaddr, + err =f2fs_submit_page_read (inode, folio, dn.data_blkaddr, op_flags, for_write);if (err) goto put_err; -return page; +return folio; put_err: -f2fs_put_page (page,1 ); +f2fs_folio_put (folio, true);return ERR_PTR (err); }
fs/f2fs/f2fs.h +12 -2
@@ -3895,8 +3895,8 @@ int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count);int f2fs_reserve_new_block (struct dnode_of_data *dn);int f2fs_get_block_locked (struct dnode_of_data *dn,pgoff_t index);int f2fs_reserve_block (struct dnode_of_data *dn,pgoff_t index); -struct page *f2fs_get_read_data_page (struct inode *inode,pgoff_t index, -blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs); +struct folio *f2fs_get_read_data_folio (struct inode *inode,pgoff_t index, +blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs);struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index,pgoff_t *next_pgofs); struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
@@ -3926,6 +3926,16 @@ int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi);void f2fs_destroy_post_read_wq (struct f2fs_sb_info *sbi);extern const struct iomap_ops f2fs_iomap_ops; +static inline struct page *f2fs_get_read_data_page (struct inode *inode, +pgoff_t index,blk_opf_t op_flags,bool for_write, +pgoff_t *next_pgofs) +{ +struct folio *folio =f2fs_get_read_data_folio (inode, index, op_flags, + for_write, next_pgofs); + +return &folio->page; +} +/* * gc.c */
Signature · 1 line
2.47.2
Chao Yu
maintainerRe: [PATCH 21/27] f2fs: Add f2fs_get_read_data_folio()
Quoted 97 lines · Matthew Wilcox (Oracle)
Convert
f2fs_get_read_data_page()intof2fs_get_read_data_folio()and add a compatibility wrapper. Saves seven hidden calls tocompound_head().Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/data.c | 35 +++++++++++++++++------------------ fs/f2fs/f2fs.h | 14 ++++++++++++-- 2 files changed, 29 insertions(+), 20 deletions(-)fs/f2fs/data.c +17
-18@@ -1203,18 +1203,17 @@ int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index)return err; } -struct page *f2fs_get_read_data_page (struct inode *inode,pgoff_t index, -blk_opf_t op_flags,bool for_write, -pgoff_t *next_pgofs) +struct folio *f2fs_get_read_data_folio (struct inode *inode,pgoff_t index, +blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs) {struct address_space *mapping = inode->i_mapping;struct dnode_of_data dn; -struct page *page; +struct folio *folio;int err; - page =f2fs_grab_cache_page (mapping, index, for_write); -if (!page) -return ERR_PTR (-ENOMEM ); + folio =f2fs_grab_cache_folio (mapping, index, for_write); +if (IS_ERR (folio)) +return folio;if (f2fs_lookup_read_extent_cache_block (inode, index, &dn.data_blkaddr)) {@@ -1249,9 +1248,9 @@ struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index, goto put_err; } got_it: -if (PageUptodate (page)) { -unlock_page (page); -return page; +if (folio_test_uptodate (folio)) { +folio_unlock (folio); +return folio; }/* @@ -1262,21 +1261,21 @@ struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index,* f2fs_init_inode_metadata. */ if (dn.data_blkaddr ==NEW_ADDR ) { -zero_user_segment (page,0 ,PAGE_SIZE ); -if (!PageUptodate (page)) -SetPageUptodate (page); -unlock_page (page); -return page; +folio_zero_segment (folio,0 ,folio_size (folio)); +if (!folio_test_uptodate (folio)) +folio_mark_uptodate (folio); +folio_unlock (folio); +return folio; } - err =f2fs_submit_page_read (inode,page_folio (page), dn.data_blkaddr, + err =f2fs_submit_page_read (inode, folio, dn.data_blkaddr, op_flags, for_write);if (err) goto put_err; -return page; +return folio; put_err: -f2fs_put_page (page,1 ); +f2fs_folio_put (folio, true);return ERR_PTR (err); }fs/f2fs/f2fs.h +2
-2@@ -3895,8 +3895,8 @@ int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count);int f2fs_reserve_new_block (struct dnode_of_data *dn);int f2fs_get_block_locked (struct dnode_of_data *dn,pgoff_t index);int f2fs_reserve_block (struct dnode_of_data *dn,pgoff_t index); -struct page *f2fs_get_read_data_page (struct inode *inode,pgoff_t index, -blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs); +struct folio *f2fs_get_read_data_folio (struct inode *inode,pgoff_t index, +blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs);struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index,pgoff_t *next_pgofs); struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
fs/f2fs/f2fs.h int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi); · line 3935
Quoted 10 lines
fs/f2fs/f2fs.h +7
-0@@ -3926,6 +3926,16 @@ int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi);void f2fs_destroy_post_read_wq (struct f2fs_sb_info *sbi);extern const struct iomap_ops f2fs_iomap_ops; +static inline struct page *f2fs_get_read_data_page (struct inode *inode, +pgoff_t index,blk_opf_t op_flags,bool for_write, +pgoff_t *next_pgofs) +{ +struct folio *folio =f2fs_get_read_data_folio (inode, index, op_flags, + for_write, next_pgofs); +
if (IS_ERR(folio)) return ERR_CAST(folio));
Quoted 6 lines
fs/f2fs/f2fs.h +3
-0+return &folio->page; +} +/* * gc.c */
Matthew Wilcox (Oracle)
maintainerPATCH 22/27 f2fs: Add f2fs_get_lock_data_folio()
In reply to Matthew Wilcox (Oracle)Convert f2fs_get_lock_data_page() to f2fs_get_lock_data_folio() and add a compatibility wrapper. Removes three hidden calls to compound_head().
--- fs/f2fs/data.c | 18 +++++++++--------- fs/f2fs/f2fs.h | 10 +++++++++- 2 files changed, 18 insertions(+), 10 deletions(-)
fs/f2fs/data.c +9 -9
@@ -1310,23 +1310,23 @@ struct page *f2fs_find_data_page(struct inode *inode, pgoff_t index,* Because, the callers, functions in dir.c and GC, should be able to know * whether this page exists or not. */ -struct page *f2fs_get_lock_data_page (struct inode *inode,pgoff_t index, +struct folio *f2fs_get_lock_data_folio (struct inode *inode,pgoff_t index,bool for_write) {struct address_space *mapping = inode->i_mapping; -struct page *page; +struct folio *folio; - page =f2fs_get_read_data_page (inode, index,0 , for_write,NULL ); -if (IS_ERR (page)) -return page; + folio =f2fs_get_read_data_folio (inode, index,0 , for_write,NULL ); +if (IS_ERR (folio)) +return folio;/* wait for read completion */ -lock_page (page); -if (unlikely (page->mapping != mapping || !PageUptodate (page))) { -f2fs_put_page (page,1 ); +folio_lock (folio); +if (unlikely (folio->mapping != mapping || !folio_test_uptodate (folio))) { +f2fs_folio_put (folio, true);return ERR_PTR (-EIO ); } -return page; +return folio; }/*
fs/f2fs/f2fs.h +9 -1
@@ -3899,7 +3899,7 @@ struct folio *f2fs_get_read_data_folio(struct inode *inode, pgoff_t index, blk_opf_t op_flags, bool for_write, pgoff_t *next_pgofs);struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index,pgoff_t *next_pgofs); -struct page *f2fs_get_lock_data_page (struct inode *inode,pgoff_t index, +struct folio *f2fs_get_lock_data_folio (struct inode *inode,pgoff_t index,bool for_write);struct page *f2fs_get_new_data_page (struct inode *inode,struct page *ipage,pgoff_t index,bool new_i_size);
@@ -3936,6 +3936,14 @@ static inline struct page *f2fs_get_read_data_page(struct inode *inode,return &folio->page; } +static inline struct page *f2fs_get_lock_data_page (struct inode *inode, +pgoff_t index,bool for_write) +{ +struct folio *folio =f2fs_get_lock_data_folio (inode, index, for_write); + +return &folio->page; +} +/* * gc.c */
Signature · 1 line
2.47.2
Chao Yu
maintainerRe: [PATCH 22/27] f2fs: Add f2fs_get_lock_data_folio()
Quoted 61 lines · Matthew Wilcox (Oracle)
Convert
f2fs_get_lock_data_page()tof2fs_get_lock_data_folio()and add a compatibility wrapper. Removes three hidden calls tocompound_head().Signed-off-by Matthew Wilcox (Oracle) <[email protected]>--- fs/f2fs/data.c | 18 +++++++++--------- fs/f2fs/f2fs.h | 10 +++++++++- 2 files changed, 18 insertions(+), 10 deletions(-)fs/f2fs/data.c +9
-9@@ -1310,23 +1310,23 @@ struct page *f2fs_find_data_page(struct inode *inode, pgoff_t index,* Because, the callers, functions in dir.c and GC, should be able to know * whether this page exists or not. */ -struct page *f2fs_get_lock_data_page (struct inode *inode,pgoff_t index, +struct folio *f2fs_get_lock_data_folio (struct inode *inode,pgoff_t index,bool for_write) {struct address_space *mapping = inode->i_mapping; -struct page *page; +struct folio *folio; - page =f2fs_get_read_data_page (inode, index,0 , for_write,NULL ); -if (IS_ERR (page)) -return page; + folio =f2fs_get_read_data_folio (inode, index,0 , for_write,NULL ); +if (IS_ERR (folio)) +return folio;/* wait for read completion */ -lock_page (page); -if (unlikely (page->mapping != mapping || !PageUptodate (page))) { -f2fs_put_page (page,1 ); +folio_lock (folio); +if (unlikely (folio->mapping != mapping || !folio_test_uptodate (folio))) { +f2fs_folio_put (folio, true);return ERR_PTR (-EIO ); } -return page; +return folio; }/* fs/f2fs/f2fs.h +1
-1@@ -3899,7 +3899,7 @@ struct folio *f2fs_get_read_data_folio(struct inode *inode, pgoff_t index, blk_opf_t op_flags, bool for_write, pgoff_t *next_pgofs);struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index,pgoff_t *next_pgofs); -struct page *f2fs_get_lock_data_page (struct inode *inode,pgoff_t index, +struct folio *f2fs_get_lock_data_folio (struct inode *inode,pgoff_t index,bool for_write);struct page *f2fs_get_new_data_page (struct inode *inode,struct page *ipage,pgoff_t index,bool new_i_size);
fs/f2fs/f2fs.h static inline struct page *f2fs_get_read_data_page(struct inode *inode, · line 3942
Quoted 7 lines
fs/f2fs/f2fs.h +4
-0@@ -3936,6 +3936,14 @@ static inline struct page *f2fs_get_read_data_page(struct inode *inode,return &folio->page; } +static inline struct page *f2fs_get_lock_data_page (struct inode *inode, +pgoff_t index,bool for_write) +{ +struct folio *folio =f2fs_get_lock_data_folio (inode, index, for_write);
if (IS_ERR(folio)) return ERR_CAST(folio));
Quoted 7 lines
fs/f2fs/f2fs.h +4
-0+ +return &folio->page; +} +/* * gc.c */
Matthew Wilcox (Oracle)
maintainerPATCH 23/27 f2fs: Convert move_data_page() to use a folio
In reply to Matthew Wilcox (Oracle)Fetch a folio from the page cache and use it throughout, saving eight hidden calls to compound_head().
--- fs/f2fs/gc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
fs/f2fs/gc.c +17 -17
@@ -1449,14 +1449,14 @@ static int move_data_block(struct inode *inode, block_t bidx, }static int move_data_page (struct inode *inode,block_t bidx,int gc_type, -unsigned int segno,int off) +unsigned int segno,int off) { -struct page *page; +struct folio *folio;int err =0 ; - page =f2fs_get_lock_data_page (inode, bidx, true); -if (IS_ERR (page)) -return PTR_ERR (page); + folio =f2fs_get_lock_data_folio (inode, bidx, true); +if (IS_ERR (folio)) +return PTR_ERR (folio);if (!check_valid_map (F2FS_I_SB (inode), segno, off)) { err = -ENOENT ;
@@ -1468,12 +1468,12 @@ static int move_data_page(struct inode *inode, block_t bidx, int gc_type, goto out;if (gc_type ==BG_GC ) { -if (folio_test_writeback (page_folio (page))) { +if (folio_test_writeback (folio)) { err = -EAGAIN ; goto out; } -set_page_dirty (page); -set_page_private_gcing (page); +folio_mark_dirty (folio); +set_page_private_gcing (&folio->page); }else {struct f2fs_io_info fio = { .sbi =F2FS_I_SB (inode),
@@ -1483,37 +1483,37 @@ static int move_data_page(struct inode *inode, block_t bidx, int gc_type, .op = REQ_OP_WRITE, .op_flags = REQ_SYNC, .old_blkaddr = NULL_ADDR, - .page = page, + .page = &folio->page, .encrypted_page = NULL, .need_lock = LOCK_REQ, .io_type = FS_GC_DATA_IO, }; -bool is_dirty =PageDirty (page); +bool is_dirty =folio_test_dirty (folio); retry: -f2fs_wait_on_page_writeback (page,DATA , true, true); +f2fs_folio_wait_writeback (folio,DATA , true, true); -set_page_dirty (page); -if (clear_page_dirty_for_io (page)) { +folio_mark_dirty (folio); +if (folio_clear_dirty_for_io (folio)) {inode_dec_dirty_pages (inode);f2fs_remove_dirty_inode (inode); } -set_page_private_gcing (page); +set_page_private_gcing (&folio->page); err =f2fs_do_write_data_page (&fio);if (err) { -clear_page_private_gcing (page); +clear_page_private_gcing (&folio->page);if (err == -ENOMEM ) {memalloc_retry_wait (GFP_NOFS ); goto retry; }if (is_dirty) -set_page_dirty (page); +folio_mark_dirty (folio); } } out: -f2fs_put_page (page,1 ); +f2fs_folio_put (folio, true);return err; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 24/27 f2fs: Convert truncate_partial_data_page() to use a folio
In reply to Matthew Wilcox (Oracle)Retrieve a folio from the page cache and use it throughout. Saves five hidden calls to compound_head().
--- fs/f2fs/file.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
fs/f2fs/file.c +13 -11
@@ -707,31 +707,33 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,loff_t offset = from & (PAGE_SIZE -1 );pgoff_t index = from >>PAGE_SHIFT ;struct address_space *mapping = inode->i_mapping; -struct page *page; +struct folio *folio;if (!offset && !cache_only)return 0 ;if (cache_only) { - page =find_lock_page (mapping, index); -if (page &&PageUptodate (page)) + folio =filemap_lock_folio (mapping, index); +if (IS_ERR (folio)) +return 0 ; +if (folio_test_uptodate (folio)) goto truncate_out; -f2fs_put_page (page,1 ); +f2fs_folio_put (folio, true);return 0 ; } - page =f2fs_get_lock_data_page (inode, index, true); -if (IS_ERR (page)) -return PTR_ERR (page) == -ENOENT ?0 :PTR_ERR (page); + folio =f2fs_get_lock_data_folio (inode, index, true); +if (IS_ERR (folio)) +return PTR_ERR (folio) == -ENOENT ?0 :PTR_ERR (folio); truncate_out: -f2fs_wait_on_page_writeback (page,DATA , true, true); -zero_user (page, offset,PAGE_SIZE - offset); +f2fs_folio_wait_writeback (folio,DATA , true, true); +folio_zero_segment (folio, offset,folio_size (folio));/* An encrypted inode should have a key and truncate the last page. */ f2fs_bug_on (F2FS_I_SB (inode), cache_only &&IS_ENCRYPTED (inode));if (!cache_only) -set_page_dirty (page); -f2fs_put_page (page,1 ); +folio_mark_dirty (folio); +f2fs_folio_put (folio, true);return 0 ; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 25/27 f2fs: Convert gc_data_segment() to use a folio
In reply to Matthew Wilcox (Oracle)Use f2fs_get_read_data_folio() instead of f2fs_get_read_data_page(). Saves a hidden call to compound_head() in f2fs_put_page().
--- fs/f2fs/gc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/f2fs/gc.c +4 -4
@@ -1542,7 +1542,6 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, entry = sum;for (off =0 ; off < usable_blks_in_seg; off++, entry++) { -struct page *data_page;struct inode *inode;struct node_info dni;/* dnode info for the data */ unsigned int ofs_in_node, nofs;
@@ -1585,6 +1584,7 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, ofs_in_node =le16_to_cpu (entry->ofs_in_node);if (phase ==3 ) { +struct folio *data_folio;int err; inode =f2fs_iget (sb, dni.ino);
@@ -1635,15 +1635,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,continue ; } - data_page =f2fs_get_read_data_page (inode, start_bidx, + data_folio =f2fs_get_read_data_folio (inode, start_bidx,REQ_RAHEAD , true,NULL );f2fs_up_write (&F2FS_I (inode)->i_gc_rwsem[WRITE ]); -if (IS_ERR (data_page)) { +if (IS_ERR (data_folio)) {iput (inode);continue ; } -f2fs_put_page (data_page,0 ); +f2fs_folio_put (data_folio, false);add_gc_inode (gc_list, inode);continue ; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 26/27 f2fs: Add f2fs_find_data_folio()
In reply to Matthew Wilcox (Oracle)Convert f2fs_find_data_page() to f2fs_find_data_folio() and add a compatibility wrapper. Saves six hidden calls to compound_head(). This was the last caller of f2fs_get_read_data_page(), so remove the compatibility wrapper.
--- fs/f2fs/data.c | 33 ++++++++++++++++++--------------- fs/f2fs/f2fs.h | 12 +++++------- 2 files changed, 23 insertions(+), 22 deletions(-)
fs/f2fs/data.c +18 -15
@@ -1279,30 +1279,33 @@ struct folio *f2fs_get_read_data_folio(struct inode *inode, pgoff_t index,return ERR_PTR (err); } -struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index, +struct folio *f2fs_find_data_folio (struct inode *inode,pgoff_t index,pgoff_t *next_pgofs) {struct address_space *mapping = inode->i_mapping; -struct page *page; +struct folio *folio; - page =find_get_page_flags (mapping, index,FGP_ACCESSED ); -if (page &&PageUptodate (page)) -return page; -f2fs_put_page (page,0 ); + folio =__filemap_get_folio (mapping, index,FGP_ACCESSED ,0 ); +if (IS_ERR (folio)) + goto read; +if (folio_test_uptodate (folio)) +return folio; +f2fs_folio_put (folio, false); - page =f2fs_get_read_data_page (inode, index,0 , false, next_pgofs); -if (IS_ERR (page)) -return page; +read: + folio =f2fs_get_read_data_folio (inode, index,0 , false, next_pgofs); +if (IS_ERR (folio)) +return folio; -if (PageUptodate (page)) -return page; +if (folio_test_uptodate (folio)) +return folio; -wait_on_page_locked (page); -if (unlikely (!PageUptodate (page))) { -f2fs_put_page (page,0 ); +folio_wait_locked (folio); +if (unlikely (!folio_test_uptodate (folio))) { +f2fs_folio_put (folio, false);return ERR_PTR (-EIO ); } -return page; +return folio; }/*
fs/f2fs/f2fs.h +5 -7
@@ -3897,8 +3897,8 @@ int f2fs_get_block_locked(struct dnode_of_data *dn, pgoff_t index);int f2fs_reserve_block (struct dnode_of_data *dn,pgoff_t index);struct folio *f2fs_get_read_data_folio (struct inode *inode,pgoff_t index,blk_opf_t op_flags,bool for_write,pgoff_t *next_pgofs); -struct page *f2fs_find_data_page (struct inode *inode,pgoff_t index, -pgoff_t *next_pgofs); +struct folio *f2fs_find_data_folio (struct inode *inode,pgoff_t index, +pgoff_t *next_pgofs);struct folio *f2fs_get_lock_data_folio (struct inode *inode,pgoff_t index,bool for_write); struct page *f2fs_get_new_data_page(struct inode *inode,
@@ -3926,12 +3926,10 @@ int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi);void f2fs_destroy_post_read_wq (struct f2fs_sb_info *sbi);extern const struct iomap_ops f2fs_iomap_ops; -static inline struct page *f2fs_get_read_data_page (struct inode *inode, -pgoff_t index,blk_opf_t op_flags,bool for_write, -pgoff_t *next_pgofs) +static inline struct page *f2fs_find_data_page (struct inode *inode, +pgoff_t index,pgoff_t *next_pgofs) { -struct folio *folio =f2fs_get_read_data_folio (inode, index, op_flags, - for_write, next_pgofs); +struct folio *folio =f2fs_find_data_folio (inode, index, next_pgofs);return &folio->page; }
Signature · 1 line
2.47.2
Matthew Wilcox (Oracle)
maintainerPATCH 27/27 mm: Remove wait_on_page_locked()
In reply to Matthew Wilcox (Oracle)This compatibility wrapper has no callers left, so remove it.
--- include/linux/pagemap.h | 5 ----- mm/filemap.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-)
include/linux/pagemap.h +0 -5
@@ -1242,11 +1242,6 @@ static inline int folio_wait_locked_killable(struct folio *folio)return folio_wait_bit_killable (folio, PG_locked); } -static inline void wait_on_page_locked (struct page *page) -{ -folio_wait_locked (page_folio (page)); -} -void folio_end_read (struct folio *folio,bool success);void wait_on_page_writeback (struct page *page);void folio_wait_writeback (struct folio *folio);
mm/filemap.c +1 -1
@@ -1380,7 +1380,7 @@ static inline int folio_wait_bit_common(struct folio *folio, int bit_nr,* @ptl: already locked ptl. This function will drop the lock. * * Wait for a migration entry referencing the given page to be removed. This is -* equivalent to put_and_wait_on_page_locked(page, TASK_UNINTERRUPTIBLE) except +* equivalent to folio_put_wait_locked(folio, TASK_UNINTERRUPTIBLE) except * this can be called without taking a reference on the page. Instead this * should be called while holding the ptl for the migration entry referencing * the page.
Signature · 1 line
2.47.2
Jaegeuk Kim
maintainerThank you for the patches. I queued them in dev-test and kicked off all my tests.
Thanks,
Quoted 51 lines · Matthew Wilcox (Oracle)
More f2fs folio conversions. This time I'm focusing on removing accesses to
page->mappingas well as getting rid of accesses to old APIs. f2fs was the last user ofwait_for_stable_page(),grab_cache_page_write_begin()andwait_on_page_locked(), so I've included those removals in this series too.Matthew Wilcox (Oracle) (27):
f2fs: Addf2fs_folio_wait_writeback()
mm: Removewait_for_stable_page()
f2fs: Addf2fs_folio_put()
f2fs: Convertf2fs_flush_inline_data()to use a folio
f2fs: Convertf2fs_sync_node_pages()to use a folio
f2fs: Pass a folio toflush_dirty_inode()
f2fs: Convertf2fs_fsync_node_pages()to use a folio
f2fs: Convertlast_fsync_dnode()to use a folio
f2fs: Return a folio fromlast_fsync_dnode()
f2fs: Addf2fs_grab_cache_folio()
mm: Removegrab_cache_page_write_begin()
f2fs: Use a folio in__get_node_page()
f2fs: Use a folio indo_write_page()
f2fs: Convertf2fs_write_end_io()to use afolio_iter
f2fs: Mark some functions as taking a const page pointer
f2fs: Convertf2fs_in_warm_node_list()to take a folio
f2fs: Addf2fs_get_node_folio()
f2fs: Use a folio throughoutf2fs_truncate_inode_blocks()
f2fs: Use a folio throughout__get_meta_page()
f2fs: Hoist thepage_folio()call to the start off2fs_merge_page_bio()f2fs: Add
f2fs_get_read_data_folio()
f2fs: Addf2fs_get_lock_data_folio()
f2fs: Convertmove_data_page()to use a folio
f2fs: Converttruncate_partial_data_page()to use a folio
f2fs: Convertgc_data_segment()to use a folio
f2fs: Addf2fs_find_data_folio()
mm: Removewait_on_page_locked()fs/f2fs/checkpoint.c | 26 ++-- fs/f2fs/data.c | 130 ++++++++++--------- fs/f2fs/f2fs.h | 90 +++++++++---- fs/f2fs/file.c | 24 ++-- fs/f2fs/gc.c | 42 +++--- fs/f2fs/node.c | 279 ++++++++++++++++++++-------------------- fs/f2fs/node.h | 6 +- fs/f2fs/segment.c | 26 ++-- include/linux/pagemap.h | 9 -- mm/filemap.c | 2 +- mm/folio-compat.c | 14 -- 11 files changed, 338 insertions(+), 310 deletions(-)Signature · 1 line
2.47.2
Quoted 5 lines · Matthew Wilcox (Oracle)
More f2fs folio conversions. This time I'm focusing on removing accesses to
page->mappingas well as getting rid of accesses to old APIs. f2fs was the last user ofwait_for_stable_page(),grab_cache_page_write_begin()andwait_on_page_locked(), so I've included those removals in this series too.
After fixing f2fs_put_page(), whole patchset looks good to me.
Jaegeuk, feel free to add:
Thanks,
Quoted 44 lines
Matthew Wilcox (Oracle) (27):
f2fs: Addf2fs_folio_wait_writeback()
mm: Removewait_for_stable_page()
f2fs: Addf2fs_folio_put()
f2fs: Convertf2fs_flush_inline_data()to use a folio
f2fs: Convertf2fs_sync_node_pages()to use a folio
f2fs: Pass a folio toflush_dirty_inode()
f2fs: Convertf2fs_fsync_node_pages()to use a folio
f2fs: Convertlast_fsync_dnode()to use a folio
f2fs: Return a folio fromlast_fsync_dnode()
f2fs: Addf2fs_grab_cache_folio()
mm: Removegrab_cache_page_write_begin()
f2fs: Use a folio in__get_node_page()
f2fs: Use a folio indo_write_page()
f2fs: Convertf2fs_write_end_io()to use afolio_iter
f2fs: Mark some functions as taking a const page pointer
f2fs: Convertf2fs_in_warm_node_list()to take a folio
f2fs: Addf2fs_get_node_folio()
f2fs: Use a folio throughoutf2fs_truncate_inode_blocks()
f2fs: Use a folio throughout__get_meta_page()
f2fs: Hoist thepage_folio()call to the start off2fs_merge_page_bio()f2fs: Add
f2fs_get_read_data_folio()
f2fs: Addf2fs_get_lock_data_folio()
f2fs: Convertmove_data_page()to use a folio
f2fs: Converttruncate_partial_data_page()to use a folio
f2fs: Convertgc_data_segment()to use a folio
f2fs: Addf2fs_find_data_folio()
mm: Removewait_on_page_locked()fs/f2fs/checkpoint.c | 26 ++-- fs/f2fs/data.c | 130 ++++++++++--------- fs/f2fs/f2fs.h | 90 +++++++++---- fs/f2fs/file.c | 24 ++-- fs/f2fs/gc.c | 42 +++--- fs/f2fs/node.c | 279 ++++++++++++++++++++-------------------- fs/f2fs/node.h | 6 +- fs/f2fs/segment.c | 26 ++-- include/linux/pagemap.h | 9 -- mm/filemap.c | 2 +- mm/folio-compat.c | 14 -- 11 files changed, 338 insertions(+), 310 deletions(-)
This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 36 lines · On Tue, 18 Feb 2025 05:51:34 +0000 you wrote:
More f2fs folio conversions. This time I'm focusing on removing accesses to
page->mappingas well as getting rid of accesses to old APIs. f2fs was the last user ofwait_for_stable_page(),grab_cache_page_write_begin()andwait_on_page_locked(), so I've included those removals in this series too.Matthew Wilcox (Oracle) (27):
f2fs: Addf2fs_folio_wait_writeback()
mm: Removewait_for_stable_page()
f2fs: Addf2fs_folio_put()
f2fs: Convertf2fs_flush_inline_data()to use a folio
f2fs: Convertf2fs_sync_node_pages()to use a folio
f2fs: Pass a folio toflush_dirty_inode()
f2fs: Convertf2fs_fsync_node_pages()to use a folio
f2fs: Convertlast_fsync_dnode()to use a folio
f2fs: Return a folio fromlast_fsync_dnode()
f2fs: Addf2fs_grab_cache_folio()
mm: Removegrab_cache_page_write_begin()
f2fs: Use a folio in__get_node_page()
f2fs: Use a folio indo_write_page()
f2fs: Convertf2fs_write_end_io()to use afolio_iter
f2fs: Mark some functions as taking a const page pointer
f2fs: Convertf2fs_in_warm_node_list()to take a folio
f2fs: Addf2fs_get_node_folio()
f2fs: Use a folio throughoutf2fs_truncate_inode_blocks()
f2fs: Use a folio throughout__get_meta_page()
f2fs: Hoist thepage_folio()call to the start off2fs_merge_page_bio()f2fs: Add
f2fs_get_read_data_folio()
f2fs: Addf2fs_get_lock_data_folio()
f2fs: Convertmove_data_page()to use a folio
f2fs: Converttruncate_partial_data_page()to use a folio
f2fs: Convertgc_data_segment()to use a folio
f2fs: Addf2fs_find_data_folio()
mm: Removewait_on_page_locked()
Quoted 1 line
[...]
Here is the summary with links:
- [f2fs-dev,01/27] f2fs: Add f2fs_folio_wait_writeback()
https://git.kernel.org/jaegeuk/f2fs/c/17683927d078 - [f2fs-dev,02/27] mm: Remove wait_for_stable_page() https://git.kernel.org/jaegeuk/f2fs/c/36e1d6344aca - [f2fs-dev,03/27] f2fs: Add f2fs_folio_put() (no matching commit) - [f2fs-dev,04/27] f2fs: Convert f2fs_flush_inline_data() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/015d9c56bd5e - [f2fs-dev,05/27] f2fs: Convert f2fs_sync_node_pages() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/5d0a91284853 - [f2fs-dev,06/27] f2fs: Pass a folio to flush_dirty_inode() https://git.kernel.org/jaegeuk/f2fs/c/de90f7614424 - [f2fs-dev,07/27] f2fs: Convert f2fs_fsync_node_pages() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/e23bebc3c0d2 - [f2fs-dev,08/27] f2fs: Convert last_fsync_dnode() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/18f3814fa6a8 - [f2fs-dev,09/27] f2fs: Return a folio from last_fsync_dnode() https://git.kernel.org/jaegeuk/f2fs/c/e11a31139517 - [f2fs-dev,10/27] f2fs: Add f2fs_grab_cache_folio() https://git.kernel.org/jaegeuk/f2fs/c/8d77f68daeb1 - [f2fs-dev,11/27] mm: Remove grab_cache_page_write_begin() https://git.kernel.org/jaegeuk/f2fs/c/e33ce6bd4ea2 - [f2fs-dev,12/27] f2fs: Use a folio in __get_node_page() https://git.kernel.org/jaegeuk/f2fs/c/48a34c598103 - [f2fs-dev,13/27] f2fs: Use a folio in do_write_page() https://git.kernel.org/jaegeuk/f2fs/c/cd8f95718c89 - [f2fs-dev,14/27] f2fs: Convert f2fs_write_end_io() to use a folio_iter https://git.kernel.org/jaegeuk/f2fs/c/fb9660481e3c - [f2fs-dev,15/27] f2fs: Mark some functions as taking a const page pointer https://git.kernel.org/jaegeuk/f2fs/c/521a46848690 - [f2fs-dev,16/27] f2fs: Convert f2fs_in_warm_node_list() to take a folio https://git.kernel.org/jaegeuk/f2fs/c/1a58a41ccce6 - [f2fs-dev,17/27] f2fs: Add f2fs_get_node_folio() https://git.kernel.org/jaegeuk/f2fs/c/4d417ae2bfce - [f2fs-dev,18/27] f2fs: Use a folio throughout f2fs_truncate_inode_blocks() https://git.kernel.org/jaegeuk/f2fs/c/520b17e093f4 - [f2fs-dev,19/27] f2fs: Use a folio throughout __get_meta_page() https://git.kernel.org/jaegeuk/f2fs/c/922e24acb49e - [f2fs-dev,20/27] f2fs: Hoist the page_folio() call to the start of f2fs_merge_page_bio() https://git.kernel.org/jaegeuk/f2fs/c/b8fcb8423053 - [f2fs-dev,21/27] f2fs: Add f2fs_get_read_data_folio() https://git.kernel.org/jaegeuk/f2fs/c/4ae71b1996ef - [f2fs-dev,22/27] f2fs: Add f2fs_get_lock_data_folio() https://git.kernel.org/jaegeuk/f2fs/c/20f974cd2124 - [f2fs-dev,23/27] f2fs: Convert move_data_page() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/6d1ba45c8db0 - [f2fs-dev,24/27] f2fs: Convert truncate_partial_data_page() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/ab907aa2a2f3 - [f2fs-dev,25/27] f2fs: Convert gc_data_segment() to use a folio https://git.kernel.org/jaegeuk/f2fs/c/a86e109ee2c6 - [f2fs-dev,26/27] f2fs: Add f2fs_find_data_folio() https://git.kernel.org/jaegeuk/f2fs/c/0cd402baa03b - [f2fs-dev,27/27] mm: Remove wait_on_page_locked() https://git.kernel.org/jaegeuk/f2fs/c/d96e2802a802
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html