diff mbox series

[v5,3/4] ocfs2: speed up chain-list searching

Message ID 20240328082943.20251-4-heming.zhao@suse.com (mailing list archive)
State New
Headers show
Series improve write IO performance when fragmentation is high | expand

Commit Message

Heming Zhao March 28, 2024, 8:29 a.m. UTC
Add short-circuit code to speed up searching

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
v5: 
- split 'sparse warnings' fix to a separate patch
- amend the commit log according to patch change

v4: first version
---
 fs/ocfs2/suballoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joseph Qi March 28, 2024, 8:58 a.m. UTC | #1
On 3/28/24 4:29 PM, Heming Zhao wrote:
> Add short-circuit code to speed up searching
> 
> Signed-off-by: Heming Zhao <heming.zhao@suse.com>

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
> v5: 
> - split 'sparse warnings' fix to a separate patch
> - amend the commit log according to patch change
> 
> v4: first version
> ---
>  fs/ocfs2/suballoc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index fc80cb3dbcd1..823e2ec38b2d 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -2008,7 +2008,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
>  	for (i = 0; i < le16_to_cpu(cl->cl_next_free_rec); i ++) {
>  		if (i == victim)
>  			continue;
> -		if (!cl->cl_recs[i].c_free)
> +		if (le32_to_cpu(cl->cl_recs[i].c_free) < bits_wanted)
>  			continue;
>  
>  		ac->ac_chain = i;
diff mbox series

Patch

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index fc80cb3dbcd1..823e2ec38b2d 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2008,7 +2008,7 @@  static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
 	for (i = 0; i < le16_to_cpu(cl->cl_next_free_rec); i ++) {
 		if (i == victim)
 			continue;
-		if (!cl->cl_recs[i].c_free)
+		if (le32_to_cpu(cl->cl_recs[i].c_free) < bits_wanted)
 			continue;
 
 		ac->ac_chain = i;