Commit d0195c7d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull f2fs updates from Jaegeuk Kim:
 "In this round, we added a new mount option, "checkpoint_merge", which
  introduces a kernel thread dealing with the f2fs checkpoints. Once we
  start to manage the IO priority along with blk-cgroup, the checkpoint
  operation can be processed in a lower priority under the process
  context. Since the checkpoint holds all the filesystem operations, we
  give a higher priority to the checkpoint thread all the time.

  Enhancements:
   - introduce gc_merge mount option to introduce a checkpoint thread
   - improve to run discard thread efficiently
   - allow modular compression algorithms
   - expose # of overprivision segments to sysfs
   - expose runtime compression stat to sysfs

  Bug fixes:
   - fix OOB memory access by the node id lookup
   - avoid touching checkpointed data in the checkpoint-disabled mode
   - fix the resizing flow to avoid kernel panic and race conditions
   - fix block allocation issues on pinned files
   - address some swapfile issues
   - fix hugtask problem and kernel panic during atomic write operations
   - don't start checkpoint thread in RO

  And, we've cleaned up some kernel coding style and build warnings. In
  addition, we fixed some minor race conditions and error handling
  routines"

* tag 'f2fs-for-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (48 commits)
  f2fs: drop inplace IO if fs status is abnormal
  f2fs: compress: remove unneed check condition
  f2fs: clean up left deprecated IO trace codes
  f2fs: avoid using native allocate_segment_by_default()
  f2fs: remove unnecessary struct declaration
  f2fs: fix to avoid NULL pointer dereference
  f2fs: avoid duplicated codes for cleanup
  f2fs: document: add description about compressed space handling
  f2fs: clean up build warnings
  f2fs: fix the periodic wakeups of discard thread
  f2fs: fix to avoid accessing invalid fio in f2fs_allocate_data_block()
  f2fs: fix to avoid GC/mmap race with f2fs_truncate()
  f2fs: set checkpoint_merge by default
  f2fs: Fix a hungtask problem in atomic write
  f2fs: fix to restrict mount condition on readonly block device
  f2fs: introduce gc_merge mount option
  f2fs: fix to cover __allocate_new_section() with curseg_lock
  f2fs: fix wrong alloc_type in f2fs_do_replace_block
  f2fs: delete empty compress.h
  f2fs: fix a typo in inode.c
  ...
parents e4adffb8 95577278
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ Date April 2019
Contact:	"Daniel Rosenberg" <drosen@google.com>
Description:	If checkpoint=disable, it displays the number of blocks that
		are unusable.
		If checkpoint=enable it displays the enumber of blocks that
		If checkpoint=enable it displays the number of blocks that
		would be unusable if checkpoint=disable were to be set.

What:		/sys/fs/f2fs/<disk>/encoding
@@ -409,3 +409,32 @@ Description: Give a way to change checkpoint merge daemon's io priority.
		I/O priority "3". We can select the class between "rt" and "be",
		and set the I/O priority within valid range of it. "," delimiter
		is necessary in between I/O class and priority number.

What:		/sys/fs/f2fs/<disk>/ovp_segments
Date:		March 2021
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:	Shows the number of overprovision segments.

What:		/sys/fs/f2fs/<disk>/compr_written_block
Date:		March 2021
Contact:	"Daeho Jeong" <daehojeong@google.com>
Description:	Show the block count written after compression since mount. Note
		that when the compressed blocks are deleted, this count doesn't
		decrease. If you write "0" here, you can initialize
		compr_written_block and compr_saved_block to "0".

What:		/sys/fs/f2fs/<disk>/compr_saved_block
Date:		March 2021
Contact:	"Daeho Jeong" <daehojeong@google.com>
Description:	Show the saved block count with compression since mount. Note
		that when the compressed blocks are deleted, this count doesn't
		decrease. If you write "0" here, you can initialize
		compr_written_block and compr_saved_block to "0".

What:		/sys/fs/f2fs/<disk>/compr_new_inode
Date:		March 2021
Contact:	"Daeho Jeong" <daehojeong@google.com>
Description:	Show the count of inode newly enabled for compression since mount.
		Note that when the compression is disabled for the files, this count
		doesn't decrease. If you write "0" here, you can initialize
		compr_new_inode to "0".
+14 −0
Original line number Diff line number Diff line
@@ -110,6 +110,12 @@ background_gc=%s Turn on/off cleaning operations, namely garbage
			 on synchronous garbage collection running in background.
			 Default value for this option is on. So garbage
			 collection is on by default.
gc_merge		 When background_gc is on, this option can be enabled to
			 let background GC thread to handle foreground GC requests,
			 it can eliminate the sluggish issue caused by slow foreground
			 GC operation when GC is triggered from a process with limited
			 I/O and CPU resources.
