From c1ce1b02bb25640567dc484dc94d3a195d21e705 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Wed, 10 Sep 2014 16:53:02 -0700 Subject: f2fs: give an option to enable in-place-updates during fsync to users If user wrote F2FS_IPU_FSYNC:4 in /sys/fs/f2fs/ipu_policy, f2fs_sync_file only starts to try in-place-updates. And, if the number of dirty pages is over /sys/fs/f2fs/min_fsync_blocks, it keeps out-of-order manner. Otherwise, it triggers in-place-updates. This may be used by storage showing very high random write performance. For example, it can be used when, Seq. writes (Data) + wait + Seq. writes (Node) is pretty much slower than, Rand. writes (Data) Signed-off-by: Jaegeuk Kim --- fs/f2fs/segment.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'fs/f2fs/segment.h') diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index bed0dc967f29..013aed2f3539 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -472,15 +472,20 @@ static inline int utilization(struct f2fs_sb_info *sbi) * F2FS_IPU_UTIL - if FS utilization is over threashold, * F2FS_IPU_SSR_UTIL - if SSR mode is activated and FS utilization is over * threashold, + * F2FS_IPU_FSYNC - activated in fsync path only for high performance flash + * storages. IPU will be triggered only if the # of dirty + * pages over min_fsync_blocks. * F2FS_IPUT_DISABLE - disable IPU. (=default option) */ #define DEF_MIN_IPU_UTIL 70 +#define DEF_MIN_FSYNC_BLOCKS 8 enum { F2FS_IPU_FORCE, F2FS_IPU_SSR, F2FS_IPU_UTIL, F2FS_IPU_SSR_UTIL, + F2FS_IPU_FSYNC, F2FS_IPU_DISABLE, }; @@ -492,10 +497,6 @@ static inline bool need_inplace_update(struct inode *inode) if (S_ISDIR(inode->i_mode)) return false; - /* this is only set during fdatasync */ - if (is_inode_flag_set(F2FS_I(inode), FI_NEED_IPU)) - return true; - switch (SM_I(sbi)->ipu_policy) { case F2FS_IPU_FORCE: return true; @@ -511,6 +512,11 @@ static inline bool need_inplace_update(struct inode *inode) if (need_SSR(sbi) && utilization(sbi) > SM_I(sbi)->min_ipu_util) return true; break; + case F2FS_IPU_FSYNC: + /* this is only set during fdatasync */ + if (is_inode_flag_set(F2FS_I(inode), FI_NEED_IPU)) + return true; + break; case F2FS_IPU_DISABLE: break; } -- cgit v1.2.3