diff mbox series

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

Message ID 20240328125203.20892-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, 12:52 p.m. UTC
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 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;