Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f86134a9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "f2fs: fix performance issue observed with multi-thread sequential read"

parents ac113081 e029e96b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -51,6 +51,14 @@ 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.


What:		/sys/fs/f2fs/<disk>/min_hot_blocks
Date:		March 2017
Contact:	"Jaegeuk Kim" <jaegeuk@kernel.org>
+21 −0
Original line number Diff line number Diff line
@@ -2109,6 +2109,18 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
	return ret;
}

static inline bool __should_serialize_io(struct inode *inode,
					struct writeback_control *wbc)
{
	if (!S_ISREG(inode->i_mode))
		return false;
	if (wbc->sync_mode != WB_SYNC_ALL)
		return true;
	if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
		return true;
	return false;
}

int __f2fs_write_data_pages(struct address_space *mapping,
						struct writeback_control *wbc,
						enum iostat_type io_type)
@@ -2117,6 +2129,7 @@ int __f2fs_write_data_pages(struct address_space *mapping,
	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
	struct blk_plug plug;
	int ret;
	bool locked = false;

	/* deal with chardevs and other special file */
	if (!mapping->a_ops->writepage)
@@ -2147,10 +2160,18 @@ int __f2fs_write_data_pages(struct address_space *mapping,
	else if (atomic_read(&sbi->wb_sync_req))
		goto skip_write;

	if (__should_serialize_io(inode, wbc)) {
		mutex_lock(&sbi->writepages);
		locked = true;
	}

	blk_start_plug(&plug);
	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
	blk_finish_plug(&plug);

	if (locked)
		mutex_unlock(&sbi->writepages);

	if (wbc->sync_mode == WB_SYNC_ALL)
		atomic_dec(&sbi->wb_sync_req);
	/*
+2 −0
Original line number Diff line number Diff line
@@ -883,6 +883,7 @@ struct f2fs_sm_info {
	unsigned int ipu_policy;	/* in-place-update policy */
	unsigned int min_ipu_util;	/* in-place-update threshold */
	unsigned int min_fsync_blocks;	/* threshold for fsync */
	unsigned int min_seq_blocks;	/* threshold for sequential blocks */
	unsigned int min_hot_blocks;	/* threshold for hot block allocation */
	unsigned int min_ssr_sections;	/* threshold to trigger SSR allocation */

@@ -1093,6 +1094,7 @@ struct f2fs_sb_info {
	struct rw_semaphore sb_lock;		/* lock for raw super block */
	int valid_super_block;			/* valid super block no */
	unsigned long s_flag;				/* flags for sbi */
	struct mutex writepages;		/* mutex for writepages() */

#ifdef CONFIG_BLK_DEV_ZONED
	unsigned int blocks_per_blkz;		/* F2FS blocks per zone */
+1 −0
Original line number Diff line number Diff line
@@ -3836,6 +3836,7 @@ int build_segment_manager(struct f2fs_sb_info *sbi)
		sm_info->ipu_policy = 1 << F2FS_IPU_FSYNC;
	sm_info->min_ipu_util = DEF_MIN_IPU_UTIL;
	sm_info->min_fsync_blocks = DEF_MIN_FSYNC_BLOCKS;
	sm_info->min_seq_blocks = sbi->blocks_per_seg * sbi->segs_per_sec;
	sm_info->min_hot_blocks = DEF_MIN_HOT_BLOCKS;
	sm_info->min_ssr_sections = reserved_sections(sbi);

+1 −0
Original line number Diff line number Diff line
@@ -2717,6 +2717,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
	/* init f2fs-specific super block info */
	sbi->valid_super_block = valid_super_block;
	mutex_init(&sbi->gc_mutex);
	mutex_init(&sbi->writepages);
	mutex_init(&sbi->cp_mutex);
	init_rwsem(&sbi->node_write);
	init_rwsem(&sbi->node_change);
Loading