nogc_merge		 Disable GC merge feature.
disable_roll_forward	 Disable the roll-forward recovery routine
norecovery		 Disable the roll-forward recovery routine, mounted read-
			 only (i.e., -o ro,disable_roll_forward)
@@ -813,6 +819,14 @@ Compression implementation
  * chattr +c file
  * chattr +c dir; touch dir/file
  * mount w/ -o compress_extension=ext; touch file.ext
  * mount w/ -o compress_extension=*; touch any_file

- At this point, compression feature doesn't expose compressed space to user
  directly in order to guarantee potential data updates later to the space.
  Instead, the main goal is to reduce data writes to flash disk as much as
  possible, resulting in extending disk life time as well as relaxing IO
  congestion. Alternatively, we've added ioctl interface to reclaim compressed
  space and show it to user after putting the immutable bit.

Compress metadata layout::

+7 −9
Original line number Diff line number Diff line
@@ -7,6 +7,13 @@ config F2FS_FS
	select CRYPTO_CRC32
	select F2FS_FS_XATTR if FS_ENCRYPTION
	select FS_ENCRYPTION_ALGS if FS_ENCRYPTION
	select LZ4_COMPRESS if F2FS_FS_LZ4
	select LZ4_DECOMPRESS if F2FS_FS_LZ4
	select LZ4HC_COMPRESS if F2FS_FS_LZ4HC
	select LZO_COMPRESS if F2FS_FS_LZO
	select LZO_DECOMPRESS if F2FS_FS_LZO
	select ZSTD_COMPRESS if F2FS_FS_ZSTD
	select ZSTD_DECOMPRESS if F2FS_FS_ZSTD
	help
	  F2FS is based on Log-structured File System (LFS), which supports
	  versatile "flash-friendly" features. The design has been focused on
@@ -94,8 +101,6 @@ config F2FS_FS_COMPRESSION
config F2FS_FS_LZO
	bool "LZO compression support"
	depends on F2FS_FS_COMPRESSION
	select LZO_COMPRESS
	select LZO_DECOMPRESS
	default y
	help
	  Support LZO compress algorithm, if unsure, say Y.
@@ -103,8 +108,6 @@ config F2FS_FS_LZO
config F2FS_FS_LZ4
	bool "LZ4 compression support"
	depends on F2FS_FS_COMPRESSION
	select LZ4_COMPRESS
	select LZ4_DECOMPRESS
	default y
	help
	  Support LZ4 compress algorithm, if unsure, say Y.
@@ -113,7 +116,6 @@ config F2FS_FS_LZ4HC
	bool "LZ4HC compression support"
	depends on F2FS_FS_COMPRESSION
	depends on F2FS_FS_LZ4
	select LZ4HC_COMPRESS
	default y
	help
	  Support LZ4HC compress algorithm, LZ4HC has compatible on-disk
@@ -122,8 +124,6 @@ config F2FS_FS_LZ4HC
config F2FS_FS_ZSTD
	bool "ZSTD compression support"
	depends on F2FS_FS_COMPRESSION
	select ZSTD_COMPRESS
	select ZSTD_DECOMPRESS
	default y
	help
	  Support ZSTD compress algorithm, if unsure, say Y.
@@ -132,8 +132,6 @@ config F2FS_FS_LZORLE
	bool "LZO-RLE compression support"
	depends on F2FS_FS_COMPRESSION
	depends on F2FS_FS_LZO
	select LZO_COMPRESS
	select LZO_DECOMPRESS
	default y
	help
	  Support LZO-RLE compress algorithm, if unsure, say Y.
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ static inline size_t f2fs_acl_size(int count)
static inline int f2fs_acl_count(size_t size)
{
	ssize_t s;

	size -= sizeof(struct f2fs_acl_header);
	s = size - 4 * sizeof(struct f2fs_acl_entry_short);
	if (s < 0) {
+7 −2
Original line number Diff line number Diff line
@@ -719,6 +719,7 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)
		orphan_blk = (struct f2fs_orphan_block *)page_address(page);
		for (j = 0; j < le32_to_cpu(orphan_blk->entry_count); j++) {
			nid_t ino = le32_to_cpu(orphan_blk->ino[j]);

			err = recover_orphan_inode(sbi, ino);
			if (err) {
				f2fs_put_page(page, 1);
@@ -1818,7 +1819,11 @@ int f2fs_issue_checkpoint(struct f2fs_sb_info *sbi)
	llist_add(&req.llnode, &cprc->issue_list);
	atomic_inc(&cprc->queued_ckpt);

	/* update issue_list before we wake up issue_checkpoint thread */
	/*
	 * update issue_list before we wake up issue_checkpoint thread,
	 * this smp_mb() pairs with another barrier in ___wait_event(),
	 * see more details in comments of waitqueue_active().
	 */
	smp_mb();

	if (waitqueue_active(&cprc->ckpt_wait_queue))
Loading