All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zheng Liu <gnehzuil.liu@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] ext4: Don't count free clusters from a corrupt block group
Date: Sun, 29 Sep 2013 14:20:45 +0800	[thread overview]
Message-ID: <20130929062045.GA10285@gmail.com> (raw)
In-Reply-To: <20130928001357.25857.94425.stgit@birch.djwong.org>

On Fri, Sep 27, 2013 at 05:13:57PM -0700, Darrick J. Wong wrote:
> A bg that's been flagged "corrupt" by definition has no free blocks, so that
> the allocator won't be tempted to use the damaged bg.  Therefore, we shouldn't
> count the clusters in the damaged group when calculating free counts.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>

                                                - Zheng

> ---
>  fs/ext4/balloc.c |   13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index dc5d572..6ea7b14 100644
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -640,6 +640,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
>  	struct ext4_group_desc *gdp;
>  	ext4_group_t i;
>  	ext4_group_t ngroups = ext4_get_groups_count(sb);
> +	struct ext4_group_info *grp;
>  #ifdef EXT4FS_DEBUG
>  	struct ext4_super_block *es;
>  	ext4_fsblk_t bitmap_count;
> @@ -655,7 +656,11 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
>  		gdp = ext4_get_group_desc(sb, i, NULL);
>  		if (!gdp)
>  			continue;
> -		desc_count += ext4_free_group_clusters(sb, gdp);
> +		grp = NULL;
> +		if (EXT4_SB(sb)->s_group_info)
> +			grp = ext4_get_group_info(sb, i);
> +		if (!grp || !EXT4_MB_GRP_BBITMAP_CORRUPT(grp))
> +			desc_count += ext4_free_group_clusters(sb, gdp);
>  		brelse(bitmap_bh);
>  		bitmap_bh = ext4_read_block_bitmap(sb, i);
>  		if (bitmap_bh == NULL)
> @@ -679,7 +684,11 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
>  		gdp = ext4_get_group_desc(sb, i, NULL);
>  		if (!gdp)
>  			continue;
> -		desc_count += ext4_free_group_clusters(sb, gdp);
> +		grp = NULL;
> +		if (EXT4_SB(sb)->s_group_info)
> +			grp = ext4_get_group_info(sb, i);
> +		if (!grp || !EXT4_MB_GRP_BBITMAP_CORRUPT(grp))
> +			desc_count += ext4_free_group_clusters(sb, gdp);
>  	}
>  
>  	return desc_count;
> 

  reply	other threads:[~2013-09-29  6:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-28  0:13 [PATCH v1.1 0/2] ext4: Shut down block groups when damage is detected, part 2 Darrick J. Wong
2013-09-28  0:13 ` [PATCH 1/2] ext4: Don't count free clusters from a corrupt block group Darrick J. Wong
2013-09-29  6:20   ` Zheng Liu [this message]
2013-10-30 15:21   ` Theodore Ts'o
2013-09-28  0:14 ` [PATCH 2/2] ext4: Spot-check block group sub-table locations Darrick J. Wong
2013-09-29  6:44   ` Zheng Liu
2013-10-09 22:08     ` Darrick J. Wong
2013-10-30 16:45       ` Theodore Ts'o
2013-10-30 17:33         ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2013-09-27  0:03 [PATCH v1 0/2] ext4: Shut down block groups when damage is detected, part 2 Darrick J. Wong
2013-09-27  0:03 ` [PATCH 1/2] ext4: Don't count free clusters from a corrupt block group Darrick J. Wong
2013-09-27  5:37   ` Zheng Liu
2013-09-27 18:03     ` Darrick J. Wong

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=20130929062045.GA10285@gmail.com \
    --to=gnehzuil.liu@gmail.com \
    --cc=darrick.wong@oracle.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.