summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gerst <bgerst@didntduck.org>2002-03-12 01:50:41 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-03-12 01:50:41 -0800
commitf7d5152e59bb1565c457a4802b9c8348a407249c (patch)
treefec08be9311623d8df7aa034855058fd159ef4a0
parent1b156290adaa3e8ead662a428f1adaea1807a6e1 (diff)
[PATCH] struct super_block cleanup - ext2
Complete the ext2 superblock seperation.
-rw-r--r--fs/ext2/super.c19
-rw-r--r--include/linux/ext2_fs.h3
-rw-r--r--include/linux/fs.h2
3 files changed, 16 insertions, 8 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index e0d85dada3ac..872756bdcd22 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -146,6 +146,8 @@ void ext2_put_super (struct super_block * sb)
if (sbi->s_block_bitmap[i])
brelse (sbi->s_block_bitmap[i]);
brelse (sbi->s_sbh);
+ sb->u.generic_sbp = NULL;
+ kfree(sbi);
return;
}
@@ -463,7 +465,11 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
int db_count;
int i, j;
- sbi = EXT2_SB(sb);
+ sbi = kmalloc(sizeof(struct ext2_super_block), GFP_KERNEL);
+ if (!sbi)
+ return -ENOMEM;
+ sb->u.generic_sbp = sbi;
+
/*
* See what the current blocksize for the device is, and
* use that as the blocksize. Otherwise (or if the blocksize
@@ -475,12 +481,12 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
sbi->s_mount_opt = 0;
if (!parse_options ((char *) data, &sb_block, &resuid, &resgid,
&sbi->s_mount_opt))
- return -EINVAL;
+ goto failed_sbi;
blocksize = sb_min_blocksize(sb, BLOCK_SIZE);
if (!blocksize) {
printk ("EXT2-fs: unable to set blocksize\n");
- return -EINVAL;
+ goto failed_sbi;
}
/*
@@ -495,7 +501,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
if (!(bh = sb_bread(sb, logic_sb_block))) {
printk ("EXT2-fs: unable to read superblock\n");
- return -EINVAL;
+ goto failed_sbi;
}
/*
* Note: s_es must be initialized as soon as possible because
@@ -541,7 +547,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
if (!sb_set_blocksize(sb, blocksize)) {
printk(KERN_ERR "EXT2-fs: blocksize too small for device.\n");
- return -EINVAL;
+ goto failed_sbi;
}
logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
@@ -699,6 +705,9 @@ failed_mount2:
kfree(sbi->s_group_desc);
failed_mount:
brelse(bh);
+failed_sbi:
+ sb->u.generic_sbp = NULL;
+ kfree(sbi);
return -EINVAL;
}
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 25c559767b91..527c8f0bf0db 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -17,6 +17,7 @@
#define _LINUX_EXT2_FS_H
#include <linux/types.h>
+#include <linux/ext2_fs_sb.h>
/*
* The second extended filesystem constants/structures
@@ -73,7 +74,7 @@
#ifdef __KERNEL__
static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
{
- return &sb->u.ext2_sb;
+ return sb->u.generic_sbp;
}
#else
/* Assume that user mode programs are passing in an ext2fs superblock, not
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 74ac6c530de3..09096196a424 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -648,7 +648,6 @@ struct quota_mount_options
#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
#define MNT_DETACH 0x00000002 /* Just detach from the tree */
-#include <linux/ext2_fs_sb.h>
#include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h>
#include <linux/ntfs_fs_sb.h>
@@ -703,7 +702,6 @@ struct super_block {
char s_id[32]; /* Informational name */
union {
- struct ext2_sb_info ext2_sb;
struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb;
struct ntfs_sb_info ntfs_sb;