Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:46 +0000 (21:11 +0100)]
f2fs: Use a folio in __find_data_block()
Remove a call to f2fs_get_inode_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:45 +0000 (21:11 +0100)]
f2fs: Use a folio in prepare_write_begin
Remove a call to f2fs_get_inode_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:44 +0000 (21:11 +0100)]
f2fs: Remove f2fs_get_node_page()
All callers have now been converted to call f2fs_get_node_folio().
Remove this wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:43 +0000 (21:11 +0100)]
f2fs: Use a folio in check_index_in_prev_nodes()
Remove a hidden call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:42 +0000 (21:11 +0100)]
f2fs: Use a folio in is_alive()
Remove four calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:41 +0000 (21:11 +0100)]
f2fs: Convert __write_node_page() to __write_node_folio()
All three callers now have a folio so pass it in. Removes
two calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:40 +0000 (21:11 +0100)]
f2fs: Convert f2fs_move_node_page() to f2fs_move_node_folio()
Pass the folio in from the one caller and use it throughout.
Removes eight hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:39 +0000 (21:11 +0100)]
f2fs: Use a folio in gc_node_segment()
Remove three calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:38 +0000 (21:11 +0100)]
f2fs: Pass a folio to f2fs_ra_node_pages()
Removes a call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:37 +0000 (21:11 +0100)]
f2fs: Use folios in truncate_partial_nodes()
Removes two calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:36 +0000 (21:11 +0100)]
f2fs: Use a folio in truncate_nodes()
Remove two calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:35 +0000 (21:11 +0100)]
f2fs: Use a folio in truncate_node()
Remove two calls to compound_head()
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:34 +0000 (21:11 +0100)]
f2fs: Use folios in f2fs_get_dnode_of_data()
Pass the folio into __get_node_folio() and f2fs_get_node_page_ra() which
becomes f2fs_get_node_folio_ra(). That function has no callers outside
node.c, so make it static. Removes seven calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:33 +0000 (21:11 +0100)]
f2fs: Add f2fs_get_node_folio()
The folio equivalent of f2fs_get_node_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:32 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_recover_xattr_data()
Remove two calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:31 +0000 (21:11 +0100)]
f2fs: Use a folio in write_all_xattrs()
Removes three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:30 +0000 (21:11 +0100)]
f2fs: Add f2fs_get_xnode_folio()
The folio equivalent of f2fs_get_xnode_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:29 +0000 (21:11 +0100)]
f2fs: Remove f2fs_grab_cache_page()
All callers have now been converted to f2fs_grab_cache_folio() so
we can remove this wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:28 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_recover_inode_page()
Save four hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:27 +0000 (21:11 +0100)]
f2fs: Pass a folio to f2fs_inode_chksum_verify()
Both callers now have a folio, so pass it in. Removes three calls
to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:26 +0000 (21:11 +0100)]
f2fs: Convert read_node_page() to read_node_folio()
Both callers now have a folio, so pass it in and remove the
conversion back to a folio. Removes two calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:25 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_ra_node_page()
Save a call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:24 +0000 (21:11 +0100)]
f2fs: Add f2fs_new_node_folio()
Convert f2fs_new_node_page() to f2fs_new_node_folio() and add
a compatibility wrapper. Removes five hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:23 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_move_inline_dirents()
Remove eight hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:22 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_convert_inline_inode()
Remove a call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:21 +0000 (21:11 +0100)]
f2fs: Use a folio in move_data_block()
Remove 11 hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:20 +0000 (21:11 +0100)]
f2fs: Use a folio in ra_data_block()
Remove three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:19 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_xattr_fiemap()
Remove four hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:18 +0000 (21:11 +0100)]
f2fs: Remove f2fs_get_new_data_page()
All callers have been converted to call f2fs_get_new_data_folio()
so delete this wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:17 +0000 (21:11 +0100)]
f2fs: Use a folio in make_empty_dir()
Remove two hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:16 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_add_regular_entry()
Remove three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:15 +0000 (21:11 +0100)]
f2fs: Use a folio in fill_zero()
Remove three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:14 +0000 (21:11 +0100)]
f2fs: Remove f2fs_get_lock_data_page()
All callers have now been converted to f2fs_get_lock_data_folio(),
so remove this wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:13 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_defragment_range()
Remove three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:12 +0000 (21:11 +0100)]
f2fs: Use a folio in __clone_blkaddrs()
Removes five hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:11 +0000 (21:11 +0100)]
highmem: Add memcpy_folio()
The folio equivalent of memcpy_page(). It should correctly and
efficiently manage large folios:
- If one, neither or both is highmem
- If (either or both) offset+len crosses a page boundary
- If the two offsets are congruent or not
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:10 +0000 (21:11 +0100)]
f2fs: Add f2fs_get_new_data_folio()
Convert f2fs_get_new_data_page() into f2fs_get_new_data_folio() and
add a f2fs_get_new_data_page() wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:09 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_migrate_blocks()
Get a folio from the pagecache and use it throughout. Removes two
calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:08 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_get_new_data_page()
Get folios from the pagecache instead of pages. Remove five calls to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:07 +0000 (21:11 +0100)]
f2fs: Remove f2fs_find_data_page()
All callers have now been converted to call f2fs_find_data_folio().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:06 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_readdir()
Get a folio instead of a page and use it throughout. Also put the folio
before checking the error so we only have to do it once. Saves two
hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:05 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_delete_entry()
Get a folio instead of a page and operate on it. Saves a call to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:04 +0000 (21:11 +0100)]
f2fs: Use a folio in find_in_level()
Get a folio instead of a page and use it throughout. Removes a
call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:03 +0000 (21:11 +0100)]
f2fs: Remove f2fs_get_sum_page()
All callers have now been converted to call f2fs_get_sum_folio()
instead.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:02 +0000 (21:11 +0100)]
f2fs: Use a folio in change_curseg()
Get a folio and use it. Saves a call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:01 +0000 (21:11 +0100)]
f2fs: Use a folio in check_index_in_prev_nodes()
Get a folio instead of a page and operate on it. Saves a call to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:00 +0000 (21:11 +0100)]
f2fs: Use folios in do_garbage_collect()
Get a folio instead of a page and operate on folios throughout.
Remove six calls to compound_head() and use folio_put_refs() to put
both references we hold at the same time, reducing the number of atomic
operations we do.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:59 +0000 (21:10 +0100)]
f2fs: Add f2fs_get_sum_folio()
Convert f2fs_get_sum_page() to f2fs_get_sum_folio() and add a
f2fs_get_sum_page() wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:58 +0000 (21:10 +0100)]
f2fs: Pass an address to scan_nat_page()
Remove a conversion from folio to page by passing in the address of the
first byte rather than the struct page containing it.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:57 +0000 (21:10 +0100)]
f2fs: Convert f2fs_get_meta_page_retry() to f2fs_get_meta_folio_retry()
Also convert get_current_nat_page() to get_current_nat_folio().
Removes three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:56 +0000 (21:10 +0100)]
f2fs: Remove f2fs_get_meta_page()
All callers have now been converted to f2fs_get_meta_folio() so
we can remove this wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:55 +0000 (21:10 +0100)]
f2fs: Use a folio in read_normal_summaries()
Get a folio instead of a page. Saves a hidden call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:54 +0000 (21:10 +0100)]
f2fs: Use a folio in read_compacted_summaries()
Get a folio instead of a page. Saves two hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:53 +0000 (21:10 +0100)]
f2fs: Use a folio in __get_nat_bitmaps()
Get a folio instead of a page. Saves a hidden call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:52 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_get_node_info()
Get a folio instead of a page. Saves a hidden call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:51 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_get_valid_checkpoint()
Convert validate_checkpoint() to return a folio and use it throughout
f2fs_get_valid_checkpoint(). Saves five hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:50 +0000 (21:10 +0100)]
f2fs: Use a folio in validate_checkpoint()
Convert get_checkpoint_version() to take a folio and use it throughout
validate_checkpoint(). Saves five hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:49 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_recover_orphan_inodes()
Get a folio instead of a page and use it throughout. Saves two
hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:48 +0000 (21:10 +0100)]
f2fs: Use a folio in build_sit_entries()
Convert get_current_sit_page() to get_current_sit_folio() and then
use the folio in build_sit_entries(). Saves a hidden call to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:47 +0000 (21:10 +0100)]
f2fs: Add f2fs_get_meta_folio()
Convert f2fs_get_meta_page() to f2fs_get_meta_folio() and add
f2fs_get_meta_page() as a wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:46 +0000 (21:10 +0100)]
f2fs: Remove f2fs_grab_meta_page()
All callers have now been converted to f2fs_grab_meta_folio() so
we can remove this wrapper.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:45 +0000 (21:10 +0100)]
f2fs: Use a folio in write_compacted_summaries()
Grab a folio instead of a page. Saves four hidden calls to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:44 +0000 (21:10 +0100)]
f2fs: Use a folio in write_current_sum_page()
Grab a folio instead of a page. Saves two hidden calls to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:43 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_update_meta_page()
Grab a folio instead of a page. Saves two hidden calls to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:42 +0000 (21:10 +0100)]
f2fs: Convert get_next_sit_page() to get_next_sit_folio()
Grab a folio instead of a page. Also convert seg_info_to_sit_page() to
seg_info_to_sit_folio() and use a folio in f2fs_flush_sit_entries().
Saves a couple of calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:41 +0000 (21:10 +0100)]
f2fs: Use a folio in get_next_nat_page()
Call f2fs_grab_meta_folio() instead of f2fs_grab_meta_page().
Saves a hidden call to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:40 +0000 (21:10 +0100)]
f2fs: Use a folio in write_orphan_inodes()
Call f2fs_grab_meta_folio() instead of f2fs_grab_meta_page().
Removes four hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:39 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_ra_meta_pages_cond()
Remove a call to find_get_page(). Saves two hidden calls to
compound_head(). Change f2fs_folio_put() to check for IS_ERR_OR_NULL
to handle the case where we got an error pointer back from
filemap_get_folio().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:38 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_ra_meta_pages()
Remove three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:37 +0000 (21:10 +0100)]
f2fs: Pass a folio to next_blkaddr_of_node()
Pass the folio into sanity_check_node_footer() so that we can pass
it further into next_blkaddr_of_node(). Removes a lot of conversions
from folio->page.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:36 +0000 (21:10 +0100)]
f2fs: Convert f2fs_get_tmp_page() to f2fs_get_tmp_folio()
Convert all the callers to receive a folio. Removes a lot of
hidden calls to compound_head() in f2fs_put_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:35 +0000 (21:10 +0100)]
f2fs: Convert __get_meta_page() to __get_meta_folio()
Push the conversion to a page into the callers.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:34 +0000 (21:10 +0100)]
f2fs: Pass a folio to f2fs_submit_merged_ipu_write()
The only caller which passes a page already has a folio, so pass
it in.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:33 +0000 (21:10 +0100)]
f2fs: Use f2fs_folio_wait_writeback()
There were some missing conversions from f2fs_wait_on_page_writeback()
to f2fs_folio_wait_writeback(). Saves a call to compound_head() at each
callsite.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:32 +0000 (21:10 +0100)]
f2fs: Convert __f2fs_write_meta_page() to __f2fs_write_meta_folio()
All callers now have a folio so pass it in. Saves three hidden calls to
compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:31 +0000 (21:10 +0100)]
f2fs: Use a folio in commit_checkpoint()
Save four calls to compound_head(). Also remove the call
to f2fs_wait_on_page_writeback() as this was already done by
f2fs_grab_meta_folio() and writeback can't have restarted in the
meantime since we hold the folio locked.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:30 +0000 (21:10 +0100)]
f2fs: Add f2fs_grab_meta_folio()
Turn f2fs_grab_meta_page() into a wrapper around f2fs_grab_meta_folio().
Saves three hidden calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:29 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_quota_read()
Support arbitrary size folios and remove a few hidden calls to
compound_head(). Also remove an unnecessary test of the uptodaate flag;
if mapping_read_folio_gfp() cannot bring the folio uptodate, it will
return an error.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:28 +0000 (21:10 +0100)]
f2fs: Use a folio in move_data_block()
Fetch a folio from the pagecache instead of a page and operate on it
throughout. Removes eight calls to compound_head() and an access to
page->mapping.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:27 +0000 (21:10 +0100)]
f2fs: Remove access to page->mapping in f2fs_is_cp_guaranteed()
page->mapping will be removed soon, so call page_folio() on the
page that was passed in.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:26 +0000 (21:10 +0100)]
f2fs: Use a folio in add_ipu_page()
Convert the incoming page to a folio at the start, then use the
folio later in the function. Moves a call to page_folio() earlier,
and removes an access to page->mapping.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:25 +0000 (21:10 +0100)]
f2fs: Use bio_for_each_folio_all() in __has_merged_page()
Iterate over each folio rather than each page. Convert
f2fs_compress_control_page() to f2fs_compress_control_folio() since
this is the only caller. Removes a reference to page->mapping which
is going away soon as well as calls to fscrypt_is_bounce_page() and
fscrypt_pagecache_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:24 +0000 (21:10 +0100)]
f2fs: Use F2FS_P_SB() in f2fs_is_compressed_page()
Remove a reference to page->mapping which is going away soon.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:23 +0000 (21:10 +0100)]
f2fs: Introduce fio_inode()
This helper returns the inode associated with the f2fs_io_info. That's a
relatively common thing to want, mildly awkward to get and provides one
place to change if we decide to record it directly, or change fio->page
to fio->folio.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
[Jaegeuk Kim: fix wrong fio_inode conversion]
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:22 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_write_raw_pages()
Convert each page in rpages to a folio before operating on it. Replaces
eight calls to compound_head() with one and removes a reference to
page->mapping which is going away soon.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:10:21 +0000 (21:10 +0100)]
f2fs: Use a folio in f2fs_compress_free_page()
Convert the incoming page to a folio and operate on it. Removes a
reference to page->mapping which is going away soon.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 12 Apr 2025 21:09:46 +0000 (21:09 +0000)]
f2fs: prevent kernel warning due to negative i_nlink from corrupted image
WARNING: CPU: 1 PID: 9426 at fs/inode.c:417 drop_nlink+0xac/0xd0
home/cc/linux/fs/inode.c:417
Modules linked in:
CPU: 1 UID: 0 PID: 9426 Comm: syz-executor568 Not tainted
6.14.0-12627-g94d471a4f428 #2 PREEMPT(full)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:drop_nlink+0xac/0xd0 home/cc/linux/fs/inode.c:417
Code: 48 8b 5d 28 be 08 00 00 00 48 8d bb 70 07 00 00 e8 f9 67 e6 ff
f0 48 ff 83 70 07 00 00 5b 5d e9 9a 12 82 ff e8 95 12 82 ff 90
<0f> 0b 90 c7 45 48 ff ff ff ff 5b 5d e9 83 12 82 ff e8 fe 5f e6
ff
RSP: 0018:
ffffc900026b7c28 EFLAGS:
00010293
RAX:
0000000000000000 RBX:
0000000000000000 RCX:
ffffffff8239710f
RDX:
ffff888041345a00 RSI:
ffffffff8239717b RDI:
0000000000000005
RBP:
ffff888054509ad0 R08:
0000000000000005 R09:
0000000000000000
R10:
0000000000000000 R11:
ffffffff9ab36f08 R12:
ffff88804bb40000
R13:
ffff8880545091e0 R14:
0000000000008000 R15:
ffff8880545091e0
FS:
000055555d0c5880(0000) GS:
ffff8880eb3e3000(0000) knlGS:
0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
CR2:
00007f915c55b178 CR3:
0000000050d20000 CR4:
0000000000352ef0
Call Trace:
<task>
f2fs_i_links_write home/cc/linux/fs/f2fs/f2fs.h:3194 [inline]
f2fs_drop_nlink+0xd1/0x3c0 home/cc/linux/fs/f2fs/dir.c:845
f2fs_delete_entry+0x542/0x1450 home/cc/linux/fs/f2fs/dir.c:909
f2fs_unlink+0x45c/0x890 home/cc/linux/fs/f2fs/namei.c:581
vfs_unlink+0x2fb/0x9b0 home/cc/linux/fs/namei.c:4544
do_unlinkat+0x4c5/0x6a0 home/cc/linux/fs/namei.c:4608
__do_sys_unlink home/cc/linux/fs/namei.c:4654 [inline]
__se_sys_unlink home/cc/linux/fs/namei.c:4652 [inline]
__x64_sys_unlink+0xc5/0x110 home/cc/linux/fs/namei.c:4652
do_syscall_x64 home/cc/linux/arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xc7/0x250 home/cc/linux/arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb3d092324b
Code: 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66
2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 57 00 00 00 0f 05
<48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01
48
RSP: 002b:
00007ffdc232d938 EFLAGS:
00000206 ORIG_RAX:
0000000000000057
RAX:
ffffffffffffffda RBX:
0000000000000000 RCX:
00007fb3d092324b
RDX:
00007ffdc232d960 RSI:
00007ffdc232d960 RDI:
00007ffdc232d9f0
RBP:
00007ffdc232d9f0 R08:
0000000000000001 R09:
00007ffdc232d7c0
R10:
00000000fffffffd R11:
0000000000000206 R12:
00007ffdc232eaf0
R13:
000055555d0cebb0 R14:
00007ffdc232d958 R15:
0000000000000001
</task>
Cc: stable@vger.kernel.org
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Tue, 8 Apr 2025 12:22:08 +0000 (20:22 +0800)]
f2fs: fix to do sanity check on sbi->total_valid_block_count
syzbot reported a f2fs bug as below:
------------[ cut here ]------------
kernel BUG at fs/f2fs/f2fs.h:2521!
RIP: 0010:dec_valid_block_count+0x3b2/0x3c0 fs/f2fs/f2fs.h:2521
Call Trace:
f2fs_truncate_data_blocks_range+0xc8c/0x11a0 fs/f2fs/file.c:695
truncate_dnode+0x417/0x740 fs/f2fs/node.c:973
truncate_nodes+0x3ec/0xf50 fs/f2fs/node.c:1014
f2fs_truncate_inode_blocks+0x8e3/0x1370 fs/f2fs/node.c:1197
f2fs_do_truncate_blocks+0x840/0x12b0 fs/f2fs/file.c:810
f2fs_truncate_blocks+0x10d/0x300 fs/f2fs/file.c:838
f2fs_truncate+0x417/0x720 fs/f2fs/file.c:888
f2fs_setattr+0xc4f/0x12f0 fs/f2fs/file.c:1112
notify_change+0xbca/0xe90 fs/attr.c:552
do_truncate+0x222/0x310 fs/open.c:65
handle_truncate fs/namei.c:3466 [inline]
do_open fs/namei.c:3849 [inline]
path_openat+0x2e4f/0x35d0 fs/namei.c:4004
do_filp_open+0x284/0x4e0 fs/namei.c:4031
do_sys_openat2+0x12b/0x1d0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_creat fs/open.c:1522 [inline]
__se_sys_creat fs/open.c:1516 [inline]
__x64_sys_creat+0x124/0x170 fs/open.c:1516
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
The reason is: in fuzzed image, sbi->total_valid_block_count is
inconsistent w/ mapped blocks indexed by inode, so, we should
not trigger panic for such case, instead, let's print log and
set fsck flag.
Fixes:
39a53e0ce0df ("f2fs: add superblock and major in-memory structure")
Reported-by: syzbot+8b376a77b2f364097fbe@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-f2fs-devel/
67f3c0b2.
050a0220.396535.0547.GAE@google.com
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Tue, 1 Apr 2025 03:58:00 +0000 (11:58 +0800)]
f2fs: support to disable linear lookup fallback
After commit
91b587ba79e1 ("f2fs: Introduce linear search for
dentries"), f2fs forced to use linear lookup whenever a hash-based
lookup fails on casefolded directory, it may affect performance
for scenarios: a) create a new file w/ filename it doesn't exist
in directory, b) lookup a file which may be removed.
This patch supports to disable linear lookup fallback, so, once there
is a solution for commit
5c26d2f1d3f5 ("unicode: Don't special case
ignorable code points") to fix red heart unicode issue, then we can
set an encodeing flag to disable the fallback for performance recovery.
The way is kept in line w/ ext4, refer to commit
9e28059d5664 ("ext4:
introduce linear search for dentries").
Cc: Daniel Lee <chullee@google.com>
Cc: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
yohan.joung [Thu, 3 Apr 2025 23:21:06 +0000 (08:21 +0900)]
f2fs: prevent the current section from being selected as a victim during GC
When selecting a victim using next_victim_seg in a large section, the
selected section might already have been cleared and designated as the
new current section, making it actively in use.
This behavior causes inconsistency between the SIT and SSA.
F2FS-fs (dm-54): Inconsistent segment (70961) type [0, 1] in SSA and SIT
Call trace:
dump_backtrace+0xe8/0x10c
show_stack+0x18/0x28
dump_stack_lvl+0x50/0x6c
dump_stack+0x18/0x28
f2fs_stop_checkpoint+0x1c/0x3c
do_garbage_collect+0x41c/0x271c
f2fs_gc+0x27c/0x828
gc_thread_func+0x290/0x88c
kthread+0x11c/0x164
ret_from_fork+0x10/0x20
issue scenario
segs_per_sec=2
- seg#0 and seg#1 are all dirty
- all valid blocks are removed in seg#1
- gc select this sec and next_victim_seg=seg#0
- migrate seg#0, next_victim_seg=seg#1
- checkpoint -> sec(seg#0, seg#1) becomes free
- allocator assigns sec(seg#0, seg#1) to curseg
- gc tries to migrate seg#1
Fixes:
e3080b0120a1 ("f2fs: support subsectional garbage collection")
Signed-off-by: yohan.joung <yohan.joung@sk.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 4 Apr 2025 19:03:03 +0000 (19:03 +0000)]
f2fs: clean up unnecessary indentation
No functional change.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Mon, 24 Mar 2025 05:33:39 +0000 (13:33 +0800)]
f2fs: fix to do sanity check on ino and xnid
syzbot reported a f2fs bug as below:
INFO: task syz-executor140:5308 blocked for more than 143 seconds.
Not tainted
6.14.0-rc7-syzkaller-00069-g81e4f8d68c66 #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor140 state:D stack:24016 pid:5308 tgid:5308 ppid:5306 task_flags:0x400140 flags:0x00000006
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5378 [inline]
__schedule+0x190e/0x4c90 kernel/sched/core.c:6765
__schedule_loop kernel/sched/core.c:6842 [inline]
schedule+0x14b/0x320 kernel/sched/core.c:6857
io_schedule+0x8d/0x110 kernel/sched/core.c:7690
folio_wait_bit_common+0x839/0xee0 mm/filemap.c:1317
__folio_lock mm/filemap.c:1664 [inline]
folio_lock include/linux/pagemap.h:1163 [inline]
__filemap_get_folio+0x147/0xb40 mm/filemap.c:1917
pagecache_get_page+0x2c/0x130 mm/folio-compat.c:87
find_get_page_flags include/linux/pagemap.h:842 [inline]
f2fs_grab_cache_page+0x2b/0x320 fs/f2fs/f2fs.h:2776
__get_node_page+0x131/0x11b0 fs/f2fs/node.c:1463
read_xattr_block+0xfb/0x190 fs/f2fs/xattr.c:306
lookup_all_xattrs fs/f2fs/xattr.c:355 [inline]
f2fs_getxattr+0x676/0xf70 fs/f2fs/xattr.c:533
__f2fs_get_acl+0x52/0x870 fs/f2fs/acl.c:179
f2fs_acl_create fs/f2fs/acl.c:375 [inline]
f2fs_init_acl+0xd7/0x9b0 fs/f2fs/acl.c:418
f2fs_init_inode_metadata+0xa0f/0x1050 fs/f2fs/dir.c:539
f2fs_add_inline_entry+0x448/0x860 fs/f2fs/inline.c:666
f2fs_add_dentry+0xba/0x1e0 fs/f2fs/dir.c:765
f2fs_do_add_link+0x28c/0x3a0 fs/f2fs/dir.c:808
f2fs_add_link fs/f2fs/f2fs.h:3616 [inline]
f2fs_mknod+0x2e8/0x5b0 fs/f2fs/namei.c:766
vfs_mknod+0x36d/0x3b0 fs/namei.c:4191
unix_bind_bsd net/unix/af_unix.c:1286 [inline]
unix_bind+0x563/0xe30 net/unix/af_unix.c:1379
__sys_bind_socket net/socket.c:1817 [inline]
__sys_bind+0x1e4/0x290 net/socket.c:1848
__do_sys_bind net/socket.c:1853 [inline]
__se_sys_bind net/socket.c:1851 [inline]
__x64_sys_bind+0x7a/0x90 net/socket.c:1851
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Let's dump and check metadata of corrupted inode, it shows its xattr_nid
is the same to its i_ino.
dump.f2fs -i 3 chaseyu.img.raw
i_xattr_nid [0x 3 : 3]
So that, during mknod in the corrupted directory, it tries to get and
lock inode page twice, result in deadlock.
- f2fs_mknod
- f2fs_add_inline_entry
- f2fs_get_inode_page --- lock dir's inode page
- f2fs_init_acl
- f2fs_acl_create(dir,..)
- __f2fs_get_acl
- f2fs_getxattr
- lookup_all_xattrs
- __get_node_page --- try to lock dir's inode page
In order to fix this, let's add sanity check on ino and xnid.
Cc: stable@vger.kernel.org
Reported-by: syzbot+cc448dcdc7ae0b4e4ffa@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-f2fs-devel/
67e06150.
050a0220.21942d.0005.GAE@google.com
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Tue, 25 Mar 2025 08:13:21 +0000 (16:13 +0800)]
f2fs: add a fast path in finish_preallocate_blocks()
This patch uses i_sem to protect access/update on f2fs_inode_info.flag
in finish_preallocate_blocks(), it avoids grabbing inode_lock() in
each open().
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Tue, 25 Mar 2025 08:06:46 +0000 (16:06 +0800)]
f2fs: zone: fix to avoid inconsistence in between SIT and SSA
w/ below testcase, it will cause inconsistence in between SIT and SSA.
create_null_blk 512 2 1024 1024
mkfs.f2fs -m /dev/nullb0
mount /dev/nullb0 /mnt/f2fs/
touch /mnt/f2fs/file
f2fs_io pinfile set /mnt/f2fs/file
fallocate -l 4GiB /mnt/f2fs/file
F2FS-fs (nullb0): Inconsistent segment (0) type [1, 0] in SSA and SIT
CPU: 5 UID: 0 PID: 2398 Comm: fallocate Tainted: G O 6.13.0-rc1 #84
Tainted: [O]=OOT_MODULE
Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
Call Trace:
<TASK>
dump_stack_lvl+0xb3/0xd0
dump_stack+0x14/0x20
f2fs_handle_critical_error+0x18c/0x220 [f2fs]
f2fs_stop_checkpoint+0x38/0x50 [f2fs]
do_garbage_collect+0x674/0x6e0 [f2fs]
f2fs_gc_range+0x12b/0x230 [f2fs]
f2fs_allocate_pinning_section+0x5c/0x150 [f2fs]
f2fs_expand_inode_data+0x1cc/0x3c0 [f2fs]
f2fs_fallocate+0x3c3/0x410 [f2fs]
vfs_fallocate+0x15f/0x4b0
__x64_sys_fallocate+0x4a/0x80
x64_sys_call+0x15e8/0x1b80
do_syscall_64+0x68/0x130
entry_SYSCALL_64_after_hwframe+0x67/0x6f
RIP: 0033:0x7f9dba5197ca
F2FS-fs (nullb0): Stopped filesystem due to reason: 4
The reason is f2fs_gc_range() may try to migrate block in curseg, however,
its SSA block is not uptodate due to the last summary block data is still
in cache of curseg.
In this patch, we add a condition in f2fs_gc_range() to check whether
section is opened or not, and skip block migration for opened section.
Fixes:
9703d69d9d15 ("f2fs: support file pinning for zoned devices")
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 27 Mar 2025 05:56:06 +0000 (13:56 +0800)]
f2fs: fix to set atomic write status more clear
1. After we start atomic write in a database file, before committing
all data, we'd better not set inode w/ vfs dirty status to avoid
redundant updates, instead, we only set inode w/ atomic dirty status.
2. After we commit all data, before committing metadata, we need to
clear atomic dirty status, and set vfs dirty status to allow vfs flush
dirty inode.
Cc: Daeho Jeong <daehojeong@google.com>
Reported-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 20 Mar 2025 02:22:30 +0000 (10:22 +0800)]
f2fs: fix to update injection attrs according to fault_option
When we update inject type via sysfs, it shows wrong rate value as
below, there is a same problem when we update inject rate, fix it.
Before:
F2FS-fs (vdd): build fault injection attr: rate: 0, type: 0xffff
F2FS-fs (vdd): build fault injection attr: rate: 1, type: 0x0
After:
F2FS-fs (vdd): build fault injection type: 0x1
F2FS-fs (vdd): build fault injection rate: 1
Meanwhile, let's avoid turning on all fault types when we enable fault
injection via fault_injection mount option, it will lead to shutdown
filesystem or fail the mount() easily.
mount -o fault_injection=4 /dev/vdd /mnt/f2fs
F2FS-fs (vdd): build fault injection attr: rate: 4, type: 0x7fffff
F2FS-fs (vdd): inject kmalloc in f2fs_kmalloc of f2fs_fill_super+0xbdf/0x27c0
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 20 Mar 2025 02:22:29 +0000 (10:22 +0800)]
f2fs: add a proc entry show inject stats
This patch adds a proc entry named inject_stats to show total injected
count for each fault type.
cat /proc/fs/f2fs/<dev>/inject_stats
fault_type injected_count
kmalloc 0
kvmalloc 0
page alloc 0
page get 0
alloc bio(obsolete) 0
alloc nid 0
orphan 0
no more block 0
too big dir depth 0
evict_inode fail 0
truncate fail 0
read IO error 0
checkpoint error 0
discard error 0
write IO error 0
slab alloc 0
dquot initialize 0
lock_op 0
invalid blkaddr 0
inconsistent blkaddr 0
no free segment 0
inconsistent footer 0
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Colin Ian King [Wed, 19 Mar 2025 11:30:10 +0000 (11:30 +0000)]
f2fs: remove redundant assignment to variable err
The variable err is being assigned a value zero and then the following
goto page_hit reassigns err a new value. The zero assignment is redundant
and can be removed.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
[Jaegeuk Kim: clean up braces and if condition, suggested by Dan Carpenter]
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Linus Torvalds [Sun, 6 Apr 2025 20:11:33 +0000 (13:11 -0700)]
Linux 6.15-rc1
Thomas Weißschuh [Wed, 2 Apr 2025 20:21:57 +0000 (21:21 +0100)]
tools/include: make uapi/linux/types.h usable from assembly
The "real" linux/types.h UAPI header gracefully degrades to a NOOP when
included from assembly code.
Mirror this behaviour in the tools/ variant.
Test for __ASSEMBLER__ over __ASSEMBLY__ as the former is provided by the
toolchain automatically.
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/lkml/
af553c62-ca2f-4956-932c-
dd6e3a126f58@sirena.org.uk/
Fixes:
c9fbaa879508 ("selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20250321-uapi-consistency-v1-1-439070118dc0@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>