linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Michael Rubin <mrubin@google.com>,
	Curt Wohlgemuth <curtw@google.com>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: Fallback to vmalloc if kmalloc can't allocate s_flex_groups array
Date: Fri, 24 Apr 2009 22:28:04 -0500	[thread overview]
Message-ID: <49F28344.4010707@redhat.com> (raw)
In-Reply-To: <1240628459-25582-1-git-send-email-tytso@mit.edu>

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@mit.edu>
> ---
>  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

  reply	other threads:[~2009-04-25  3:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 14:32 Use of kmalloc vs vmalloc in ext4? Curt Wohlgemuth
2009-04-06  6:45 ` Michael Rubin
2009-04-06  9:33   ` Andreas Dilger
2009-04-25  3:00   ` [PATCH] ext4: Fallback to vmalloc if kmalloc can't allocate s_flex_groups array Theodore Ts'o
2009-04-25  3:28     ` Eric Sandeen [this message]
2009-04-25  3:57       ` Theodore Tso
2009-04-25  3:07   ` Use of kmalloc vs vmalloc in ext4? Theodore Tso
2009-04-25  3:39     ` Theodore Tso
2009-04-26  2:12       ` Theodore Tso

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=49F28344.4010707@redhat.com \
    --to=sandeen@redhat.com \
    --cc=curtw@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mrubin@google.com \
    --cc=tytso@mit.edu \
    /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).