Commit cb591b78 authored by Oleg Drokin's avatar Oleg Drokin

reiserfs_fs_sb.h, super.c, procfs.c:

  reiserfs_fill_super cleanup. From Josh MacDonald.
parent 828156c1
...@@ -36,7 +36,7 @@ static struct super_block *procinfo_prologue( kdev_t dev ) ...@@ -36,7 +36,7 @@ static struct super_block *procinfo_prologue( kdev_t dev )
/* get super-block by device */ /* get super-block by device */
result = get_super( dev ); result = get_super( dev );
if( result != NULL ) { if( result != NULL ) {
if( !reiserfs_is_super( result ) ) { if( !is_reiserfs_super( result ) ) {
printk( KERN_DEBUG "reiserfs: procfs-52: " printk( KERN_DEBUG "reiserfs: procfs-52: "
"non-reiserfs super found\n" ); "non-reiserfs super found\n" );
drop_super( result ); drop_super( result );
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#define REISERFS_OLD_BLOCKSIZE 4096 #define REISERFS_OLD_BLOCKSIZE 4096
#define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20 #define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20
static struct file_system_type reiserfs_fs_type;
const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING; const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING;
const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING; const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING;
const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING; const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING;
...@@ -55,6 +57,11 @@ static int is_any_reiserfs_magic_string (struct reiserfs_super_block * rs) ...@@ -55,6 +57,11 @@ static int is_any_reiserfs_magic_string (struct reiserfs_super_block * rs)
is_reiserfs_jr (rs)); is_reiserfs_jr (rs));
} }
int is_reiserfs_super (struct super_block *s)
{
return s -> s_type == & reiserfs_fs_type ;
}
static int reiserfs_remount (struct super_block * s, int * flags, char * data); static int reiserfs_remount (struct super_block * s, int * flags, char * data);
static int reiserfs_statfs (struct super_block * s, struct statfs * buf); static int reiserfs_statfs (struct super_block * s, struct statfs * buf);
...@@ -997,7 +1004,7 @@ int function2code (hashf_t func) ...@@ -997,7 +1004,7 @@ int function2code (hashf_t func)
// at the ext2 code and comparing. It's subfunctions contain no code // at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled. // used as a template unless they are so labeled.
// //
static int reiserfs_fill_super(struct super_block *s, void *data, int silent) static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
{ {
struct inode *root_inode; struct inode *root_inode;
int j; int j;
...@@ -1009,21 +1016,24 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1009,21 +1016,24 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
struct reiserfs_super_block * rs; struct reiserfs_super_block * rs;
char *jdev_name; char *jdev_name;
struct reiserfs_sb_info *sbi; struct reiserfs_sb_info *sbi;
int errval = -EINVAL;
sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi) {
return -ENOMEM; errval = -ENOMEM;
goto error;
}
s->u.generic_sbp = sbi; s->u.generic_sbp = sbi;
memset (sbi, 0, sizeof (struct reiserfs_sb_info)); memset (sbi, 0, sizeof (struct reiserfs_sb_info));
jdev_name = NULL; jdev_name = NULL;
if (parse_options ((char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name) == 0) { if (parse_options ((char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name) == 0) {
return -EINVAL; goto error;
} }
if (blocks) { if (blocks) {
printk("reserfs: resize option for remount only\n"); printk("jmacd-7: reiserfs_fill_super: resize option for remount only\n");
return -EINVAL; goto error;
} }
/* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */ /* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
...@@ -1038,7 +1048,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1038,7 +1048,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
sbi->s_mount_state = REISERFS_VALID_FS ; sbi->s_mount_state = REISERFS_VALID_FS ;
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) { if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
printk ("reiserfs_fill_super: unable to read bitmap\n"); printk ("jmacd-8: reiserfs_fill_super: unable to read bitmap\n");
goto error; goto error;
} }
#ifdef CONFIG_REISERFS_CHECK #ifdef CONFIG_REISERFS_CHECK
...@@ -1056,7 +1066,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1056,7 +1066,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
*/ */
} }
if (reread_meta_blocks(s)) { if (reread_meta_blocks(s)) {
printk("reiserfs_fill_super: unable to reread meta blocks after journal init\n") ; printk("jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init\n") ;
goto error ; goto error ;
} }
...@@ -1071,7 +1081,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1071,7 +1081,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
args.dirid = REISERFS_ROOT_PARENT_OBJECTID ; args.dirid = REISERFS_ROOT_PARENT_OBJECTID ;
root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args)); root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args));
if (!root_inode) { if (!root_inode) {
printk ("reiserfs_fill_super: get root inode failed\n"); printk ("jmacd-10: reiserfs_fill_super: get root inode failed\n");
goto error; goto error;
} }
...@@ -1155,7 +1165,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1155,7 +1165,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
reiserfs_proc_register( s, "journal", reiserfs_journal_in_proc ); reiserfs_proc_register( s, "journal", reiserfs_journal_in_proc );
init_waitqueue_head (&(sbi->s_wait)); init_waitqueue_head (&(sbi->s_wait));
return 0; return (0);
error: error:
if (jinit_done) { /* kill the commit thread, free journal ram */ if (jinit_done) { /* kill the commit thread, free journal ram */
...@@ -1172,10 +1182,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1172,10 +1182,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
if (SB_BUFFER_WITH_SB (s)) if (SB_BUFFER_WITH_SB (s))
brelse(SB_BUFFER_WITH_SB (s)); brelse(SB_BUFFER_WITH_SB (s));
kfree(sbi); if (sbi != NULL) {
s->u.generic_sbp = NULL; kfree(sbi);
}
return -EINVAL; s->u.generic_sbp = NULL;
return errval;
} }
...@@ -1202,66 +1214,60 @@ static int reiserfs_statfs (struct super_block * s, struct statfs * buf) ...@@ -1202,66 +1214,60 @@ static int reiserfs_statfs (struct super_block * s, struct statfs * buf)
return 0; return 0;
} }
static struct super_block *reiserfs_get_sb(struct file_system_type *fs_type, static struct super_block*
int flags, char *dev_name, void *data) get_super_block (struct file_system_type *fs_type,
int flags,
char *dev_name,
void *data)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super); return get_sb_bdev (fs_type, flags, dev_name, data, reiserfs_fill_super);
} }
static struct file_system_type reiserfs_fs_type = { static int __init
owner: THIS_MODULE, init_reiserfs_fs ( void )
name: "reiserfs",
get_sb: reiserfs_get_sb,
kill_sb: kill_block_super,
fs_flags: FS_REQUIRES_DEV,
};
int reiserfs_is_super(struct super_block *s)
{ {
return s->s_type == &reiserfs_fs_type; int ret;
}
// if ((ret = init_inodecache ())) {
// this is exactly what 2.3.99-pre9's init_ext2_fs is return ret;
// }
static int __init init_reiserfs_fs (void)
{
int err = init_inodecache();
if (err)
goto out1;
reiserfs_proc_info_global_init();
reiserfs_proc_register_global( "version",
reiserfs_global_version_in_proc );
err = register_filesystem(&reiserfs_fs_type);
if (err)
goto out;
return 0;
out:
reiserfs_proc_unregister_global( "version" );
reiserfs_proc_info_global_done();
destroy_inodecache();
out1:
return err;
}
reiserfs_proc_info_global_init ();
reiserfs_proc_register_global ("version", reiserfs_global_version_in_proc);
MODULE_DESCRIPTION("ReiserFS journaled filesystem"); ret = register_filesystem (& reiserfs_fs_type);
MODULE_AUTHOR("Hans Reiser <reiser@namesys.com>");
MODULE_LICENSE("GPL");
// if (ret == 0) {
// this is exactly what 2.3.99-pre9's init_ext2_fs is return 0;
// }
static void __exit exit_reiserfs_fs(void)
{ reiserfs_proc_unregister_global ("version");
reiserfs_proc_unregister_global( "version" ); reiserfs_proc_info_global_done ();
reiserfs_proc_info_global_done(); destroy_inodecache ();
unregister_filesystem(&reiserfs_fs_type);
destroy_inodecache(); return ret;
} }
module_init(init_reiserfs_fs) ; static void __exit
module_exit(exit_reiserfs_fs) ; exit_reiserfs_fs ( void )
{
reiserfs_proc_unregister_global ("version");
reiserfs_proc_info_global_done ();
unregister_filesystem (& reiserfs_fs_type);
destroy_inodecache ();
}
static struct file_system_type reiserfs_fs_type = {
owner: THIS_MODULE,
name: "reiserfs",
get_sb: get_super_block,
kill_sb: kill_block_super,
fs_flags: FS_REQUIRES_DEV,
};
MODULE_DESCRIPTION ("ReiserFS journaled filesystem");
MODULE_AUTHOR ("Hans Reiser <reiser@namesys.com>");
MODULE_LICENSE ("GPL");
module_init (init_reiserfs_fs);
module_exit (exit_reiserfs_fs);
...@@ -430,7 +430,7 @@ struct reiserfs_sb_info ...@@ -430,7 +430,7 @@ struct reiserfs_sb_info
void reiserfs_file_buffer (struct buffer_head * bh, int list); void reiserfs_file_buffer (struct buffer_head * bh, int list);
int reiserfs_is_super(struct super_block *s) ; int is_reiserfs_super(struct super_block *s) ;
int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ;
int flush_old_commits(struct super_block *s, int) ; int flush_old_commits(struct super_block *s, int) ;
int show_reiserfs_locks(void) ; int show_reiserfs_locks(void) ;
......
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