public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Jason Yan <yanaijie@huawei.com>, tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: make ext4_mb_initialize_context return void
Date: Thu, 27 Oct 2022 16:12:45 +0800	[thread overview]
Message-ID: <23c58b71-8dbc-b314-de53-31e2593f94d4@linux.dev> (raw)
In-Reply-To: <bf9dba6f-50c6-5ba8-31e3-b60de18105f1@huawei.com>



On 10/27/22 2:29 PM, Jason Yan wrote:
>
> On 2022/10/27 11:24, Guoqing Jiang wrote:
>> Change the return type to void since it always return 0, and no need
>> to do the checking in ext4_mb_new_blocks.
>>
>> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
>> ---
>>   fs/ext4/mballoc.c | 10 ++--------
>>   1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
>> index 9dad93059945..5b2ae37a8b80 100644
>> --- a/fs/ext4/mballoc.c
>> +++ b/fs/ext4/mballoc.c
>> @@ -5204,7 +5204,7 @@ static void ext4_mb_group_or_file(struct 
>> ext4_allocation_context *ac)
>>       mutex_lock(&ac->ac_lg->lg_mutex);
>>   }
>>   -static noinline_for_stack int
>> +static noinline_for_stack void
>>   ext4_mb_initialize_context(struct ext4_allocation_context *ac,
>>                   struct ext4_allocation_request *ar)
>>   {
>> @@ -5253,8 +5253,6 @@ ext4_mb_initialize_context(struct 
>> ext4_allocation_context *ac,
>>               (unsigned) ar->lleft, (unsigned) ar->pleft,
>>               (unsigned) ar->lright, (unsigned) ar->pright,
>>               inode_is_open_for_write(ar->inode) ? "" : "non-");
>> -    return 0;
>> -
>>   }
>>     static noinline_for_stack void
>> @@ -5591,11 +5589,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
>>           goto out;
>>       }
>>   -    *errp = ext4_mb_initialize_context(ac, ar);
>> -    if (*errp) {
>> -        ar->len = 0;
>> -        goto out;
>> -    }
>> +    ext4_mb_initialize_context(ac, ar);
>
> This changed the logic here slightly. *errp will not be intialized 
> with zero after this change. So we need to carefully check whether 
> this will cause any issues.

Yes, thanks for reminder. I think "*errp" is always set later with below.

https://elixir.bootlin.com/linux/v6.1-rc2/source/fs/ext4/mballoc.c#L5606
https://elixir.bootlin.com/linux/v6.1-rc2/source/fs/ext4/mballoc.c#L5611
https://elixir.bootlin.com/linux/v6.1-rc2/source/fs/ext4/mballoc.c#L5629
https://elixir.bootlin.com/linux/v6.1-rc2/source/fs/ext4/mballoc.c#L5646

Is there any place where don't set it accordfingly? If so,  the below 
should be kept.

*errp = ext4_mb_initialize_context(ac, ar);

Thanks,
Guoqing

  reply	other threads:[~2022-10-27  8:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27  3:24 [PATCH] ext4: make ext4_mb_initialize_context return void Guoqing Jiang
2022-10-27  6:29 ` Jason Yan
2022-10-27  8:12   ` Guoqing Jiang [this message]
2022-10-28 10:54     ` Ojaswin Mujoo
2022-10-29  2:56       ` Guoqing Jiang

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=23c58b71-8dbc-b314-de53-31e2593f94d4@linux.dev \
    --to=guoqing.jiang@linux.dev \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yanaijie@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox