Commit 6e135bae authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull f2fs updates from Jaegeuk Kim:
 "In this series, we've implemented transparent compression
  experimentally. It supports LZO and LZ4, but will add more later as we
  investigate in the field more.

  At this point, the 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're also considering to add ioctl() to reclaim
  compressed space and show it to user after putting the immutable bit.

  Enhancements:
   - add compression support
   - avoid unnecessary locks in quota ops
   - harden power-cut scenario for zoned block devices
   - use private bio_set to avoid IO congestion
   - replace GC mutex with rwsem to serialize callers

  Bug fixes:
   - fix dentry consistency and memory corruption in rename()'s error case
   - fix wrong swap extent reports
   - fix casefolding bugs
   - change lock coverage to avoid deadlock
   - avoid GFP_KERNEL under f2fs_lock_op

  And, we've cleaned up sysfs entries to prepare no debugfs"

* tag 'f2fs-for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (31 commits)
  f2fs: fix race conditions in ->d_compare() and ->d_hash()
  f2fs: fix dcache lookup of !casefolded directories
  f2fs: Add f2fs stats to sysfs
  f2fs: delete duplicate information on sysfs nodes
  f2fs: change to use rwsem for gc_mutex
  f2fs: update f2fs document regarding to fsync_mode
  f2fs: add a way to turn off ipu bio cache
  f2fs: code cleanup for f2fs_statfs_project()
  f2fs: fix miscounted block limit in f2fs_statfs_project()
  f2fs: show the CP_PAUSE reason in checkpoint traces
  f2fs: fix deadlock allocating bio_post_read_ctx from mempool
  f2fs: remove unneeded check for error allocating bio_post_read_ctx
  f2fs: convert inline_dir early before starting rename
  f2fs: fix memleak of kobject
  f2fs: fix to add swap extent correctly
  f2fs: run fsck when getting bad inode during GC
  f2fs: support data compression
  f2fs: free sysfs kobject
  f2fs: declare nested quota_sem and remove unnecessary sems
  f2fs: don't put new_page twice in f2fs_rename
  ...
parents 0196be12 80f2388a
Loading
Loading
Loading
Loading
+167 −113
Original line number Diff line number Diff line
What:		/sys/fs/f2fs/<disk>/gc_max_sleep_time
Date:		July 2013
Contact:	"Namjae Jeon" <namjae.jeon@samsung.com>
Description:
		 Controls the maximun sleep time for gc_thread. Time
Description:	Controls the maximum sleep time for gc_thread. Time
		is in milliseconds.

What:		/sys/fs/f2fs/<disk>/gc_min_sleep_time
Date:		July 2013
Contact:	"Namjae Jeon" <namjae.jeon@samsung.com>
Description:
		 Controls the minimum sleep time for gc_thread. Time
Description:	Controls the minimum sleep time for gc_thread. Time
		is in milliseconds.

What:		/sys/fs/f2fs/<disk>/gc_no_gc_sleep_time
Date:		July 2013
Contact:	"Namjae Jeon" <namjae.jeon@samsung.com>
Description:
		 Controls the default sleep time for gc_thread. Time
Description:	Controls the default sleep time for gc_thread. Time
		is in milliseconds.

What:		/sys/fs/f2fs/<disk>/gc_idle
Date:		July 2013
Contact:	"Namjae Jeon" <namjae.jeon@samsung.com>
Description:
		 Controls the victim selection policy for garbage collection.
Description:	Controls the victim selection policy for garbage collection.
		Setting gc_idle = 0(default) will disable this option. Setting
		gc_idle = 1 will select the Cost Benefit approach & setting
		gc_idle = 2 will select the greedy approach.

What:		/sys/fs/f2fs/<disk>/reclaim_segments
Date:		October 2013
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the issue rate of segment discard commands.

What:		/sys/fs/f2fs/<disk>/max_blkaddr
Description:	This parameter controls the number of prefree segments to be
		reclaimed. If the number of prefree segments is larger than
		the number of segments in the proportion to the percentage
		over total volume size, f2fs tries to conduct checkpoint to
		reclaim the prefree segments to free segments.
		By default, 5% over total # of segments.

