All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: don't load the block bitmap for block groups which have no space
Date: Mon, 13 Aug 2012 11:02:08 -0500	[thread overview]
Message-ID: <50292500.1070807@redhat.com> (raw)
In-Reply-To: <1344622885-14982-1-git-send-email-tytso@mit.edu>

On 8/10/12 1:21 PM, Theodore Ts'o wrote:
> Add a short circuit check to ext4_mb_group_group() so that we don't
> bother to load the block bitmap for a block group which does not have
> any space available.  (Or which does not have enough space until we
> are in desperation mode, i.e., when cr == 3.)
> 
> Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=45741
> Reported-by: mirek@me.com
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

Looks ok to me; I think this just further optimizes what was done
in

8a57d9d61a6e361c7bb159dda797672c1df1a691
ext4: check for a good block group before loading buddy pages

correct?

-Eric

> ---
>  fs/ext4/mballoc.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 8eae947..3a57975 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1862,6 +1862,12 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
>  
>  	BUG_ON(cr < 0 || cr >= 4);
>  
> +	free = grp->bb_free;
> +	if (free == 0)
> +		return 0;
> +	if (cr <= 2 && free < ac->ac_g_ex.fe_len)
> +		return 0;
> +
>  	/* We only do this if the grp has never been initialized */
>  	if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
>  		int ret = ext4_mb_init_group(ac->ac_sb, group);
> @@ -1869,10 +1875,7 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
>  			return 0;
>  	}
>  
> -	free = grp->bb_free;
>  	fragments = grp->bb_fragments;
> -	if (free == 0)
> -		return 0;
>  	if (fragments == 0)
>  		return 0;
>  
> 


  reply	other threads:[~2012-08-13 16:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 16:42 [Bug 45741] New: ext4 scans all disk when calling fallocate after mount on 99% full volume bugzilla-daemon
2012-08-09 18:10 ` [Bug 45741] " bugzilla-daemon
2012-08-10 18:21   ` [PATCH] ext4: don't load the block bitmap for block groups which have no space Theodore Ts'o
2012-08-13 16:02     ` Eric Sandeen [this message]
2012-08-13 18:49       ` Theodore Ts'o
2012-08-13 18:51         ` Eric Sandeen
2012-08-13 23:20         ` Andreas Dilger
2012-10-15 21:24 ` [Bug 45741] ext4 scans all disk when calling fallocate after mount on 99% full volume bugzilla-daemon
2012-11-08 14:21 ` bugzilla-daemon

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=50292500.1070807@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.