All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heming Zhao <heming.zhao@suse.com>
To: joseph.qi@linux.alibaba.com
Cc: Heming Zhao <heming.zhao@suse.com>,
	ocfs2-devel@lists.linux.dev, ailiop@suse.com
Subject: [PATCH v4 3/3] ocfs2: speed up chain-list searching
Date: Wed, 27 Mar 2024 16:21:46 +0800	[thread overview]
Message-ID: <20240327082146.6258-4-heming.zhao@suse.com> (raw)
In-Reply-To: <20240327082146.6258-1-heming.zhao@suse.com>

ocfs2_claim_suballoc_bits():
- Add short-circuit code to speed up searching

ocfs2_local_alloc_new_window():
- remove 1 sparse warning
```
fs/ocfs2/localalloc.c:1224:41: warning: incorrect type in argument 1 (different base types)
fs/ocfs2/localalloc.c:1224:41:    expected unsigned long long val1
fs/ocfs2/localalloc.c:1224:41:    got restricted __le32 [usertype] la_bm_off
```

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
 fs/ocfs2/localalloc.c | 2 +-
 fs/ocfs2/suballoc.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 2391b96b8a3b..2758ae9164f3 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -1221,7 +1221,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
 			     OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
 
 	trace_ocfs2_local_alloc_new_window_result(
-		OCFS2_LOCAL_ALLOC(alloc)->la_bm_off,
+		le32_to_cpu(OCFS2_LOCAL_ALLOC(alloc)->la_bm_off),
 		le32_to_cpu(alloc->id1.bitmap1.i_total));
 
 bail:
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 4163554b0383..ebfa17dccf97 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;
-- 
2.35.3


  parent reply	other threads:[~2024-03-27  8:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  8:21 [PATCH v4 0/3] improve write IO performance when fragmentation is high Heming Zhao
2024-03-27  8:21 ` [PATCH v4 1/3] ocfs2: " Heming Zhao
2024-03-27 10:58   ` Joseph Qi
2024-03-27 12:54     ` Heming Zhao
2024-03-28  1:50       ` Joseph Qi
2024-03-28  1:55         ` Heming Zhao
2024-03-27  8:21 ` [PATCH v4 2/3] ocfs2: adjust enabling place for la window Heming Zhao
2024-03-27 11:05   ` Joseph Qi
2024-03-27 12:59     ` Heming Zhao
2024-03-28  1:58       ` Joseph Qi
2024-03-28  2:36         ` Heming Zhao
2024-03-27  8:21 ` Heming Zhao [this message]
2024-03-27 11:17   ` [PATCH v4 3/3] ocfs2: speed up chain-list searching Joseph Qi
2024-03-27 12:59     ` Heming Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240327082146.6258-4-heming.zhao@suse.com \
    --to=heming.zhao@suse.com \
    --cc=ailiop@suse.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.