What:		/sys/fs/f2fs/<disk>/main_blkaddr
Date:		November 2019
Contact:	"Ramon Pantin" <pantin@google.com>
Description:
@@ -40,76 +43,76 @@ Description:
What:		/sys/fs/f2fs/<disk>/ipu_policy
Date:		November 2013
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the in-place-update policy.
Description:	Controls the in-place-update policy.
		updates in f2fs. User can set:
		0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
		0x04: F2FS_IPU_UTIL,  0x08: F2FS_IPU_SSR_UTIL,
		0x10: F2FS_IPU_FSYNC, 0x20: F2FS_IPU_ASYNC,
		0x40: F2FS_IPU_NOCACHE.
		Refer segment.h for details.

What:		/sys/fs/f2fs/<disk>/min_ipu_util
Date:		November 2013
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the FS utilization condition for the in-place-update
		 policies.
Description:	Controls the FS utilization condition for the in-place-update
		policies. It is used by F2FS_IPU_UTIL and F2FS_IPU_SSR_UTIL policies.

What:		/sys/fs/f2fs/<disk>/min_fsync_blocks
Date:		September 2014
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls the dirty page count condition for the in-place-update
Description:	Controls the dirty page count condition for the in-place-update
		policies.

What:		/sys/fs/f2fs/<disk>/min_seq_blocks
Date:		August 2018
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls the dirty page count condition for batched sequential
		 writes in ->writepages.

Description:	Controls the dirty page count condition for batched sequential
		writes in writepages.

What:		/sys/fs/f2fs/<disk>/min_hot_blocks
Date:		March 2017
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls the dirty page count condition for redefining hot data.
Description:	Controls the dirty page count condition for redefining hot data.

What:		/sys/fs/f2fs/<disk>/min_ssr_sections
Date:		October 2017
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		 Controls the fee section threshold to trigger SSR allocation.
Description:	Controls the free section threshold to trigger SSR allocation.
		If this is large, SSR mode will be enabled early.

What:		/sys/fs/f2fs/<disk>/max_small_discards
Date:		November 2013
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the issue rate of small discard commands.
Description:	Controls the issue rate of discard commands that consist of small
		blocks less than 2MB. The candidates to be discarded are cached until
		checkpoint is triggered, and issued during the checkpoint.
		By default, it is disabled with 0.

What:		/sys/fs/f2fs/<disk>/discard_granularity
Date:		July 2017
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		Controls discard granularity of inner discard thread, inner thread
Description:	Controls discard granularity of inner discard thread. Inner thread
		will not issue discards with size that is smaller than granularity.
		The unit size is one block, now only support configuring in range
		of [1, 512].
		The unit size is one block(4KB), now only support configuring
		in range of [1, 512]. Default value is 4(=16KB).

What:		/sys/fs/f2fs/<disk>/umount_discard_timeout
Date:		January 2019
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		Set timeout to issue discard commands during umount.
Description:	Set timeout to issue discard commands during umount.
	        Default: 5 secs

What:		/sys/fs/f2fs/<disk>/max_victim_search
Date:		January 2014
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the number of trials to find a victim segment.
Description:	Controls the number of trials to find a victim segment
		when conducting SSR and cleaning operations. The default value
		is 4096 which covers 8GB block address range.

What:		/sys/fs/f2fs/<disk>/migration_granularity
Date:		October 2018
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		 Controls migration granularity of garbage collection on large
Description:	Controls migration granularity of garbage collection on large
		section, it can let GC move partial segment{s} of one section
		in one GC cycle, so that dispersing heavy overhead GC to
		multiple lightweight one.
@@ -117,106 +120,106 @@ Description:
What:		/sys/fs/f2fs/<disk>/dir_level
Date:		March 2014
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the directory level for large directory.
Description:	Controls the directory level for large directory. If a
		directory has a number of files, it can reduce the file lookup
		latency by increasing this dir_level value. Otherwise, it
		needs to decrease this value to reduce the space overhead.
		The default value is 0.

What:		/sys/fs/f2fs/<disk>/ram_thresh
Date:		March 2014
Contact:	"Jaegeuk Kim" <jaegeuk.kim@samsung.com>
Description:
		 Controls the memory footprint used by f2fs.
Description:	Controls the memory footprint used by free nids and cached
		nat entries. By default, 1 is set, which indicates
		10 MB / 1 GB RAM.

What:		/sys/fs/f2fs/<disk>/batched_trim_sections
Date:		February 2015
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls the trimming rate in batch mode.
Description:	Controls the trimming rate in batch mode.
		<deprecated>

What:		/sys/fs/f2fs/<disk>/cp_interval
Date:		October 2015
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls the checkpoint timing.
Description:	Controls the checkpoint timing, set to 60 seconds by default.

What:		/sys/fs/f2fs/<disk>/idle_interval
Date:		January 2016
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls the idle timing for all paths other than
		 discard and gc path.
