linux-2.6-microblaze.git
2 weeks agof2fs: introduce is_{meta,node}_folio
Chao Yu [Fri, 23 May 2025 07:33:03 +0000 (15:33 +0800)]
f2fs: introduce is_{meta,node}_folio

Just cleanup, no changes.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: add ckpt_valid_blocks to the section entry
yohan.joung [Mon, 12 May 2025 07:36:10 +0000 (16:36 +0900)]
f2fs: add ckpt_valid_blocks to the section entry

when performing buffered writes in a large section,
overhead is incurred due to the iteration through
ckpt_valid_blocks within the section.
when SEGS_PER_SEC is 128, this overhead accounts for 20% within
the f2fs_write_single_data_page routine.
as the size of the section increases, the overhead also grows.
to handle this problem ckpt_valid_blocks is
added within the section entries.

Test
insmod null_blk.ko nr_devices=1 completion_nsec=1  submit_queues=8
hw_queue_depth=64 max_sectors=512 bs=4096 memory_backed=1
make_f2fs /dev/block/nullb0
make_f2fs -s 128 /dev/block/nullb0
fio --bs=512k --size=1536M --rw=write --name=1
--filename=/mnt/test_dir/seq_write
--ioengine=io_uring --iodepth=64 --end_fsync=1

before
SEGS_PER_SEC 1
2556MiB/s
SEGS_PER_SEC 128
2145MiB/s

after
SEGS_PER_SEC 1
2556MiB/s
SEGS_PER_SEC 128
2556MiB/s

Signed-off-by: yohan.joung <yohan.joung@sk.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: add a method for calculating the remaining blocks in the current segment in...
yohan.joung [Mon, 12 May 2025 07:36:09 +0000 (16:36 +0900)]
f2fs: add a method for calculating the remaining blocks in the current segment in LFS mode.

In LFS mode, the previous segment cannot use invalid blocks,
so the remaining blocks from the next_blkoff of the current segment
to the end of the section are calculated.

Signed-off-by: yohan.joung <yohan.joung@sk.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: introduce FAULT_VMALLOC
Chao Yu [Tue, 13 May 2025 05:57:21 +0000 (13:57 +0800)]
f2fs: introduce FAULT_VMALLOC

Introduce a new fault type FAULT_VMALLOC to simulate no memory error in
f2fs_vmalloc().

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: use vmalloc instead of kvmalloc in .init_{,de}compress_ctx
Chao Yu [Tue, 13 May 2025 05:57:20 +0000 (13:57 +0800)]
f2fs: use vmalloc instead of kvmalloc in .init_{,de}compress_ctx

.init_{,de}compress_ctx uses kvmalloc() to alloc memory, it will try
to allocate physically continuous page first, it may cause more memory
allocation pressure, let's use vmalloc instead to mitigate it.

[Test]
cd /data/local/tmp
touch file
f2fs_io setflags compression file
f2fs_io getflags file
for i in $(seq 1 10); do sync; echo 3 > /proc/sys/vm/drop_caches;\
time f2fs_io write 512 0 4096 zero osync file; truncate -s 0 file;\
done

[Result]
Before After Delta
21.243 21.694 -2.12%

For compression, we recommend to use ioctl to compress file data in
background for workaround.

For decompression, only zstd will be affected.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: add f2fs_bug_on() in f2fs_quota_read()
Chao Yu [Tue, 13 May 2025 03:19:07 +0000 (11:19 +0800)]
f2fs: add f2fs_bug_on() in f2fs_quota_read()

mapping_read_folio_gfp() will return a folio, it should always be
uptodate, let's check folio uptodate status to detect any potenial
bug.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: add f2fs_bug_on() to detect potential bug
Chao Yu [Mon, 12 May 2025 11:54:41 +0000 (19:54 +0800)]
f2fs: add f2fs_bug_on() to detect potential bug

Add f2fs_bug_on() to check whether memory preallocation will fail or
not after radix_tree_preload(GFP_NOFS | __GFP_NOFAIL).

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2 weeks agof2fs: remove unused sbi argument from checksum functions
Eric Biggers [Tue, 13 May 2025 05:48:25 +0000 (22:48 -0700)]
f2fs: remove unused sbi argument from checksum functions

Since __f2fs_crc32() now calls crc32() directly, it no longer uses its
sbi argument.  Remove that, and simplify its callers accordingly.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
4 weeks agof2fs: fix 32-bits hexademical number in fault injection doc
Chao Yu [Mon, 12 May 2025 11:55:14 +0000 (19:55 +0800)]
f2fs: fix 32-bits hexademical number in fault injection doc

FAULT_KMALLOC                    0x000000001

There is one redundant '0' in 32-bits hexademical number of fault type,
remove it.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
4 weeks agof2fs: don't over-report free space or inodes in statvfs
Chao Yu [Tue, 13 May 2025 11:25:38 +0000 (19:25 +0800)]
f2fs: don't over-report free space or inodes in statvfs

This fixes an analogus bug that was fixed in modern filesystems:
a) xfs in commit 4b8d867ca6e2 ("xfs: don't over-report free space or
inodes in statvfs")
b) ext4 in commit f87d3af74193 ("ext4: don't over-report free space
or inodes in statvfs")
where statfs can report misleading / incorrect information where
project quota is enabled, and the free space is less than the
remaining quota.

This commit will resolve a test failure in generic/762 which tests
for this bug.

generic/762       - output mismatch (see /share/git/fstests/results//generic/762.out.bad)
    --- tests/generic/762.out   2025-04-15 10:21:53.371067071 +0800
    +++ /share/git/fstests/results//generic/762.out.bad 2025-05-13 16:13:37.000000000 +0800
    @@ -6,8 +6,10 @@
     root blocks2 is in range
     dir blocks2 is in range
     root bavail2 is in range
    -dir bavail2 is in range
    +dir bavail2 has value of 1539066
    +dir bavail2 is NOT in range 304734.87 .. 310891.13
     root blocks3 is in range
    ...
    (Run 'diff -u /share/git/fstests/tests/generic/762.out /share/git/fstests/results//generic/762.out.bad'  to see the entire diff)

HINT: You _MAY_ be missing kernel fix:
      XXXXXXXXXXXXXX xfs: don't over-report free space or inodes in statvfs

Cc: stable@kernel.org
Fixes: ddc34e328d06 ("f2fs: introduce f2fs_statfs_project")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: return bool from __write_node_folio
Christoph Hellwig [Thu, 8 May 2025 05:14:32 +0000 (07:14 +0200)]
f2fs: return bool from __write_node_folio

__write_node_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE.
As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return
instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: simplify return value handling in f2fs_fsync_node_pages
Christoph Hellwig [Thu, 8 May 2025 05:14:31 +0000 (07:14 +0200)]
f2fs: simplify return value handling in f2fs_fsync_node_pages

Always assign ret where the error happens, and jump to out instead
of multiple loop exit conditions to prepare for changes in the
__write_node_folio calling convention.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: always unlock the page in f2fs_write_single_data_page
Christoph Hellwig [Thu, 8 May 2025 05:14:30 +0000 (07:14 +0200)]
f2fs: always unlock the page in f2fs_write_single_data_page

Consolidate the code to unlock the page in f2fs_write_single_data_page
instead of leaving it to the callers for the AOP_WRITEPAGE_ACTIVATE case.
Replace AOP_WRITEPAGE_ACTIVATE with a positive return of 1 as this case
now doesn't match the historic ->writepage special return code that is
on it's way out now that ->writepage has been removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: remove wbc->for_reclaim handling
Christoph Hellwig [Thu, 8 May 2025 05:14:29 +0000 (07:14 +0200)]
f2fs: remove wbc->for_reclaim handling

Since commits 7ff0104a8052 ("f2fs: Remove f2fs_write_node_page()") and
3b47398d9861 ("f2fs: Remove f2fs_write_meta_page()'), f2fs can't be
called from reclaim context any more.  Remove all code keyed of the
wbc->for_reclaim flag, which is now only set for writing out swap or
shmem pages inside the swap code, but never passed to file systems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: return bool from __f2fs_write_meta_folio
Christoph Hellwig [Thu, 8 May 2025 05:14:28 +0000 (07:14 +0200)]
f2fs: return bool from __f2fs_write_meta_folio

__f2fs_write_meta_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE.
As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return
instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: fix to return correct error number in f2fs_sync_node_pages()
Chao Yu [Thu, 8 May 2025 05:14:27 +0000 (07:14 +0200)]
f2fs: fix to return correct error number in f2fs_sync_node_pages()

If __write_node_folio() failed, it will return AOP_WRITEPAGE_ACTIVATE,
the incorrect return value may be passed to userspace in below path,
fix it.

- sync_filesystem
 - sync_fs
  - f2fs_issue_checkpoint
   - block_operations
    - f2fs_sync_node_pages
     - __write_node_folio
     : return AOP_WRITEPAGE_ACTIVATE

Cc: stable@vger.kernel.org
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: drop usage of folio_index
Kairui Song [Wed, 30 Apr 2025 18:10:49 +0000 (02:10 +0800)]
f2fs: drop usage of folio_index

folio_index is only needed for mixed usage of page cache and swap
cache, for pure page cache usage, the caller can just use
folio->index instead.

It can't be a swap cache folio here.  Swap mapping may only call into fs
through `swap_rw` but f2fs does not use that method for swap.

Signed-off-by: Kairui Song <kasong@tencent.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org> (maintainer:F2FS FILE SYSTEM)
Cc: Chao Yu <chao@kernel.org> (maintainer:F2FS FILE SYSTEM)
Cc: linux-f2fs-devel@lists.sourceforge.net (open list:F2FS FILE SYSTEM)
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: support FAULT_TIMEOUT
Chao Yu [Fri, 25 Apr 2025 09:50:55 +0000 (17:50 +0800)]
f2fs: support FAULT_TIMEOUT

Support to inject a timeout fault into function, currently it only
support to inject timeout to commit_atomic_write flow to reproduce
inconsistent bug, like the bug fixed by commit f098aeba04c9 ("f2fs:
fix to avoid atomicity corruption of atomic file").

By default, the new type fault will inject 1000ms timeout, and the
timeout process can be interrupted by SIGKILL.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: handle error cases of memory donation
Daeho Jeong [Wed, 23 Apr 2025 20:49:34 +0000 (13:49 -0700)]
f2fs: handle error cases of memory donation

In cases of removing memory donation, we need to handle some error cases
like ENOENT and EACCES (indicating the range already has been donated).

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: fix to bail out in get_new_segment()
Chao Yu [Tue, 22 Apr 2025 11:56:38 +0000 (19:56 +0800)]
f2fs: fix to bail out in get_new_segment()

------------[ cut here ]------------
WARNING: CPU: 3 PID: 579 at fs/f2fs/segment.c:2832 new_curseg+0x5e8/0x6dc
pc : new_curseg+0x5e8/0x6dc
Call trace:
 new_curseg+0x5e8/0x6dc
 f2fs_allocate_data_block+0xa54/0xe28
 do_write_page+0x6c/0x194
 f2fs_do_write_node_page+0x38/0x78
 __write_node_page+0x248/0x6d4
 f2fs_sync_node_pages+0x524/0x72c
 f2fs_write_checkpoint+0x4bc/0x9b0
 __checkpoint_and_complete_reqs+0x80/0x244
 issue_checkpoint_thread+0x8c/0xec
 kthread+0x114/0x1bc
 ret_from_fork+0x10/0x20

get_new_segment() detects inconsistent status in between free_segmap
and free_secmap, let's record such error into super block, and bail
out get_new_segment() instead of continue using the segment.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: sysfs: export linear_lookup in features directory
Chao Yu [Wed, 16 Apr 2025 05:48:05 +0000 (13:48 +0800)]
f2fs: sysfs: export linear_lookup in features directory

cat /sys/fs/f2fs/features/linear_lookup
supported

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
5 weeks agof2fs: sysfs: add encoding_flags entry
Chao Yu [Tue, 6 May 2025 07:47:25 +0000 (15:47 +0800)]
f2fs: sysfs: add encoding_flags entry

This patch adds a new sysfs entry /sys/fs/f2fs/<disk>/encoding_flags,
it is a read-only entry to show the value of sb.s_encoding_flags, the
value is hexadecimal.

============================     ==========
Flag_Name                        Flag_Value
============================     ==========
SB_ENC_STRICT_MODE_FL            0x00000001
SB_ENC_NO_COMPAT_FALLBACK_FL     0x00000002
============================     ==========

case#1
mkfs.f2fs -f -O casefold -C utf8:strict /dev/vda
mount /dev/vda /mnt/f2fs
cat /sys/fs/f2fs/vda/encoding_flags
1

case#2
mkfs.f2fs -f -O casefold -C utf8 /dev/vda
fsck.f2fs --nolinear-lookup=1 /dev/vda
mount /dev/vda /mnt/f2fs
cat /sys/fs/f2fs/vda/encoding_flags
2

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: zone: fix to calculate first_zoned_segno correctly
Chao Yu [Thu, 10 Apr 2025 03:10:19 +0000 (11:10 +0800)]
f2fs: zone: fix to calculate first_zoned_segno correctly

A zoned device can has both conventional zones and sequential zones,
so we should not treat first segment of zoned device as first_zoned_segno,
instead, we need to check zone type for each zone during traversing zoned
device to find first_zoned_segno.

Otherwise, for below case, first_zoned_segno will be 0, which could be
wrong.

create_null_blk 512 2 1024 1024
mkfs.f2fs -m /dev/nullb0

Testcase:

export SCRIPTS_PATH=/share/git/scripts

test multiple devices w/ zoned device
for ((i=0;i<8;i++)) do {
zonesize=$((2<<$i))
conzone=$((4096/$zonesize))
seqzone=$((4096/$zonesize))
$SCRIPTS_PATH/nullblk_create.sh 512 $zonesize $conzone $seqzone
mkfs.f2fs -f -m /dev/vdb -c /dev/nullb0
mount /dev/vdb /mnt/f2fs
touch /mnt/f2fs/file
f2fs_io pinfile set /mnt/f2fs/file $((8589934592*2))
stat /mnt/f2fs/file
df
cat /proc/fs/f2fs/vdb/segment_info
umount /mnt/f2fs
$SCRIPTS_PATH/nullblk_remove.sh 0
} done

test single zoned device
for ((i=0;i<8;i++)) do {
zonesize=$((2<<$i))
conzone=$((4096/$zonesize))
seqzone=$((4096/$zonesize))
$SCRIPTS_PATH/nullblk_create.sh 512 $zonesize $conzone $seqzone
mkfs.f2fs -f -m /dev/nullb0
mount /dev/nullb0 /mnt/f2fs
touch /mnt/f2fs/file
f2fs_io pinfile set /mnt/f2fs/file $((8589934592*2))
stat /mnt/f2fs/file
df
cat /proc/fs/f2fs/nullb0/segment_info
umount /mnt/f2fs
$SCRIPTS_PATH/nullblk_remove.sh 0
} done

Fixes: 9703d69d9d15 ("f2fs: support file pinning for zoned devices")
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: fix to do sanity check on sit_bitmap_size
Chao Yu [Mon, 14 Apr 2025 10:55:20 +0000 (18:55 +0800)]
f2fs: fix to do sanity check on sit_bitmap_size

w/ below testcase, resize will generate a corrupted image which
contains inconsistent metadata, so when mounting such image, it
will trigger kernel panic:

touch img
truncate -s $((512*1024*1024*1024)) img
mkfs.f2fs -f img $((256*1024*1024))
resize.f2fs -s -i img -t $((1024*1024*1024))
mount img /mnt/f2fs

------------[ cut here ]------------
kernel BUG at fs/f2fs/segment.h:863!
Oops: invalid opcode: 0000 [#1] SMP PTI
CPU: 11 UID: 0 PID: 3922 Comm: mount Not tainted 6.15.0-rc1+ #191 PREEMPT(voluntary)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:f2fs_ra_meta_pages+0x47c/0x490

Call Trace:
 f2fs_build_segment_manager+0x11c3/0x2600
 f2fs_fill_super+0xe97/0x2840
 mount_bdev+0xf4/0x140
 legacy_get_tree+0x2b/0x50
 vfs_get_tree+0x29/0xd0
 path_mount+0x487/0xaf0
 __x64_sys_mount+0x116/0x150
 do_syscall_64+0x82/0x190
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fdbfde1bcfe

The reaseon is:

sit_i->bitmap_size is 192, so size of sit bitmap is 192*8=1536, at maximum
there are 1536 sit blocks, however MAIN_SEGS is 261893, so that sit_blk_cnt
is 4762, build_sit_entries() -> current_sit_addr() tries to access
out-of-boundary in sit_bitmap at offset from [1536, 4762), once sit_bitmap
and sit_bitmap_mirror is not the same, it will trigger f2fs_bug_on().

Let's add sanity check in f2fs_sanity_check_ckpt() to avoid panic.

Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: fix to detect gcing page in f2fs_is_cp_guaranteed()
Chao Yu [Mon, 14 Apr 2025 10:52:37 +0000 (18:52 +0800)]
f2fs: fix to detect gcing page in f2fs_is_cp_guaranteed()

Jan Prusakowski reported a f2fs bug as below:

f2fs/007 will hang kernel during testing w/ below configs:

kernel 6.12.18 (from pixel-kernel/android16-6.12)
export MKFS_OPTIONS="-O encrypt -O extra_attr -O project_quota -O quota"
export F2FS_MOUNT_OPTIONS="test_dummy_encryption,discard,fsync_mode=nobarrier,reserve_root=32768,checkpoint_merge,atgc"

cat /proc/<umount_proc_id>/stack
f2fs_wait_on_all_pages+0xa3/0x130
do_checkpoint+0x40c/0x5d0
f2fs_write_checkpoint+0x258/0x550
kill_f2fs_super+0x14f/0x190
deactivate_locked_super+0x30/0xb0
cleanup_mnt+0xba/0x150
task_work_run+0x59/0xa0
syscall_exit_to_user_mode+0x12d/0x130
do_syscall_64+0x57/0x110
entry_SYSCALL_64_after_hwframe+0x76/0x7e

cat /sys/kernel/debug/f2fs/status

  - IO_W (CP: -256, Data:  256, Flush: (   0    0    1), Discard: (   0    0)) cmd:    0 undiscard:   0

CP IOs reference count becomes negative.

The root cause is:

After 4961acdd65c9 ("f2fs: fix to tag gcing flag on page during block
migration"), we will tag page w/ gcing flag for raw page of cluster
during its migration.

However, if the inode is both encrypted and compressed, during
ioc_decompress(), it will tag page w/ gcing flag, and it increase
F2FS_WB_DATA reference count:
- f2fs_write_multi_page
 - f2fs_write_raw_page
  - f2fs_write_single_page
   - do_write_page
    - f2fs_submit_page_write
     - WB_DATA_TYPE(bio_page, fio->compressed_page)
     : bio_page is encrypted, so mapping is NULL, and fio->compressed_page
       is NULL, it returns F2FS_WB_DATA
     - inc_page_count(.., F2FS_WB_DATA)

Then, during end_io(), it decrease F2FS_WB_CP_DATA reference count:
- f2fs_write_end_io
 - f2fs_compress_write_end_io
  - fscrypt_pagecache_folio
  : get raw page from encrypted page
  - WB_DATA_TYPE(&folio->page, false)
  : raw page has gcing flag, it returns F2FS_WB_CP_DATA
  - dec_page_count(.., F2FS_WB_CP_DATA)

In order to fix this issue, we need to detect gcing flag in raw page
in f2fs_is_cp_guaranteed().

Fixes: 4961acdd65c9 ("f2fs: fix to tag gcing flag on page during block migration")
Reported-by: Jan Prusakowski <jprusakowski@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: clean up w/ fscrypt_is_bounce_page()
Chao Yu [Mon, 14 Apr 2025 10:52:36 +0000 (18:52 +0800)]
f2fs: clean up w/ fscrypt_is_bounce_page()

Just cleanup, no logic changes.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Convert clear_node_page_dirty() to clear_node_folio_dirty()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:53 +0000 (21:12 +0100)]
f2fs: Convert clear_node_page_dirty() to clear_node_folio_dirty()

Both callers have a folio so pass it in, removing 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>
7 weeks agof2fs: Use a folio in flush_inline_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:52 +0000 (21:12 +0100)]
f2fs: Use a folio in flush_inline_data()

Get a folio from the page cache and use it throughout.  Removes
six 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>
7 weeks agof2fs: Remove f2fs_new_node_page()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:51 +0000 (21:12 +0100)]
f2fs: Remove f2fs_new_node_page()

All callers now use f2fs_new_node_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>
7 weeks agof2fs: Convert fsync_node_entry->page to folio
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:50 +0000 (21:12 +0100)]
f2fs: Convert fsync_node_entry->page to folio

Convert all callers to set/get a folio instead of a page.  Removes
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>
7 weeks agof2fs: Pass a folio to get_dnode_addr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:49 +0000 (21:12 +0100)]
f2fs: Pass a folio to get_dnode_addr()

All callers except __get_inode_rdev() and __set_inode_rdev() now have a
folio, but the only callers of those two functions do have a folio, so
pass the folio to them and then into get_dnode_addr().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Convert dnode_of_data->node_page to node_folio
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:48 +0000 (21:12 +0100)]
f2fs: Convert dnode_of_data->node_page to node_folio

