Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
[deliverable/linux.git] / fs / freevxfs / vxfs_super.c
index daf58a9fae70b9c27a15aafcee493bf191937bd6..455ce5b77e9bf9eea279dccdf4a31a2a2154cd74 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2000-2001 Christoph Hellwig.
+ * Copyright (c) 2016 Krzysztof Blaszkowski
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include "vxfs_inode.h"
 
 
-MODULE_AUTHOR("Christoph Hellwig");
+MODULE_AUTHOR("Christoph Hellwig, Krzysztof Blaszkowski");
 MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver");
 MODULE_LICENSE("Dual BSD/GPL");
 
-
-
-static void            vxfs_put_super(struct super_block *);
-static int             vxfs_statfs(struct dentry *, struct kstatfs *);
-static int             vxfs_remount(struct super_block *, int *, char *);
-
-static const struct super_operations vxfs_super_ops = {
-       .evict_inode =          vxfs_evict_inode,
-       .put_super =            vxfs_put_super,
-       .statfs =               vxfs_statfs,
-       .remount_fs =           vxfs_remount,
-};
+static struct kmem_cache *vxfs_inode_cachep;
 
 /**
  * vxfs_put_super - free superblock resources
@@ -130,6 +120,37 @@ static int vxfs_remount(struct super_block *sb, int *flags, char *data)
        return 0;
 }
 
+static struct inode *vxfs_alloc_inode(struct super_block *sb)
+{
+       struct vxfs_inode_info *vi;
+
+       vi = kmem_cache_alloc(vxfs_inode_cachep, GFP_KERNEL);
+       if (!vi)
+               return NULL;
+       inode_init_once(&vi->vfs_inode);
+       return &vi->vfs_inode;
+}
+
+static void vxfs_i_callback(struct rcu_head *head)
+{
+       struct inode *inode = container_of(head, struct inode, i_rcu);
+
+       kmem_cache_free(vxfs_inode_cachep, VXFS_INO(inode));
+}
+
+static void vxfs_destroy_inode(struct inode *inode)
+{
+       call_rcu(&inode->i_rcu, vxfs_i_callback);
+}
+
+static const struct super_operations vxfs_super_ops = {
+       .alloc_inode            = vxfs_alloc_inode,
+       .destroy_inode          = vxfs_destroy_inode,
+       .evict_inode            = vxfs_evict_inode,
+       .put_super              = vxfs_put_super,
+       .statfs                 = vxfs_statfs,
+       .remount_fs             = vxfs_remount,
+};
 
 static int vxfs_try_sb_magic(struct super_block *sbp, int silent,
                unsigned blk, __fs32 magic)
@@ -213,6 +234,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
                goto out;
        }
 
+       sbp->s_op = &vxfs_super_ops;
        sbp->s_fs_info = infp;
 
        if (!vxfs_try_sb_magic(sbp, silent, 1,
@@ -263,7 +285,6 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
                goto out;
        }
 
-       sbp->s_op = &vxfs_super_ops;
        root = vxfs_iget(sbp, VXFS_ROOT_INO);
        if (IS_ERR(root)) {
                ret = PTR_ERR(root);
This page took 0.02991 seconds and 5 git commands to generate.