Commit 8b42fe12 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull f2fs updates from Jaegeuk Kim:
 "We've added two major features: 1) compression level and 2)
  checkpoint_merge, in this round.

  Compression level expands 'compress_algorithm' mount option to accept
  parameter as format of <algorithm>:<level>, by this way, it gives a
  way to allow user to do more specified config on lz4 and zstd
  compression level, then f2fs compression can provide higher compress
  ratio.

  checkpoint_merge creates a kernel daemon and makes it to merge
  concurrent checkpoint requests as much as possible to eliminate
  redundant checkpoint issues. Plus, we can eliminate the sluggish issue
  caused by slow checkpoint operation when the checkpoint is done in a
  process context in a cgroup having low i/o budget and cpu shares.

  Enhancements:
   - add compress level for lz4 and zstd in mount option
   - checkpoint_merge mount option
   - deprecate f2fs_trace_io

  Bug fixes:
   - flush data when enabling checkpoint back
   - handle corner cases of mount options
   - missing ACL update and lock for I_LINKABLE flag
   - attach FIEMAP_EXTENT_MERGED in f2fs_fiemap
   - fix potential deadlock in compression flow
   - fix wrong submit_io condition

  As usual, we've cleaned up many code flows and fixed minor bugs"

* tag 'f2fs-for-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (32 commits)
  Documentation: f2fs: fix typo s/automaic/automatic
  f2fs: give a warning only for readonly partition
  f2fs: don't grab superblock freeze for flush/ckpt thread
  f2fs: add ckpt_thread_ioprio sysfs node
  f2fs: introduce checkpoint_merge mount option
  f2fs: relocate inline conversion from mmap() to mkwrite()
  f2fs: fix a wrong condition in __submit_bio
  f2fs: remove unnecessary initialization in xattr.c
  f2fs: fix to avoid inconsistent quota data
  f2fs: flush data when enabling checkpoint back
  f2fs: deprecate f2fs_trace_io
  f2fs: Remove readahead collision detection
  f2fs: remove unused stat_{inc, dec}_atomic_write
  f2fs: introduce sb_status sysfs node
  f2fs: fix to use per-inode maxbytes
  f2fs: compress: fix potential deadlock
  libfs: unexport generic_ci_d_compare() and generic_ci_d_hash()
  f2fs: fix to set/clear I_LINKABLE under i_lock
  f2fs: fix null page reference in redirty_blocks
  f2fs: clean up post-read processing
  ...
parents 6f3952cb 092af2eb
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -377,3 +377,35 @@ Description: This gives a control to limit the bio size in f2fs.
		Default is zero, which will follow underlying block layer limit,
		whereas, if it has a certain bytes value, f2fs won't submit a
		bio larger than that size.

What:		/sys/fs/f2fs/<disk>/stat/sb_status
Date:		December 2020
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:	Show status of f2fs superblock in real time.

		====== ===================== =================================
		value  sb status macro       description
		0x1    SBI_IS_DIRTY          dirty flag for checkpoint
		0x2    SBI_IS_CLOSE          specify unmounting
		0x4    SBI_NEED_FSCK         need fsck.f2fs to fix
		0x8    SBI_POR_DOING         recovery is doing or not
		0x10   SBI_NEED_SB_WRITE     need to recover superblock
		0x20   SBI_NEED_CP           need to checkpoint
		0x40   SBI_IS_SHUTDOWN       shutdown by ioctl
		0x80   SBI_IS_RECOVERED      recovered orphan/data
		0x100  SBI_CP_DISABLED       CP was disabled last mount
		0x200  SBI_CP_DISABLED_QUICK CP was disabled quickly
		0x400  SBI_QUOTA_NEED_FLUSH  need to flush quota info in CP
		0x800  SBI_QUOTA_SKIP_FLUSH  skip flushing quota in current CP
		0x1000 SBI_QUOTA_NEED_REPAIR quota file may be corrupted
		0x2000 SBI_IS_RESIZEFS       resizefs is in process
		====== ===================== =================================

What:		/sys/fs/f2fs/<disk>/ckpt_thread_ioprio
Date:		January 2021
Contact:	"Daeho Jeong" <daehojeong@google.com>
Description:	Give a way to change checkpoint merge daemon's io priority.
		Its default value is "be,3", which means "BE" I/O class and
		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.
+17 −1
Original line number Diff line number Diff line
@@ -247,8 +247,24 @@ checkpoint=%s[:%u[%]] Set to "disable" to turn off checkpointing. Set to "enabl
			 hide up to all remaining free space. The actual space that
			 would be unusable can be viewed at /sys/fs/f2fs/<disk>/unusable
			 This space is reclaimed once checkpoint=enable.
