diff mbox series

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

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

Commit Message

Wu Bo Sept. 15, 2023, 9:04 a.m. UTC
If the segment type is not matched, goto next segment to save time.
---
 fsck/mount.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chao Yu Sept. 20, 2023, 1:07 p.m. UTC | #1
On 2023/9/15 17:04, Wu Bo wrote:
> 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 == want_type && !new_sec &&
>   			!f2fs_test_bit(offset, (const char *)bitmap))
>   			return 0;
> +		if (type != want_type)
> +			goto next_segment;

if (type != want_type)
	goto next_segment;
else if (!new_sec && !f2fs_test_bit(offset, (const char *)bitmap))
	return 0;

Thanks,

>   
>   		*to = left ? *to - 1: *to + 1;
>   	}
diff mbox series

Patch

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 == want_type && !new_sec &&
 			!f2fs_test_bit(offset, (const char *)bitmap))
 			return 0;
+		if (type != want_type)
+			goto next_segment;
 
 		*to = left ? *to - 1: *to + 1;
 	}