Description:	Controls the idle timing of system, if there is no FS operation
		during given interval.
		Set to 5 seconds by default.

What:		/sys/fs/f2fs/<disk>/discard_idle_interval
Date:		September 2018
Contact:	"Chao Yu" <yuchao0@huawei.com>
Contact:	"Sahitya Tummala" <stummala@codeaurora.org>
Description:
		 Controls the idle timing for discard path.
Description:	Controls the idle timing of discard thread given
		this time interval.
		Default is 5 secs.

What:		/sys/fs/f2fs/<disk>/gc_idle_interval
Date:		September 2018
Contact:	"Chao Yu" <yuchao0@huawei.com>
Contact:	"Sahitya Tummala" <stummala@codeaurora.org>
Description:
		 Controls the idle timing for gc path.
Description:    Controls the idle timing for gc path. Set to 5 seconds by default.

What:		/sys/fs/f2fs/<disk>/iostat_enable
Date:		August 2017
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		 Controls to enable/disable IO stat.
Description:	Controls to enable/disable IO stat.

What:		/sys/fs/f2fs/<disk>/ra_nid_pages
Date:		October 2015
Contact:	"Chao Yu" <chao2.yu@samsung.com>
Description:
		 Controls the count of nid pages to be readaheaded.
Description:	Controls the count of nid pages to be readaheaded.
		When building free nids, F2FS reads NAT blocks ahead for
		speed up. Default is 0.

What:		/sys/fs/f2fs/<disk>/dirty_nats_ratio
Date:		January 2016
Contact:	"Chao Yu" <chao2.yu@samsung.com>
Description:
		 Controls dirty nat entries ratio threshold, if current
Description:	Controls dirty nat entries ratio threshold, if current
		ratio exceeds configured threshold, checkpoint will
		be triggered for flushing dirty nat entries.

What:		/sys/fs/f2fs/<disk>/lifetime_write_kbytes
Date:		January 2016
Contact:	"Shuoran Liu" <liushuoran@huawei.com>
Description:
		 Shows total written kbytes issued to disk.
Description:	Shows total written kbytes issued to disk.

What:		/sys/fs/f2fs/<disk>/features
Date:		July 2017
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Shows all enabled features in current device.
Description:	Shows all enabled features in current device.

What:		/sys/fs/f2fs/<disk>/inject_rate
Date:		May 2016
Contact:	"Sheng Yong" <shengyong1@huawei.com>
Description:
		 Controls the injection rate.
Description:	Controls the injection rate of arbitrary faults.

What:		/sys/fs/f2fs/<disk>/inject_type
Date:		May 2016
Contact:	"Sheng Yong" <shengyong1@huawei.com>
Description:
		 Controls the injection type.
Description:	Controls the injection type of arbitrary faults.

What:		/sys/fs/f2fs/<disk>/dirty_segments
Date:		October 2017
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:	Shows the number of dirty segments.

What:		/sys/fs/f2fs/<disk>/reserved_blocks
Date:		June 2017
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		 Controls target reserved blocks in system, the threshold
Description:	Controls target reserved blocks in system, the threshold
		is soft, it could exceed current available user space.

What:		/sys/fs/f2fs/<disk>/current_reserved_blocks
Date:		October 2017
Contact:	"Yunlong Song" <yunlong.song@huawei.com>
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		 Shows current reserved blocks in system, it may be temporarily
Description:	Shows current reserved blocks in system, it may be temporarily
		smaller than target_reserved_blocks, but will gradually
		increase to target_reserved_blocks when more free blocks are
		freed by user later.
@@ -224,26 +227,31 @@ Description:
What:		/sys/fs/f2fs/<disk>/gc_urgent
Date:		August 2017
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Do background GC agressively
Description:	Do background GC agressively when set. When gc_urgent = 1,
		background thread starts to do GC by given gc_urgent_sleep_time
		interval. It is set to 0 by default.

What:		/sys/fs/f2fs/<disk>/gc_urgent_sleep_time
Date:		August 2017
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
Description:
		 Controls sleep time of GC urgent mode
Description:	Controls sleep time of GC urgent mode. Set to 500ms by default.

What:		/sys/fs/f2fs/<disk>/readdir_ra
Date:		November 2017
Contact:	"Sheng Yong" <shengyong1@huawei.com>
Description:
		 Controls readahead inode block in readdir.
Description:	Controls readahead inode block in readdir. Enabled by default.