All assignments to this struct member are conversions from a folio
so convert it to be a folio and convert all users.  At the same time,
convert data_blkaddr() to take a folio as all callers now have a folio.
Remove eight 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>
7 weeks agof2fs: Pass a folio to set_nid()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:47 +0000 (21:12 +0100)]
f2fs: Pass a folio to set_nid()

All callers 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>
7 weeks agof2fs: Pass a folio to f2fs_update_inode()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:46 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_update_inode()

All callers now have a folio, so pass it in.  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>
7 weeks agof2fs: Return a folio from f2fs_init_inode_metadata()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:45 +0000 (21:12 +0100)]
f2fs: Return a folio from f2fs_init_inode_metadata()

Convert all three callers to handle a folio return.  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>
7 weeks agof2fs: Pass a folio to f2fs_init_read_extent_tree()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:44 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_init_read_extent_tree()

The only caller alredy has a folio so pass it in.  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>
7 weeks agof2fs: Use a folio in f2fs_wait_on_block_writeback()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:43 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_wait_on_block_writeback()

Fetch a folio from the pagecache and use it.  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>
7 weeks agof2fs: Use a folio in redirty_blocks()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:42 +0000 (21:12 +0100)]
f2fs: Use a folio in redirty_blocks()

Support large folios & simplify the loops in redirty_blocks().
Use the folio APIs and 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>
7 weeks agof2fs: Use a folio in f2fs_encrypt_one_page()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:41 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_encrypt_one_page()

