lkml.org 
[lkml]   [2023]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] ext4: reduce unnecessary memory allocation in alloc_flex_gd()
On Wed 18-10-23 19:42:21, Baokun Li wrote:
> When a large flex_bg file system is resized, the number of groups to be
> added may be small, and a large amount of memory that will not be used will
> be allocated. Therefore, resize_bg can be set to the size after the number
> of new_group_data to be used is aligned upwards to the power of 2. This
> does not affect the disk layout after online resize and saves some memory.
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Looks good, just one small comment below. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>


> @@ -248,6 +250,14 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size)
> else
> flex_gd->resize_bg = flexbg_size;
>
> + /* Avoid allocating new groups that will not be used. */

Perhaps make the comment more understandable like:
/* Avoid allocating large 'groups' array if not needed */

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR

\
 
 \ /
  Last update: 2023-10-19 13:58    [W:0.140 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site