What:		/sys/fs/f2fs/<disk>/gc_pin_file_thresh
Date:		January 2018
Contact:	Jaegeuk Kim <jaegeuk@kernel.org>
Description:	This indicates how many GC can be failed for the pinned
		file. If it exceeds this, F2FS doesn't guarantee its pinning
		state. 2048 trials is set by default.

What:		/sys/fs/f2fs/<disk>/extension_list
Date:		Feburary 2018
Contact:	"Chao Yu" <yuchao0@huawei.com>
Description:
		 Used to control configure extension list:
Description:	Used to control configure extension list:
		- Query: cat /sys/fs/f2fs/<disk>/extension_list
		- Add: echo '[h/c]extension' > /sys/fs/f2fs/<disk>/extension_list
		- Del: echo '[h/c]!extension' > /sys/fs/f2fs/<disk>/extension_list
@@ -253,14 +261,60 @@ Description:
What:		/sys/fs/f2fs/<disk>/unusable
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 would be unusable
                if checkpoint=disable were to be set.
Description:	If checkpoint=disable, it displays the number of blocks that
		are unusable.
		If checkpoint=enable it displays the enumber of blocks that
		would be unusable if checkpoint=disable were to be set.

What:		/sys/fs/f2fs/<disk>/encoding
Date		July 2019
Contact:	"Daniel Rosenberg" <drosen@google.com>
Description:
		Displays name and version of the encoding set for the filesystem.
Description:	Displays name and version of the encoding set for the filesystem.
		If no encoding is set, displays (none)

What:		/sys/fs/f2fs/<disk>/free_segments
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of free segments in disk.

What:		/sys/fs/f2fs/<disk>/cp_foreground_calls
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of checkpoint operations performed on demand. Available when
		CONFIG_F2FS_STAT_FS=y.

What:		/sys/fs/f2fs/<disk>/cp_background_calls
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of checkpoint operations performed in the background to
		free segments. Available when CONFIG_F2FS_STAT_FS=y.

What:		/sys/fs/f2fs/<disk>/gc_foreground_calls
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of garbage collection operations performed on demand.
		Available when CONFIG_F2FS_STAT_FS=y.

What:		/sys/fs/f2fs/<disk>/gc_background_calls
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of garbage collection operations triggered in background.
		Available when CONFIG_F2FS_STAT_FS=y.

What:		/sys/fs/f2fs/<disk>/moved_blocks_foreground
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of blocks moved by garbage collection in foreground.
		Available when CONFIG_F2FS_STAT_FS=y.

What:		/sys/fs/f2fs/<disk>/moved_blocks_background
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Number of blocks moved by garbage collection in background.
		Available when CONFIG_F2FS_STAT_FS=y.

What:		/sys/fs/f2fs/<disk>/avg_vblocks
Date:		September 2019
Contact:	"Hridya Valsaraju" <hridya@google.com>
Description:	Average number of valid blocks.
		Available when CONFIG_F2FS_STAT_FS=y.
+52 −164

File changed.

Preview size limit exceeded, changes collapsed.

+26 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ config F2FS_FS

config F2FS_STAT_FS
	bool "F2FS Status Information"
	depends on F2FS_FS && DEBUG_FS
	depends on F2FS_FS
	default y
	help
	  /sys/kernel/debug/f2fs/ contains information about all the partitions
@@ -93,3 +93,28 @@ config F2FS_FAULT_INJECTION
	  Test F2FS to inject faults such as ENOMEM, ENOSPC, and so on.

	  If unsure, say N.

config F2FS_FS_COMPRESSION
	bool "F2FS compression feature"
	depends on F2FS_FS
	help
	  Enable filesystem-level compression on f2fs regular files,
	  multiple back-end compression algorithms are supported.

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.

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.
+1 −0
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ 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
+3 −3
Original line number Diff line number Diff line
@@ -1509,10 +1509,10 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
	f2fs_wait_on_all_pages_writeback(sbi);

	/*
	 * invalidate intermediate page cache borrowed from meta inode
	 * which are used for migration of encrypted inode's blocks.
	 * invalidate intermediate page cache borrowed from meta inode which are
	 * used for migration of encrypted or verity inode's blocks.
	 */
	if (f2fs_sb_has_encrypt(sbi))
	if (f2fs_sb_has_encrypt(sbi) || f2fs_sb_has_verity(sbi))
		invalidate_mapping_pages(META_MAPPING(sbi),
				MAIN_BLKADDR(sbi), MAX_BLKADDR(sbi) - 1);

Loading