Fetch a folio from the page cache instead of a page.  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>
7 weeks agof2fs: Convert f2fs_load_compressed_page() to f2fs_load_compressed_folio()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:40 +0000 (21:12 +0100)]
f2fs: Convert f2fs_load_compressed_page() to f2fs_load_compressed_folio()

The only caller already has a folio, so pass it in.  Copy the entire
size of the folio to support large block sizes.  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>
7 weeks agof2fs: Use a folio in prepare_compress_overwrite()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:39 +0000 (21:12 +0100)]
f2fs: Use a folio in prepare_compress_overwrite()

Add f2fs_filemap_get_folio() as a wrapper around __filemap_get_folio()
which can inject an error.  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>
7 weeks agof2fs: Use a folio in f2fs_cache_compressed_page()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:38 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_cache_compressed_page()

Look up a folio instead of a page, and if that fails, allocate a folio.
Removes five calls to compound_head(), one of the last few references to
add_to_page_cache_lru() and honours the cpuset_do_page_mem_spread()
setting.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Use a folio in f2fs_truncate_meta_inode_pages()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:37 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_truncate_meta_inode_pages()

Fetch a folio from the pagecache instead of a page.  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>
7 weeks agof2fs: Use a folio in need_inode_page_update()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:36 +0000 (21:12 +0100)]
f2fs: Use a folio in need_inode_page_update()

