upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / fs / sysfs / mount.c
index 07a29a2..95d8229 100644 (file)
@@ -14,6 +14,7 @@
 
 struct vfsmount *sysfs_mount;
 struct super_block * sysfs_sb = NULL;
+kmem_cache_t *sysfs_dir_cachep;
 
 static struct super_operations sysfs_ops = {
        .statfs         = simple_statfs,
@@ -36,6 +37,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        sb->s_magic = SYSFS_SUPER_MAGIC;
        sb->s_op = &sysfs_ops;
+       sb->s_time_gran = 1;
        sysfs_sb = sb;
 
        inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO);
@@ -74,7 +76,13 @@ static struct file_system_type sysfs_fs_type = {
 
 int __init sysfs_init(void)
 {
-       int err;
+       int err = -ENOMEM;
+
+       sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache",
+                                             sizeof(struct sysfs_dirent),
+                                             0, 0, NULL, NULL);
+       if (!sysfs_dir_cachep)
+               goto out;
 
        err = register_filesystem(&sysfs_fs_type);
        if (!err) {
@@ -83,7 +91,15 @@ int __init sysfs_init(void)
                        printk(KERN_ERR "sysfs: could not mount!\n");
                        err = PTR_ERR(sysfs_mount);
                        sysfs_mount = NULL;
+                       unregister_filesystem(&sysfs_fs_type);
+                       goto out_err;
                }
-       }
+       } else
+               goto out_err;
+out:
        return err;
+out_err:
+       kmem_cache_destroy(sysfs_dir_cachep);
+       sysfs_dir_cachep = NULL;
+       goto out;
 }