From: tytso@mit.edu
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [1/4]: Ext2/3 updates: Fix/simplify alternate superblock logic
Date: Tue, 12 Nov 2002 01:33:11 -0500 [thread overview]
Message-ID: <E18BUbn-0005ix-00@snap.thunk.org> (raw)
Fix/simplify alternate superblock logic
Fix bugs when specifying an alternate superblock as a mount option; not
all of the cases where a alternate sb was specified and a block device
whose hardware blocksize was not 1024 worked correctly (and the failure
mode was different for ext2 and ext3). The code has been tightened up
and simplified, so that it is right in all of the permutations of these
cases.
ext2/super.c | 12 +++++-------
ext3/super.c | 10 ++++------
2 files changed, 9 insertions(+), 13 deletions(-)
diff -Nru a/fs/ext2/super.c b/fs/ext2/super.c
--- a/fs/ext2/super.c Tue Nov 12 01:12:15 2002
+++ b/fs/ext2/super.c Tue Nov 12 01:12:15 2002
@@ -548,9 +548,9 @@
struct buffer_head * bh;
struct ext2_sb_info * sbi;
struct ext2_super_block * es;
- unsigned long block, sb_block = 1;
- unsigned long logic_sb_block = get_sb_block(&data);
- unsigned long offset = 0;
+ unsigned long block, sb_block = get_sb_block(&data);
+ unsigned long logic_sb_block;
+ unsigned long offset;
unsigned long def_mount_opts;
int blocksize = BLOCK_SIZE;
int db_count;
@@ -579,10 +579,8 @@
* If the superblock doesn't start on a hardware sector boundary,
* calculate the offset.
*/
- if (blocksize != BLOCK_SIZE) {
- logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
- offset = (sb_block*BLOCK_SIZE) % blocksize;
- }
+ logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
+ offset = (sb_block*BLOCK_SIZE) % blocksize;
if (!(bh = sb_bread(sb, logic_sb_block))) {
printk ("EXT2-fs: unable to read superblock\n");
diff -Nru a/fs/ext3/super.c b/fs/ext3/super.c
--- a/fs/ext3/super.c Tue Nov 12 01:12:15 2002
+++ b/fs/ext3/super.c Tue Nov 12 01:12:15 2002
@@ -1000,8 +1000,8 @@
struct ext3_super_block *es = 0;
struct ext3_sb_info *sbi;
unsigned long sb_block = get_sb_block(&data);
- unsigned long block, logic_sb_block = 1;
- unsigned long offset = 0;
+ unsigned long block, logic_sb_block;
+ unsigned long offset;
unsigned long journal_inum = 0;
unsigned long def_mount_opts;
int blocksize;
@@ -1033,10 +1033,8 @@
* The ext3 superblock will not be buffer aligned for other than 1kB
* block sizes. We need to calculate the offset from buffer start.
*/
- if (blocksize != EXT3_MIN_BLOCK_SIZE) {
- logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize;
- offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize;
- }
+ logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize;
+ offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize;
if (!(bh = sb_bread(sb, logic_sb_block))) {
printk (KERN_ERR "EXT3-fs: unable to read superblock\n");
reply other threads:[~2002-11-12 6:26 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=E18BUbn-0005ix-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox