public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: return 0 when ext4_get_group_info failed in __mb_check_buddy
@ 2024-01-02 11:20 yangerkun
  2024-01-02 12:17 ` Kemeng Shi
  0 siblings, 1 reply; 3+ messages in thread
From: yangerkun @ 2024-01-02 11:20 UTC (permalink / raw)
  To: tytso, adilger.kernel, jack; +Cc: linux-ext4

The return value for __mb_check_buddy should be a integer. Found this by
code review.

Fixes: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 fs/ext4/mballoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d72b5e3c92ec..55c70a1b445a 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -758,7 +758,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
 
 	grp = ext4_get_group_info(sb, e4b->bd_group);
 	if (!grp)
-		return NULL;
+		return 0;
 	list_for_each(cur, &grp->bb_prealloc_list) {
 		ext4_group_t groupnr;
 		struct ext4_prealloc_space *pa;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: return 0 when ext4_get_group_info failed in __mb_check_buddy
  2024-01-02 11:20 [PATCH] ext4: return 0 when ext4_get_group_info failed in __mb_check_buddy yangerkun
@ 2024-01-02 12:17 ` Kemeng Shi
  2024-01-02 12:33   ` yangerkun
  0 siblings, 1 reply; 3+ messages in thread
From: Kemeng Shi @ 2024-01-02 12:17 UTC (permalink / raw)
  To: yangerkun, tytso, adilger.kernel, jack; +Cc: linux-ext4



on 1/2/2024 7:20 PM, yangerkun wrote:
> The return value for __mb_check_buddy should be a integer. Found this by
> code review.
> 
Hi yangerkun,
I think the return value of __mb_check_buddy is actually not used and can
be removed. See [1] for details :). Thanks!

[1] https://lore.kernel.org/lkml/20231125161143.3945726-2-shikemeng@huaweicloud.com/

> Fixes: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
> Signed-off-by: yangerkun <yangerkun@huawei.com>
> ---
>  fs/ext4/mballoc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index d72b5e3c92ec..55c70a1b445a 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -758,7 +758,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
>  
>  	grp = ext4_get_group_info(sb, e4b->bd_group);
>  	if (!grp)
> -		return NULL;
> +		return 0;
>  	list_for_each(cur, &grp->bb_prealloc_list) {
>  		ext4_group_t groupnr;
>  		struct ext4_prealloc_space *pa;
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: return 0 when ext4_get_group_info failed in __mb_check_buddy
  2024-01-02 12:17 ` Kemeng Shi
@ 2024-01-02 12:33   ` yangerkun
  0 siblings, 0 replies; 3+ messages in thread
From: yangerkun @ 2024-01-02 12:33 UTC (permalink / raw)
  To: Kemeng Shi, tytso, adilger.kernel, jack; +Cc: linux-ext4



在 2024/1/2 20:17, Kemeng Shi 写道:
> 
> 
> on 1/2/2024 7:20 PM, yangerkun wrote:
>> The return value for __mb_check_buddy should be a integer. Found this by
>> code review.
>>
> Hi yangerkun,
> I think the return value of __mb_check_buddy is actually not used and can
> be removed. See [1] for details :). Thanks!

Hi Kemeng,

Yeah, the return value nowdays help nothing, it's a good choice to 
remove them all.

Thanks.

> 
> [1] https://lore.kernel.org/lkml/20231125161143.3945726-2-shikemeng@huaweicloud.com/
> 
>> Fixes: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
>> Signed-off-by: yangerkun <yangerkun@huawei.com>
>> ---
>>   fs/ext4/mballoc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
>> index d72b5e3c92ec..55c70a1b445a 100644
>> --- a/fs/ext4/mballoc.c
>> +++ b/fs/ext4/mballoc.c
>> @@ -758,7 +758,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
>>   
>>   	grp = ext4_get_group_info(sb, e4b->bd_group);
>>   	if (!grp)
>> -		return NULL;
>> +		return 0;
>>   	list_for_each(cur, &grp->bb_prealloc_list) {
>>   		ext4_group_t groupnr;
>>   		struct ext4_prealloc_space *pa;
>>
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-02 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-02 11:20 [PATCH] ext4: return 0 when ext4_get_group_info failed in __mb_check_buddy yangerkun
2024-01-02 12:17 ` Kemeng Shi
2024-01-02 12:33   ` yangerkun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox