Skip to content

Commit 227c4d5

Browse files
committed
Merge tag 'f2fs-for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs updates from Jaegeuk Kim: "In this round, we've improved the compression support especially for Android such as allowing compression for mmap files, replacing the immutable bit with internal bit to prohibits data writes explicitly, and adding a mount option, "compress_cache", to improve random reads. And, we added "readonly" feature to compact the partition w/ compression enabled, which will be useful for Android RO partitions. Enhancements: - support compression for mmap file - use an f2fs flag instead of IMMUTABLE bit for compression - support RO feature w/ extent_cache - fully support swapfile with file pinning - improve atgc tunability - add nocompress extensions to unselect files for compression Bug fixes: - fix false alaram on iget failure during GC - fix race condition on global pointers when there are multiple f2fs instances - add MODULE_SOFTDEP for initramfs As usual, we've also cleaned up some places for better code readability (e.g., sysfs/feature, debugging messages, slab cache name, and docs)" * tag 'f2fs-for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (32 commits) f2fs: drop dirty node pages when cp is in error status f2fs: initialize page->private when using for our internal use f2fs: compress: add nocompress extensions support MAINTAINERS: f2fs: update my email address f2fs: remove false alarm on iget failure during GC f2fs: enable extent cache for compression files in read-only f2fs: fix to avoid adding tab before doc section f2fs: introduce f2fs_casefolded_name slab cache f2fs: swap: support migrating swapfile in aligned write mode f2fs: swap: remove dead codes f2fs: compress: add compress_inode to cache compressed blocks f2fs: clean up /sys/fs/f2fs/<disk>/features f2fs: add pin_file in feature list f2fs: Advertise encrypted casefolding in sysfs f2fs: Show casefolding support only when supported f2fs: support RO feature f2fs: logging neatening f2fs: introduce FI_COMPRESS_RELEASED instead of using IMMUTABLE bit f2fs: compress: remove unneeded preallocation f2fs: atgc: export entries for better tunability via sysfs ...
2 parents bd9c350 + 28607bf commit 227c4d5

21 files changed

Lines changed: 1168 additions & 495 deletions

File tree

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,34 @@ Description: Shows total written kbytes issued to disk.
203203
What: /sys/fs/f2fs/<disk>/features
204204
Date: July 2017
205205
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
206-
Description: Shows all enabled features in current device.
206+
Description: <deprecated: should use /sys/fs/f2fs/<disk>/feature_list/
207+
Shows all enabled features in current device.
208+
Supported features:
209+
encryption, blkzoned, extra_attr, projquota, inode_checksum,
210+
flexible_inline_xattr, quota_ino, inode_crtime, lost_found,
211+
verity, sb_checksum, casefold, readonly, compression, pin_file.
212+
213+
What: /sys/fs/f2fs/<disk>/feature_list/
214+
Date: June 2021
215+
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
216+
Description: Expand /sys/fs/f2fs/<disk>/features to meet sysfs rule.
217+
Supported on-disk features:
218+
encryption, block_zoned (aka blkzoned), extra_attr,
219+
project_quota (aka projquota), inode_checksum,
220+
flexible_inline_xattr, quota_ino, inode_crtime, lost_found,
221+
verity, sb_checksum, casefold, readonly, compression.
222+
Note that, pin_file is moved into /sys/fs/f2fs/features/.
223+
224+
What: /sys/fs/f2fs/features/
225+
Date: July 2017
226+
Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
227+
Description: Shows all enabled kernel features.
228+
Supported features:
229+
encryption, block_zoned, extra_attr, project_quota,
230+
inode_checksum, flexible_inline_xattr, quota_ino,
231+
inode_crtime, lost_found, verity, sb_checksum,
232+
casefold, readonly, compression, test_dummy_encryption_v2,
233+
atomic_write, pin_file, encrypted_casefold.
207234

208235
What: /sys/fs/f2fs/<disk>/inject_rate
209236
Date: May 2016
@@ -438,3 +465,31 @@ Description: Show the count of inode newly enabled for compression since mount.
438465
Note that when the compression is disabled for the files, this count
439466
doesn't decrease. If you write "0" here, you can initialize
440467
compr_new_inode to "0".
468+
469+
What: /sys/fs/f2fs/<disk>/atgc_candidate_ratio
470+
Date: May 2021
471+
Contact: "Chao Yu" <yuchao0@huawei.com>
472+
Description: When ATGC is on, it controls candidate ratio in order to limit total
473+
number of potential victim in all candidates, the value should be in
474+
range of [0, 100], by default it was initialized as 20(%).
475+
476+
What: /sys/fs/f2fs/<disk>/atgc_candidate_count
477+
Date: May 2021
478+
Contact: "Chao Yu" <yuchao0@huawei.com>
479+
Description: When ATGC is on, it controls candidate count in order to limit total
480+
number of potential victim in all candidates, by default it was
481+
initialized as 10 (sections).
482+
483+
What: /sys/fs/f2fs/<disk>/atgc_age_weight
484+
Date: May 2021
485+
Contact: "Chao Yu" <yuchao0@huawei.com>
486+
Description: When ATGC is on, it controls age weight to balance weight proportion
487+
in between aging and valid blocks, the value should be in range of
488+
[0, 100], by default it was initialized as 60(%).
489+
490+
What: /sys/fs/f2fs/<disk>/atgc_age_threshold
491+
Date: May 2021
492+
Contact: "Chao Yu" <yuchao0@huawei.com>
493+
Description: When ATGC is on, it controls age threshold to bypass GCing young
494+
candidates whose age is not beyond the threshold, by default it was
495+
initialized as 604800 seconds (equals to 7 days).

Documentation/filesystems/f2fs.rst

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ compress_extension=%s Support adding specified extension, so that f2fs can enab
281281
For other files, we can still enable compression via ioctl.
282282
Note that, there is one reserved special extension '*', it
283283
can be set to enable compression for all files.
284+
nocompress_extension=%s Support adding specified extension, so that f2fs can disable
285+
compression on those corresponding files, just contrary to compression extension.
286+
If you know exactly which files cannot be compressed, you can use this.
287+
The same extension name can't appear in both compress and nocompress
288+
extension at the same time.
289+
If the compress extension specifies all files, the types specified by the
290+
nocompress extension will be treated as special cases and will not be compressed.
291+
Don't allow use '*' to specifie all file in nocompress extension.
292+
After add nocompress_extension, the priority should be:
293+
dir_flag < comp_extention,nocompress_extension < comp_file_flag,no_comp_file_flag.
294+
See more in compression sections.
295+
284296
compress_chksum Support verifying chksum of raw data in compressed cluster.
285297
compress_mode=%s Control file compression mode. This supports "fs" and "user"
286298
modes. In "fs" mode (default), f2fs does automatic compression
@@ -289,6 +301,9 @@ compress_mode=%s Control file compression mode. This supports "fs" and "user"
289301
choosing the target file and the timing. The user can do manual
290302
compression/decompression on the compression enabled files using
291303
ioctls.
304+
compress_cache Support to use address space of a filesystem managed inode to
305+
cache compressed block, in order to improve cache hit ratio of
306+
random read.
292307
inlinecrypt When possible, encrypt/decrypt the contents of encrypted
293308
files using the blk-crypto framework rather than
294309
filesystem-layer encryption. This allows the use of
@@ -717,10 +732,10 @@ users.
717732
===================== ======================== ===================
718733
User F2FS Block
719734
===================== ======================== ===================
720-
META WRITE_LIFE_NOT_SET
721-
HOT_NODE "
722-
WARM_NODE "
723-
COLD_NODE "
735+
N/A META WRITE_LIFE_NOT_SET
736+
N/A HOT_NODE "
737+
N/A WARM_NODE "
738+
N/A COLD_NODE "
724739
ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME
725740
extension list " "
726741

@@ -746,10 +761,10 @@ WRITE_LIFE_LONG " WRITE_LIFE_LONG
746761
===================== ======================== ===================
747762
User F2FS Block
748763
===================== ======================== ===================
749-
META WRITE_LIFE_MEDIUM;
750-
HOT_NODE WRITE_LIFE_NOT_SET
751-
WARM_NODE "
752-
COLD_NODE WRITE_LIFE_NONE
764+
N/A META WRITE_LIFE_MEDIUM;
765+
N/A HOT_NODE WRITE_LIFE_NOT_SET
766+
N/A WARM_NODE "
767+
N/A COLD_NODE WRITE_LIFE_NONE
753768
ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME
754769
extension list " "
755770

@@ -814,13 +829,30 @@ Compression implementation
814829
all logical blocks in cluster contain valid data and compress ratio of
815830
cluster data is lower than specified threshold.
816831

817-
- To enable compression on regular inode, there are three ways:
832+
- To enable compression on regular inode, there are four ways:
818833

819834
* chattr +c file
820835
* chattr +c dir; touch dir/file
821836
* mount w/ -o compress_extension=ext; touch file.ext
822837
* mount w/ -o compress_extension=*; touch any_file
823838

839+
- To disable compression on regular inode, there are two ways:
840+
841+
* chattr -c file
842+
* mount w/ -o nocompress_extension=ext; touch file.ext
843+
844+
- Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
845+
846+
* compress_extension=so; nocompress_extension=zip; chattr +c dir; touch
847+
dir/foo.so; touch dir/bar.zip; touch dir/baz.txt; then foo.so and baz.txt
848+
should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
849+
can enable compress on bar.zip.
850+
* compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
851+
dir/foo.so; touch dir/bar.zip; touch dir/baz.txt; then foo.so should be
852+
compresse, bar.zip and baz.txt should be non-compressed.
853+
chattr+c dir/bar.zip; chattr+c dir/baz.txt; can enable compress on bar.zip
854+
and baz.txt.
855+
824856
- At this point, compression feature doesn't expose compressed space to user
825857
directly in order to guarantee potential data updates later to the space.
826858
Instead, the main goal is to reduce data writes to flash disk as much as

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7010,7 +7010,7 @@ F: drivers/iommu/exynos-iommu.c
70107010

70117011
F2FS FILE SYSTEM
70127012
M: Jaegeuk Kim <jaegeuk@kernel.org>
7013-
M: Chao Yu <yuchao0@huawei.com>
7013+
M: Chao Yu <chao@kernel.org>
70147014
L: linux-f2fs-devel@lists.sourceforge.net
70157015
S: Maintained
70167016
W: https://f2fs.wiki.kernel.org/

fs/f2fs/checkpoint.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static int f2fs_set_meta_page_dirty(struct page *page)
444444
if (!PageDirty(page)) {
445445
__set_page_dirty_nobuffers(page);
446446
inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_META);
447-
f2fs_set_page_private(page, 0);
447+
set_page_private_reference(page);
448448
return 1;
449449
}
450450
return 0;
@@ -1018,7 +1018,7 @@ void f2fs_update_dirty_page(struct inode *inode, struct page *page)
10181018
inode_inc_dirty_pages(inode);
10191019
spin_unlock(&sbi->inode_lock[type]);
10201020

1021-
f2fs_set_page_private(page, 0);
1021+
set_page_private_reference(page);
10221022
}
10231023

10241024
void f2fs_remove_dirty_inode(struct inode *inode)

0 commit comments

Comments
 (0)