diff mbox series

[f2fs-dev,v2,2/3] f2fs-tools: skip not matched segment when finding free block

Message ID ea4273b977dcd05522ffbe4c6d84d44ce202d0c7.1695890686.git.bo.wu@vivo.com (mailing list archive)
State New
Headers show
Series f2fs-tools: cache free segments count to improve perfmance | expand

Commit Message

Wu Bo Sept. 28, 2023, 9:20 a.m. UTC
If the segment type is not matched, goto next segment to save time.
---
 fsck/mount.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fsck/mount.c b/fsck/mount.c
index e4372cf..098e73d 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2852,8 +2852,10 @@  next_segment:
 			}
 		}
 
-		if (type == want_type && !new_sec &&
-			!f2fs_test_bit(offset, (const char *)bitmap))
+		if (type != want_type)
+			goto next_segment;
+		else if (!new_sec &&
+				!f2fs_test_bit(offset, (const char *)bitmap))
 			return 0;
 
 		*to = left ? *to - 1: *to + 1;