aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r--fs/f2fs/segment.h39
1 files changed, 16 insertions, 23 deletions
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