Fetch a folio from the pagecache instead of a page.  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>
7 weeks agof2fs: Pass a folio to f2fs_set_link()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:35 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_set_link()

All callers now have a folio, pass it in.  Removes 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>
7 weeks agof2fs: Convert f2fs_put_page_dic() to f2fs_put_folio_dic()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:34 +0000 (21:12 +0100)]
f2fs: Convert f2fs_put_page_dic() to f2fs_put_folio_dic()

The only caller 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>
7 weeks agof2fs: Pass a folio to inline_data_addr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:33 +0000 (21:12 +0100)]
f2fs: Pass a folio to inline_data_addr()

All callers now have 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>
7 weeks agof2fs: Pass a folio to __recover_inline_status()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:32 +0000 (21:12 +0100)]
f2fs: Pass a folio to __recover_inline_status()

The only caller has 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>
7 weeks agof2fs: Pass a folio to f2fs_recover_inline_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:31 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_recover_inline_data()

The only caller 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>
7 weeks agof2fs: Pass a folio to f2fs_delete_inline_entry()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:30 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_delete_inline_entry()

The caller now has a folio so pass it in.  Removes 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>
7 weeks agof2fs: Pass a folio to f2fs_delete_entry()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:29 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_delete_entry()

All callers now have a folio so pass it in.  Removes eight 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>
7 weeks agof2fs: Pass a folio to f2fs_parent_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:28 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_parent_dir()