checkpoint_merge	 When checkpoint is enabled, this can be used to create a kernel
			 daemon and make it to merge concurrent checkpoint requests as
			 much as possible to eliminate redundant checkpoint issues. Plus,
			 we can eliminate the sluggish issue caused by slow checkpoint
			 operation when the checkpoint is done in a process context in
			 a cgroup having low i/o budget and cpu shares. To make this
			 do better, we set the default i/o priority of the kernel daemon
			 to "3", to give one higher priority than other kernel threads.
			 This is the same way to give a I/O priority to the jbd2
			 journaling thread of ext4 filesystem.
nocheckpoint_merge	 Disable checkpoint merge feature.
compress_algorithm=%s	 Control compress algorithm, currently f2fs supports "lzo",
			 "lz4", "zstd" and "lzo-rle" algorithm.
compress_algorithm=%s:%d Control compress algorithm and its compress level, now, only
			 "lz4" and "zstd" support compress level config.
			 algorithm	level range
			 lz4		3 - 16
			 zstd		1 - 22
compress_log_size=%u	 Support configuring compress cluster size, the size will
			 be 4KB * (1 << %u), 16KB is minimum size, also it's
			 default size.
@@ -831,7 +847,7 @@ This is the default option. f2fs does automatic compression in the writeback of
compression enabled files.

2) compress_mode=user
This disables the automaic compression and gives the user discretion of choosing the
This disables the automatic compression and gives the user discretion of choosing the
target file and the timing. The user can do manual compression/decompression on the
compression enabled files using F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE
ioctls like the below.
+10 −10
Original line number Diff line number Diff line
@@ -76,16 +76,6 @@ config F2FS_CHECK_FS

	  If you want to improve the performance, say N.

config F2FS_IO_TRACE
	bool "F2FS IO tracer"
	depends on F2FS_FS
	depends on FUNCTION_TRACER
	help
	  F2FS IO trace is based on a function trace, which gathers process
	  information and block IO patterns in the filesystem level.

	  If unsure, say N.

config F2FS_FAULT_INJECTION
	bool "F2FS fault injection facility"
	depends on F2FS_FS
@@ -119,6 +109,16 @@ config F2FS_FS_LZ4
	help
	  Support LZ4 compress algorithm, if unsure, say Y.

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
	  layout with LZ4, if unsure, say Y.

config F2FS_FS_ZSTD
	bool "ZSTD compression support"
	depends on F2FS_FS_COMPRESSION
+0 −1
Original line number Diff line number Diff line
@@ -7,6 +7,5 @@ f2fs-y += shrinker.o extent_cache.o sysfs.o
f2fs-$(CONFIG_F2FS_STAT_FS) += debug.o
f2fs-$(CONFIG_F2FS_FS_XATTR) += xattr.o
f2fs-$(CONFIG_F2FS_FS_POSIX_ACL) += acl.o
f2fs-$(CONFIG_F2FS_IO_TRACE) += trace.o
f2fs-$(CONFIG_FS_VERITY) += verity.o
f2fs-$(CONFIG_F2FS_FS_COMPRESSION) += compress.o
+22 −1
Original line number Diff line number Diff line
@@ -200,6 +200,27 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type)
	return __f2fs_get_acl(inode, type, NULL);
}

static int f2fs_acl_update_mode(struct inode *inode, umode_t *mode_p,
			  struct posix_acl **acl)
{
	umode_t mode = inode->i_mode;
	int error;

	if (is_inode_flag_set(inode, FI_ACL_MODE))
		mode = F2FS_I(inode)->i_acl_mode;

	error = posix_acl_equiv_mode(*acl, &mode);
	if (error < 0)
		return error;
	if (error == 0)
		*acl = NULL;
	if (!in_group_p(inode->i_gid) &&
	    !capable_wrt_inode_uidgid(inode, CAP_FSETID))
		mode &= ~S_ISGID;
	*mode_p = mode;
	return 0;
}

static int __f2fs_set_acl(struct inode *inode, int type,
			struct posix_acl *acl, struct page *ipage)
{
@@ -213,7 +234,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
	case ACL_TYPE_ACCESS:
		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
		if (acl && !ipage) {
			error = posix_acl_update_mode(inode, &mode, &acl);
			error = f2fs_acl_update_mode(inode, &mode, &acl);
			if (error)
				return error;
			set_acl_inode(inode, mode);
Loading