aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-09-16 21:30:54 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-09-23 14:10:24 -0400
commit9b5f136fd41658f384a5b4ea49d8ef37036e15f5 (patch)
tree9264f0986377dfdb252db27ba59fbb2cb1210bce
parent210f41bc048263d572515e1e0edc28d362ce673e (diff)
f2fs: change the ipu_policy option to enable combinations
This patch changes the ipu_policy setting to use any combination of orthogonal policies. Signed-off-by: Changman Lee <cm224.lee@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--Documentation/filesystems/f2fs.txt6
-rw-r--r--fs/f2fs/segment.c2
-rw-r--r--fs/f2fs/segment.h39
3 files changed, 20 insertions, 27 deletions
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index d010da85a769..2cca5a25ef89 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -192,9 +192,9 @@ Files in /sys/fs/f2fs/<devname>
192 192
193 ipu_policy This parameter controls the policy of in-place 193 ipu_policy This parameter controls the policy of in-place
194 updates in f2fs. There are five policies: 194 updates in f2fs. There are five policies:
195 0: F2FS_IPU_FORCE, 1: F2FS_IPU_SSR, 195 0x01: F2FS_IPU_FORCE, 0x02: F2FS_IPU_SSR,
196 2: F2FS_IPU_UTIL, 3: F2FS_IPU_SSR_UTIL, 196 0x04: F2FS_IPU_UTIL, 0x08: F2FS_IPU_SSR_UTIL,
197 4: F2FS_IPU_FSYNC, 5: F2FS_IPU_DISABLE. 197 0x10: F2FS_IPU_FSYNC.
198 198
199 min_ipu_util This parameter controls the threshold to trigger 199 min_ipu_util This parameter controls the threshold to trigger
200 in-place-updates. The number indicates percentage 200 in-place-updates. The number indicates percentage
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 24b768ae39c4..3125a3d35245 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1928,7 +1928,7 @@ int build_segment_manager(struct f2fs_sb_info *sbi)
1928 sm_info->ssa_blkaddr = le32_to_cpu(raw_super->ssa_blkaddr); 1928 sm_info->ssa_blkaddr = le32_to_cpu(raw_super->ssa_blkaddr);
1929 sm_info->rec_prefree_segments = sm_info->main_segments * 1929 sm_info->rec_prefree_segments = sm_info->main_segments *
1930 DEF_RECLAIM_PREFREE_SEGMENTS / 100; 1930 DEF_RECLAIM_PREFREE_SEGMENTS / 100;
1931 sm_info->ipu_policy = F2FS_IPU_FSYNC; 1931 sm_info->ipu_policy = 1 << F2FS_IPU_FSYNC;
1932 sm_info->min_ipu_util = DEF_MIN_IPU_UTIL; 1932 sm_info->min_ipu_util = DEF_MIN_IPU_UTIL;
1933 sm_info->min_fsync_blocks = DEF_MIN_FSYNC_BLOCKS; 1933 sm_info->min_fsync_blocks = DEF_MIN_FSYNC_BLOCKS;
1934 1934
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 032c0905a12b..d317b61f83a5 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -487,40 +487,33 @@ enum {
487 F2FS_IPU_UTIL, 487 F2FS_IPU_UTIL,
488 F2FS_IPU_SSR_UTIL, 488 F2FS_IPU_SSR_UTIL,
489 F2FS_IPU_FSYNC, 489 F2FS_IPU_FSYNC,
490 F2FS_IPU_DISABLE,
491}; 490};
492 491
493static inline bool need_inplace_update(struct inode *inode) 492static inline bool need_inplace_update(struct inode *inode)
494{ 493{
495 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 494 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
495 unsigned int policy = SM_I(sbi)->ipu_policy;
496 496
497 /* IPU can be done only for the user data */ 497 /* IPU can be done only for the user data */
498 if (S_ISDIR(inode->i_mode)) 498 if (S_ISDIR(inode->i_mode))
499 return false; 499 return false;
500 500
501 switch (SM_I(sbi)->ipu_policy) { 501 if (policy & (0x1 << F2FS_IPU_FORCE))
502 case F2FS_IPU_FORCE:
503 return true; 502 return true;
504 case F2FS_IPU_SSR: 503 if (policy & (0x1 << F2FS_IPU_SSR) && need_SSR(sbi))
505 if (need_SSR(sbi)) 504 return true;
506 return true; 505 if (policy & (0x1 << F2FS_IPU_UTIL) &&
507 break; 506 utilization(sbi) > SM_I(sbi)->min_ipu_util)
508 case F2FS_IPU_UTIL: 507 return true;
509 if (utilization(sbi) > SM_I(sbi)->min_ipu_util) 508 if (policy & (0x1 << F2FS_IPU_SSR_UTIL) && need_SSR(sbi) &&
510 return true; 509 utilization(sbi) > SM_I(sbi)->min_ipu_util)
511 break; 510 return true;
512 case F2FS_IPU_SSR_UTIL: 511
513 if (need_SSR(sbi) && utilization(sbi) > SM_I(sbi)->min_ipu_util) 512 /* this is only set during fdatasync */
514 return true; 513 if (policy & (0x1 << F2FS_IPU_FSYNC) &&
515 break; 514 is_inode_flag_set(F2FS_I(inode), FI_NEED_IPU))
516 case F2FS_IPU_FSYNC: 515 return true;
517 /* this is only set during fdatasync */ 516
518 if (is_inode_flag_set(F2FS_I(inode), FI_NEED_IPU))
519 return true;
520 break;
521 case F2FS_IPU_DISABLE:
522 break;
523 }
524 return false; 517 return false;
525} 518}
526 519