git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git]
/
fs
/
ext2
/
super.c
diff --git
a/fs/ext2/super.c
b/fs/ext2/super.c
index
6bd5bfd
..
ab65b5f
100644
(file)
--- a/
fs/ext2/super.c
+++ b/
fs/ext2/super.c
@@
-16,6
+16,7
@@
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
* David S. Miller (davem@caip.rutgers.edu), 1995
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
@@
-38,7
+39,7
@@
static void ext2_sync_super(struct super_block *sb,
struct ext2_super_block *es);
static int ext2_remount (struct super_block * sb, int * flags, char * data);
static void ext2_sync_super(struct super_block *sb,
struct ext2_super_block *es);
static int ext2_remount (struct super_block * sb, int * flags, char * data);
-static int ext2_statfs (struct
dentry * dentry
, struct kstatfs * buf);
+static int ext2_statfs (struct
super_block * sb
, struct kstatfs * buf);
void ext2_error (struct super_block * sb, const char * function,
const char * fmt, ...)
void ext2_error (struct super_block * sb, const char * function,
const char * fmt, ...)
@@
-174,8
+175,7
@@
static int init_inodecache(void)
{
ext2_inode_cachep = kmem_cache_create("ext2_inode_cache",
sizeof(struct ext2_inode_info),
{
ext2_inode_cachep = kmem_cache_create("ext2_inode_cache",
sizeof(struct ext2_inode_info),
- 0, (SLAB_RECLAIM_ACCOUNT|
- SLAB_MEM_SPREAD),
+ 0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ext2_inode_cachep == NULL)
return -ENOMEM;
init_once, NULL);
if (ext2_inode_cachep == NULL)
return -ENOMEM;
@@
-210,6
+210,8
@@
static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
if (sbi->s_mount_opt & EXT2_MOUNT_GRPID)
seq_puts(seq, ",grpid");
if (sbi->s_mount_opt & EXT2_MOUNT_GRPID)
seq_puts(seq, ",grpid");
+ else
+ seq_puts(seq, ",nogrpid");
#if defined(CONFIG_QUOTA)
if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
#if defined(CONFIG_QUOTA)
if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
@@
-259,7
+261,7
@@
static struct dentry *ext2_get_dentry(struct super_block *sb, void *vobjp)
struct inode *inode;
struct dentry *result;
struct inode *inode;
struct dentry *result;
- if (ino
< EXT2_FIRST_INO(sb) && ino != EXT2_ROOT_INO
)
+ if (ino
!= EXT2_ROOT_INO && ino < EXT2_FIRST_INO(sb)
)
return ERR_PTR(-ESTALE);
if (ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count))
return ERR_PTR(-ESTALE);
return ERR_PTR(-ESTALE);
if (ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count))
return ERR_PTR(-ESTALE);
@@
-272,8
+274,9
@@
static struct dentry *ext2_get_dentry(struct super_block *sb, void *vobjp)
inode = iget(sb, ino);
if (inode == NULL)
return ERR_PTR(-ENOMEM);
inode = iget(sb, ino);
if (inode == NULL)
return ERR_PTR(-ENOMEM);
- if (is_bad_inode(inode) ||
- (generation && inode->i_generation != generation)) {
+ if (is_bad_inode(inode)
+ || (generation && inode->i_generation != generation)
+ ) {
/* we didn't find the right inode.. */
iput(inode);
return ERR_PTR(-ESTALE);
/* we didn't find the right inode.. */
iput(inode);
return ERR_PTR(-ESTALE);
@@
-289,11
+292,13
@@
static struct dentry *ext2_get_dentry(struct super_block *sb, void *vobjp)
return result;
}
return result;
}
+
/* Yes, most of these are left as NULL!!
* A NULL value implies the default, which works with ext2-like file
* systems, but can be improved upon.
* Currently only get_parent is required.
*/
/* Yes, most of these are left as NULL!!
* A NULL value implies the default, which works with ext2-like file
* systems, but can be improved upon.
* Currently only get_parent is required.
*/
+struct dentry *ext2_get_parent(struct dentry *child);
static struct export_operations ext2_export_ops = {
.get_parent = ext2_get_parent,
.get_dentry = ext2_get_dentry,
static struct export_operations ext2_export_ops = {
.get_parent = ext2_get_parent,
.get_dentry = ext2_get_dentry,
@@
-822,7
+827,7
@@
static int ext2_fill_super(struct super_block *sb, void *data, int silent)
if (EXT2_INODE_SIZE(sb) == 0)
goto cantfind_ext2;
sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb);
if (EXT2_INODE_SIZE(sb) == 0)
goto cantfind_ext2;
sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb);
- if (sbi->s_inodes_per_block == 0
|| sbi->s_inodes_per_group == 0
)
+ if (sbi->s_inodes_per_block == 0)
goto cantfind_ext2;
sbi->s_itb_per_group = sbi->s_inodes_per_group /
sbi->s_inodes_per_block;
goto cantfind_ext2;
sbi->s_itb_per_group = sbi->s_inodes_per_group /
sbi->s_inodes_per_block;
@@
-880,6
+885,9
@@
static int ext2_fill_super(struct super_block *sb, void *data, int silent)
printk ("EXT2-fs: not enough memory\n");
goto failed_mount;
}
printk ("EXT2-fs: not enough memory\n");
goto failed_mount;
}
+ percpu_counter_init(&sbi->s_freeblocks_counter);
+ percpu_counter_init(&sbi->s_freeinodes_counter);
+ percpu_counter_init(&sbi->s_dirs_counter);
bgl_lock_init(&sbi->s_blockgroup_lock);
sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
GFP_KERNEL);
bgl_lock_init(&sbi->s_blockgroup_lock);
sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
GFP_KERNEL);
@@
-900,18
+908,12
@@
static int ext2_fill_super(struct super_block *sb, void *data, int silent)
}
if (!ext2_check_descriptors (sb)) {
printk ("EXT2-fs: group descriptors corrupted!\n");
}
if (!ext2_check_descriptors (sb)) {
printk ("EXT2-fs: group descriptors corrupted!\n");
+ db_count = i;
goto failed_mount2;
}
sbi->s_gdb_count = db_count;
get_random_bytes(&sbi->s_next_generation, sizeof(u32));
spin_lock_init(&sbi->s_next_gen_lock);
goto failed_mount2;
}
sbi->s_gdb_count = db_count;
get_random_bytes(&sbi->s_next_generation, sizeof(u32));
spin_lock_init(&sbi->s_next_gen_lock);
-
- percpu_counter_init(&sbi->s_freeblocks_counter,
- ext2_count_free_blocks(sb));
- percpu_counter_init(&sbi->s_freeinodes_counter,
- ext2_count_free_inodes(sb));
- percpu_counter_init(&sbi->s_dirs_counter,
- ext2_count_dirs(sb));
/*
* set up enough so that it can read an inode
*/
/*
* set up enough so that it can read an inode
*/
@@
-923,18
+925,24
@@
static int ext2_fill_super(struct super_block *sb, void *data, int silent)
if (!sb->s_root) {
iput(root);
printk(KERN_ERR "EXT2-fs: get root inode failed\n");
if (!sb->s_root) {
iput(root);
printk(KERN_ERR "EXT2-fs: get root inode failed\n");
- goto failed_mount
3
;
+ goto failed_mount
2
;
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
dput(sb->s_root);
sb->s_root = NULL;
printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n");
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
dput(sb->s_root);
sb->s_root = NULL;
printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n");
- goto failed_mount
3
;
+ goto failed_mount
2
;
}
if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
ext2_warning(sb, __FUNCTION__,
"mounting ext3 filesystem as ext2");
ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY);
}
if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
ext2_warning(sb, __FUNCTION__,
"mounting ext3 filesystem as ext2");
ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY);
+ percpu_counter_mod(&sbi->s_freeblocks_counter,
+ ext2_count_free_blocks(sb));
+ percpu_counter_mod(&sbi->s_freeinodes_counter,
+ ext2_count_free_inodes(sb));
+ percpu_counter_mod(&sbi->s_dirs_counter,
+ ext2_count_dirs(sb));
return 0;
cantfind_ext2:
return 0;
cantfind_ext2:
@@
-942,10
+950,7
@@
cantfind_ext2:
printk("VFS: Can't find an ext2 filesystem on dev %s.\n",
sb->s_id);
goto failed_mount;
printk("VFS: Can't find an ext2 filesystem on dev %s.\n",
sb->s_id);
goto failed_mount;
-failed_mount3:
- percpu_counter_destroy(&sbi->s_freeblocks_counter);
- percpu_counter_destroy(&sbi->s_freeinodes_counter);
- percpu_counter_destroy(&sbi->s_dirs_counter);
+
failed_mount2:
for (i = 0; i < db_count; i++)
brelse(sbi->s_group_desc[i]);
failed_mount2:
for (i = 0; i < db_count; i++)
brelse(sbi->s_group_desc[i]);
@@
-1091,9
+1096,8
@@
restore_opts:
return err;
}
return err;
}
-static int ext2_statfs (struct
dentry * dentry
, struct kstatfs * buf)
+static int ext2_statfs (struct
super_block * sb
, struct kstatfs * buf)
{
{
- struct super_block *sb = dentry->d_sb;
struct ext2_sb_info *sbi = EXT2_SB(sb);
unsigned long overhead;
int i;
struct ext2_sb_info *sbi = EXT2_SB(sb);
unsigned long overhead;
int i;
@@
-1141,10
+1145,10
@@
static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
return 0;
}
return 0;
}
-static
int
ext2_get_sb(struct file_system_type *fs_type,
- int flags, const char *dev_name, void *data
, struct vfsmount *mnt
)
+static
struct super_block *
ext2_get_sb(struct file_system_type *fs_type,
+ int flags, const char *dev_name, void *data)
{
{
- return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super
, mnt
);
+ return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super);
}
#ifdef CONFIG_QUOTA
}
#ifdef CONFIG_QUOTA
@@
-1209,7
+1213,7
@@
static ssize_t ext2_quota_write(struct super_block *sb, int type,
struct buffer_head tmp_bh;
struct buffer_head *bh;
struct buffer_head tmp_bh;
struct buffer_head *bh;
- mutex_lock
_nested(&inode->i_mutex, I_MUTEX_QUOTA
);
+ mutex_lock
(&inode->i_mutex
);
while (towrite > 0) {
tocopy = sb->s_blocksize - offset < towrite ?
sb->s_blocksize - offset : towrite;
while (towrite > 0) {
tocopy = sb->s_blocksize - offset < towrite ?
sb->s_blocksize - offset : towrite;