Commit 89672159 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: add a mount option for rb-tree extent cache



This patch adds a mount option 'extent_cache' in f2fs.

It is try to use a rb-tree based extent cache to cache more mapping information
with less memory if this option is set, otherwise we will use the original one
extent info cache.

Suggested-by: default avatarChangman Lee <cm224.lee@samsung.com>
Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 429511cd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -140,6 +140,10 @@ nobarrier This option can be used if underlying storage guarantees
fastboot               This option is used when a system wants to reduce mount
                       time as much as possible, even though normal performance
		       can be sacrificed.
extent_cache           Enable an extent cache based on rb-tree, it can cache
                       as many as extent which map between contiguous logical
                       address and physical address per inode, resulting in
                       increasing the cache hit ratio.

================================================================================
DEBUGFS ENTRIES
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#define F2FS_MOUNT_FLUSH_MERGE		0x00000400
#define F2FS_MOUNT_NOBARRIER		0x00000800
#define F2FS_MOUNT_FASTBOOT		0x00001000
#define F2FS_MOUNT_EXTENT_CACHE		0x00002000

#define clear_opt(sbi, option)	(sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
#define set_opt(sbi, option)	(sbi->mount_opt.opt |= F2FS_MOUNT_##option)
+7 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ enum {
	Opt_flush_merge,
	Opt_nobarrier,
	Opt_fastboot,
	Opt_extent_cache,
	Opt_err,
};

@@ -78,6 +79,7 @@ static match_table_t f2fs_tokens = {
	{Opt_flush_merge, "flush_merge"},
	{Opt_nobarrier, "nobarrier"},
	{Opt_fastboot, "fastboot"},
	{Opt_extent_cache, "extent_cache"},
	{Opt_err, NULL},
};

@@ -367,6 +369,9 @@ static int parse_options(struct super_block *sb, char *options)
		case Opt_fastboot:
			set_opt(sbi, FASTBOOT);
			break;
		case Opt_extent_cache:
			set_opt(sbi, EXTENT_CACHE);
			break;
		default:
			f2fs_msg(sb, KERN_ERR,
				"Unrecognized mount option \"%s\" or missing value",
@@ -599,6 +604,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
		seq_puts(seq, ",nobarrier");
	if (test_opt(sbi, FASTBOOT))
		seq_puts(seq, ",fastboot");
	if (test_opt(sbi, EXTENT_CACHE))
		seq_puts(seq, ",extent_cache");
	seq_printf(seq, ",active_logs=%u", sbi->active_logs);

	return 0;