linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: Fix incorrect return value
@ 2024-04-04 13:47 Wang Jianjian
  2024-04-07  6:23 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Jianjian @ 2024-04-04 13:47 UTC (permalink / raw)
  To: linux-f2fs-devel, jaegeuk, chao; +Cc: Wang Jianjian

dquot_mark_dquot_dirty returns old dirty state not the error code.

Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
---
 fs/f2fs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a6867f26f141..af07027475d9 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3063,13 +3063,13 @@ static int f2fs_dquot_mark_dquot_dirty(struct dquot *dquot)
 {
 	struct super_block *sb = dquot->dq_sb;
 	struct f2fs_sb_info *sbi = F2FS_SB(sb);
-	int ret = dquot_mark_dquot_dirty(dquot);
 
+	dquot_mark_dquot_dirty(dquot);
 	/* if we are using journalled quota */
 	if (is_journalled_quota(sbi))
 		set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH);
 
-	return ret;
+	return 0;
 }
 
 static int f2fs_dquot_commit_info(struct super_block *sb, int type)
-- 
2.34.3



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: Fix incorrect return value
  2024-04-04 13:47 [f2fs-dev] [PATCH] f2fs: Fix incorrect return value Wang Jianjian
@ 2024-04-07  6:23 ` Chao Yu
  2024-04-09  6:47   ` wangjianjian (C) via Linux-f2fs-devel
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2024-04-07  6:23 UTC (permalink / raw)
  To: Wang Jianjian; +Cc: jaegeuk, linux-f2fs-devel

On 2024/4/4 21:47, Wang Jianjian wrote:
> dquot_mark_dquot_dirty returns old dirty state not the error code.

I think it's fine to just pass return value of dquot_mark_dquot_dirty()
to caller, because caller can distinguish status from return value:
1) < 0, there is an error, 2) >= 0, there is no error, previously it is
dirty if it is 1.

Thanks,

> 
> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
> ---
>   fs/f2fs/super.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index a6867f26f141..af07027475d9 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -3063,13 +3063,13 @@ static int f2fs_dquot_mark_dquot_dirty(struct dquot *dquot)
>   {
>   	struct super_block *sb = dquot->dq_sb;
>   	struct f2fs_sb_info *sbi = F2FS_SB(sb);
> -	int ret = dquot_mark_dquot_dirty(dquot);
>   
> +	dquot_mark_dquot_dirty(dquot);
>   	/* if we are using journalled quota */
>   	if (is_journalled_quota(sbi))
>   		set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH);
>   
> -	return ret;
> +	return 0;
>   }
>   
>   static int f2fs_dquot_commit_info(struct super_block *sb, int type)


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: Fix incorrect return value
  2024-04-07  6:23 ` Chao Yu
@ 2024-04-09  6:47   ` wangjianjian (C) via Linux-f2fs-devel
  2024-04-11  9:28     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: wangjianjian (C) via Linux-f2fs-devel @ 2024-04-09  6:47 UTC (permalink / raw)
  To: linux-f2fs-devel

On 2024/4/7 14:23, Chao Yu wrote:
> On 2024/4/4 21:47, Wang Jianjian wrote:
>> dquot_mark_dquot_dirty returns old dirty state not the error code.
> 
> I think it's fine to just pass return value of dquot_mark_dquot_dirty()
> to caller, because caller can distinguish status from return value:
> 1) < 0, there is an error, 2) >= 0, there is no error, previously it is
> dirty if it is 1.
mark_all_dquot_dirty uses if return value is 0 to save error code. It 
may cause mess.
By the way, I am fine don't change it.

> 
> Thanks,
> 
>>
>> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
>> ---
>>   fs/f2fs/super.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>> index a6867f26f141..af07027475d9 100644
>> --- a/fs/f2fs/super.c
>> +++ b/fs/f2fs/super.c
>> @@ -3063,13 +3063,13 @@ static int f2fs_dquot_mark_dquot_dirty(struct 
>> dquot *dquot)
>>   {
>>       struct super_block *sb = dquot->dq_sb;
>>       struct f2fs_sb_info *sbi = F2FS_SB(sb);
>> -    int ret = dquot_mark_dquot_dirty(dquot);
>> +    dquot_mark_dquot_dirty(dquot);
>>       /* if we are using journalled quota */
>>       if (is_journalled_quota(sbi))
>>           set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH);
>> -    return ret;
>> +    return 0;
>>   }
>>   static int f2fs_dquot_commit_info(struct super_block *sb, int type)
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
-- 
Regards



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: Fix incorrect return value
  2024-04-09  6:47   ` wangjianjian (C) via Linux-f2fs-devel
@ 2024-04-11  9:28     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2024-04-11  9:28 UTC (permalink / raw)
  To: wangjianjian (C), linux-f2fs-devel

On 2024/4/9 14:47, wangjianjian (C) via Linux-f2fs-devel wrote:
> On 2024/4/7 14:23, Chao Yu wrote:
>> On 2024/4/4 21:47, Wang Jianjian wrote:
>>> dquot_mark_dquot_dirty returns old dirty state not the error code.
>>
>> I think it's fine to just pass return value of dquot_mark_dquot_dirty()
>> to caller, because caller can distinguish status from return value:
>> 1) < 0, there is an error, 2) >= 0, there is no error, previously it is
>> dirty if it is 1.
> mark_all_dquot_dirty uses if return value is 0 to save error code. It may cause mess.

I didn't get your point...

No caller of mark_all_dquot_dirty() cares about its return value, so,
I think there is no practical problem now.

> By the way, I am fine don't change it.
> 
>>
>> Thanks,
>>
>>>
>>> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
>>> ---
>>>   fs/f2fs/super.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>>> index a6867f26f141..af07027475d9 100644
>>> --- a/fs/f2fs/super.c
>>> +++ b/fs/f2fs/super.c
>>> @@ -3063,13 +3063,13 @@ static int f2fs_dquot_mark_dquot_dirty(struct dquot *dquot)
>>>   {
>>>       struct super_block *sb = dquot->dq_sb;
>>>       struct f2fs_sb_info *sbi = F2FS_SB(sb);
>>> -    int ret = dquot_mark_dquot_dirty(dquot);
>>> +    dquot_mark_dquot_dirty(dquot);
>>>       /* if we are using journalled quota */
>>>       if (is_journalled_quota(sbi))
>>>           set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH);
>>> -    return ret;
>>> +    return 0;
>>>   }
>>>   static int f2fs_dquot_commit_info(struct super_block *sb, int type)
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2024-04-11  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 13:47 [f2fs-dev] [PATCH] f2fs: Fix incorrect return value Wang Jianjian
2024-04-07  6:23 ` Chao Yu
2024-04-09  6:47   ` wangjianjian (C) via Linux-f2fs-devel
2024-04-11  9:28     ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).