From 1471f525455788c20b130690e0f104df451aeb43 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 13 Mar 2000 20:55:15 +0000 Subject: Merge with Linux 2.3.51. --- fs/ext2/super.c | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'fs/ext2/super.c') diff --git a/fs/ext2/super.c b/fs/ext2/super.c index b4cdc5868..73be71e61 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -116,7 +116,6 @@ void ext2_put_super (struct super_block * sb) brelse (sb->u.ext2_sb.s_block_bitmap[i]); brelse (sb->u.ext2_sb.s_sbh); - MOD_DEC_USE_COUNT; return; } @@ -402,12 +401,9 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, set_opt (sb->u.ext2_sb.s_mount_opt, CHECK_NORMAL); if (!parse_options ((char *) data, &sb_block, &resuid, &resgid, &sb->u.ext2_sb.s_mount_opt)) { - sb->s_dev = 0; return NULL; } - MOD_INC_USE_COUNT; - lock_super (sb); set_blocksize (dev, blocksize); /* @@ -421,10 +417,7 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, } if (!(bh = bread (dev, logic_sb_block, blocksize))) { - sb->s_dev = 0; - unlock_super (sb); printk ("EXT2-fs: unable to read superblock\n"); - MOD_DEC_USE_COUNT; return NULL; } /* @@ -439,11 +432,8 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, printk ("VFS: Can't find an ext2 filesystem on dev " "%s.\n", bdevname(dev)); failed_mount: - sb->s_dev = 0; - unlock_super (sb); if (bh) brelse(bh); - MOD_DEC_USE_COUNT; return NULL; } if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) { @@ -616,7 +606,6 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, sb->u.ext2_sb.s_loaded_inode_bitmaps = 0; sb->u.ext2_sb.s_loaded_block_bitmaps = 0; sb->u.ext2_sb.s_db_per_group = db_count; - unlock_super (sb); /* * set up enough so that it can read an inode */ @@ -624,7 +613,6 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, sb->s_op = &ext2_sops; sb->s_root = d_alloc_root(iget(sb, EXT2_ROOT_INO)); if (!sb->s_root) { - sb->s_dev = 0; for (i = 0; i < db_count; i++) if (sb->u.ext2_sb.s_group_desc[i]) brelse (sb->u.ext2_sb.s_group_desc[i]); @@ -632,7 +620,6 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, db_count * sizeof (struct buffer_head *)); brelse (bh); printk ("EXT2-fs: get root inode failed\n"); - MOD_DEC_USE_COUNT; return NULL; } ext2_setup_super (sb, es); @@ -725,10 +712,9 @@ int ext2_remount (struct super_block * sb, int * flags, char * data) return 0; } -int ext2_statfs (struct super_block * sb, struct statfs * buf, int bufsiz) +int ext2_statfs (struct super_block * sb, struct statfs * buf) { unsigned long overhead; - struct statfs tmp; int ngroups, i; if (test_opt (sb, MINIX_DF)) @@ -768,25 +754,20 @@ int ext2_statfs (struct super_block * sb, struct statfs * buf, int bufsiz) (2 + sb->u.ext2_sb.s_itb_per_group)); } - tmp.f_type = EXT2_SUPER_MAGIC; - tmp.f_bsize = sb->s_blocksize; - tmp.f_blocks = le32_to_cpu(sb->u.ext2_sb.s_es->s_blocks_count) - overhead; - tmp.f_bfree = ext2_count_free_blocks (sb); - tmp.f_bavail = tmp.f_bfree - le32_to_cpu(sb->u.ext2_sb.s_es->s_r_blocks_count); - if (tmp.f_bfree < le32_to_cpu(sb->u.ext2_sb.s_es->s_r_blocks_count)) - tmp.f_bavail = 0; - tmp.f_files = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count); - tmp.f_ffree = ext2_count_free_inodes (sb); - tmp.f_namelen = EXT2_NAME_LEN; - return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0; + buf->f_type = EXT2_SUPER_MAGIC; + buf->f_bsize = sb->s_blocksize; + buf->f_blocks = le32_to_cpu(sb->u.ext2_sb.s_es->s_blocks_count) - overhead; + buf->f_bfree = ext2_count_free_blocks (sb); + buf->f_bavail = buf->f_bfree - le32_to_cpu(sb->u.ext2_sb.s_es->s_r_blocks_count); + if (buf->f_bfree < le32_to_cpu(sb->u.ext2_sb.s_es->s_r_blocks_count)) + buf->f_bavail = 0; + buf->f_files = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count); + buf->f_ffree = ext2_count_free_inodes (sb); + buf->f_namelen = EXT2_NAME_LEN; + return 0; } -static struct file_system_type ext2_fs_type = { - "ext2", - FS_REQUIRES_DEV /* | FS_IBASKET */, /* ibaskets have unresolved bugs */ - ext2_read_super, - NULL -}; +static DECLARE_FSTYPE_DEV(ext2_fs_type, "ext2", ext2_read_super); static int __init init_ext2_fs(void) { -- cgit v1.2.3