Convert all the callers to pass a folio.  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>
7 weeks agof2fs: Pass a folio to f2fs_find_entry()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:27 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_find_entry()

Convert all callers to pass in a pointer to a folio instead of a page.
Also convert f2fs_inode_by_name() to take a folio pointer.  Removes
six 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>
7 weeks agof2fs: Pass a folio to __f2fs_find_entry()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:26 +0000 (21:12 +0100)]
f2fs: Pass a folio to __f2fs_find_entry()

Also pass a folio to f2fs_find_in_inline_dir() and find_in_level().
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>
7 weeks agof2fs: Pass a folio to f2fs_truncate_inline_inode()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:25 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_truncate_inline_inode()

All callers now have a folio, so pass it in.  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>
7 weeks agof2fs: Pass a folio to f2fs_do_read_inline_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:24 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_do_read_inline_data()

All callers now have 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>
7 weeks agof2fs: Convert dnode_of_data->inode_page to inode_folio
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:23 +0000 (21:12 +0100)]
f2fs: Convert dnode_of_data->inode_page to inode_folio

Also rename inode_page_locked to inode_folio_locked.  Removes 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>
7 weeks agof2fs: Pass a folio to f2fs_has_enough_room()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:22 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_has_enough_room()

The only caller 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>
7 weeks agof2fs: Pass a folio to f2fs_make_empty_inline_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:21 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_make_empty_inline_dir()

The only caller already has a folio, so pass it in.  Removes 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>
7 weeks agof2fs: Pass a folio to init_dent_inode()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:20 +0000 (21:12 +0100)]
f2fs: Pass a folio to init_dent_inode()

The only caller has a folio, so pass it in.  Removes 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>
7 weeks agof2fs: Pass a folio to inline_xattr_addr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:19 +0000 (21:12 +0100)]
f2fs: Pass a folio to inline_xattr_addr()

All callers now have 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>
7 weeks agof2fs: Pass a folio to f2fs_recover_inline_xattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:18 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_recover_inline_xattr()

The caller 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>
7 weeks agof2fs: Pass a folio to do_recover_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:17 +0000 (21:12 +0100)]
f2fs: Pass a folio to do_recover_data()

Push the page conversion into do_recover_data().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Pass a folio to read_inline_xattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:16 +0000 (21:12 +0100)]
f2fs: Pass a folio to read_inline_xattr()

Both callers have 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>
7 weeks agof2fs: Pass a folio to f2fs_getxattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:15 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_getxattr()

The one caller of __f2fs_get_acl() which passes a non-NULL page already
has a folio, so pass it in, then into f2fs_getxattr(), which lets us
pass it to lookup_all_xattrs().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Remove f2fs_get_inode_page()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:14 +0000 (21:12 +0100)]
f2fs: Remove f2fs_get_inode_page()

All callers have now been converted to call f2fs_get_inode_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>
7 weeks agof2fs: Use a folio in f2fs_recover_inline_xattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:13 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_recover_inline_xattr()

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>
7 weeks agof2fs: Use a folio in read_inline_xattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:12 +0000 (21:12 +0100)]
f2fs: Use a folio in read_inline_xattr()

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>
7 weeks agof2fs: Pass a folio to write_all_xattrs()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:11 +0000 (21:12 +0100)]
f2fs: Pass a folio to write_all_xattrs()

Also convert in_page to in_folio.  Save 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>
7 weeks agof2fs: Pass a folio to __f2fs_setxattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:10 +0000 (21:12 +0100)]
f2fs: Pass a folio to __f2fs_setxattr()

Also pass the folio into read_all_xattrs().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Pass a folio to f2fs_setxattr()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:09 +0000 (21:12 +0100)]
f2fs: Pass a folio to f2fs_setxattr()

Also convert f2fs_initxattrs() to take a 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>
7 weeks agof2fs: Pass folios to f2fs_init_acl()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:08 +0000 (21:12 +0100)]
f2fs: Pass folios to f2fs_init_acl()

