diff --git a/fsck/f2fs.h b/fsck/f2fs.h
index 703f34074ef1..e65644e9ccf3 100644
--- a/fsck/f2fs.h
+++ b/fsck/f2fs.h
@@ -463,6 +463,7 @@ static inline block_t __end_block_addr(struct f2fs_sb_info *sbi)
 #define GET_R2L_SEGNO(sbi, segno)	(segno + FREE_I_START_SEGNO(sbi))
 
 #define MAIN_SEGS(sbi)	(SM_I(sbi)->main_segments)
+#define TOTAL_SEGS(sbi)	(SM_I(sbi)->segment_count)
 #define TOTAL_BLKS(sbi)	(TOTAL_SEGS(sbi) << (sbi)->log_blocks_per_seg)
 #define MAX_BLKADDR(sbi)	(SEG0_BLKADDR(sbi) + TOTAL_BLKS(sbi))
 
@@ -511,7 +512,6 @@ struct fsync_inode_entry {
 	((segno) % sit_i->sents_per_block)
 #define SIT_BLOCK_OFFSET(sit_i, segno)                                  \
 	((segno) / SIT_ENTRY_PER_BLOCK)
-#define TOTAL_SEGS(sbi) (SM_I(sbi)->main_segments)
 
 static inline bool IS_VALID_NID(struct f2fs_sb_info *sbi, u32 nid)
 {
diff --git a/fsck/fsck.c b/fsck/fsck.c
index df91c82bb6d7..1b6f2c20b2b3 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -2064,7 +2064,7 @@ int fsck_chk_meta(struct f2fs_sb_info *sbi)
 	unsigned int i;
 
 	/* 1. check sit usage with CP: curseg is lost? */
-	for (i = 0; i < TOTAL_SEGS(sbi); i++) {
+	for (i = 0; i < MAIN_SEGS(sbi); i++) {
 		se = get_seg_entry(sbi, i);
 		if (se->valid_blocks != 0)
 			sit_valid_segs++;
@@ -2607,7 +2607,7 @@ int check_sit_types(struct f2fs_sb_info *sbi)
 	unsigned int i;
 	int err = 0;
 
-	for (i = 0; i < TOTAL_SEGS(sbi); i++) {
+	for (i = 0; i < MAIN_SEGS(sbi); i++) {
 		struct seg_entry *se;
 
 		se = get_seg_entry(sbi, i);
diff --git a/fsck/mount.c b/fsck/mount.c
index 2a87759c6e34..2b26701852b5 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -80,7 +80,7 @@ unsigned int get_usable_seg_count(struct f2fs_sb_info *sbi)
 {
 	unsigned int i, usable_seg_count = 0;
 
-	for (i = 0; i < TOTAL_SEGS(sbi); i++)
+	for (i = 0; i < MAIN_SEGS(sbi); i++)
 		if (is_usable_seg(sbi, i))
 			usable_seg_count++;
 
@@ -96,7 +96,7 @@ bool is_usable_seg(struct f2fs_sb_info *UNUSED(sbi), unsigned int UNUSED(segno))
 
 unsigned int get_usable_seg_count(struct f2fs_sb_info *sbi)
 {
-	return TOTAL_SEGS(sbi);
+	return MAIN_SEGS(sbi);
 }
 
 #endif
@@ -105,7 +105,7 @@ u32 get_free_segments(struct f2fs_sb_info *sbi)
 {
 	u32 i, free_segs = 0;
 
-	for (i = 0; i < TOTAL_SEGS(sbi); i++) {
+	for (i = 0; i < MAIN_SEGS(sbi); i++) {
 		struct seg_entry *se = get_seg_entry(sbi, i);
 
 		if (se->valid_blocks == 0x0 && !IS_CUR_SEGNO(sbi, i) &&
@@ -1789,13 +1789,13 @@ int build_sit_info(struct f2fs_sb_info *sbi)
 
 	SM_I(sbi)->sit_info = sit_i;
 
-	sit_i->sentries = calloc(TOTAL_SEGS(sbi) * sizeof(struct seg_entry), 1);
+	sit_i->sentries = calloc(MAIN_SEGS(sbi) * sizeof(struct seg_entry), 1);
 	if (!sit_i->sentries) {
 		MSG(1, "\tError: Calloc failed for build_sit_info!\n");
 		goto free_sit_info;
 	}
 
-	bitmap_size = TOTAL_SEGS(sbi) * SIT_VBLOCK_MAP_SIZE;
+	bitmap_size = MAIN_SEGS(sbi) * SIT_VBLOCK_MAP_SIZE;
 
 	if (need_fsync_data_record(sbi))
 		bitmap_size += bitmap_size;
@@ -1808,7 +1808,7 @@ int build_sit_info(struct f2fs_sb_info *sbi)
 
 	bitmap = sit_i->bitmap;
 
-	for (start = 0; start < TOTAL_SEGS(sbi); start++) {
+	for (start = 0; start < MAIN_SEGS(sbi); start++) {
 		sit_i->sentries[start].cur_valid_map = bitmap;
 		bitmap += SIT_VBLOCK_MAP_SIZE;
 
@@ -2060,7 +2060,7 @@ static int build_curseg(struct f2fs_sb_info *sbi)
 			blk_off = get_cp(cur_node_blkoff[i - CURSEG_HOT_NODE]);
 			segno = get_cp(cur_node_segno[i - CURSEG_HOT_NODE]);
 		}
-		ASSERT(segno < TOTAL_SEGS(sbi));
+		ASSERT(segno < MAIN_SEGS(sbi));
 		ASSERT(blk_off < DEFAULT_BLOCKS_PER_SEGMENT);
 
 		array[i].segno = segno;
@@ -2422,7 +2422,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
 		segno = start_blk * sit_i->sents_per_block;
 		end = (start_blk + readed) * sit_i->sents_per_block;
 
-		for (; segno < end && segno < TOTAL_SEGS(sbi); segno++) {
+		for (; segno < end && segno < MAIN_SEGS(sbi); segno++) {
 			se = &sit_i->sentries[segno];
 
 			get_current_sit_page(sbi, segno, sit_blk);
@@ -2448,7 +2448,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
 	for (i = 0; i < sits_in_cursum(journal); i++) {
 		segno = le32_to_cpu(segno_in_journal(journal, i));
 
-		if (segno >= TOTAL_SEGS(sbi)) {
+		if (segno >= MAIN_SEGS(sbi)) {
 			MSG(0, "\tError: build_sit_entries: segno(%u) is invalid!!!\n", segno);
 			journal->n_sits = cpu_to_le16(i);
 			c.fix_on = 1;
@@ -2525,7 +2525,7 @@ void build_sit_area_bitmap(struct f2fs_sb_info *sbi)
 
 	ASSERT(fsck->sit_area_bitmap_sz == fsck->main_area_bitmap_sz);
 
-	for (segno = 0; segno < TOTAL_SEGS(sbi); segno++) {
+	for (segno = 0; segno < MAIN_SEGS(sbi); segno++) {
 		se = get_seg_entry(sbi, segno);
 
 		memcpy(ptr, se->cur_valid_map, SIT_VBLOCK_MAP_SIZE);
@@ -2571,7 +2571,7 @@ void rewrite_sit_area_bitmap(struct f2fs_sb_info *sbi)
 
 	ptr = fsck->main_area_bitmap;
 
-	for (segno = 0; segno < TOTAL_SEGS(sbi); segno++) {
+	for (segno = 0; segno < MAIN_SEGS(sbi); segno++) {
 		struct f2fs_sit_entry *sit;
 		struct seg_entry *se;
 		u16 valid_blocks = 0;
@@ -2694,7 +2694,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi)
 	sit_blk = calloc(BLOCK_SZ, 1);
 	ASSERT(sit_blk);
 	/* update free segments */
-	for (segno = 0; segno < TOTAL_SEGS(sbi); segno++) {
+	for (segno = 0; segno < MAIN_SEGS(sbi); segno++) {
 		struct f2fs_sit_entry *sit;
 		struct seg_entry *se;
 
@@ -3400,7 +3400,7 @@ static int find_fsync_inode(struct f2fs_sb_info *sbi, struct list_head *head)
 	struct f2fs_node *node_blk;
 	block_t blkaddr;
 	unsigned int loop_cnt = 0;
-	unsigned int free_blocks = TOTAL_SEGS(sbi) * sbi->blocks_per_seg -
+	unsigned int free_blocks = MAIN_SEGS(sbi) * sbi->blocks_per_seg -
 						sbi->total_valid_block_count;
 	int err = 0;
 
diff --git a/fsck/resize.c b/fsck/resize.c
index c545dd950743..2fd394154799 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -175,7 +175,7 @@ static void migrate_main(struct f2fs_sb_info *sbi, unsigned int offset)
 
 	ASSERT(raw != NULL);
 
-	for (i = TOTAL_SEGS(sbi) - 1; i >= 0; i--) {
+	for (i = MAIN_SEGS(sbi) - 1; i >= 0; i--) {
 		se = get_seg_entry(sbi, i);
 		if (!se->valid_blocks)
 			continue;
@@ -240,7 +240,7 @@ static void migrate_ssa(struct f2fs_sb_info *sbi,
 	block_t new_sum_blkaddr = get_newsb(ssa_blkaddr);
 	block_t end_sum_blkaddr = get_newsb(main_blkaddr);
 	block_t expand_sum_blkaddr = new_sum_blkaddr +
-					TOTAL_SEGS(sbi) - offset;
+					MAIN_SEGS(sbi) - offset;
 	block_t blkaddr;
 	int ret;
 	void *zero_block = calloc(BLOCK_SZ, 1);
@@ -258,7 +258,7 @@ static void migrate_ssa(struct f2fs_sb_info *sbi,
 		}
 	} else {
 		blkaddr = end_sum_blkaddr - 1;
-		offset = TOTAL_SEGS(sbi) - 1;
+		offset = MAIN_SEGS(sbi) - 1;
 		while (blkaddr >= new_sum_blkaddr) {
 			if (blkaddr >= expand_sum_blkaddr) {
 				ret = dev_write_block(zero_block, blkaddr--);
@@ -412,7 +412,7 @@ static void migrate_sit(struct f2fs_sb_info *sbi,
 		DBG(3, "Write zero sit: %x\n", get_newsb(sit_blkaddr) + index);
 	}
 
-	for (segno = 0; segno < TOTAL_SEGS(sbi); segno++) {
+	for (segno = 0; segno < MAIN_SEGS(sbi); segno++) {
 		struct f2fs_sit_entry *sit;
 
 		se = get_seg_entry(sbi, segno);
