PATCH 2.5.2.9: ext2 unbork fs.h (part 3/7)
Subsystems (2)
patch3 desc: dynamically allocate sb->u.ext2_sbp
fs/ext2/balloc.c +1 -0
@@ -14,6 +14,7 @@#include <linux/config.h> #include <linux/fs.h> #include <linux/ext2_fs.h> +#include <linux/ext2_fs_sb.h> #include <linux/locks.h> #include <linux/quotaops.h>
fs/ext2/dir.c +1 -0
@@ -23,6 +23,7 @@#include <linux/fs.h> #include <linux/ext2_fs.h> +#include <linux/ext2_fs_sb.h> #include <linux/pagemap.h> typedef struct ext2_dir_entry_2 ext2_dirent ;
fs/ext2/ialloc.c +1 -0
@@ -15,6 +15,7 @@#include <linux/config.h> #include <linux/fs.h> #include <linux/ext2_fs.h> +#include <linux/ext2_fs_sb.h> #include <linux/locks.h> #include <linux/quotaops.h>
fs/ext2/inode.c +1 -0
@@ -24,6 +24,7 @@#include <linux/fs.h> #include <linux/ext2_fs.h> +#include <linux/ext2_fs_sb.h> #include <linux/locks.h> #include <linux/smp_lock.h> #include <linux/sched.h>
fs/ext2/super.c +16 -7
@@ -21,6 +21,7 @@#include <linux/string.h> #include <linux/fs.h> #include <linux/ext2_fs.h> +#include <linux/ext2_fs_sb.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/locks.h>
@@ -149,7 +150,8 @@brelse (esb->s_block_bitmap[i]);brelse (esb->s_sbh); -return ; +kfree (esb); + sb->u.ext2_sbp =NULL ; }static struct super_operations ext2_sops = {
@@ -419,8 +421,12 @@int i, j;struct ext2_sb_info *esb; -/* when dynamically allocated, this will change */ - esb =ext2_sb (sb); +/* dynamically allocate fs-private sb data */ + sb->u.ext2_sbp =kmalloc (sizeof (*esb),GFP_NOFS ); +if (!sb->u.ext2_sbp) +return NULL ; + esb = sb->u.ext2_sbp; +memset (esb,0 ,sizeof (*esb));/* * See what the current blocksize for the device is, and
@@ -433,13 +439,13 @@ esb->s_mount_opt =0 ;if (!parse_options ((char *) data, &sb_block, &resuid, &resgid, &esb->s_mount_opt)) { -return NULL ; + goto err; } blocksize =sb_min_blocksize (sb,BLOCK_SIZE );if (!blocksize) {printk ("EXT2-fs: unable to set blocksize\n" ); -return NULL ; + goto err; }/*
@@ -454,7 +460,7 @@if (!(bh =sb_bread (sb, logic_sb_block))) {printk ("EXT2-fs: unable to read superblock\n" ); -return NULL ; + goto err; }/* * Note: s_es must be initialized as soon as possible because
@@ -500,7 +506,7 @@if (!sb_set_blocksize (sb, blocksize)) {printk (KERN_ERR "EXT2-fs: blocksize too small for device.\n" ); -return NULL ; + goto err; } logic_sb_block = (sb_block*BLOCK_SIZE ) / blocksize;
@@ -658,6 +664,9 @@kfree (esb->s_group_desc); failed_mount:brelse (bh); +err: +kfree (esb); + sb->u.ext2_sbp =NULL ;return NULL ; }
include/linux/ext2_fs.h +2 -2
@@ -604,9 +604,9 @@static inline struct ext2_sb_info *ext2_sb (struct super_block *sb) { -if (!sb) +if (!sb->u.ext2_sbp)BUG (); -return &sb->u.ext2_sb; +return sb->u.ext2_sbp; }extern void ext2_error (struct super_block *,const char *,const char *, ...)
include/linux/fs.h +5 -2
@@ -664,7 +664,6 @@#define MNT_DETACH 0x00000002/* Just detach from the tree */ #include <linux/minix_fs_sb.h> -#include <linux/ext2_fs_sb.h> #include <linux/ext3_fs_sb.h> #include <linux/hpfs_fs_sb.h> #include <linux/ntfs_fs_sb.h>
@@ -687,6 +686,8 @@#include <linux/cramfs_fs_sb.h> #include <linux/jffs2_fs_sb.h> +struct ext2_sb_info ; +extern struct list_head super_blocks;extern spinlock_t sb_lock;
@@ -722,7 +723,6 @@union {struct minix_sb_info minix_sb; -struct ext2_sb_info ext2_sb;struct ext3_sb_info ext3_sb;struct hpfs_sb_info hpfs_sb;struct ntfs_sb_info ntfs_sb;
@@ -745,6 +745,9 @@struct ncp_sb_info ncpfs_sb;struct jffs2_sb_info jffs2_sb;struct cramfs_sb_info cramfs_sb; + +struct ext2_sb_info *ext2_sbp; +void *generic_sbp; } u;/*