diff mbox series

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

Message ID 20240327082146.6258-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 27, 2024, 8:21 a.m. UTC
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(-)

Comments

Joseph Qi March 27, 2024, 11:17 a.m. UTC | #1
On 3/27/24 4:21 PM, Heming Zhao wrote:
> 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
> ```

Could you please split the sparse warning into a separate patch?
For 'la_bm_off', it seems that other place may also has similar warning,
e.g. ocfs2_load_local_alloc().

Joseph

> 
> 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;
Heming Zhao March 27, 2024, 12:59 p.m. UTC | #2
On 3/27/24 19:17, Joseph Qi wrote:
> 
> 
> On 3/27/24 4:21 PM, Heming Zhao wrote:
>> 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
>> ```
> 
> Could you please split the sparse warning into a separate patch?
> For 'la_bm_off', it seems that other place may also has similar warning,
> e.g. ocfs2_load_local_alloc().
> 
> Joseph

No problem.

-Heming
diff mbox series

Patch

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;