The one caller already has folios, so pass them in, and further pass
them to __f2fs_set_acl() and f2fs_acl_create().  There should be
no change to the generated code for this commit.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Use a folio in do_read_inode()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:07 +0000 (21:12 +0100)]
f2fs: Use a folio in do_read_inode()

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>
7 weeks agof2fs: Use a folio in f2fs_update_inode_page()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:06 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_update_inode_page()

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>
7 weeks agof2fs: Use a folio in f2fs_inline_data_fiemap()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:05 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_inline_data_fiemap()

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>
7 weeks agof2fs: Use a folio in f2fs_read_inline_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:04 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_read_inline_dir()

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>
7 weeks agof2fs: Use a folio in f2fs_empty_inline_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:03 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_empty_inline_dir()

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>
7 weeks agof2fs: Use a folio in f2fs_find_in_inline_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:02 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_find_in_inline_dir()

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>
7 weeks agof2fs: Use a folio in f2fs_recover_inline_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:01 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_recover_inline_data()

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>
7 weeks agof2fs: Use a folio in f2fs_read_inline_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:12:00 +0000 (21:12 +0100)]
f2fs: Use a folio in f2fs_read_inline_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>
7 weeks agof2fs: Use a folio in f2fs_write_inline_data()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:59 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_write_inline_data()

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>
7 weeks agof2fs: Remove f2fs_get_xnode_page()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:58 +0000 (21:11 +0100)]
f2fs: Remove f2fs_get_xnode_page()

All callers have now been converted to call f2fs_get_xnode_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>
7 weeks agof2fs: Use a folio in read_xattr_block()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:57 +0000 (21:11 +0100)]
f2fs: Use a folio in read_xattr_block()

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>
7 weeks agof2fs: Convert f2fs_convert_inline_page() to f2fs_convert_inline_folio()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:56 +0000 (21:11 +0100)]
f2fs: Convert f2fs_convert_inline_page() to f2fs_convert_inline_folio()

Both callers have a folio, so pass it in.  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>
7 weeks agof2fs: Pass folios to set_new_dnode()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:55 +0000 (21:11 +0100)]
f2fs: Pass folios to set_new_dnode()

Removes a lot of conversions of folios into pages.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
7 weeks agof2fs: Use a folio in f2fs_truncate_xattr_node()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:54 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_truncate_xattr_node()

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>
7 weeks agof2fs: Use a folio in f2fs_do_truncate_blocks()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:53 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_do_truncate_blocks()

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>
7 weeks agof2fs: Pass a folio to f2fs_move_rehashed_dirents()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:52 +0000 (21:11 +0100)]
f2fs: Pass a folio to f2fs_move_rehashed_dirents()

Remove seven 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>
7 weeks agof2fs: Pass a folio to f2fs_move_inline_dirents()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:51 +0000 (21:11 +0100)]
f2fs: Pass a folio to f2fs_move_inline_dirents()

Pass the folio through do_convert_inline_dir() to
f2fs_move_inline_dirents().  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>
7 weeks agof2fs: Use a folio in f2fs_add_inline_entry()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:50 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_add_inline_entry()

Also convert f2fs_init_inode_metadata() to take a folio.  Remove
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>
7 weeks agof2fs: Use a folio in f2fs_try_convert_inline_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:49 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_try_convert_inline_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>
7 weeks agof2fs: Pass a folio to make_empty_dir()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:48 +0000 (21:11 +0100)]
f2fs: Pass a folio to make_empty_dir()

Pass the folio into make_empty_dir() and then into
f2fs_get_new_data_folio().  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>
7 weeks agof2fs: Use a folio in f2fs_init_inode_metadata()
Matthew Wilcox (Oracle) [Mon, 31 Mar 2025 20:11:47 +0000 (21:11 +0100)]
f2fs: Use a folio in f2fs_init_inode_metadata()

Since this is the only caller of f2fs_new_inode_page(), convert that
to return a folio at the same time.  Removes 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>
7 weeks agof2fs: Use a folio in __find_data_block()
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>
7 weeks agof2fs: Use a folio in prepare_write_begin
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>
7 weeks agof2fs: Remove f2fs_get_node_page()
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>
7 weeks agof2fs: Use a folio in check_index_in_prev_nodes()
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>
7 weeks agof2fs: Use a folio in is_alive()
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>
7 weeks agof2fs: Convert __write_node_page() to __write_node_folio()
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>
7 weeks agof2fs: Convert f2fs_move_node_page() to f2fs_move_node_folio()
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>