From: tytso@mit.edu
To: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: [PATCH] ext2/3 bugfix 5/6: Fix meta_bg compatibility with e2fsprogs
Date: Wed, 06 Nov 2002 22:59:27 -0500 [thread overview]
Message-ID: <E189dpH-0007Gi-00@snap.thunk.org> (raw)
Fix meta_bg compatibility with e2fsprogs 1.30.
The algorithm for finding the block group descriptor blocks for the
future on-line resizable ext2/3 format change got out of sync with
what was actually shipped in e2fsprogs 1.30. (And what is in e2fsprogs
1.30 is better since it avoids a free block fragmentation at the
beginning of the block group.) This change is safe, since no one is
actually using the new meta_bg block group layout just yet.
fs/ext2/super.c | 5 ++++-
fs/ext3/super.c | 5 ++++-
include/linux/ext3_fs.h | 5 ++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff -Nru a/fs/ext2/super.c b/fs/ext2/super.c
--- a/fs/ext2/super.c Wed Nov 6 22:26:51 2002
+++ b/fs/ext2/super.c Wed Nov 6 22:26:51 2002
@@ -529,6 +529,7 @@
{
struct ext2_sb_info *sbi = EXT2_SB(sb);
unsigned long bg, first_data_block, first_meta_bg;
+ int has_super = 0;
first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block);
first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
@@ -537,7 +538,9 @@
nr < first_meta_bg)
return (logic_sb_block + nr + 1);
bg = sbi->s_desc_per_block * nr;
- return (first_data_block + 1 + (bg * sbi->s_blocks_per_group));
+ if (ext2_bg_has_super(sb, bg))
+ has_super = 1;
+ return (first_data_block + has_super + (bg * sbi->s_blocks_per_group));
}
static int ext2_fill_super(struct super_block *sb, void *data, int silent)
diff -Nru a/fs/ext3/super.c b/fs/ext3/super.c
--- a/fs/ext3/super.c Wed Nov 6 22:26:51 2002
+++ b/fs/ext3/super.c Wed Nov 6 22:26:51 2002
@@ -979,6 +979,7 @@
{
struct ext3_sb_info *sbi = EXT3_SB(sb);
unsigned long bg, first_data_block, first_meta_bg;
+ int has_super = 0;
first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block);
first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
@@ -987,7 +988,9 @@
nr < first_meta_bg)
return (logic_sb_block + nr + 1);
bg = sbi->s_desc_per_block * nr;
- return (first_data_block + 1 + (bg * sbi->s_blocks_per_group));
+ if (ext3_bg_has_super(sb, bg))
+ has_super = 1;
+ return (first_data_block + has_super + (bg * sbi->s_blocks_per_group));
}
diff -Nru a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
--- a/include/linux/ext3_fs.h Wed Nov 6 22:26:51 2002
+++ b/include/linux/ext3_fs.h Wed Nov 6 22:26:51 2002
@@ -513,10 +513,9 @@
#define EXT3_FEATURE_INCOMPAT_META_BG 0x0010
#define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
-#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
- EXT2_FEATURE_INCOMPAT_META_BG)
#define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| \
- EXT3_FEATURE_INCOMPAT_RECOVER)
+ EXT3_FEATURE_INCOMPAT_RECOVER| \
+ EXT3_FEATURE_INCOMPAT_META_BG)
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
reply other threads:[~2002-11-07 3:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E189dpH-0007Gi-00@snap.thunk.org \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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.