File tree Expand file tree Collapse file tree
Documentation/ABI/testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ Date: January 2018
331331Contact: Jaegeuk Kim <jaegeuk@kernel.org>
332332Description: This indicates how many GC can be failed for the pinned
333333 file. If it exceeds this, F2FS doesn't guarantee its pinning
334- state. 2048 trials is set by default.
334+ state. 2048 trials is set by default, and 65535 as maximum .
335335
336336What: /sys/fs/f2fs/<disk>/extension_list
337337Date: February 2018
Original file line number Diff line number Diff line change @@ -813,7 +813,7 @@ struct f2fs_inode_info {
813813 unsigned char i_dir_level ; /* use for dentry level for large dir */
814814 union {
815815 unsigned int i_current_depth ; /* only for directory depth */
816- unsigned int i_gc_failures ; /* for gc failure statistic */
816+ unsigned short i_gc_failures ; /* for gc failure statistic */
817817 };
818818 unsigned int i_pino ; /* parent inode number */
819819 umode_t i_acl_mode ; /* keep file acl mode temporarily */
@@ -1673,7 +1673,7 @@ struct f2fs_sb_info {
16731673 unsigned long long skipped_gc_rwsem ; /* FG_GC only */
16741674
16751675 /* threshold for gc trials on pinned files */
1676- u64 gc_pin_file_threshold ;
1676+ unsigned short gc_pin_file_threshold ;
16771677 struct f2fs_rwsem pin_sem ;
16781678
16791679 /* maximum # of trials to find a victim segment for SSR and GC */
Original file line number Diff line number Diff line change @@ -3215,16 +3215,17 @@ int f2fs_pin_file_control(struct inode *inode, bool inc)
32153215 struct f2fs_inode_info * fi = F2FS_I (inode );
32163216 struct f2fs_sb_info * sbi = F2FS_I_SB (inode );
32173217
3218- /* Use i_gc_failures for normal file as a risk signal. */
3219- if (inc )
3220- f2fs_i_gc_failures_write (inode , fi -> i_gc_failures + 1 );
3221-
3222- if (fi -> i_gc_failures > sbi -> gc_pin_file_threshold ) {
3218+ if (fi -> i_gc_failures >= sbi -> gc_pin_file_threshold ) {
32233219 f2fs_warn (sbi , "%s: Enable GC = ino %lx after %x GC trials" ,
32243220 __func__ , inode -> i_ino , fi -> i_gc_failures );
32253221 clear_inode_flag (inode , FI_PIN_FILE );
32263222 return - EAGAIN ;
32273223 }
3224+
3225+ /* Use i_gc_failures for normal file as a risk signal. */
3226+ if (inc )
3227+ f2fs_i_gc_failures_write (inode , fi -> i_gc_failures + 1 );
3228+
32283229 return 0 ;
32293230}
32303231
Original file line number Diff line number Diff line change 2626#define LIMIT_FREE_BLOCK 40 /* percentage over invalid + free space */
2727
2828#define DEF_GC_FAILED_PINNED_FILES 2048
29+ #define MAX_GC_FAILED_PINNED_FILES USHRT_MAX
2930
3031/* Search max. number of dirty segments to select a victim segment */
3132#define DEF_MAX_VICTIM_SEARCH 4096 /* covers 8GB */
Original file line number Diff line number Diff line change @@ -675,6 +675,13 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
675675 return count ;
676676 }
677677
678+ if (!strcmp (a -> attr .name , "gc_pin_file_threshold" )) {
679+ if (t > MAX_GC_FAILED_PINNED_FILES )
680+ return - EINVAL ;
681+ sbi -> gc_pin_file_threshold = t ;
682+ return count ;
683+ }
684+
678685 if (!strcmp (a -> attr .name , "gc_reclaimed_segments" )) {
679686 if (t != 0 )
680687 return - EINVAL ;
You can’t perform that action at this time.
0 commit comments