[f2fs-dev] [PATCH 1/3] f2fs-tools: use 'IS_CUR_SEGNO()' to check if it is current segment

2023-09-15 Thread Wu Bo via Linux-f2fs-devel
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

[f2fs-dev] [PATCH 0/3] f2fs-tools: cache free segments count to improve perfmance

2023-09-15 Thread Wu Bo via Linux-f2fs-devel
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 &

[f2fs-dev] [PATCH 3/3] f2fs-tools: cache free segments count to improve perfmance

2023-09-15 Thread Wu Bo via Linux-f2fs-devel
'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

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

2023-09-15 Thread Wu Bo via Linux-f2fs-devel
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 ==