Use IS_CUR_SEGNO() here can make code more concise and readable.
---
fsck/mount.c | 17 -
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index df0314d..00940b8 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2531,20 +2531,11 @@ void buil
When I looking at the performance of resize via flame graph, I can see that
'find_next_free_block()->get_free_segments()' cosume most user space time.
Every calling 'get_free_segments()', it will traverses all segments to calculate
the free segments count. And this path is called a lot in resize &
'get_free_segments()' is implemented by traversing all segments to
calculate the total free segments. It cosume much time.
Every time when call 'find_next_free_block()' this calculation will
do it again. So if we cache the free segments count, it will greatly
improve performance of dfrag & resize
If the segment type is not matched, goto next segment to save time.
---
fsck/mount.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fsck/mount.c b/fsck/mount.c
index 00940b8..dccaae2 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -2854,6 +2854,8 @@ next_segment:
if (type ==