@@ -1884,7 +1884,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
18841884 unsigned int start = 0 , end = -1 ;
18851885 unsigned int secno , start_segno ;
18861886 bool force = (cpc -> reason & CP_DISCARD );
1887- bool need_align = test_opt (sbi , LFS ) && sbi -> segs_per_sec > 1 ;
1887+ bool need_align = test_opt (sbi , LFS ) && __is_large_section ( sbi ) ;
18881888
18891889 mutex_lock (& dirty_i -> seglist_lock );
18901890
@@ -1916,7 +1916,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi,
19161916 (end - 1 ) <= cpc -> trim_end )
19171917 continue ;
19181918
1919- if (!test_opt (sbi , LFS ) || sbi -> segs_per_sec == 1 ) {
1919+ if (!test_opt (sbi , LFS ) || ! __is_large_section ( sbi ) ) {
19201920 f2fs_issue_discard (sbi , START_BLOCK (sbi , start ),
19211921 (end - start ) << sbi -> log_blocks_per_seg );
19221922 continue ;
@@ -2148,7 +2148,7 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
21482148 /* update total number of valid blocks to be written in ckpt area */
21492149 SIT_I (sbi )-> written_valid_blocks += del ;
21502150
2151- if (sbi -> segs_per_sec > 1 )
2151+ if (__is_large_section ( sbi ) )
21522152 get_sec_entry (sbi , segno )-> valid_blocks += del ;
21532153}
21542154
@@ -2414,7 +2414,7 @@ static void reset_curseg(struct f2fs_sb_info *sbi, int type, int modified)
24142414static unsigned int __get_next_segno (struct f2fs_sb_info * sbi , int type )
24152415{
24162416 /* if segs_per_sec is large than 1, we need to keep original policy. */
2417- if (sbi -> segs_per_sec != 1 )
2417+ if (__is_large_section ( sbi ) )
24182418 return CURSEG_I (sbi , type )-> segno ;
24192419
24202420 if (unlikely (is_sbi_flag_set (sbi , SBI_CP_DISABLED )))
@@ -2724,7 +2724,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
27242724 struct discard_policy dpolicy ;
27252725 unsigned long long trimmed = 0 ;
27262726 int err = 0 ;
2727- bool need_align = test_opt (sbi , LFS ) && sbi -> segs_per_sec > 1 ;
2727+ bool need_align = test_opt (sbi , LFS ) && __is_large_section ( sbi ) ;
27282728
27292729 if (start >= MAX_BLKADDR (sbi ) || range -> len < sbi -> blocksize )
27302730 return - EINVAL ;
@@ -3882,7 +3882,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
38823882 if (!sit_i -> tmp_map )
38833883 return - ENOMEM ;
38843884
3885- if (sbi -> segs_per_sec > 1 ) {
3885+ if (__is_large_section ( sbi ) ) {
38863886 sit_i -> sec_entries =
38873887 f2fs_kvzalloc (sbi , array_size (sizeof (struct sec_entry ),
38883888 MAIN_SECS (sbi )),
@@ -4037,7 +4037,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
40374037 se -> valid_blocks ;
40384038 }
40394039
4040- if (sbi -> segs_per_sec > 1 )
4040+ if (__is_large_section ( sbi ) )
40414041 get_sec_entry (sbi , start )-> valid_blocks +=
40424042 se -> valid_blocks ;
40434043 }
@@ -4081,7 +4081,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
40814081 sbi -> discard_blks -= se -> valid_blocks ;
40824082 }
40834083
4084- if (sbi -> segs_per_sec > 1 ) {
4084+ if (__is_large_section ( sbi ) ) {
40854085 get_sec_entry (sbi , start )-> valid_blocks +=
40864086 se -> valid_blocks ;
40874087 get_sec_entry (sbi , start )-> valid_blocks -=
0 commit comments