linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Andre Noll <maan@systemlinux.org>
Cc: Theodore Ts'o <tytso@mit.edu>,
	linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Eric Sandeen <esandeen@redhat.com>
Subject: Re: ext3: bogus i_mode errors with 2.6.18.1
Date: Tue, 14 Nov 2006 17:03:56 -0700	[thread overview]
Message-ID: <20061115000356.GA14624@schatzie.adilger.int> (raw)
In-Reply-To: <20061030095558.GB6446@skl-net.de>

On Oct 30, 2006  10:55 +0100, Andre Noll wrote:
> Note that the patch does not address the EXT3_FEATURE_INCOMPAT_META_BG
> case yet. I'll have to look at this in more detail.

See more below...  Basically, the patch looks good enough to submit for
inclusion.  Can you CC it to Andrew on the next iteration.

> +static inline int block_needs_fix(ext3_fsblk_t block,
> +		unsigned long num,
> +		struct ext3_group_desc *gdp,
> +		struct super_block *sb)
> +{
> +	if (in_range(le32_to_cpu(gdp->bg_block_bitmap), block, num))
> +		return 1;
> +	if (in_range(le32_to_cpu(gdp->bg_inode_bitmap), block, num))
> +		return 1;
> +	if (in_range(block, le32_to_cpu(gdp->bg_inode_table),
> +			EXT3_SB(sb)->s_itb_per_group))
> +		return 1;
> +	if (in_range(block + num - 1, le32_to_cpu(gdp->bg_inode_table),
> +			EXT3_SB(sb)->s_itb_per_group))
> +		return 1;

This _should_ probably also include a check for the backup group descriptors
and superblock, but unfortunately the helpers ext3_bg_has_super() and
ext3_bg_num_gdb() are fairly CPU intensive and not something you want to
check for each block that is allocated/freed.  In the future (mballoc) when
we have per-group data structs we can just store a flag per group whether
it has a backup or not instead of recomputing the powers of 3, 5, 7 each time.
Maybe a comment for now to indicate that needs to be fixed in the future?


Also a minor nit - this is actually checking "num" blocks, and it might be
useful in the future so it would be clearer to call it something like
ext3_blocks_are_metadata().

> +static void fix_group(int group, struct super_block *sb)
> +{
> +	int i;
> +	ext3_fsblk_t bit;
> +	unsigned long gdblocks;
> +	struct buffer_head *gdp_bh;
> +	struct ext3_group_desc *gdp = ext3_get_group_desc(sb, group, &gdp_bh);
> +
> +	if (ext3_bg_has_super(sb, group))
> +		ext3_set_bit(0, gdp_bh->b_data);
> +	gdblocks = ext3_bg_num_gdb(sb, group);
> +	for (i = 0, bit = 1; i < gdblocks; i++, bit++)
> +		/* actually a bit more complex for INCOMPAT_META_BG fs */
> +		ext3_set_bit(i, gdp_bh->b_data);

Actually, in newer kernels ext3_bg_num_gdb() includes INCOMPAT_META_BG
support, so that may be enough.


Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

  reply	other threads:[~2006-11-15  0:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20061023144556.GY22487@skl-net.de>
2006-10-23 16:44 ` ext3: bogus i_mode errors with 2.6.18.1 Andreas Dilger
2006-10-23 20:02   ` Andreas Dilger
2006-10-24  9:14     ` Andre Noll
2006-10-24 20:27       ` Andreas Dilger
2006-10-25  9:44         ` Andre Noll
2006-10-26  9:36           ` Andreas Dilger
2006-10-26 16:02             ` Andre Noll
2006-10-26 18:01               ` Andreas Dilger
2006-10-27 15:34                 ` Andre Noll
2006-10-28 14:24                   ` Andreas Dilger
2006-10-30  9:55                     ` Andre Noll
2006-11-15  0:03                       ` Andreas Dilger [this message]
2006-11-15 14:30                         ` Andre Noll

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=20061115000356.GA14624@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=esandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maan@systemlinux.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;
as well as URLs for NNTP newsgroup(s).