>From e4979c6a29eb79d59d8bc2eca9acc0d2b416780f Mon Sep 17 00:00:00 2001 From: KB Date: Wed, 25 May 2016 22:15:20 +0200 Subject: [PATCH 4/7] super_operations.destroy_inode Signed-off-by: KB --- fs/freevxfs/vxfs_extern.h | 1 + fs/freevxfs/vxfs_inode.c | 16 ++++++++++++---- fs/freevxfs/vxfs_super.c | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/freevxfs/vxfs_extern.h b/fs/freevxfs/vxfs_extern.h index 0a3ff86..4d8298b 100644 --- a/fs/freevxfs/vxfs_extern.h +++ b/fs/freevxfs/vxfs_extern.h @@ -65,6 +65,7 @@ extern struct vxfs_inode_info * vxfs_stiget(struct super_block *, ino_t); extern struct inode * vxfs_iget(struct super_block *, ino_t); extern void vxfs_evict_inode(struct inode *); extern void vxfs_inode_info_free(struct vxfs_inode_info *vip); +extern void vxfs_destroy_inode(struct inode *ip); /* vxfs_lookup.c */ extern const struct inode_operations vxfs_dir_inode_ops; diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c index 16d8d27..9b45ad7 100644 --- a/fs/freevxfs/vxfs_inode.c +++ b/fs/freevxfs/vxfs_inode.c @@ -397,7 +397,15 @@ vxfs_iget(struct super_block *sbp, ino_t ino) 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, inode->i_private); + void *priv = inode->i_private; + + inode->i_private = NULL; + kmem_cache_free(vxfs_inode_cachep, priv); +} + +void vxfs_destroy_inode(struct inode *ip) +{ + call_rcu(&ip->i_rcu, vxfs_i_callback); } /** @@ -405,17 +413,17 @@ static void vxfs_i_callback(struct rcu_head *head) * @ip: inode to discard. * * Description: - * vxfs_evict_inode() is called on the final iput and frees the private - * inode area. + * vxfs_evict_inode() is called on the final iput */ void vxfs_evict_inode(struct inode *ip) { truncate_inode_pages_final(&ip->i_data); + invalidate_inode_buffers(ip); clear_inode(ip); - call_rcu(&ip->i_rcu, vxfs_i_callback); } + void vxfs_inode_info_free(struct vxfs_inode_info *vip) { kmem_cache_free(vxfs_inode_cachep, vip); diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 6a19802..11a535a 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -59,6 +59,7 @@ 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 = { + .destroy_inode = vxfs_destroy_inode, .evict_inode = vxfs_evict_inode, .put_super = vxfs_put_super, .statfs = vxfs_statfs, -- 1.7.3.4