Commit a8723f35 authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] struct super_block cleanup - efs

Separates efs_sb_info from struct super_block.
parent f8534f75
...@@ -70,10 +70,17 @@ static void destroy_inodecache(void) ...@@ -70,10 +70,17 @@ static void destroy_inodecache(void)
printk(KERN_INFO "efs_inode_cache: not all structures were freed\n"); printk(KERN_INFO "efs_inode_cache: not all structures were freed\n");
} }
void efs_put_super(struct super_block *s)
{
kfree(s->u.generic_sbp);
s->u.generic_sbp = NULL;
}
static struct super_operations efs_superblock_operations = { static struct super_operations efs_superblock_operations = {
alloc_inode: efs_alloc_inode, alloc_inode: efs_alloc_inode,
destroy_inode: efs_destroy_inode, destroy_inode: efs_destroy_inode,
read_inode: efs_read_inode, read_inode: efs_read_inode,
put_super: efs_put_super,
statfs: efs_statfs, statfs: efs_statfs,
}; };
...@@ -205,7 +212,11 @@ int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -205,7 +212,11 @@ int efs_fill_super(struct super_block *s, void *d, int silent)
struct efs_sb_info *sb; struct efs_sb_info *sb;
struct buffer_head *bh; struct buffer_head *bh;
sb = SUPER_INFO(s); sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
if (!sb)
return -ENOMEM;
s->u.generic_sbp = sb;
memset(sb, 0, sizeof(struct efs_sb_info));
s->s_magic = EFS_SUPER_MAGIC; s->s_magic = EFS_SUPER_MAGIC;
sb_set_blocksize(s, EFS_BLOCKSIZE); sb_set_blocksize(s, EFS_BLOCKSIZE);
...@@ -263,6 +274,8 @@ int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -263,6 +274,8 @@ int efs_fill_super(struct super_block *s, void *d, int silent)
out_no_fs_ul: out_no_fs_ul:
out_no_fs: out_no_fs:
s->u.generic_sbp = NULL;
kfree(sb);
return -EINVAL; return -EINVAL;
} }
......
...@@ -29,6 +29,7 @@ static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aes ...@@ -29,6 +29,7 @@ static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aes
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/efs_fs_i.h> #include <linux/efs_fs_i.h>
#include <linux/efs_fs_sb.h>
#include <linux/efs_dir.h> #include <linux/efs_dir.h>
#ifndef MIN #ifndef MIN
...@@ -42,7 +43,11 @@ static inline struct efs_inode_info *INODE_INFO(struct inode *inode) ...@@ -42,7 +43,11 @@ static inline struct efs_inode_info *INODE_INFO(struct inode *inode)
{ {
return list_entry(inode, struct efs_inode_info, vfs_inode); return list_entry(inode, struct efs_inode_info, vfs_inode);
} }
#define SUPER_INFO(s) &((s)->u.efs_sb)
static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
{
return sb->u.generic_sbp;
}
extern struct inode_operations efs_dir_inode_operations; extern struct inode_operations efs_dir_inode_operations;
extern struct file_operations efs_dir_operations; extern struct file_operations efs_dir_operations;
......
...@@ -653,7 +653,6 @@ struct quota_mount_options ...@@ -653,7 +653,6 @@ struct quota_mount_options
#include <linux/sysv_fs_sb.h> #include <linux/sysv_fs_sb.h>
#include <linux/affs_fs_sb.h> #include <linux/affs_fs_sb.h>
#include <linux/ufs_fs_sb.h> #include <linux/ufs_fs_sb.h>
#include <linux/efs_fs_sb.h>
#include <linux/romfs_fs_sb.h> #include <linux/romfs_fs_sb.h>
#include <linux/smb_fs_sb.h> #include <linux/smb_fs_sb.h>
#include <linux/hfs_fs_sb.h> #include <linux/hfs_fs_sb.h>
...@@ -706,7 +705,6 @@ struct super_block { ...@@ -706,7 +705,6 @@ struct super_block {
struct sysv_sb_info sysv_sb; struct sysv_sb_info sysv_sb;
struct affs_sb_info affs_sb; struct affs_sb_info affs_sb;
struct ufs_sb_info ufs_sb; struct ufs_sb_info ufs_sb;
struct efs_sb_info efs_sb;
struct shmem_sb_info shmem_sb; struct shmem_sb_info shmem_sb;
struct romfs_sb_info romfs_sb; struct romfs_sb_info romfs_sb;
struct smb_sb_info smbfs_sb; struct smb_sb_info smbfs_sb;
......
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