Skip to contentSkip to conversation

fsck: use free segments if free segments is enough

PATCH In review Yunlei He 3 participants 4 messages Dec 18, 2017 – Dec 20, 2017

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 fsck: use free segments if free segments is enough

Use free segments if free segments is enough

---
 fsck/mount.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
fsck/mount.c +6 -15
index 678eeae..3e25165 100644
@@ -1890,23 +1890,14 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
 			continue;
 		}
 
-		if (se->valid_blocks == 0 && not_enough) {
-			*to = left ? START_BLOCK(sbi, segno) - 1:
+		if (se->valid_blocks == 0) {
+			if (not_enough) {
+				*to = left ? START_BLOCK(sbi, segno) - 1:
 						START_BLOCK(sbi, segno + 1);
-			continue;
-		}
-
-		if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec)) {
-			struct seg_entry *se2;
-			unsigned int i;
-
-			for (i = 1; i < sbi->segs_per_sec; i++) {
-				se2 = get_seg_entry(sbi, segno + i);
-				if (se2->valid_blocks)
-					break;
-			}
-			if (i == sbi->segs_per_sec)
+				continue;
+			} else {
 				return 0;
+			}
 		}
 
 		if (se->type == type &&
Signature · 6 lines
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
#1 lore raw
Quoted 1 line · Yunlei He

Use free segments if free segments is enough

It doesn't matter with large section?

Quoted 42 lines
---
 fsck/mount.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
fsck/mount.c +6 -15
index 678eeae..3e25165 100644
@@ -1890,23 +1890,14 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
 			continue;
 		}
 
-		if (se->valid_blocks == 0 && not_enough) {
-			*to = left ? START_BLOCK(sbi, segno) - 1:
+		if (se->valid_blocks == 0) {
+			if (not_enough) {
+				*to = left ? START_BLOCK(sbi, segno) - 1:
 						START_BLOCK(sbi, segno + 1);
-			continue;
-		}
-
-		if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec)) {
-			struct seg_entry *se2;
-			unsigned int i;
-
-			for (i = 1; i < sbi->segs_per_sec; i++) {
-				se2 = get_seg_entry(sbi, segno + i);
-				if (se2->valid_blocks)
-					break;
-			}
-			if (i == sbi->segs_per_sec)
+				continue;
+			} else {
 				return 0;
+			}
 		}
 
 		if (se->type == type &&
Signature · 1 line
1.9.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#2 lore raw

Hi Jaegeuk,

Quoted 5 lines · Jaegeuk Kim
Quoted 1 line · Yunlei He

Use free segments if free segments is enough

It doesn't matter with large section?

I couldn't find any special constraint with the large section

    after I read GC and SSR selection flow... :(

And since now f2fs has aggressive SSR, different types of node or different types of data will be mixed in a segment...

I have turned to Yun Lei and Yong for help, but we still cannot get any conclusion on it.

Could you give me some hints on the large section?

Thanks again

Quoted 39 lines
Quoted 39 lines
---
  fsck/mount.c | 21 ++++++---------------
  1 file changed, 6 insertions(+), 15 deletions(-)
fsck/mount.c +6 -15
index 678eeae..3e25165 100644
@@ -1890,23 +1890,14 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
  			continue;
  		}
 
-		if (se->valid_blocks == 0 && not_enough) {
-			*to = left ? START_BLOCK(sbi, segno) - 1:
+		if (se->valid_blocks == 0) {
+			if (not_enough) {
+				*to = left ? START_BLOCK(sbi, segno) - 1:
  						START_BLOCK(sbi, segno + 1);
-			continue;
-		}
-
-		if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec)) {
-			struct seg_entry *se2;
-			unsigned int i;
-
-			for (i = 1; i < sbi->segs_per_sec; i++) {
-				se2 = get_seg_entry(sbi, segno + i);
-				if (se2->valid_blocks)
-					break;
-			}
-			if (i == sbi->segs_per_sec)
+				continue;
+			} else {
  				return 0;
+			}
  		}
 
Quoted 12 lines
Quoted 3 lines
fsck/mount.c +0 -0
  		if (se->type == type &&
Signature · 1 line
1.9.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#3 lore raw
Quoted 9 lines · Gaoxiang (OS)

Hi Jaegeuk,

Quoted 5 lines · Jaegeuk Kim
Quoted 1 line · Yunlei He

Use free segments if free segments is enough

It doesn't matter with large section?

I couldn't find any special constraint with the large section

Quoted 8 lines
    after I read GC and SSR selection flow... :(

And since now f2fs has aggressive SSR, different types of node or different types of data will be mixed in a segment...

I have turned to Yun Lei and Yong for help, but we still cannot get any conclusion on it.

Could you give me some hints on the large section?

It can be used for LFS mode by host-managed SMR drives.

Quoted 54 lines

Thanks again

Quoted 51 lines
Quoted 42 lines
---
  fsck/mount.c | 21 ++++++---------------
  1 file changed, 6 insertions(+), 15 deletions(-)
fsck/mount.c +6 -15
index 678eeae..3e25165 100644
@@ -1890,23 +1890,14 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, int type)
  			continue;
  		}
 
-		if (se->valid_blocks == 0 && not_enough) {
-			*to = left ? START_BLOCK(sbi, segno) - 1:
+		if (se->valid_blocks == 0) {
+			if (not_enough) {
+				*to = left ? START_BLOCK(sbi, segno) - 1:
  						START_BLOCK(sbi, segno + 1);
-			continue;
-		}
-
-		if (se->valid_blocks == 0 && !(segno % sbi->segs_per_sec)) {
-			struct seg_entry *se2;
-			unsigned int i;
-
-			for (i = 1; i < sbi->segs_per_sec; i++) {
-				se2 = get_seg_entry(sbi, segno + i);
-				if (se2->valid_blocks)
-					break;
-			}
-			if (i == sbi->segs_per_sec)
+				continue;
+			} else {
  				return 0;
+			}
  		}
 
  		if (se->type == type &&
Signature · 1 line
1.9.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot