Commit 1b23ec30 authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] struct superblock cleanup - minixfs

Switch to using kmalloc to allocate the minix superblock structure.
parent ddd7dce9
...@@ -70,6 +70,8 @@ static void minix_put_super(struct super_block *sb) ...@@ -70,6 +70,8 @@ static void minix_put_super(struct super_block *sb)
brelse(sbi->s_zmap[i]); brelse(sbi->s_zmap[i]);
brelse (sbi->s_sbh); brelse (sbi->s_sbh);
kfree(sbi->s_imap); kfree(sbi->s_imap);
sb->u.generic_sbp = NULL;
kfree(sbi);
return; return;
} }
...@@ -170,7 +172,12 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) ...@@ -170,7 +172,12 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
struct minix_super_block *ms; struct minix_super_block *ms;
int i, block; int i, block;
struct inode *root_inode; struct inode *root_inode;
struct minix_sb_info *sbi = minix_sb(s); struct minix_sb_info *sbi;
sbi = kmalloc(sizeof(struct minix_sb_info), GFP_KERNEL);
if (!sbi)
return -ENOMEM;
s->u.generic_sbp = sbi;
/* N.B. These should be compile-time tests. /* N.B. These should be compile-time tests.
Unfortunately that is impossible. */ Unfortunately that is impossible. */
...@@ -313,6 +320,8 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) ...@@ -313,6 +320,8 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
out_bad_sb: out_bad_sb:
printk("MINIX-fs: unable to read superblock\n"); printk("MINIX-fs: unable to read superblock\n");
out: out:
s->u.generic_sbp = NULL;
kfree(sbi);
return -EINVAL; return -EINVAL;
} }
......
...@@ -649,7 +649,6 @@ struct quota_mount_options ...@@ -649,7 +649,6 @@ struct quota_mount_options
#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
#define MNT_DETACH 0x00000002 /* Just detach from the tree */ #define MNT_DETACH 0x00000002 /* Just detach from the tree */
#include <linux/minix_fs_sb.h>
#include <linux/ext2_fs_sb.h> #include <linux/ext2_fs_sb.h>
#include <linux/ext3_fs_sb.h> #include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h> #include <linux/hpfs_fs_sb.h>
...@@ -707,7 +706,6 @@ struct super_block { ...@@ -707,7 +706,6 @@ struct super_block {
char s_id[32]; /* Informational name */ char s_id[32]; /* Informational name */
union { union {
struct minix_sb_info minix_sb;
struct ext2_sb_info ext2_sb; struct ext2_sb_info ext2_sb;
struct ext3_sb_info ext3_sb; struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb; struct hpfs_sb_info hpfs_sb;
......
...@@ -134,7 +134,7 @@ extern struct dentry_operations minix_dentry_operations; ...@@ -134,7 +134,7 @@ extern struct dentry_operations minix_dentry_operations;
static inline struct minix_sb_info *minix_sb(struct super_block *sb) static inline struct minix_sb_info *minix_sb(struct super_block *sb)
{ {
return &sb->u.minix_sb; return sb->u.generic_sbp;
} }
static inline struct minix_inode_info *minix_i(struct inode *inode) static inline struct minix_inode_info *minix_i(struct inode *inode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment