Message ID | 20240328082943.20251-4-heming.zhao@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | improve write IO performance when fragmentation is high | expand |
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 --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;
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(-)