Re: [PATCH] ext4: Fallback to vmalloc if kmalloc can't allocate s_flex_groups array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Theodore Ts'o wrote:
> For very large filesystems, the s_flex_groups array can get quite big.
> For example, a 16TB filesystem will have 8192 flex groups by default,
> so the array is 96k, which is marginal for kmalloc().  On the other
> hand, a 160GB filesystem will have 80 flex groups, so the array will
> be 960 bytes.  So we try to allocate the array first using kmalloc(),
> and if that fails, we'll try to use vmalloc() instead.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx>
> ---
>  fs/ext4/super.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 

...

> @@ -2849,7 +2855,10 @@ failed_mount3:
>  failed_mount2:
>  	for (i = 0; i < db_count; i++)
>  		brelse(sbi->s_group_desc[i]);
> -	kfree(sbi->s_group_desc);
> +	if (is_vmalloc_addr(sbi->s_group_desc))
> +		vfree(sbi->s_group_desc);
> +	else
> +		kfree(sbi->s_group_desc);
>  failed_mount:
>  	if (sbi->s_proc) {
>  		remove_proc_entry(sb->s_id, ext4_proc_root);

er, won't you need the same vfree/kfree treatment in ext4_put_super? :)

-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux