public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Guibouret <damien.guibouret@partition-saving.com>
To: Theodore Tso <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: s_first_meta_bg treatment incompatibility between kernel and e2fsprogs
Date: Mon, 16 Nov 2009 16:51:57 +0100	[thread overview]
Message-ID: <4B01751D.1010705@partition-saving.com> (raw)
In-Reply-To: <20091115192355.GD4323@mit.edu>

Hello,

Theodore Tso wrote:
> On Sun, Nov 15, 2009 at 11:28:13AM +0100, Damien Guibouret wrote:

[...]

> As far as the matter of taste issue is concerned, I think we already
> have too many static functions with a single caller, and it actually
> makes the code harder to understand.  So adding yet another simple
> static function I think is a bad thing, not a good thing.
> 

It was just to mimic the existing function, but I agree with you.
The other difference is that it shall be applied on ext3 also.

> 
>>And I think there is some other places where kernel should be fixed when  
>>it uses s_gdb_count (but here my knowledge of the sources are not deep  
>>enough to be sure on what shall be performed).
> 
> 
> I've looked through the other areas, and the one place where I see a
> problem is in the block validity checks in ext4_iget() for the
> extended attribute block and in block_validity.c.  The former can and
> should be fixed to use the latter.
> 
> Here's the fix that I plan to be using.   Comments, anyone?
>

For the first one (on block_validity.c), as far as I understand, 
presence of superblock and descriptors blocks in a group are no more 
related in case of meta_bg group, so shouldn't be the code divided into 
2 distincts part: one to treat super block, second to treat descriptor 
blocks (I do not understand the ((i < 5) || ((i % flex_size) == 0) part 
into the test, so add it if it is trully needed), something as:
		ext4_fsblk_t firstSystemBlock = ext4_group_first_block_no(sb, i);
		unsigned long nbDescBlocks;
                 if (ext4_bg_has_super(sb, i)) {
                         add_system_zone(sbi, firstSystemBlock,
                                         1);
			firstSystemBlock++;
		}
		nbDescBlocks = ext4_bg_num_gdb(sb, i);
		if (nbDescBlocks != 0)
			add_system_zone(sbi, firstSystemBlock,
                                         nbDescBlocks);

Regards,

Damien

> 							- Ted
> 
> ext4: fix block validity checks so they work correctly with meta_bg
> 
> The block validity checks used by ext4_data_block_valid() wasn't
> correctly written to check file systems with the meta_bg feature.  Fix
> this.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
>  fs/ext4/block_validity.c |    2 +-
>  fs/ext4/inode.c          |    5 +----
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
> index 50784ef..dc79b75 100644
> --- a/fs/ext4/block_validity.c
> +++ b/fs/ext4/block_validity.c
> @@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_block *sb)
>  		if (ext4_bg_has_super(sb, i) &&
>  		    ((i < 5) || ((i % flex_size) == 0)))
>  			add_system_zone(sbi, ext4_group_first_block_no(sb, i),
> -					sbi->s_gdb_count + 1);
> +					ext4_bg_num_gdb(sb, i) + 1);
>  		gdp = ext4_get_group_desc(sb, i, NULL);
>  		ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1);
>  		if (ret)
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index b5cdb88..c62ca93 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4886,10 +4886,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
>  
>  	ret = 0;
>  	if (ei->i_file_acl &&
> -	    ((ei->i_file_acl <
> -	      (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
> -	       EXT4_SB(sb)->s_gdb_count)) ||
> -	     (ei->i_file_acl >= ext4_blocks_count(EXT4_SB(sb)->s_es)))) {
> +	    !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
>  		ext4_error(sb, __func__,
>  			   "bad extended attribute block %llu in inode #%lu",
>  			   ei->i_file_acl, inode->i_ino);
> 
> 


      reply	other threads:[~2009-11-16 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11 12:09 s_first_meta_bg treatment incompatibility between kernel and e2fsprogs Damien Guibouret
2009-11-15  4:20 ` Theodore Tso
2009-11-15 10:28   ` Damien Guibouret
2009-11-15 19:23     ` Theodore Tso
2009-11-16 15:51       ` Damien Guibouret [this message]

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=4B01751D.1010705@partition-saving.com \
    --to=damien.guibouret@partition-saving.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox