linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huaweicloud.com>
To: Jan Kara <jack@suse.cz>, yangerkun <yangerkun@huawei.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] ext4: remove unused buddy_loaded in ext4_mb_seq_groups_show
Date: Thu, 18 Jan 2024 12:22:31 +0800	[thread overview]
Message-ID: <b3d2acd5-8289-59fd-c7b4-9befecdc03f5@huaweicloud.com> (raw)
In-Reply-To: <20240117125647.4gyqfhngii2dxnlo@quack3>



在 2024/1/17 20:56, Jan Kara 写道:
> On Wed 17-01-24 19:52:22, yangerkun wrote:
>> We can just first call ext4_mb_unload_buddy, then copy information from
>> ext4_group_info. So remove this unused value.
>>
>> Signed-off-by: yangerkun <yangerkun@huawei.com>
> 
> Looks good. Feel free to add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>
> 
> Although I'd prefer if you add a comment before memcpy() like:
> 
> 	/*
> 	 * We care only about free space counters in the group info and
> 	 * these are safe to access even after the buddy has been unloaded
> 	 */
> 
> 								Honza
> 

Thanks a lot for your review! I will do it next version!

>> ---
>>   fs/ext4/mballoc.c | 9 ++-------
>>   1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
>> index f44f668e407f..139f232bdbb5 100644
>> --- a/fs/ext4/mballoc.c
>> +++ b/fs/ext4/mballoc.c
>> @@ -2990,8 +2990,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
>>   {
>>   	struct super_block *sb = pde_data(file_inode(seq->file));
>>   	ext4_group_t group = (ext4_group_t) ((unsigned long) v);
>> -	int i;
>> -	int err, buddy_loaded = 0;
>> +	int i, err;
>>   	struct ext4_buddy e4b;
>>   	struct ext4_group_info *grinfo;
>>   	unsigned char blocksize_bits = min_t(unsigned char,
>> @@ -3021,14 +3020,10 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
>>   			seq_printf(seq, "#%-5u: I/O error\n", group);
>>   			return 0;
>>   		}
>> -		buddy_loaded = 1;
>> +		ext4_mb_unload_buddy(&e4b);
>>   	}
>>   
>>   	memcpy(&sg, grinfo, i);
>> -
>> -	if (buddy_loaded)
>> -		ext4_mb_unload_buddy(&e4b);
>> -
>>   	seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free,
>>   			sg.info.bb_fragments, sg.info.bb_first_free);
>>   	for (i = 0; i <= 13; i++)
>> -- 
>> 2.39.2
>>


      reply	other threads:[~2024-01-18  4:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 11:52 [PATCH 1/2] ext4: remove unused buddy_loaded in ext4_mb_seq_groups_show yangerkun
2024-01-17 11:52 ` [PATCH 2/2] ext4: distinguish different error " yangerkun
2024-01-17 12:58   ` Jan Kara
2024-01-17 12:56 ` [PATCH 1/2] ext4: remove unused buddy_loaded " Jan Kara
2024-01-18  4:22   ` yangerkun [this message]

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=b3d2acd5-8289-59fd-c7b4-9befecdc03f5@huaweicloud.com \
    --to=yangerkun@huaweicloud.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yangerkun@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;
as well as URLs for NNTP newsgroup(s).