summaryrefslogtreecommitdiff
path: root/fs/freevxfs/vxfs_super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-06-01 08:44:45 +0200
committerChristoph Hellwig <hch@lst.de>2016-06-01 09:23:24 +0200
commit2f137e31e07118bead0d17ccc89b0e71aec74732 (patch)
treef7ac2621f116e5290730730b5f58db991acb65fc /fs/freevxfs/vxfs_super.c
parentf2bf2c70488145c961306b873c75147048db743d (diff)
freevxfs: implement ->alloc_inode and ->destroy_inode
This driver predates those methods and was trying to be clever allocating it's own private data. Switch to the generic scheme used by other file systems. Based on an earlier patch from Krzysztof Błaszkowski <kb@sysmikro.com.pl>. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/freevxfs/vxfs_super.c')
-rw-r--r--fs/freevxfs/vxfs_super.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index 40125cc825f2..dfa775ef4d1d 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -52,6 +52,8 @@ MODULE_AUTHOR("Christoph Hellwig");
MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver");
MODULE_LICENSE("Dual BSD/GPL");
+static struct kmem_cache *vxfs_inode_cachep;
+
/**
* vxfs_put_super - free superblock resources
* @sbp: VFS superblock.
@@ -117,7 +119,31 @@ 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;
+ 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,
@@ -206,6 +232,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,
@@ -256,7 +283,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);