summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/porting25
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c10
-rw-r--r--drivers/dax/super.c7
-rw-r--r--drivers/staging/erofs/super.c10
-rw-r--r--fs/9p/v9fs_vfs.h2
-rw-r--r--fs/9p/vfs_inode.c10
-rw-r--r--fs/9p/vfs_super.c4
-rw-r--r--fs/adfs/super.c10
-rw-r--r--fs/affs/super.c10
-rw-r--r--fs/afs/super.c9
-rw-r--r--fs/befs/linuxvfs.c12
-rw-r--r--fs/bfs/inode.c10
-rw-r--r--fs/block_dev.c14
-rw-r--r--fs/btrfs/ctree.h1
-rw-r--r--fs/btrfs/inode.c7
-rw-r--r--fs/btrfs/super.c1
-rw-r--r--fs/ceph/inode.c5
-rw-r--r--fs/ceph/super.c1
-rw-r--r--fs/ceph/super.h1
-rw-r--r--fs/cifs/cifsfs.c12
-rw-r--r--fs/coda/inode.c10
-rw-r--r--fs/debugfs/inode.c10
-rw-r--r--fs/ecryptfs/super.c5
-rw-r--r--fs/efs/super.c10
-rw-r--r--fs/ext2/super.c10
-rw-r--r--fs/ext4/super.c5
-rw-r--r--fs/f2fs/super.c10
-rw-r--r--fs/fat/inode.c10
-rw-r--r--fs/freevxfs/vxfs_super.c11
-rw-r--r--fs/fuse/inode.c24
-rw-r--r--fs/gfs2/super.c12
-rw-r--r--fs/hfs/super.c10
-rw-r--r--fs/hfsplus/super.c13
-rw-r--r--fs/hostfs/hostfs_kern.c10
-rw-r--r--fs/hpfs/super.c10
-rw-r--r--fs/hugetlbfs/inode.c5
-rw-r--r--fs/inode.c56
-rw-r--r--fs/isofs/inode.c10
-rw-r--r--fs/jffs2/super.c10
-rw-r--r--fs/jfs/inode.c13
-rw-r--r--fs/jfs/super.c24
-rw-r--r--fs/minix/inode.c10
-rw-r--r--fs/nfs/inode.c10
-rw-r--r--fs/nfs/internal.h2
-rw-r--r--fs/nfs/nfs4super.c2
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/nilfs2/nilfs.h2
-rw-r--r--fs/nilfs2/super.c11
-rw-r--r--fs/ntfs/inode.c17
-rw-r--r--fs/ntfs/inode.h2
-rw-r--r--fs/ntfs/super.c2
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c10
-rw-r--r--fs/ocfs2/super.c12
-rw-r--r--fs/openpromfs/inode.c10
-rw-r--r--fs/orangefs/super.c9
-rw-r--r--fs/overlayfs/super.c13
-rw-r--r--fs/proc/inode.c10
-rw-r--r--fs/qnx4/inode.c12
-rw-r--r--fs/qnx6/inode.c12
-rw-r--r--fs/reiserfs/super.c10
-rw-r--r--fs/romfs/super.c11
-rw-r--r--fs/squashfs/super.c11
-rw-r--r--fs/sysv/inode.c10
-rw-r--r--fs/ubifs/super.c10
-rw-r--r--fs/udf/super.c10
-rw-r--r--fs/ufs/super.c10
-rw-r--r--include/linux/fs.h6
-rw-r--r--ipc/mqueue.c10
-rw-r--r--kernel/bpf/inode.c10
-rw-r--r--mm/shmem.c5
-rw-r--r--net/sunrpc/rpc_pipe.c11
-rw-r--r--security/apparmor/apparmorfs.c10
-rw-r--r--security/inode.c10
74 files changed, 230 insertions, 493 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index efea228ccd8a..7b20c385cc02 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -118,6 +118,7 @@ set: exclusive
118--------------------------- super_operations --------------------------- 118--------------------------- super_operations ---------------------------
119prototypes: 119prototypes:
120 struct inode *(*alloc_inode)(struct super_block *sb); 120 struct inode *(*alloc_inode)(struct super_block *sb);
121 void (*free_inode)(struct inode *);
121 void (*destroy_inode)(struct inode *); 122 void (*destroy_inode)(struct inode *);
122 void (*dirty_inode) (struct inode *, int flags); 123 void (*dirty_inode) (struct inode *, int flags);
123 int (*write_inode) (struct inode *, struct writeback_control *wbc); 124 int (*write_inode) (struct inode *, struct writeback_control *wbc);
@@ -139,6 +140,7 @@ locking rules:
139 All may block [not true, see below] 140 All may block [not true, see below]
140 s_umount 141 s_umount
141alloc_inode: 142alloc_inode:
143free_inode: called from RCU callback
142destroy_inode: 144destroy_inode:
143dirty_inode: 145dirty_inode:
144write_inode: 146write_inode:
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index cf43bc4dbf31..b8d3ddd8b8db 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -638,3 +638,28 @@ in your dentry operations instead.
638 inode to d_splice_alias() will also do the right thing (equivalent of 638 inode to d_splice_alias() will also do the right thing (equivalent of
639 d_add(dentry, NULL); return NULL;), so that kind of special cases 639 d_add(dentry, NULL); return NULL;), so that kind of special cases
640 also doesn't need a separate treatment. 640 also doesn't need a separate treatment.
641--
642[strongly recommended]
643 take the RCU-delayed parts of ->destroy_inode() into a new method -
644 ->free_inode(). If ->destroy_inode() becomes empty - all the better,
645 just get rid of it. Synchronous work (e.g. the stuff that can't
646 be done from an RCU callback, or any WARN_ON() where we want the
647 stack trace) *might* be movable to ->evict_inode(); however,
648 that goes only for the things that are not needed to balance something
649 done by ->alloc_inode(). IOW, if it's cleaning up the stuff that
650 might have accumulated over the life of in-core inode, ->evict_inode()
651 might be a fit.
652
653 Rules for inode destruction:
654 * if ->destroy_inode() is non-NULL, it gets called
655 * if ->free_inode() is non-NULL, it gets scheduled by call_rcu()
656 * combination of NULL ->destroy_inode and NULL ->free_inode is
657 treated as NULL/free_inode_nonrcu, to preserve the compatibility.
658
659 Note that the callback (be it via ->free_inode() or explicit call_rcu()
660 in ->destroy_inode()) is *NOT* ordered wrt superblock destruction;
661 as the matter of fact, the superblock and all associated structures
662 might be already gone. The filesystem driver is guaranteed to be still
663 there, but that's it. Freeing memory in the callback is fine; doing
664 more than that is possible, but requires a lot of care and is best
665 avoided.
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index db329d4bf1c3..c1a75216050a 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -71,17 +71,11 @@ spufs_alloc_inode(struct super_block *sb)
71 return &ei->vfs_inode; 71 return &ei->vfs_inode;
72} 72}
73 73
74static void spufs_i_callback(struct rcu_head *head) 74static void spufs_free_inode(struct inode *inode)
75{ 75{
76 struct inode *inode = container_of(head, struct inode, i_rcu);
77 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode)); 76 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode));
78} 77}
79 78
80static void spufs_destroy_inode(struct inode *inode)
81{
82 call_rcu(&inode->i_rcu, spufs_i_callback);
83}
84
85static void 79static void
86spufs_init_once(void *p) 80spufs_init_once(void *p)
87{ 81{
@@ -739,7 +733,7 @@ spufs_fill_super(struct super_block *sb, void *data, int silent)
739 struct spufs_sb_info *info; 733 struct spufs_sb_info *info;
740 static const struct super_operations s_ops = { 734 static const struct super_operations s_ops = {
741 .alloc_inode = spufs_alloc_inode, 735 .alloc_inode = spufs_alloc_inode,
742 .destroy_inode = spufs_destroy_inode, 736 .free_inode = spufs_free_inode,
743 .statfs = simple_statfs, 737 .statfs = simple_statfs,
744 .evict_inode = spufs_evict_inode, 738 .evict_inode = spufs_evict_inode,
745 .show_options = spufs_show_options, 739 .show_options = spufs_show_options,
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 0a339b85133e..bbd57ca0634a 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -412,11 +412,9 @@ static struct dax_device *to_dax_dev(struct inode *inode)
412 return container_of(inode, struct dax_device, inode); 412 return container_of(inode, struct dax_device, inode);
413} 413}
414 414
415static void dax_i_callback(struct rcu_head *head) 415static void dax_free_inode(struct inode *inode)
416{ 416{
417 struct inode *inode = container_of(head, struct inode, i_rcu);
418 struct dax_device *dax_dev = to_dax_dev(inode); 417 struct dax_device *dax_dev = to_dax_dev(inode);
419
420 kfree(dax_dev->host); 418 kfree(dax_dev->host);
421 dax_dev->host = NULL; 419 dax_dev->host = NULL;
422 if (inode->i_rdev) 420 if (inode->i_rdev)
@@ -427,16 +425,15 @@ static void dax_i_callback(struct rcu_head *head)
427static void dax_destroy_inode(struct inode *inode) 425static void dax_destroy_inode(struct inode *inode)
428{ 426{
429 struct dax_device *dax_dev = to_dax_dev(inode); 427 struct dax_device *dax_dev = to_dax_dev(inode);
430
431 WARN_ONCE(test_bit(DAXDEV_ALIVE, &dax_dev->flags), 428 WARN_ONCE(test_bit(DAXDEV_ALIVE, &dax_dev->flags),
432 "kill_dax() must be called before final iput()\n"); 429 "kill_dax() must be called before final iput()\n");
433 call_rcu(&inode->i_rcu, dax_i_callback);
434} 430}
435 431
436static const struct super_operations dax_sops = { 432static const struct super_operations dax_sops = {
437 .statfs = simple_statfs, 433 .statfs = simple_statfs,
438 .alloc_inode = dax_alloc_inode, 434 .alloc_inode = dax_alloc_inode,
439 .destroy_inode = dax_destroy_inode, 435 .destroy_inode = dax_destroy_inode,
436 .free_inode = dax_free_inode,
440 .drop_inode = generic_delete_inode, 437 .drop_inode = generic_delete_inode,
441}; 438};
442 439
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 15c784fba879..700cbd460807 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -57,9 +57,8 @@ static struct inode *alloc_inode(struct super_block *sb)
57 return &vi->vfs_inode; 57 return &vi->vfs_inode;
58} 58}
59 59
60static void i_callback(struct rcu_head *head) 60static void free_inode(struct inode *inode)
61{ 61{
62 struct inode *inode = container_of(head, struct inode, i_rcu);
63 struct erofs_vnode *vi = EROFS_V(inode); 62 struct erofs_vnode *vi = EROFS_V(inode);
64 63
65 /* be careful RCU symlink path (see ext4_inode_info->i_data)! */ 64 /* be careful RCU symlink path (see ext4_inode_info->i_data)! */
@@ -71,11 +70,6 @@ static void i_callback(struct rcu_head *head)
71 kmem_cache_free(erofs_inode_cachep, vi); 70 kmem_cache_free(erofs_inode_cachep, vi);
72} 71}
73 72
74static void destroy_inode(struct inode *inode)
75{
76 call_rcu(&inode->i_rcu, i_callback);
77}
78
79static int superblock_read(struct super_block *sb) 73static int superblock_read(struct super_block *sb)
80{ 74{
81 struct erofs_sb_info *sbi; 75 struct erofs_sb_info *sbi;
@@ -668,7 +662,7 @@ out:
668const struct super_operations erofs_sops = { 662const struct super_operations erofs_sops = {
669 .put_super = erofs_put_super, 663 .put_super = erofs_put_super,
670 .alloc_inode = alloc_inode, 664 .alloc_inode = alloc_inode,
671 .destroy_inode = destroy_inode, 665 .free_inode = free_inode,
672 .statfs = erofs_statfs, 666 .statfs = erofs_statfs,
673 .show_options = erofs_show_options, 667 .show_options = erofs_show_options,
674 .remount_fs = erofs_remount, 668 .remount_fs = erofs_remount,
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index aaee1e6584e6..60cd4ba04afc 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -58,7 +58,7 @@ extern const struct file_operations v9fs_mmap_file_operations_dotl;
58extern struct kmem_cache *v9fs_inode_cache; 58extern struct kmem_cache *v9fs_inode_cache;
59 59
60struct inode *v9fs_alloc_inode(struct super_block *sb); 60struct inode *v9fs_alloc_inode(struct super_block *sb);
61void v9fs_destroy_inode(struct inode *inode); 61void v9fs_free_inode(struct inode *inode);
62struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t); 62struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t);
63int v9fs_init_inode(struct v9fs_session_info *v9ses, 63int v9fs_init_inode(struct v9fs_session_info *v9ses,
64 struct inode *inode, umode_t mode, dev_t); 64 struct inode *inode, umode_t mode, dev_t);
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 72b779bc0942..24050e866e64 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -253,21 +253,15 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
253} 253}
254 254
255/** 255/**
256 * v9fs_destroy_inode - destroy an inode 256 * v9fs_free_inode - destroy an inode
257 * 257 *
258 */ 258 */
259 259
260static void v9fs_i_callback(struct rcu_head *head) 260void v9fs_free_inode(struct inode *inode)
261{ 261{
262 struct inode *inode = container_of(head, struct inode, i_rcu);
263 kmem_cache_free(v9fs_inode_cache, V9FS_I(inode)); 262 kmem_cache_free(v9fs_inode_cache, V9FS_I(inode));
264} 263}
265 264
266void v9fs_destroy_inode(struct inode *inode)
267{
268 call_rcu(&inode->i_rcu, v9fs_i_callback);
269}
270
271int v9fs_init_inode(struct v9fs_session_info *v9ses, 265int v9fs_init_inode(struct v9fs_session_info *v9ses,
272 struct inode *inode, umode_t mode, dev_t rdev) 266 struct inode *inode, umode_t mode, dev_t rdev)
273{ 267{
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index d13d35cf69c0..67d1b965adcd 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -344,7 +344,7 @@ static int v9fs_write_inode_dotl(struct inode *inode,
344 344
345static const struct super_operations v9fs_super_ops = { 345static const struct super_operations v9fs_super_ops = {
346 .alloc_inode = v9fs_alloc_inode, 346 .alloc_inode = v9fs_alloc_inode,
347 .destroy_inode = v9fs_destroy_inode, 347 .free_inode = v9fs_free_inode,
348 .statfs = simple_statfs, 348 .statfs = simple_statfs,
349 .evict_inode = v9fs_evict_inode, 349 .evict_inode = v9fs_evict_inode,
350 .show_options = v9fs_show_options, 350 .show_options = v9fs_show_options,
@@ -354,7 +354,7 @@ static const struct super_operations v9fs_super_ops = {
354 354
355static const struct super_operations v9fs_super_ops_dotl = { 355static const struct super_operations v9fs_super_ops_dotl = {
356 .alloc_inode = v9fs_alloc_inode, 356 .alloc_inode = v9fs_alloc_inode,
357 .destroy_inode = v9fs_destroy_inode, 357 .free_inode = v9fs_free_inode,
358 .statfs = v9fs_statfs, 358 .statfs = v9fs_statfs,
359 .drop_inode = v9fs_drop_inode, 359 .drop_inode = v9fs_drop_inode,
360 .evict_inode = v9fs_evict_inode, 360 .evict_inode = v9fs_evict_inode,
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 7e099a7a4eb1..2a83655c408f 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -248,17 +248,11 @@ static struct inode *adfs_alloc_inode(struct super_block *sb)
248 return &ei->vfs_inode; 248 return &ei->vfs_inode;
249} 249}
250 250
251static void adfs_i_callback(struct rcu_head *head) 251static void adfs_free_inode(struct inode *inode)
252{ 252{
253 struct inode *inode = container_of(head, struct inode, i_rcu);
254 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode)); 253 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
255} 254}
256 255
257static void adfs_destroy_inode(struct inode *inode)
258{
259 call_rcu(&inode->i_rcu, adfs_i_callback);
260}
261
262static void init_once(void *foo) 256static void init_once(void *foo)
263{ 257{
264 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo; 258 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
@@ -290,7 +284,7 @@ static void destroy_inodecache(void)
290 284
291static const struct super_operations adfs_sops = { 285static const struct super_operations adfs_sops = {
292 .alloc_inode = adfs_alloc_inode, 286 .alloc_inode = adfs_alloc_inode,
293 .destroy_inode = adfs_destroy_inode, 287 .free_inode = adfs_free_inode,
294 .drop_inode = generic_delete_inode, 288 .drop_inode = generic_delete_inode,
295 .write_inode = adfs_write_inode, 289 .write_inode = adfs_write_inode,
296 .put_super = adfs_put_super, 290 .put_super = adfs_put_super,
diff --git a/fs/affs/super.c b/fs/affs/super.c
index d1ad11a8a4a5..d58217f0baaa 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -111,17 +111,11 @@ static struct inode *affs_alloc_inode(struct super_block *sb)
111 return &i->vfs_inode; 111 return &i->vfs_inode;
112} 112}
113 113
114static void affs_i_callback(struct rcu_head *head) 114static void affs_free_inode(struct inode *inode)
115{ 115{
116 struct inode *inode = container_of(head, struct inode, i_rcu);
117 kmem_cache_free(affs_inode_cachep, AFFS_I(inode)); 116 kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
118} 117}
119 118
120static void affs_destroy_inode(struct inode *inode)
121{
122 call_rcu(&inode->i_rcu, affs_i_callback);
123}
124
125static void init_once(void *foo) 119static void init_once(void *foo)
126{ 120{
127 struct affs_inode_info *ei = (struct affs_inode_info *) foo; 121 struct affs_inode_info *ei = (struct affs_inode_info *) foo;
@@ -155,7 +149,7 @@ static void destroy_inodecache(void)
155 149
156static const struct super_operations affs_sops = { 150static const struct super_operations affs_sops = {
157 .alloc_inode = affs_alloc_inode, 151 .alloc_inode = affs_alloc_inode,
158 .destroy_inode = affs_destroy_inode, 152 .free_inode = affs_free_inode,
159 .write_inode = affs_write_inode, 153 .write_inode = affs_write_inode,
160 .evict_inode = affs_evict_inode, 154 .evict_inode = affs_evict_inode,
161 .put_super = affs_put_super, 155 .put_super = affs_put_super,
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 5adf012b8e27..bab89763119b 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -33,6 +33,7 @@ static void afs_i_init_once(void *foo);
33static void afs_kill_super(struct super_block *sb); 33static void afs_kill_super(struct super_block *sb);
34static struct inode *afs_alloc_inode(struct super_block *sb); 34static struct inode *afs_alloc_inode(struct super_block *sb);
35static void afs_destroy_inode(struct inode *inode); 35static void afs_destroy_inode(struct inode *inode);
36static void afs_free_inode(struct inode *inode);
36static int afs_statfs(struct dentry *dentry, struct kstatfs *buf); 37static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
37static int afs_show_devname(struct seq_file *m, struct dentry *root); 38static int afs_show_devname(struct seq_file *m, struct dentry *root);
38static int afs_show_options(struct seq_file *m, struct dentry *root); 39static int afs_show_options(struct seq_file *m, struct dentry *root);
@@ -56,6 +57,7 @@ static const struct super_operations afs_super_ops = {
56 .alloc_inode = afs_alloc_inode, 57 .alloc_inode = afs_alloc_inode,
57 .drop_inode = afs_drop_inode, 58 .drop_inode = afs_drop_inode,
58 .destroy_inode = afs_destroy_inode, 59 .destroy_inode = afs_destroy_inode,
60 .free_inode = afs_free_inode,
59 .evict_inode = afs_evict_inode, 61 .evict_inode = afs_evict_inode,
60 .show_devname = afs_show_devname, 62 .show_devname = afs_show_devname,
61 .show_options = afs_show_options, 63 .show_options = afs_show_options,
@@ -660,11 +662,9 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
660 return &vnode->vfs_inode; 662 return &vnode->vfs_inode;
661} 663}
662 664
663static void afs_i_callback(struct rcu_head *head) 665static void afs_free_inode(struct inode *inode)
664{ 666{
665 struct inode *inode = container_of(head, struct inode, i_rcu); 667 kmem_cache_free(afs_inode_cachep, AFS_FS_I(inode));
666 struct afs_vnode *vnode = AFS_FS_I(inode);
667 kmem_cache_free(afs_inode_cachep, vnode);
668} 668}
669 669
670/* 670/*
@@ -680,7 +680,6 @@ static void afs_destroy_inode(struct inode *inode)
680 680
681 ASSERTCMP(vnode->cb_interest, ==, NULL); 681 ASSERTCMP(vnode->cb_interest, ==, NULL);
682 682
683 call_rcu(&inode->i_rcu, afs_i_callback);
684 atomic_dec(&afs_count_active_inodes); 683 atomic_dec(&afs_count_active_inodes);
685} 684}
686 685
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 4700b4534439..e273850c95af 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -44,7 +44,7 @@ static struct dentry *befs_lookup(struct inode *, struct dentry *,
44 unsigned int); 44 unsigned int);
45static struct inode *befs_iget(struct super_block *, unsigned long); 45static struct inode *befs_iget(struct super_block *, unsigned long);
46static struct inode *befs_alloc_inode(struct super_block *sb); 46static struct inode *befs_alloc_inode(struct super_block *sb);
47static void befs_destroy_inode(struct inode *inode); 47static void befs_free_inode(struct inode *inode);
48static void befs_destroy_inodecache(void); 48static void befs_destroy_inodecache(void);
49static int befs_symlink_readpage(struct file *, struct page *); 49static int befs_symlink_readpage(struct file *, struct page *);
50static int befs_utf2nls(struct super_block *sb, const char *in, int in_len, 50static int befs_utf2nls(struct super_block *sb, const char *in, int in_len,
@@ -64,7 +64,7 @@ static struct dentry *befs_get_parent(struct dentry *child);
64 64
65static const struct super_operations befs_sops = { 65static const struct super_operations befs_sops = {
66 .alloc_inode = befs_alloc_inode, /* allocate a new inode */ 66 .alloc_inode = befs_alloc_inode, /* allocate a new inode */
67 .destroy_inode = befs_destroy_inode, /* deallocate an inode */ 67 .free_inode = befs_free_inode, /* deallocate an inode */
68 .put_super = befs_put_super, /* uninit super */ 68 .put_super = befs_put_super, /* uninit super */
69 .statfs = befs_statfs, /* statfs */ 69 .statfs = befs_statfs, /* statfs */
70 .remount_fs = befs_remount, 70 .remount_fs = befs_remount,
@@ -281,17 +281,11 @@ befs_alloc_inode(struct super_block *sb)
281 return &bi->vfs_inode; 281 return &bi->vfs_inode;
282} 282}
283 283
284static void befs_i_callback(struct rcu_head *head) 284static void befs_free_inode(struct inode *inode)
285{ 285{
286 struct inode *inode = container_of(head, struct inode, i_rcu);
287 kmem_cache_free(befs_inode_cachep, BEFS_I(inode)); 286 kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
288} 287}
289 288
290static void befs_destroy_inode(struct inode *inode)
291{
292 call_rcu(&inode->i_rcu, befs_i_callback);
293}
294
295static void init_once(void *foo) 289static void init_once(void *foo)
296{ 290{
297 struct befs_inode_info *bi = (struct befs_inode_info *) foo; 291 struct befs_inode_info *bi = (struct befs_inode_info *) foo;
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index d136b2aaafb3..dc0cd2aa3d65 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -245,17 +245,11 @@ static struct inode *bfs_alloc_inode(struct super_block *sb)
245 return &bi->vfs_inode; 245 return &bi->vfs_inode;
246} 246}
247 247
248static void bfs_i_callback(struct rcu_head *head) 248static void bfs_free_inode(struct inode *inode)
249{ 249{
250 struct inode *inode = container_of(head, struct inode, i_rcu);
251 kmem_cache_free(bfs_inode_cachep, BFS_I(inode)); 250 kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
252} 251}
253 252
254static void bfs_destroy_inode(struct inode *inode)
255{
256 call_rcu(&inode->i_rcu, bfs_i_callback);
257}
258
259static void init_once(void *foo) 253static void init_once(void *foo)
260{ 254{
261 struct bfs_inode_info *bi = foo; 255 struct bfs_inode_info *bi = foo;
@@ -287,7 +281,7 @@ static void destroy_inodecache(void)
287 281
288static const struct super_operations bfs_sops = { 282static const struct super_operations bfs_sops = {
289 .alloc_inode = bfs_alloc_inode, 283 .alloc_inode = bfs_alloc_inode,
290 .destroy_inode = bfs_destroy_inode, 284 .free_inode = bfs_free_inode,
291 .write_inode = bfs_write_inode, 285 .write_inode = bfs_write_inode,
292 .evict_inode = bfs_evict_inode, 286 .evict_inode = bfs_evict_inode,
293 .put_super = bfs_put_super, 287 .put_super = bfs_put_super,
diff --git a/fs/block_dev.c b/fs/block_dev.c
index bb28e2ead679..9ee3117ee0bf 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -790,17 +790,9 @@ static struct inode *bdev_alloc_inode(struct super_block *sb)
790 return &ei->vfs_inode; 790 return &ei->vfs_inode;
791} 791}
792 792
793static void bdev_i_callback(struct rcu_head *head) 793static void bdev_free_inode(struct inode *inode)
794{ 794{
795 struct inode *inode = container_of(head, struct inode, i_rcu); 795 kmem_cache_free(bdev_cachep, BDEV_I(inode));
796 struct bdev_inode *bdi = BDEV_I(inode);
797
798 kmem_cache_free(bdev_cachep, bdi);
799}
800
801static void bdev_destroy_inode(struct inode *inode)
802{
803 call_rcu(&inode->i_rcu, bdev_i_callback);
804} 796}
805 797
806static void init_once(void *foo) 798static void init_once(void *foo)
@@ -840,7 +832,7 @@ static void bdev_evict_inode(struct inode *inode)
840static const struct super_operations bdev_sops = { 832static const struct super_operations bdev_sops = {
841 .statfs = simple_statfs, 833 .statfs = simple_statfs,
842 .alloc_inode = bdev_alloc_inode, 834 .alloc_inode = bdev_alloc_inode,
843 .destroy_inode = bdev_destroy_inode, 835 .free_inode = bdev_free_inode,
844 .drop_inode = generic_delete_inode, 836 .drop_inode = generic_delete_inode,
845 .evict_inode = bdev_evict_inode, 837 .evict_inode = bdev_evict_inode,
846}; 838};
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b3642367a595..5260a9263d73 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3267,6 +3267,7 @@ void btrfs_evict_inode(struct inode *inode);
3267int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); 3267int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
3268struct inode *btrfs_alloc_inode(struct super_block *sb); 3268struct inode *btrfs_alloc_inode(struct super_block *sb);
3269void btrfs_destroy_inode(struct inode *inode); 3269void btrfs_destroy_inode(struct inode *inode);
3270void btrfs_free_inode(struct inode *inode);
3270int btrfs_drop_inode(struct inode *inode); 3271int btrfs_drop_inode(struct inode *inode);
3271int __init btrfs_init_cachep(void); 3272int __init btrfs_init_cachep(void);
3272void __cold btrfs_destroy_cachep(void); 3273void __cold btrfs_destroy_cachep(void);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2973608824ec..ade7d0c5ce1b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9206,9 +9206,8 @@ void btrfs_test_destroy_inode(struct inode *inode)
9206} 9206}
9207#endif 9207#endif
9208 9208
9209static void btrfs_i_callback(struct rcu_head *head) 9209void btrfs_free_inode(struct inode *inode)
9210{ 9210{
9211 struct inode *inode = container_of(head, struct inode, i_rcu);
9212 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); 9211 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
9213} 9212}
9214 9213
@@ -9234,7 +9233,7 @@ void btrfs_destroy_inode(struct inode *inode)
9234 * created. 9233 * created.
9235 */ 9234 */
9236 if (!root) 9235 if (!root)
9237 goto free; 9236 return;
9238 9237
9239 while (1) { 9238 while (1) {
9240 ordered = btrfs_lookup_first_ordered_extent(inode, (u64)-1); 9239 ordered = btrfs_lookup_first_ordered_extent(inode, (u64)-1);
@@ -9252,8 +9251,6 @@ void btrfs_destroy_inode(struct inode *inode)
9252 btrfs_qgroup_check_reserved_leak(inode); 9251 btrfs_qgroup_check_reserved_leak(inode);
9253 inode_tree_del(inode); 9252 inode_tree_del(inode);
9254 btrfs_drop_extent_cache(BTRFS_I(inode), 0, (u64)-1, 0); 9253 btrfs_drop_extent_cache(BTRFS_I(inode), 0, (u64)-1, 0);
9255free:
9256 call_rcu(&inode->i_rcu, btrfs_i_callback);
9257} 9254}
9258 9255
9259int btrfs_drop_inode(struct inode *inode) 9256int btrfs_drop_inode(struct inode *inode)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 120e4340792a..236f812091a3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2298,6 +2298,7 @@ static const struct super_operations btrfs_super_ops = {
2298 .show_devname = btrfs_show_devname, 2298 .show_devname = btrfs_show_devname,
2299 .alloc_inode = btrfs_alloc_inode, 2299 .alloc_inode = btrfs_alloc_inode,
2300 .destroy_inode = btrfs_destroy_inode, 2300 .destroy_inode = btrfs_destroy_inode,
2301 .free_inode = btrfs_free_inode,
2301 .statfs = btrfs_statfs, 2302 .statfs = btrfs_statfs,
2302 .remount_fs = btrfs_remount, 2303 .remount_fs = btrfs_remount,
2303 .freeze_fs = btrfs_freeze, 2304 .freeze_fs = btrfs_freeze,
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index c2feb310ac1e..35dae6d5493a 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -519,9 +519,8 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
519 return &ci->vfs_inode; 519 return &ci->vfs_inode;
520} 520}
521 521
522static void ceph_i_callback(struct rcu_head *head) 522void ceph_free_inode(struct inode *inode)
523{ 523{
524 struct inode *inode = container_of(head, struct inode, i_rcu);
525 struct ceph_inode_info *ci = ceph_inode(inode); 524 struct ceph_inode_info *ci = ceph_inode(inode);
526 525
527 kfree(ci->i_symlink); 526 kfree(ci->i_symlink);
@@ -581,8 +580,6 @@ void ceph_destroy_inode(struct inode *inode)
581 ceph_buffer_put(ci->i_xattrs.prealloc_blob); 580 ceph_buffer_put(ci->i_xattrs.prealloc_blob);
582 581
583 ceph_put_string(rcu_dereference_raw(ci->i_layout.pool_ns)); 582 ceph_put_string(rcu_dereference_raw(ci->i_layout.pool_ns));
584
585 call_rcu(&inode->i_rcu, ceph_i_callback);
586} 583}
587 584
588int ceph_drop_inode(struct inode *inode) 585int ceph_drop_inode(struct inode *inode)
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 6d5bb2f74612..285edda4fc3b 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -848,6 +848,7 @@ static void ceph_umount_begin(struct super_block *sb)
848static const struct super_operations ceph_super_ops = { 848static const struct super_operations ceph_super_ops = {
849 .alloc_inode = ceph_alloc_inode, 849 .alloc_inode = ceph_alloc_inode,
850 .destroy_inode = ceph_destroy_inode, 850 .destroy_inode = ceph_destroy_inode,
851 .free_inode = ceph_free_inode,
851 .write_inode = ceph_write_inode, 852 .write_inode = ceph_write_inode,
852 .drop_inode = ceph_drop_inode, 853 .drop_inode = ceph_drop_inode,
853 .sync_fs = ceph_sync_fs, 854 .sync_fs = ceph_sync_fs,
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 16c03188578e..c5b4a05905c0 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -874,6 +874,7 @@ extern const struct inode_operations ceph_file_iops;
874 874
875extern struct inode *ceph_alloc_inode(struct super_block *sb); 875extern struct inode *ceph_alloc_inode(struct super_block *sb);
876extern void ceph_destroy_inode(struct inode *inode); 876extern void ceph_destroy_inode(struct inode *inode);
877extern void ceph_free_inode(struct inode *inode);
877extern int ceph_drop_inode(struct inode *inode); 878extern int ceph_drop_inode(struct inode *inode);
878 879
879extern struct inode *ceph_get_inode(struct super_block *sb, 880extern struct inode *ceph_get_inode(struct super_block *sb,
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index a05bf1d6e1d0..877174761efb 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -315,16 +315,10 @@ cifs_alloc_inode(struct super_block *sb)
315 return &cifs_inode->vfs_inode; 315 return &cifs_inode->vfs_inode;
316} 316}
317 317
318static void cifs_i_callback(struct rcu_head *head)
319{
320 struct inode *inode = container_of(head, struct inode, i_rcu);
321 kmem_cache_free(cifs_inode_cachep, CIFS_I(inode));
322}
323
324static void 318static void
325cifs_destroy_inode(struct inode *inode) 319cifs_free_inode(struct inode *inode)
326{ 320{
327 call_rcu(&inode->i_rcu, cifs_i_callback); 321 kmem_cache_free(cifs_inode_cachep, CIFS_I(inode));
328} 322}
329 323
330static void 324static void
@@ -630,7 +624,7 @@ static int cifs_drop_inode(struct inode *inode)
630static const struct super_operations cifs_super_ops = { 624static const struct super_operations cifs_super_ops = {
631 .statfs = cifs_statfs, 625 .statfs = cifs_statfs,
632 .alloc_inode = cifs_alloc_inode, 626 .alloc_inode = cifs_alloc_inode,
633 .destroy_inode = cifs_destroy_inode, 627 .free_inode = cifs_free_inode,
634 .drop_inode = cifs_drop_inode, 628 .drop_inode = cifs_drop_inode,
635 .evict_inode = cifs_evict_inode, 629 .evict_inode = cifs_evict_inode,
636/* .delete_inode = cifs_delete_inode, */ /* Do not need above 630/* .delete_inode = cifs_delete_inode, */ /* Do not need above
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 97424cf206c0..23f6ebd08e80 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -54,17 +54,11 @@ static struct inode *coda_alloc_inode(struct super_block *sb)
54 return &ei->vfs_inode; 54 return &ei->vfs_inode;
55} 55}
56 56
57static void coda_i_callback(struct rcu_head *head) 57static void coda_free_inode(struct inode *inode)
58{ 58{
59 struct inode *inode = container_of(head, struct inode, i_rcu);
60 kmem_cache_free(coda_inode_cachep, ITOC(inode)); 59 kmem_cache_free(coda_inode_cachep, ITOC(inode));
61} 60}
62 61
63static void coda_destroy_inode(struct inode *inode)
64{
65 call_rcu(&inode->i_rcu, coda_i_callback);
66}
67
68static void init_once(void *foo) 62static void init_once(void *foo)
69{ 63{
70 struct coda_inode_info *ei = (struct coda_inode_info *) foo; 64 struct coda_inode_info *ei = (struct coda_inode_info *) foo;
@@ -104,7 +98,7 @@ static int coda_remount(struct super_block *sb, int *flags, char *data)
104static const struct super_operations coda_super_operations = 98static const struct super_operations coda_super_operations =
105{ 99{
106 .alloc_inode = coda_alloc_inode, 100 .alloc_inode = coda_alloc_inode,
107 .destroy_inode = coda_destroy_inode, 101 .free_inode = coda_free_inode,
108 .evict_inode = coda_evict_inode, 102 .evict_inode = coda_evict_inode,
109 .put_super = coda_put_super, 103 .put_super = coda_put_super,
110 .statfs = coda_statfs, 104 .statfs = coda_statfs,
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index f25daa207421..414fa4752047 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -163,24 +163,18 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root)
163 return 0; 163 return 0;
164} 164}
165 165
166static void debugfs_i_callback(struct rcu_head *head) 166static void debugfs_free_inode(struct inode *inode)
167{ 167{
168 struct inode *inode = container_of(head, struct inode, i_rcu);
169 if (S_ISLNK(inode->i_mode)) 168 if (S_ISLNK(inode->i_mode))
170 kfree(inode->i_link); 169 kfree(inode->i_link);
171 free_inode_nonrcu(inode); 170 free_inode_nonrcu(inode);
172} 171}
173 172
174static void debugfs_destroy_inode(struct inode *inode)
175{
176 call_rcu(&inode->i_rcu, debugfs_i_callback);
177}
178
179static const struct super_operations debugfs_super_operations = { 173static const struct super_operations debugfs_super_operations = {
180 .statfs = simple_statfs, 174 .statfs = simple_statfs,
181 .remount_fs = debugfs_remount, 175 .remount_fs = debugfs_remount,
182 .show_options = debugfs_show_options, 176 .show_options = debugfs_show_options,
183 .destroy_inode = debugfs_destroy_inode, 177 .free_inode = debugfs_free_inode,
184}; 178};
185 179
186static void debugfs_release_dentry(struct dentry *dentry) 180static void debugfs_release_dentry(struct dentry *dentry)
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c
index 85411ceb0508..c3e511f2b6c0 100644
--- a/fs/ecryptfs/super.c
+++ b/fs/ecryptfs/super.c
@@ -67,9 +67,8 @@ out:
67 return inode; 67 return inode;
68} 68}
69 69
70static void ecryptfs_i_callback(struct rcu_head *head) 70static void ecryptfs_free_inode(struct inode *inode)
71{ 71{
72 struct inode *inode = container_of(head, struct inode, i_rcu);
73 struct ecryptfs_inode_info *inode_info; 72 struct ecryptfs_inode_info *inode_info;
74 inode_info = ecryptfs_inode_to_private(inode); 73 inode_info = ecryptfs_inode_to_private(inode);
75 74
@@ -92,7 +91,6 @@ static void ecryptfs_destroy_inode(struct inode *inode)
92 inode_info = ecryptfs_inode_to_private(inode); 91 inode_info = ecryptfs_inode_to_private(inode);
93 BUG_ON(inode_info->lower_file); 92 BUG_ON(inode_info->lower_file);
94 ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); 93 ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat);
95 call_rcu(&inode->i_rcu, ecryptfs_i_callback);
96} 94}
97 95
98/** 96/**
@@ -186,6 +184,7 @@ static int ecryptfs_show_options(struct seq_file *m, struct dentry *root)
186const struct super_operations ecryptfs_sops = { 184const struct super_operations ecryptfs_sops = {
187 .alloc_inode = ecryptfs_alloc_inode, 185 .alloc_inode = ecryptfs_alloc_inode,
188 .destroy_inode = ecryptfs_destroy_inode, 186 .destroy_inode = ecryptfs_destroy_inode,
187 .free_inode = ecryptfs_free_inode,
189 .statfs = ecryptfs_statfs, 188 .statfs = ecryptfs_statfs,
190 .remount_fs = NULL, 189 .remount_fs = NULL,
191 .evict_inode = ecryptfs_evict_inode, 190 .evict_inode = ecryptfs_evict_inode,
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 6ffb7ba1547a..867fc24dee20 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -74,17 +74,11 @@ static struct inode *efs_alloc_inode(struct super_block *sb)
74 return &ei->vfs_inode; 74 return &ei->vfs_inode;
75} 75}
76 76
77static void efs_i_callback(struct rcu_head *head) 77static void efs_free_inode(struct inode *inode)
78{ 78{
79 struct inode *inode = container_of(head, struct inode, i_rcu);
80 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode)); 79 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
81} 80}
82 81
83static void efs_destroy_inode(struct inode *inode)
84{
85 call_rcu(&inode->i_rcu, efs_i_callback);
86}
87
88static void init_once(void *foo) 82static void init_once(void *foo)
89{ 83{
90 struct efs_inode_info *ei = (struct efs_inode_info *) foo; 84 struct efs_inode_info *ei = (struct efs_inode_info *) foo;
@@ -122,7 +116,7 @@ static int efs_remount(struct super_block *sb, int *flags, char *data)
122 116
123static const struct super_operations efs_superblock_operations = { 117static const struct super_operations efs_superblock_operations = {
124 .alloc_inode = efs_alloc_inode, 118 .alloc_inode = efs_alloc_inode,
125 .destroy_inode = efs_destroy_inode, 119 .free_inode = efs_free_inode,
126 .statfs = efs_statfs, 120 .statfs = efs_statfs,
127 .remount_fs = efs_remount, 121 .remount_fs = efs_remount,
128}; 122};
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 0128010a0874..3988633789cb 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -192,17 +192,11 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
192 return &ei->vfs_inode; 192 return &ei->vfs_inode;
193} 193}
194 194
195static void ext2_i_callback(struct rcu_head *head) 195static void ext2_free_in_core_inode(struct inode *inode)
196{ 196{
197 struct inode *inode = container_of(head, struct inode, i_rcu);
198 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); 197 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
199} 198}
200 199
201static void ext2_destroy_inode(struct inode *inode)
202{
203 call_rcu(&inode->i_rcu, ext2_i_callback);
204}
205
206static void init_once(void *foo) 200static void init_once(void *foo)
207{ 201{
208 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; 202 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
@@ -351,7 +345,7 @@ static const struct quotactl_ops ext2_quotactl_ops = {
351 345
352static const struct super_operations ext2_sops = { 346static const struct super_operations ext2_sops = {
353 .alloc_inode = ext2_alloc_inode, 347 .alloc_inode = ext2_alloc_inode,
354 .destroy_inode = ext2_destroy_inode, 348 .free_inode = ext2_free_in_core_inode,
355 .write_inode = ext2_write_inode, 349 .write_inode = ext2_write_inode,
356 .evict_inode = ext2_evict_inode, 350 .evict_inode = ext2_evict_inode,
357 .put_super = ext2_put_super, 351 .put_super = ext2_put_super,
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6ed4eb81e674..981f702848e7 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1107,9 +1107,8 @@ static int ext4_drop_inode(struct inode *inode)
1107 return drop; 1107 return drop;
1108} 1108}
1109 1109
1110static void ext4_i_callback(struct rcu_head *head) 1110static void ext4_free_in_core_inode(struct inode *inode)
1111{ 1111{
1112 struct inode *inode = container_of(head, struct inode, i_rcu);
1113 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode)); 1112 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
1114} 1113}
1115 1114
@@ -1124,7 +1123,6 @@ static void ext4_destroy_inode(struct inode *inode)
1124 true); 1123 true);
1125 dump_stack(); 1124 dump_stack();
1126 } 1125 }
1127 call_rcu(&inode->i_rcu, ext4_i_callback);
1128} 1126}
1129 1127
1130static void init_once(void *foo) 1128static void init_once(void *foo)
@@ -1402,6 +1400,7 @@ static const struct quotactl_ops ext4_qctl_operations = {
1402 1400
1403static const struct super_operations ext4_sops = { 1401static const struct super_operations ext4_sops = {
1404 .alloc_inode = ext4_alloc_inode, 1402 .alloc_inode = ext4_alloc_inode,
1403 .free_inode = ext4_free_in_core_inode,
1405 .destroy_inode = ext4_destroy_inode, 1404 .destroy_inode = ext4_destroy_inode,
1406 .write_inode = ext4_write_inode, 1405 .write_inode = ext4_write_inode,
1407 .dirty_inode = ext4_dirty_inode, 1406 .dirty_inode = ext4_dirty_inode,
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index f2aaa2cc6b3e..9924eac76254 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1000,17 +1000,11 @@ static void f2fs_dirty_inode(struct inode *inode, int flags)
1000 f2fs_inode_dirtied(inode, false); 1000 f2fs_inode_dirtied(inode, false);
1001} 1001}
1002 1002
1003static void f2fs_i_callback(struct rcu_head *head) 1003static void f2fs_free_inode(struct inode *inode)
1004{ 1004{
1005 struct inode *inode = container_of(head, struct inode, i_rcu);
1006 kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode)); 1005 kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode));
1007} 1006}
1008 1007
1009static void f2fs_destroy_inode(struct inode *inode)
1010{
1011 call_rcu(&inode->i_rcu, f2fs_i_callback);
1012}
1013
1014static void destroy_percpu_info(struct f2fs_sb_info *sbi) 1008static void destroy_percpu_info(struct f2fs_sb_info *sbi)
1015{ 1009{
1016 percpu_counter_destroy(&sbi->alloc_valid_block_count); 1010 percpu_counter_destroy(&sbi->alloc_valid_block_count);
@@ -2166,8 +2160,8 @@ void f2fs_quota_off_umount(struct super_block *sb)
2166 2160
2167static const struct super_operations f2fs_sops = { 2161static const struct super_operations f2fs_sops = {
2168 .alloc_inode = f2fs_alloc_inode, 2162 .alloc_inode = f2fs_alloc_inode,
2163 .free_inode = f2fs_free_inode,
2169 .drop_inode = f2fs_drop_inode, 2164 .drop_inode = f2fs_drop_inode,
2170 .destroy_inode = f2fs_destroy_inode,
2171 .write_inode = f2fs_write_inode, 2165 .write_inode = f2fs_write_inode,
2172 .dirty_inode = f2fs_dirty_inode, 2166 .dirty_inode = f2fs_dirty_inode,
2173 .show_options = f2fs_show_options, 2167 .show_options = f2fs_show_options,
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 79bb0e73a65f..ba93d1373306 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -746,17 +746,11 @@ static struct inode *fat_alloc_inode(struct super_block *sb)
746 return &ei->vfs_inode; 746 return &ei->vfs_inode;
747} 747}
748 748
749static void fat_i_callback(struct rcu_head *head) 749static void fat_free_inode(struct inode *inode)
750{ 750{
751 struct inode *inode = container_of(head, struct inode, i_rcu);
752 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode)); 751 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
753} 752}
754 753
755static void fat_destroy_inode(struct inode *inode)
756{
757 call_rcu(&inode->i_rcu, fat_i_callback);
758}
759
760static void init_once(void *foo) 754static void init_once(void *foo)
761{ 755{
762 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo; 756 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;
@@ -920,7 +914,7 @@ EXPORT_SYMBOL_GPL(fat_sync_inode);
920static int fat_show_options(struct seq_file *m, struct dentry *root); 914static int fat_show_options(struct seq_file *m, struct dentry *root);
921static const struct super_operations fat_sops = { 915static const struct super_operations fat_sops = {
922 .alloc_inode = fat_alloc_inode, 916 .alloc_inode = fat_alloc_inode,
923 .destroy_inode = fat_destroy_inode, 917 .free_inode = fat_free_inode,
924 .write_inode = fat_write_inode, 918 .write_inode = fat_write_inode,
925 .evict_inode = fat_evict_inode, 919 .evict_inode = fat_evict_inode,
926 .put_super = fat_put_super, 920 .put_super = fat_put_super,
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index 48b24bb50d02..a89f68c3cbed 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -131,21 +131,14 @@ static struct inode *vxfs_alloc_inode(struct super_block *sb)
131 return &vi->vfs_inode; 131 return &vi->vfs_inode;
132} 132}
133 133
134static void vxfs_i_callback(struct rcu_head *head) 134static void vxfs_free_inode(struct inode *inode)
135{ 135{
136 struct inode *inode = container_of(head, struct inode, i_rcu);
137
138 kmem_cache_free(vxfs_inode_cachep, VXFS_INO(inode)); 136 kmem_cache_free(vxfs_inode_cachep, VXFS_INO(inode));
139} 137}
140 138
141static void vxfs_destroy_inode(struct inode *inode)
142{
143 call_rcu(&inode->i_rcu, vxfs_i_callback);
144}
145
146static const struct super_operations vxfs_super_ops = { 139static const struct super_operations vxfs_super_ops = {
147 .alloc_inode = vxfs_alloc_inode, 140 .alloc_inode = vxfs_alloc_inode,
148 .destroy_inode = vxfs_destroy_inode, 141 .free_inode = vxfs_free_inode,
149 .evict_inode = vxfs_evict_inode, 142 .evict_inode = vxfs_evict_inode,
150 .put_super = vxfs_put_super, 143 .put_super = vxfs_put_super,
151 .statfs = vxfs_statfs, 144 .statfs = vxfs_statfs,
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index ec5d9953dfb6..f485d09d14df 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -107,34 +107,30 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
107 return inode; 107 return inode;
108} 108}
109 109
110static void fuse_i_callback(struct rcu_head *head) 110static void fuse_free_inode(struct inode *inode)
111{
112 struct inode *inode = container_of(head, struct inode, i_rcu);
113 kmem_cache_free(fuse_inode_cachep, inode);
114}
115
116static void fuse_destroy_inode(struct inode *inode)
117{ 111{
118 struct fuse_inode *fi = get_fuse_inode(inode); 112 struct fuse_inode *fi = get_fuse_inode(inode);
119 if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) { 113
120 WARN_ON(!list_empty(&fi->write_files));
121 WARN_ON(!list_empty(&fi->queued_writes));
122 }
123 mutex_destroy(&fi->mutex); 114 mutex_destroy(&fi->mutex);
124 kfree(fi->forget); 115 kfree(fi->forget);
125 call_rcu(&inode->i_rcu, fuse_i_callback); 116 kmem_cache_free(fuse_inode_cachep, fi);
126} 117}
127 118
128static void fuse_evict_inode(struct inode *inode) 119static void fuse_evict_inode(struct inode *inode)
129{ 120{
121 struct fuse_inode *fi = get_fuse_inode(inode);
122
130 truncate_inode_pages_final(&inode->i_data); 123 truncate_inode_pages_final(&inode->i_data);
131 clear_inode(inode); 124 clear_inode(inode);
132 if (inode->i_sb->s_flags & SB_ACTIVE) { 125 if (inode->i_sb->s_flags & SB_ACTIVE) {
133 struct fuse_conn *fc = get_fuse_conn(inode); 126 struct fuse_conn *fc = get_fuse_conn(inode);
134 struct fuse_inode *fi = get_fuse_inode(inode);
135 fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup); 127 fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup);
136 fi->forget = NULL; 128 fi->forget = NULL;
137 } 129 }
130 if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) {
131 WARN_ON(!list_empty(&fi->write_files));
132 WARN_ON(!list_empty(&fi->queued_writes));
133 }
138} 134}
139 135
140static int fuse_remount_fs(struct super_block *sb, int *flags, char *data) 136static int fuse_remount_fs(struct super_block *sb, int *flags, char *data)
@@ -814,7 +810,7 @@ static const struct export_operations fuse_export_operations = {
814 810
815static const struct super_operations fuse_super_operations = { 811static const struct super_operations fuse_super_operations = {
816 .alloc_inode = fuse_alloc_inode, 812 .alloc_inode = fuse_alloc_inode,
817 .destroy_inode = fuse_destroy_inode, 813 .free_inode = fuse_free_inode,
818 .evict_inode = fuse_evict_inode, 814 .evict_inode = fuse_evict_inode,
819 .write_inode = fuse_write_inode, 815 .write_inode = fuse_write_inode,
820 .drop_inode = generic_delete_inode, 816 .drop_inode = generic_delete_inode,
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index ca71163ff7cf..7b8d2306b3d3 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1736,20 +1736,14 @@ static struct inode *gfs2_alloc_inode(struct super_block *sb)
1736 return &ip->i_inode; 1736 return &ip->i_inode;
1737} 1737}
1738 1738
1739static void gfs2_i_callback(struct rcu_head *head) 1739static void gfs2_free_inode(struct inode *inode)
1740{ 1740{
1741 struct inode *inode = container_of(head, struct inode, i_rcu); 1741 kmem_cache_free(gfs2_inode_cachep, GFS2_I(inode));
1742 kmem_cache_free(gfs2_inode_cachep, inode);
1743}
1744
1745static void gfs2_destroy_inode(struct inode *inode)
1746{
1747 call_rcu(&inode->i_rcu, gfs2_i_callback);
1748} 1742}
1749 1743
1750const struct super_operations gfs2_super_ops = { 1744const struct super_operations gfs2_super_ops = {
1751 .alloc_inode = gfs2_alloc_inode, 1745 .alloc_inode = gfs2_alloc_inode,
1752 .destroy_inode = gfs2_destroy_inode, 1746 .free_inode = gfs2_free_inode,
1753 .write_inode = gfs2_write_inode, 1747 .write_inode = gfs2_write_inode,
1754 .dirty_inode = gfs2_dirty_inode, 1748 .dirty_inode = gfs2_dirty_inode,
1755 .evict_inode = gfs2_evict_inode, 1749 .evict_inode = gfs2_evict_inode,
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 173876782f73..c33324686d89 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -167,20 +167,14 @@ static struct inode *hfs_alloc_inode(struct super_block *sb)
167 return i ? &i->vfs_inode : NULL; 167 return i ? &i->vfs_inode : NULL;
168} 168}
169 169
170static void hfs_i_callback(struct rcu_head *head) 170static void hfs_free_inode(struct inode *inode)
171{ 171{
172 struct inode *inode = container_of(head, struct inode, i_rcu);
173 kmem_cache_free(hfs_inode_cachep, HFS_I(inode)); 172 kmem_cache_free(hfs_inode_cachep, HFS_I(inode));
174} 173}
175 174
176static void hfs_destroy_inode(struct inode *inode)
177{
178 call_rcu(&inode->i_rcu, hfs_i_callback);
179}
180
181static const struct super_operations hfs_super_operations = { 175static const struct super_operations hfs_super_operations = {
182 .alloc_inode = hfs_alloc_inode, 176 .alloc_inode = hfs_alloc_inode,
183 .destroy_inode = hfs_destroy_inode, 177 .free_inode = hfs_free_inode,
184 .write_inode = hfs_write_inode, 178 .write_inode = hfs_write_inode,
185 .evict_inode = hfs_evict_inode, 179 .evict_inode = hfs_evict_inode,
186 .put_super = hfs_put_super, 180 .put_super = hfs_put_super,
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index eb4535eba95d..0cc5feff76cd 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -18,7 +18,7 @@
18#include <linux/nls.h> 18#include <linux/nls.h>
19 19
20static struct inode *hfsplus_alloc_inode(struct super_block *sb); 20static struct inode *hfsplus_alloc_inode(struct super_block *sb);
21static void hfsplus_destroy_inode(struct inode *inode); 21static void hfsplus_free_inode(struct inode *inode);
22 22
23#include "hfsplus_fs.h" 23#include "hfsplus_fs.h"
24#include "xattr.h" 24#include "xattr.h"
@@ -361,7 +361,7 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
361 361
362static const struct super_operations hfsplus_sops = { 362static const struct super_operations hfsplus_sops = {
363 .alloc_inode = hfsplus_alloc_inode, 363 .alloc_inode = hfsplus_alloc_inode,
364 .destroy_inode = hfsplus_destroy_inode, 364 .free_inode = hfsplus_free_inode,
365 .write_inode = hfsplus_write_inode, 365 .write_inode = hfsplus_write_inode,
366 .evict_inode = hfsplus_evict_inode, 366 .evict_inode = hfsplus_evict_inode,
367 .put_super = hfsplus_put_super, 367 .put_super = hfsplus_put_super,
@@ -628,18 +628,11 @@ static struct inode *hfsplus_alloc_inode(struct super_block *sb)
628 return i ? &i->vfs_inode : NULL; 628 return i ? &i->vfs_inode : NULL;
629} 629}
630 630
631static void hfsplus_i_callback(struct rcu_head *head) 631static void hfsplus_free_inode(struct inode *inode)
632{ 632{
633 struct inode *inode = container_of(head, struct inode, i_rcu);
634
635 kmem_cache_free(hfsplus_inode_cachep, HFSPLUS_I(inode)); 633 kmem_cache_free(hfsplus_inode_cachep, HFSPLUS_I(inode));
636} 634}
637 635
638static void hfsplus_destroy_inode(struct inode *inode)
639{
640 call_rcu(&inode->i_rcu, hfsplus_i_callback);
641}
642
643#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info) 636#define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info)
644 637
645static struct dentry *hfsplus_mount(struct file_system_type *fs_type, 638static struct dentry *hfsplus_mount(struct file_system_type *fs_type,
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 444c7b170359..5a7eb0c79839 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -243,17 +243,11 @@ static void hostfs_evict_inode(struct inode *inode)
243 } 243 }
244} 244}
245 245
246static void hostfs_i_callback(struct rcu_head *head) 246static void hostfs_free_inode(struct inode *inode)
247{ 247{
248 struct inode *inode = container_of(head, struct inode, i_rcu);
249 kfree(HOSTFS_I(inode)); 248 kfree(HOSTFS_I(inode));
250} 249}
251 250
252static void hostfs_destroy_inode(struct inode *inode)
253{
254 call_rcu(&inode->i_rcu, hostfs_i_callback);
255}
256
257static int hostfs_show_options(struct seq_file *seq, struct dentry *root) 251static int hostfs_show_options(struct seq_file *seq, struct dentry *root)
258{ 252{
259 const char *root_path = root->d_sb->s_fs_info; 253 const char *root_path = root->d_sb->s_fs_info;
@@ -270,7 +264,7 @@ static int hostfs_show_options(struct seq_file *seq, struct dentry *root)
270 264
271static const struct super_operations hostfs_sbops = { 265static const struct super_operations hostfs_sbops = {
272 .alloc_inode = hostfs_alloc_inode, 266 .alloc_inode = hostfs_alloc_inode,
273 .destroy_inode = hostfs_destroy_inode, 267 .free_inode = hostfs_free_inode,
274 .evict_inode = hostfs_evict_inode, 268 .evict_inode = hostfs_evict_inode,
275 .statfs = hostfs_statfs, 269 .statfs = hostfs_statfs,
276 .show_options = hostfs_show_options, 270 .show_options = hostfs_show_options,
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index f2c3ebcd309c..ed4264bca790 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -238,17 +238,11 @@ static struct inode *hpfs_alloc_inode(struct super_block *sb)
238 return &ei->vfs_inode; 238 return &ei->vfs_inode;
239} 239}
240 240
241static void hpfs_i_callback(struct rcu_head *head) 241static void hpfs_free_inode(struct inode *inode)
242{ 242{
243 struct inode *inode = container_of(head, struct inode, i_rcu);
244 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode)); 243 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
245} 244}
246 245
247static void hpfs_destroy_inode(struct inode *inode)
248{
249 call_rcu(&inode->i_rcu, hpfs_i_callback);
250}
251
252static void init_once(void *foo) 246static void init_once(void *foo)
253{ 247{
254 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; 248 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
@@ -532,7 +526,7 @@ static int hpfs_show_options(struct seq_file *seq, struct dentry *root)
532static const struct super_operations hpfs_sops = 526static const struct super_operations hpfs_sops =
533{ 527{
534 .alloc_inode = hpfs_alloc_inode, 528 .alloc_inode = hpfs_alloc_inode,
535 .destroy_inode = hpfs_destroy_inode, 529 .free_inode = hpfs_free_inode,
536 .evict_inode = hpfs_evict_inode, 530 .evict_inode = hpfs_evict_inode,
537 .put_super = hpfs_put_super, 531 .put_super = hpfs_put_super,
538 .statfs = hpfs_statfs, 532 .statfs = hpfs_statfs,
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 9285dd4f4b1c..c74ef4426282 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1051,9 +1051,8 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
1051 return &p->vfs_inode; 1051 return &p->vfs_inode;
1052} 1052}
1053 1053
1054static void hugetlbfs_i_callback(struct rcu_head *head) 1054static void hugetlbfs_free_inode(struct inode *inode)
1055{ 1055{
1056 struct inode *inode = container_of(head, struct inode, i_rcu);
1057 kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); 1056 kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
1058} 1057}
1059 1058
@@ -1061,7 +1060,6 @@ static void hugetlbfs_destroy_inode(struct inode *inode)
1061{ 1060{
1062 hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb)); 1061 hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb));
1063 mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy); 1062 mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy);
1064 call_rcu(&inode->i_rcu, hugetlbfs_i_callback);
1065} 1063}
1066 1064
1067static const struct address_space_operations hugetlbfs_aops = { 1065static const struct address_space_operations hugetlbfs_aops = {
@@ -1108,6 +1106,7 @@ static const struct inode_operations hugetlbfs_inode_operations = {
1108 1106
1109static const struct super_operations hugetlbfs_ops = { 1107static const struct super_operations hugetlbfs_ops = {
1110 .alloc_inode = hugetlbfs_alloc_inode, 1108 .alloc_inode = hugetlbfs_alloc_inode,
1109 .free_inode = hugetlbfs_free_inode,
1111 .destroy_inode = hugetlbfs_destroy_inode, 1110 .destroy_inode = hugetlbfs_destroy_inode,
1112 .evict_inode = hugetlbfs_evict_inode, 1111 .evict_inode = hugetlbfs_evict_inode,
1113 .statfs = hugetlbfs_statfs, 1112 .statfs = hugetlbfs_statfs,
diff --git a/fs/inode.c b/fs/inode.c
index 9a453f3637f8..16b10e53292e 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -202,12 +202,28 @@ out:
202} 202}
203EXPORT_SYMBOL(inode_init_always); 203EXPORT_SYMBOL(inode_init_always);
204 204
205void free_inode_nonrcu(struct inode *inode)
206{
207 kmem_cache_free(inode_cachep, inode);
208}
209EXPORT_SYMBOL(free_inode_nonrcu);
210
211static void i_callback(struct rcu_head *head)
212{
213 struct inode *inode = container_of(head, struct inode, i_rcu);
214 if (inode->free_inode)
215 inode->free_inode(inode);
216 else
217 free_inode_nonrcu(inode);
218}
219
205static struct inode *alloc_inode(struct super_block *sb) 220static struct inode *alloc_inode(struct super_block *sb)
206{ 221{
222 const struct super_operations *ops = sb->s_op;
207 struct inode *inode; 223 struct inode *inode;
208 224
209 if (sb->s_op->alloc_inode) 225 if (ops->alloc_inode)
210 inode = sb->s_op->alloc_inode(sb); 226 inode = ops->alloc_inode(sb);
211 else 227 else
212 inode = kmem_cache_alloc(inode_cachep, GFP_KERNEL); 228 inode = kmem_cache_alloc(inode_cachep, GFP_KERNEL);
213 229
@@ -215,22 +231,19 @@ static struct inode *alloc_inode(struct super_block *sb)
215 return NULL; 231 return NULL;
216 232
217 if (unlikely(inode_init_always(sb, inode))) { 233 if (unlikely(inode_init_always(sb, inode))) {
218 if (inode->i_sb->s_op->destroy_inode) 234 if (ops->destroy_inode) {
219 inode->i_sb->s_op->destroy_inode(inode); 235 ops->destroy_inode(inode);
220 else 236 if (!ops->free_inode)
221 kmem_cache_free(inode_cachep, inode); 237 return NULL;
238 }
239 inode->free_inode = ops->free_inode;
240 i_callback(&inode->i_rcu);
222 return NULL; 241 return NULL;
223 } 242 }
224 243
225 return inode; 244 return inode;
226} 245}
227 246
228void free_inode_nonrcu(struct inode *inode)
229{
230 kmem_cache_free(inode_cachep, inode);
231}
232EXPORT_SYMBOL(free_inode_nonrcu);
233
234void __destroy_inode(struct inode *inode) 247void __destroy_inode(struct inode *inode)
235{ 248{
236 BUG_ON(inode_has_buffers(inode)); 249 BUG_ON(inode_has_buffers(inode));
@@ -253,20 +266,19 @@ void __destroy_inode(struct inode *inode)
253} 266}
254EXPORT_SYMBOL(__destroy_inode); 267EXPORT_SYMBOL(__destroy_inode);
255 268
256static void i_callback(struct rcu_head *head)
257{
258 struct inode *inode = container_of(head, struct inode, i_rcu);
259 kmem_cache_free(inode_cachep, inode);
260}
261
262static void destroy_inode(struct inode *inode) 269static void destroy_inode(struct inode *inode)
263{ 270{
271 const struct super_operations *ops = inode->i_sb->s_op;
272
264 BUG_ON(!list_empty(&inode->i_lru)); 273 BUG_ON(!list_empty(&inode->i_lru));
265 __destroy_inode(inode); 274 __destroy_inode(inode);
266 if (inode->i_sb->s_op->destroy_inode) 275 if (ops->destroy_inode) {
267 inode->i_sb->s_op->destroy_inode(inode); 276 ops->destroy_inode(inode);
268 else 277 if (!ops->free_inode)
269 call_rcu(&inode->i_rcu, i_callback); 278 return;
279 }
280 inode->free_inode = ops->free_inode;
281 call_rcu(&inode->i_rcu, i_callback);
270} 282}
271 283
272/** 284/**
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 488a9e7f8f66..603b052a3c94 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -72,17 +72,11 @@ static struct inode *isofs_alloc_inode(struct super_block *sb)
72 return &ei->vfs_inode; 72 return &ei->vfs_inode;
73} 73}
74 74
75static void isofs_i_callback(struct rcu_head *head) 75static void isofs_free_inode(struct inode *inode)
76{ 76{
77 struct inode *inode = container_of(head, struct inode, i_rcu);
78 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 77 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
79} 78}
80 79
81static void isofs_destroy_inode(struct inode *inode)
82{
83 call_rcu(&inode->i_rcu, isofs_i_callback);
84}
85
86static void init_once(void *foo) 80static void init_once(void *foo)
87{ 81{
88 struct iso_inode_info *ei = foo; 82 struct iso_inode_info *ei = foo;
@@ -122,7 +116,7 @@ static int isofs_remount(struct super_block *sb, int *flags, char *data)
122 116
123static const struct super_operations isofs_sops = { 117static const struct super_operations isofs_sops = {
124 .alloc_inode = isofs_alloc_inode, 118 .alloc_inode = isofs_alloc_inode,
125 .destroy_inode = isofs_destroy_inode, 119 .free_inode = isofs_free_inode,
126 .put_super = isofs_put_super, 120 .put_super = isofs_put_super,
127 .statfs = isofs_statfs, 121 .statfs = isofs_statfs,
128 .remount_fs = isofs_remount, 122 .remount_fs = isofs_remount,
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 05d892c79339..af4aa6599473 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -44,20 +44,14 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb)
44 return &f->vfs_inode; 44 return &f->vfs_inode;
45} 45}
46 46
47static void jffs2_i_callback(struct rcu_head *head) 47static void jffs2_free_inode(struct inode *inode)
48{ 48{
49 struct inode *inode = container_of(head, struct inode, i_rcu);
50 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 49 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
51 50
52 kfree(f->target); 51 kfree(f->target);
53 kmem_cache_free(jffs2_inode_cachep, f); 52 kmem_cache_free(jffs2_inode_cachep, f);
54} 53}
55 54
56static void jffs2_destroy_inode(struct inode *inode)
57{
58 call_rcu(&inode->i_rcu, jffs2_i_callback);
59}
60
61static void jffs2_i_init_once(void *foo) 55static void jffs2_i_init_once(void *foo)
62{ 56{
63 struct jffs2_inode_info *f = foo; 57 struct jffs2_inode_info *f = foo;
@@ -258,7 +252,7 @@ static int jffs2_remount_fs(struct super_block *sb, int *flags, char *data)
258static const struct super_operations jffs2_super_operations = 252static const struct super_operations jffs2_super_operations =
259{ 253{
260 .alloc_inode = jffs2_alloc_inode, 254 .alloc_inode = jffs2_alloc_inode,
261 .destroy_inode =jffs2_destroy_inode, 255 .free_inode = jffs2_free_inode,
262 .put_super = jffs2_put_super, 256 .put_super = jffs2_put_super,
263 .statfs = jffs2_statfs, 257 .statfs = jffs2_statfs,
264 .remount_fs = jffs2_remount_fs, 258 .remount_fs = jffs2_remount_fs,
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 805ae9e8944a..f2b92b292abe 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -31,6 +31,7 @@
31#include "jfs_extent.h" 31#include "jfs_extent.h"
32#include "jfs_unicode.h" 32#include "jfs_unicode.h"
33#include "jfs_debug.h" 33#include "jfs_debug.h"
34#include "jfs_dmap.h"
34 35
35 36
36struct inode *jfs_iget(struct super_block *sb, unsigned long ino) 37struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
@@ -150,6 +151,8 @@ int jfs_write_inode(struct inode *inode, struct writeback_control *wbc)
150 151
151void jfs_evict_inode(struct inode *inode) 152void jfs_evict_inode(struct inode *inode)
152{ 153{
154 struct jfs_inode_info *ji = JFS_IP(inode);
155
153 jfs_info("In jfs_evict_inode, inode = 0x%p", inode); 156 jfs_info("In jfs_evict_inode, inode = 0x%p", inode);
154 157
155 if (!inode->i_nlink && !is_bad_inode(inode)) { 158 if (!inode->i_nlink && !is_bad_inode(inode)) {
@@ -173,6 +176,16 @@ void jfs_evict_inode(struct inode *inode)
173 } 176 }
174 clear_inode(inode); 177 clear_inode(inode);
175 dquot_drop(inode); 178 dquot_drop(inode);
179
180 BUG_ON(!list_empty(&ji->anon_inode_list));
181
182 spin_lock_irq(&ji->ag_lock);
183 if (ji->active_ag != -1) {
184 struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
185 atomic_dec(&bmap->db_active[ji->active_ag]);
186 ji->active_ag = -1;
187 }
188 spin_unlock_irq(&ji->ag_lock);
176} 189}
177 190
178void jfs_dirty_inode(struct inode *inode, int flags) 191void jfs_dirty_inode(struct inode *inode, int flags)
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 65d8fc87ab11..9454831bbd71 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -124,27 +124,9 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
124 return &jfs_inode->vfs_inode; 124 return &jfs_inode->vfs_inode;
125} 125}
126 126
127static void jfs_i_callback(struct rcu_head *head) 127static void jfs_free_inode(struct inode *inode)
128{ 128{
129 struct inode *inode = container_of(head, struct inode, i_rcu); 129 kmem_cache_free(jfs_inode_cachep, JFS_IP(inode));
130 struct jfs_inode_info *ji = JFS_IP(inode);
131 kmem_cache_free(jfs_inode_cachep, ji);
132}
133
134static void jfs_destroy_inode(struct inode *inode)
135{
136 struct jfs_inode_info *ji = JFS_IP(inode);
137
138 BUG_ON(!list_empty(&ji->anon_inode_list));
139
140 spin_lock_irq(&ji->ag_lock);
141 if (ji->active_ag != -1) {
142 struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
143 atomic_dec(&bmap->db_active[ji->active_ag]);
144 ji->active_ag = -1;
145 }
146 spin_unlock_irq(&ji->ag_lock);
147 call_rcu(&inode->i_rcu, jfs_i_callback);
148} 130}
149 131
150static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) 132static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -912,7 +894,7 @@ out:
912 894
913static const struct super_operations jfs_super_operations = { 895static const struct super_operations jfs_super_operations = {
914 .alloc_inode = jfs_alloc_inode, 896 .alloc_inode = jfs_alloc_inode,
915 .destroy_inode = jfs_destroy_inode, 897 .free_inode = jfs_free_inode,
916 .dirty_inode = jfs_dirty_inode, 898 .dirty_inode = jfs_dirty_inode,
917 .write_inode = jfs_write_inode, 899 .write_inode = jfs_write_inode,
918 .evict_inode = jfs_evict_inode, 900 .evict_inode = jfs_evict_inode,
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 72e308c3e66b..101200761f61 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -68,17 +68,11 @@ static struct inode *minix_alloc_inode(struct super_block *sb)
68 return &ei->vfs_inode; 68 return &ei->vfs_inode;
69} 69}
70 70
71static void minix_i_callback(struct rcu_head *head) 71static void minix_free_in_core_inode(struct inode *inode)
72{ 72{
73 struct inode *inode = container_of(head, struct inode, i_rcu);
74 kmem_cache_free(minix_inode_cachep, minix_i(inode)); 73 kmem_cache_free(minix_inode_cachep, minix_i(inode));
75} 74}
76 75
77static void minix_destroy_inode(struct inode *inode)
78{
79 call_rcu(&inode->i_rcu, minix_i_callback);
80}
81
82static void init_once(void *foo) 76static void init_once(void *foo)
83{ 77{
84 struct minix_inode_info *ei = (struct minix_inode_info *) foo; 78 struct minix_inode_info *ei = (struct minix_inode_info *) foo;
@@ -110,7 +104,7 @@ static void destroy_inodecache(void)
110 104
111static const struct super_operations minix_sops = { 105static const struct super_operations minix_sops = {
112 .alloc_inode = minix_alloc_inode, 106 .alloc_inode = minix_alloc_inode,
113 .destroy_inode = minix_destroy_inode, 107 .free_inode = minix_free_in_core_inode,
114 .write_inode = minix_write_inode, 108 .write_inode = minix_write_inode,
115 .evict_inode = minix_evict_inode, 109 .evict_inode = minix_evict_inode,
116 .put_super = minix_put_super, 110 .put_super = minix_put_super,
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 414a90d48493..f61af8307dc8 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -2055,17 +2055,11 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
2055} 2055}
2056EXPORT_SYMBOL_GPL(nfs_alloc_inode); 2056EXPORT_SYMBOL_GPL(nfs_alloc_inode);
2057 2057
2058static void nfs_i_callback(struct rcu_head *head) 2058void nfs_free_inode(struct inode *inode)
2059{ 2059{
2060 struct inode *inode = container_of(head, struct inode, i_rcu);
2061 kmem_cache_free(nfs_inode_cachep, NFS_I(inode)); 2060 kmem_cache_free(nfs_inode_cachep, NFS_I(inode));
2062} 2061}
2063 2062EXPORT_SYMBOL_GPL(nfs_free_inode);
2064void nfs_destroy_inode(struct inode *inode)
2065{
2066 call_rcu(&inode->i_rcu, nfs_i_callback);
2067}
2068EXPORT_SYMBOL_GPL(nfs_destroy_inode);
2069 2063
2070static inline void nfs4_init_once(struct nfs_inode *nfsi) 2064static inline void nfs4_init_once(struct nfs_inode *nfsi)
2071{ 2065{
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index c7cf23ae6597..331a0504eaf8 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -381,7 +381,7 @@ int nfs_check_flags(int);
381/* inode.c */ 381/* inode.c */
382extern struct workqueue_struct *nfsiod_workqueue; 382extern struct workqueue_struct *nfsiod_workqueue;
383extern struct inode *nfs_alloc_inode(struct super_block *sb); 383extern struct inode *nfs_alloc_inode(struct super_block *sb);
384extern void nfs_destroy_inode(struct inode *); 384extern void nfs_free_inode(struct inode *);
385extern int nfs_write_inode(struct inode *, struct writeback_control *); 385extern int nfs_write_inode(struct inode *, struct writeback_control *);
386extern int nfs_drop_inode(struct inode *); 386extern int nfs_drop_inode(struct inode *);
387extern void nfs_clear_inode(struct inode *); 387extern void nfs_clear_inode(struct inode *);
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index 6fb7cb6b3f4b..689977e148cb 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -50,7 +50,7 @@ struct file_system_type nfs4_referral_fs_type = {
50 50
51static const struct super_operations nfs4_sops = { 51static const struct super_operations nfs4_sops = {
52 .alloc_inode = nfs_alloc_inode, 52 .alloc_inode = nfs_alloc_inode,
53 .destroy_inode = nfs_destroy_inode, 53 .free_inode = nfs_free_inode,
54 .write_inode = nfs4_write_inode, 54 .write_inode = nfs4_write_inode,
55 .drop_inode = nfs_drop_inode, 55 .drop_inode = nfs_drop_inode,
56 .statfs = nfs_statfs, 56 .statfs = nfs_statfs,
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c27ac96a95bd..450ae77d19bf 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -309,7 +309,7 @@ struct file_system_type nfs_xdev_fs_type = {
309 309
310const struct super_operations nfs_sops = { 310const struct super_operations nfs_sops = {
311 .alloc_inode = nfs_alloc_inode, 311 .alloc_inode = nfs_alloc_inode,
312 .destroy_inode = nfs_destroy_inode, 312 .free_inode = nfs_free_inode,
313 .write_inode = nfs_write_inode, 313 .write_inode = nfs_write_inode,
314 .drop_inode = nfs_drop_inode, 314 .drop_inode = nfs_drop_inode,
315 .statfs = nfs_statfs, 315 .statfs = nfs_statfs,
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index a2f247b6a209..42395ba52da6 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -252,7 +252,6 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, struct nilfs_argv *,
252void nilfs_inode_add_blocks(struct inode *inode, int n); 252void nilfs_inode_add_blocks(struct inode *inode, int n);
253void nilfs_inode_sub_blocks(struct inode *inode, int n); 253void nilfs_inode_sub_blocks(struct inode *inode, int n);
254extern struct inode *nilfs_new_inode(struct inode *, umode_t); 254extern struct inode *nilfs_new_inode(struct inode *, umode_t);
255extern void nilfs_free_inode(struct inode *);
256extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int); 255extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
257extern void nilfs_set_inode_flags(struct inode *); 256extern void nilfs_set_inode_flags(struct inode *);
258extern int nilfs_read_inode_common(struct inode *, struct nilfs_inode *); 257extern int nilfs_read_inode_common(struct inode *, struct nilfs_inode *);
@@ -289,7 +288,6 @@ static inline int nilfs_mark_inode_dirty_sync(struct inode *inode)
289 288
290/* super.c */ 289/* super.c */
291extern struct inode *nilfs_alloc_inode(struct super_block *); 290extern struct inode *nilfs_alloc_inode(struct super_block *);
292extern void nilfs_destroy_inode(struct inode *);
293 291
294extern __printf(3, 4) 292extern __printf(3, 4)
295void __nilfs_msg(struct super_block *sb, const char *level, 293void __nilfs_msg(struct super_block *sb, const char *level,
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 26290aa1023f..5729ee86da9a 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -155,21 +155,14 @@ struct inode *nilfs_alloc_inode(struct super_block *sb)
155 return &ii->vfs_inode; 155 return &ii->vfs_inode;
156} 156}
157 157
158static void nilfs_i_callback(struct rcu_head *head) 158static void nilfs_free_inode(struct inode *inode)
159{ 159{
160 struct inode *inode = container_of(head, struct inode, i_rcu);
161
162 if (nilfs_is_metadata_file_inode(inode)) 160 if (nilfs_is_metadata_file_inode(inode))
163 nilfs_mdt_destroy(inode); 161 nilfs_mdt_destroy(inode);
164 162
165 kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode)); 163 kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode));
166} 164}
167 165
168void nilfs_destroy_inode(struct inode *inode)
169{
170 call_rcu(&inode->i_rcu, nilfs_i_callback);
171}
172
173static int nilfs_sync_super(struct super_block *sb, int flag) 166static int nilfs_sync_super(struct super_block *sb, int flag)
174{ 167{
175 struct the_nilfs *nilfs = sb->s_fs_info; 168 struct the_nilfs *nilfs = sb->s_fs_info;
@@ -686,7 +679,7 @@ static int nilfs_show_options(struct seq_file *seq, struct dentry *dentry)
686 679
687static const struct super_operations nilfs_sops = { 680static const struct super_operations nilfs_sops = {
688 .alloc_inode = nilfs_alloc_inode, 681 .alloc_inode = nilfs_alloc_inode,
689 .destroy_inode = nilfs_destroy_inode, 682 .free_inode = nilfs_free_inode,
690 .dirty_inode = nilfs_dirty_inode, 683 .dirty_inode = nilfs_dirty_inode,
691 .evict_inode = nilfs_evict_inode, 684 .evict_inode = nilfs_evict_inode,
692 .put_super = nilfs_put_super, 685 .put_super = nilfs_put_super,
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index bd3221cbdd95..fb1a2b49a5da 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -332,23 +332,11 @@ struct inode *ntfs_alloc_big_inode(struct super_block *sb)
332 return NULL; 332 return NULL;
333} 333}
334 334
335static void ntfs_i_callback(struct rcu_head *head) 335void ntfs_free_big_inode(struct inode *inode)
336{ 336{
337 struct inode *inode = container_of(head, struct inode, i_rcu);
338 kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode)); 337 kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode));
339} 338}
340 339
341void ntfs_destroy_big_inode(struct inode *inode)
342{
343 ntfs_inode *ni = NTFS_I(inode);
344
345 ntfs_debug("Entering.");
346 BUG_ON(ni->page);
347 if (!atomic_dec_and_test(&ni->count))
348 BUG();
349 call_rcu(&inode->i_rcu, ntfs_i_callback);
350}
351
352static inline ntfs_inode *ntfs_alloc_extent_inode(void) 340static inline ntfs_inode *ntfs_alloc_extent_inode(void)
353{ 341{
354 ntfs_inode *ni; 342 ntfs_inode *ni;
@@ -2287,6 +2275,9 @@ void ntfs_evict_big_inode(struct inode *vi)
2287 ni->ext.base_ntfs_ino = NULL; 2275 ni->ext.base_ntfs_ino = NULL;
2288 } 2276 }
2289 } 2277 }
2278 BUG_ON(ni->page);
2279 if (!atomic_dec_and_test(&ni->count))
2280 BUG();
2290 return; 2281 return;
2291} 2282}
2292 2283
diff --git a/fs/ntfs/inode.h b/fs/ntfs/inode.h
index b3c3469de6cb..58c8fd2948d3 100644
--- a/fs/ntfs/inode.h
+++ b/fs/ntfs/inode.h
@@ -278,7 +278,7 @@ extern struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name,
278 u32 name_len); 278 u32 name_len);
279 279
280extern struct inode *ntfs_alloc_big_inode(struct super_block *sb); 280extern struct inode *ntfs_alloc_big_inode(struct super_block *sb);
281extern void ntfs_destroy_big_inode(struct inode *inode); 281extern void ntfs_free_big_inode(struct inode *inode);
282extern void ntfs_evict_big_inode(struct inode *vi); 282extern void ntfs_evict_big_inode(struct inode *vi);
283 283
284extern void __ntfs_init_inode(struct super_block *sb, ntfs_inode *ni); 284extern void __ntfs_init_inode(struct super_block *sb, ntfs_inode *ni);
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index bb7159f697f2..887ea8b3b000 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -2676,7 +2676,7 @@ static int ntfs_write_inode(struct inode *vi, struct writeback_control *wbc)
2676 */ 2676 */
2677static const struct super_operations ntfs_sops = { 2677static const struct super_operations ntfs_sops = {
2678 .alloc_inode = ntfs_alloc_big_inode, /* VFS: Allocate new inode. */ 2678 .alloc_inode = ntfs_alloc_big_inode, /* VFS: Allocate new inode. */
2679 .destroy_inode = ntfs_destroy_big_inode, /* VFS: Deallocate inode. */ 2679 .free_inode = ntfs_free_big_inode, /* VFS: Deallocate inode. */
2680#ifdef NTFS_RW 2680#ifdef NTFS_RW
2681 .write_inode = ntfs_write_inode, /* VFS: Write dirty inode to 2681 .write_inode = ntfs_write_inode, /* VFS: Write dirty inode to
2682 disk. */ 2682 disk. */
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 8decbe95dcec..98885181e1fe 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -349,17 +349,11 @@ static struct inode *dlmfs_alloc_inode(struct super_block *sb)
349 return &ip->ip_vfs_inode; 349 return &ip->ip_vfs_inode;
350} 350}
351 351
352static void dlmfs_i_callback(struct rcu_head *head) 352static void dlmfs_free_inode(struct inode *inode)
353{ 353{
354 struct inode *inode = container_of(head, struct inode, i_rcu);
355 kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode)); 354 kmem_cache_free(dlmfs_inode_cache, DLMFS_I(inode));
356} 355}
357 356
358static void dlmfs_destroy_inode(struct inode *inode)
359{
360 call_rcu(&inode->i_rcu, dlmfs_i_callback);
361}
362
363static void dlmfs_evict_inode(struct inode *inode) 357static void dlmfs_evict_inode(struct inode *inode)
364{ 358{
365 int status; 359 int status;
@@ -605,7 +599,7 @@ static const struct inode_operations dlmfs_root_inode_operations = {
605static const struct super_operations dlmfs_ops = { 599static const struct super_operations dlmfs_ops = {
606 .statfs = simple_statfs, 600 .statfs = simple_statfs,
607 .alloc_inode = dlmfs_alloc_inode, 601 .alloc_inode = dlmfs_alloc_inode,
608 .destroy_inode = dlmfs_destroy_inode, 602 .free_inode = dlmfs_free_inode,
609 .evict_inode = dlmfs_evict_inode, 603 .evict_inode = dlmfs_evict_inode,
610 .drop_inode = generic_delete_inode, 604 .drop_inode = generic_delete_inode,
611}; 605};
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 96ae7cedd487..7982a93e630f 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -134,7 +134,7 @@ static int ocfs2_get_sector(struct super_block *sb,
134 int block, 134 int block,
135 int sect_size); 135 int sect_size);
136static struct inode *ocfs2_alloc_inode(struct super_block *sb); 136static struct inode *ocfs2_alloc_inode(struct super_block *sb);
137static void ocfs2_destroy_inode(struct inode *inode); 137static void ocfs2_free_inode(struct inode *inode);
138static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend); 138static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
139static int ocfs2_enable_quotas(struct ocfs2_super *osb); 139static int ocfs2_enable_quotas(struct ocfs2_super *osb);
140static void ocfs2_disable_quotas(struct ocfs2_super *osb); 140static void ocfs2_disable_quotas(struct ocfs2_super *osb);
@@ -147,7 +147,7 @@ static struct dquot **ocfs2_get_dquots(struct inode *inode)
147static const struct super_operations ocfs2_sops = { 147static const struct super_operations ocfs2_sops = {
148 .statfs = ocfs2_statfs, 148 .statfs = ocfs2_statfs,
149 .alloc_inode = ocfs2_alloc_inode, 149 .alloc_inode = ocfs2_alloc_inode,
150 .destroy_inode = ocfs2_destroy_inode, 150 .free_inode = ocfs2_free_inode,
151 .drop_inode = ocfs2_drop_inode, 151 .drop_inode = ocfs2_drop_inode,
152 .evict_inode = ocfs2_evict_inode, 152 .evict_inode = ocfs2_evict_inode,
153 .sync_fs = ocfs2_sync_fs, 153 .sync_fs = ocfs2_sync_fs,
@@ -575,17 +575,11 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
575 return &oi->vfs_inode; 575 return &oi->vfs_inode;
576} 576}
577 577
578static void ocfs2_i_callback(struct rcu_head *head) 578static void ocfs2_free_inode(struct inode *inode)
579{ 579{
580 struct inode *inode = container_of(head, struct inode, i_rcu);
581 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode)); 580 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
582} 581}
583 582
584static void ocfs2_destroy_inode(struct inode *inode)
585{
586 call_rcu(&inode->i_rcu, ocfs2_i_callback);
587}
588
589static unsigned long long ocfs2_max_file_offset(unsigned int bbits, 583static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
590 unsigned int cbits) 584 unsigned int cbits)
591{ 585{
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index 1b2d0d2fe2ee..46655e454c55 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -336,17 +336,11 @@ static struct inode *openprom_alloc_inode(struct super_block *sb)
336 return &oi->vfs_inode; 336 return &oi->vfs_inode;
337} 337}
338 338
339static void openprom_i_callback(struct rcu_head *head) 339static void openprom_free_inode(struct inode *inode)
340{ 340{
341 struct inode *inode = container_of(head, struct inode, i_rcu);
342 kmem_cache_free(op_inode_cachep, OP_I(inode)); 341 kmem_cache_free(op_inode_cachep, OP_I(inode));
343} 342}
344 343
345static void openprom_destroy_inode(struct inode *inode)
346{
347 call_rcu(&inode->i_rcu, openprom_i_callback);
348}
349
350static struct inode *openprom_iget(struct super_block *sb, ino_t ino) 344static struct inode *openprom_iget(struct super_block *sb, ino_t ino)
351{ 345{
352 struct inode *inode; 346 struct inode *inode;
@@ -375,7 +369,7 @@ static int openprom_remount(struct super_block *sb, int *flags, char *data)
375 369
376static const struct super_operations openprom_sops = { 370static const struct super_operations openprom_sops = {
377 .alloc_inode = openprom_alloc_inode, 371 .alloc_inode = openprom_alloc_inode,
378 .destroy_inode = openprom_destroy_inode, 372 .free_inode = openprom_free_inode,
379 .statfs = simple_statfs, 373 .statfs = simple_statfs,
380 .remount_fs = openprom_remount, 374 .remount_fs = openprom_remount,
381}; 375};
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index dfaee90d30bd..3784f7e8b603 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -124,11 +124,9 @@ static struct inode *orangefs_alloc_inode(struct super_block *sb)
124 return &orangefs_inode->vfs_inode; 124 return &orangefs_inode->vfs_inode;
125} 125}
126 126
127static void orangefs_i_callback(struct rcu_head *head) 127static void orangefs_free_inode(struct inode *inode)
128{ 128{
129 struct inode *inode = container_of(head, struct inode, i_rcu); 129 kmem_cache_free(orangefs_inode_cache, ORANGEFS_I(inode));
130 struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
131 kmem_cache_free(orangefs_inode_cache, orangefs_inode);
132} 130}
133 131
134static void orangefs_destroy_inode(struct inode *inode) 132static void orangefs_destroy_inode(struct inode *inode)
@@ -138,8 +136,6 @@ static void orangefs_destroy_inode(struct inode *inode)
138 gossip_debug(GOSSIP_SUPER_DEBUG, 136 gossip_debug(GOSSIP_SUPER_DEBUG,
139 "%s: deallocated %p destroying inode %pU\n", 137 "%s: deallocated %p destroying inode %pU\n",
140 __func__, orangefs_inode, get_khandle_from_ino(inode)); 138 __func__, orangefs_inode, get_khandle_from_ino(inode));
141
142 call_rcu(&inode->i_rcu, orangefs_i_callback);
143} 139}
144 140
145/* 141/*
@@ -299,6 +295,7 @@ void fsid_key_table_finalize(void)
299 295
300static const struct super_operations orangefs_s_ops = { 296static const struct super_operations orangefs_s_ops = {
301 .alloc_inode = orangefs_alloc_inode, 297 .alloc_inode = orangefs_alloc_inode,
298 .free_inode = orangefs_free_inode,
302 .destroy_inode = orangefs_destroy_inode, 299 .destroy_inode = orangefs_destroy_inode,
303 .drop_inode = generic_delete_inode, 300 .drop_inode = generic_delete_inode,
304 .statfs = orangefs_statfs, 301 .statfs = orangefs_statfs,
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 0116735cc321..5ec4fc2f5d7e 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -190,11 +190,13 @@ static struct inode *ovl_alloc_inode(struct super_block *sb)
190 return &oi->vfs_inode; 190 return &oi->vfs_inode;
191} 191}
192 192
193static void ovl_i_callback(struct rcu_head *head) 193static void ovl_free_inode(struct inode *inode)
194{ 194{
195 struct inode *inode = container_of(head, struct inode, i_rcu); 195 struct ovl_inode *oi = OVL_I(inode);
196 196
197 kmem_cache_free(ovl_inode_cachep, OVL_I(inode)); 197 kfree(oi->redirect);
198 mutex_destroy(&oi->lock);
199 kmem_cache_free(ovl_inode_cachep, oi);
198} 200}
199 201
200static void ovl_destroy_inode(struct inode *inode) 202static void ovl_destroy_inode(struct inode *inode)
@@ -207,10 +209,6 @@ static void ovl_destroy_inode(struct inode *inode)
207 ovl_dir_cache_free(inode); 209 ovl_dir_cache_free(inode);
208 else 210 else
209 iput(oi->lowerdata); 211 iput(oi->lowerdata);
210 kfree(oi->redirect);
211 mutex_destroy(&oi->lock);
212
213 call_rcu(&inode->i_rcu, ovl_i_callback);
214} 212}
215 213
216static void ovl_free_fs(struct ovl_fs *ofs) 214static void ovl_free_fs(struct ovl_fs *ofs)
@@ -377,6 +375,7 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data)
377 375
378static const struct super_operations ovl_super_operations = { 376static const struct super_operations ovl_super_operations = {
379 .alloc_inode = ovl_alloc_inode, 377 .alloc_inode = ovl_alloc_inode,
378 .free_inode = ovl_free_inode,
380 .destroy_inode = ovl_destroy_inode, 379 .destroy_inode = ovl_destroy_inode,
381 .drop_inode = generic_delete_inode, 380 .drop_inode = generic_delete_inode,
382 .put_super = ovl_put_super, 381 .put_super = ovl_put_super,
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index fc7e38def174..5f8d215b3fd0 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -72,17 +72,11 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
72 return &ei->vfs_inode; 72 return &ei->vfs_inode;
73} 73}
74 74
75static void proc_i_callback(struct rcu_head *head) 75static void proc_free_inode(struct inode *inode)
76{ 76{
77 struct inode *inode = container_of(head, struct inode, i_rcu);
78 kmem_cache_free(proc_inode_cachep, PROC_I(inode)); 77 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
79} 78}
80 79
81static void proc_destroy_inode(struct inode *inode)
82{
83 call_rcu(&inode->i_rcu, proc_i_callback);
84}
85
86static void init_once(void *foo) 80static void init_once(void *foo)
87{ 81{
88 struct proc_inode *ei = (struct proc_inode *) foo; 82 struct proc_inode *ei = (struct proc_inode *) foo;
@@ -123,7 +117,7 @@ static int proc_show_options(struct seq_file *seq, struct dentry *root)
123 117
124const struct super_operations proc_sops = { 118const struct super_operations proc_sops = {
125 .alloc_inode = proc_alloc_inode, 119 .alloc_inode = proc_alloc_inode,
126 .destroy_inode = proc_destroy_inode, 120 .free_inode = proc_free_inode,
127 .drop_inode = generic_delete_inode, 121 .drop_inode = generic_delete_inode,
128 .evict_inode = proc_evict_inode, 122 .evict_inode = proc_evict_inode,
129 .statfs = simple_statfs, 123 .statfs = simple_statfs,
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 3d46fe302fcb..48c70aa4a3ec 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -28,14 +28,14 @@
28static const struct super_operations qnx4_sops; 28static const struct super_operations qnx4_sops;
29 29
30static struct inode *qnx4_alloc_inode(struct super_block *sb); 30static struct inode *qnx4_alloc_inode(struct super_block *sb);
31static void qnx4_destroy_inode(struct inode *inode); 31static void qnx4_free_inode(struct inode *inode);
32static int qnx4_remount(struct super_block *sb, int *flags, char *data); 32static int qnx4_remount(struct super_block *sb, int *flags, char *data);
33static int qnx4_statfs(struct dentry *, struct kstatfs *); 33static int qnx4_statfs(struct dentry *, struct kstatfs *);
34 34
35static const struct super_operations qnx4_sops = 35static const struct super_operations qnx4_sops =
36{ 36{
37 .alloc_inode = qnx4_alloc_inode, 37 .alloc_inode = qnx4_alloc_inode,
38 .destroy_inode = qnx4_destroy_inode, 38 .free_inode = qnx4_free_inode,
39 .statfs = qnx4_statfs, 39 .statfs = qnx4_statfs,
40 .remount_fs = qnx4_remount, 40 .remount_fs = qnx4_remount,
41}; 41};
@@ -342,17 +342,11 @@ static struct inode *qnx4_alloc_inode(struct super_block *sb)
342 return &ei->vfs_inode; 342 return &ei->vfs_inode;
343} 343}
344 344
345static void qnx4_i_callback(struct rcu_head *head) 345static void qnx4_free_inode(struct inode *inode)
346{ 346{
347 struct inode *inode = container_of(head, struct inode, i_rcu);
348 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode)); 347 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode));
349} 348}
350 349
351static void qnx4_destroy_inode(struct inode *inode)
352{
353 call_rcu(&inode->i_rcu, qnx4_i_callback);
354}
355
356static void init_once(void *foo) 350static void init_once(void *foo)
357{ 351{
358 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo; 352 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo;
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 4aeb26bcb4d0..59cf45f6be49 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -29,14 +29,14 @@ static const struct super_operations qnx6_sops;
29 29
30static void qnx6_put_super(struct super_block *sb); 30static void qnx6_put_super(struct super_block *sb);
31static struct inode *qnx6_alloc_inode(struct super_block *sb); 31static struct inode *qnx6_alloc_inode(struct super_block *sb);
32static void qnx6_destroy_inode(struct inode *inode); 32static void qnx6_free_inode(struct inode *inode);
33static int qnx6_remount(struct super_block *sb, int *flags, char *data); 33static int qnx6_remount(struct super_block *sb, int *flags, char *data);
34static int qnx6_statfs(struct dentry *dentry, struct kstatfs *buf); 34static int qnx6_statfs(struct dentry *dentry, struct kstatfs *buf);
35static int qnx6_show_options(struct seq_file *seq, struct dentry *root); 35static int qnx6_show_options(struct seq_file *seq, struct dentry *root);
36 36
37static const struct super_operations qnx6_sops = { 37static const struct super_operations qnx6_sops = {
38 .alloc_inode = qnx6_alloc_inode, 38 .alloc_inode = qnx6_alloc_inode,
39 .destroy_inode = qnx6_destroy_inode, 39 .free_inode = qnx6_free_inode,
40 .put_super = qnx6_put_super, 40 .put_super = qnx6_put_super,
41 .statfs = qnx6_statfs, 41 .statfs = qnx6_statfs,
42 .remount_fs = qnx6_remount, 42 .remount_fs = qnx6_remount,
@@ -602,17 +602,11 @@ static struct inode *qnx6_alloc_inode(struct super_block *sb)
602 return &ei->vfs_inode; 602 return &ei->vfs_inode;
603} 603}
604 604
605static void qnx6_i_callback(struct rcu_head *head) 605static void qnx6_free_inode(struct inode *inode)
606{ 606{
607 struct inode *inode = container_of(head, struct inode, i_rcu);
608 kmem_cache_free(qnx6_inode_cachep, QNX6_I(inode)); 607 kmem_cache_free(qnx6_inode_cachep, QNX6_I(inode));
609} 608}
610 609
611static void qnx6_destroy_inode(struct inode *inode)
612{
613 call_rcu(&inode->i_rcu, qnx6_i_callback);
614}
615
616static void init_once(void *foo) 610static void init_once(void *foo)
617{ 611{
618 struct qnx6_inode_info *ei = (struct qnx6_inode_info *) foo; 612 struct qnx6_inode_info *ei = (struct qnx6_inode_info *) foo;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 1fc934d24459..ab028ea0e561 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -650,17 +650,11 @@ static struct inode *reiserfs_alloc_inode(struct super_block *sb)
650 return &ei->vfs_inode; 650 return &ei->vfs_inode;
651} 651}
652 652
653static void reiserfs_i_callback(struct rcu_head *head) 653static void reiserfs_free_inode(struct inode *inode)
654{ 654{
655 struct inode *inode = container_of(head, struct inode, i_rcu);
656 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); 655 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
657} 656}
658 657
659static void reiserfs_destroy_inode(struct inode *inode)
660{
661 call_rcu(&inode->i_rcu, reiserfs_i_callback);
662}
663
664static void init_once(void *foo) 658static void init_once(void *foo)
665{ 659{
666 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; 660 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
@@ -815,7 +809,7 @@ static struct dquot **reiserfs_get_dquots(struct inode *inode)
815 809
816static const struct super_operations reiserfs_sops = { 810static const struct super_operations reiserfs_sops = {
817 .alloc_inode = reiserfs_alloc_inode, 811 .alloc_inode = reiserfs_alloc_inode,
818 .destroy_inode = reiserfs_destroy_inode, 812 .free_inode = reiserfs_free_inode,
819 .write_inode = reiserfs_write_inode, 813 .write_inode = reiserfs_write_inode,
820 .dirty_inode = reiserfs_dirty_inode, 814 .dirty_inode = reiserfs_dirty_inode,
821 .evict_inode = reiserfs_evict_inode, 815 .evict_inode = reiserfs_evict_inode,
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index 6ccb51993a76..7d580f7c3f1d 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -381,18 +381,11 @@ static struct inode *romfs_alloc_inode(struct super_block *sb)
381/* 381/*
382 * return a spent inode to the slab cache 382 * return a spent inode to the slab cache
383 */ 383 */
384static void romfs_i_callback(struct rcu_head *head) 384static void romfs_free_inode(struct inode *inode)
385{ 385{
386 struct inode *inode = container_of(head, struct inode, i_rcu);
387
388 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode)); 386 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode));
389} 387}
390 388
391static void romfs_destroy_inode(struct inode *inode)
392{
393 call_rcu(&inode->i_rcu, romfs_i_callback);
394}
395
396/* 389/*
397 * get filesystem statistics 390 * get filesystem statistics
398 */ 391 */
@@ -439,7 +432,7 @@ static int romfs_remount(struct super_block *sb, int *flags, char *data)
439 432
440static const struct super_operations romfs_super_ops = { 433static const struct super_operations romfs_super_ops = {
441 .alloc_inode = romfs_alloc_inode, 434 .alloc_inode = romfs_alloc_inode,
442 .destroy_inode = romfs_destroy_inode, 435 .free_inode = romfs_free_inode,
443 .statfs = romfs_statfs, 436 .statfs = romfs_statfs,
444 .remount_fs = romfs_remount, 437 .remount_fs = romfs_remount,
445}; 438};
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 40e657386fa5..767046d9f65d 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -473,18 +473,11 @@ static struct inode *squashfs_alloc_inode(struct super_block *sb)
473} 473}
474 474
475 475
476static void squashfs_i_callback(struct rcu_head *head) 476static void squashfs_free_inode(struct inode *inode)
477{ 477{
478 struct inode *inode = container_of(head, struct inode, i_rcu);
479 kmem_cache_free(squashfs_inode_cachep, squashfs_i(inode)); 478 kmem_cache_free(squashfs_inode_cachep, squashfs_i(inode));
480} 479}
481 480
482static void squashfs_destroy_inode(struct inode *inode)
483{
484 call_rcu(&inode->i_rcu, squashfs_i_callback);
485}
486
487
488static struct file_system_type squashfs_fs_type = { 481static struct file_system_type squashfs_fs_type = {
489 .owner = THIS_MODULE, 482 .owner = THIS_MODULE,
490 .name = "squashfs", 483 .name = "squashfs",
@@ -496,7 +489,7 @@ MODULE_ALIAS_FS("squashfs");
496 489
497static const struct super_operations squashfs_super_ops = { 490static const struct super_operations squashfs_super_ops = {
498 .alloc_inode = squashfs_alloc_inode, 491 .alloc_inode = squashfs_alloc_inode,
499 .destroy_inode = squashfs_destroy_inode, 492 .free_inode = squashfs_free_inode,
500 .statfs = squashfs_statfs, 493 .statfs = squashfs_statfs,
501 .put_super = squashfs_put_super, 494 .put_super = squashfs_put_super,
502 .remount_fs = squashfs_remount 495 .remount_fs = squashfs_remount
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index 273736f41be3..02b1d9d0c182 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -313,17 +313,11 @@ static struct inode *sysv_alloc_inode(struct super_block *sb)
313 return &si->vfs_inode; 313 return &si->vfs_inode;
314} 314}
315 315
316static void sysv_i_callback(struct rcu_head *head) 316static void sysv_free_in_core_inode(struct inode *inode)
317{ 317{
318 struct inode *inode = container_of(head, struct inode, i_rcu);
319 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode)); 318 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode));
320} 319}
321 320
322static void sysv_destroy_inode(struct inode *inode)
323{
324 call_rcu(&inode->i_rcu, sysv_i_callback);
325}
326
327static void init_once(void *p) 321static void init_once(void *p)
328{ 322{
329 struct sysv_inode_info *si = (struct sysv_inode_info *)p; 323 struct sysv_inode_info *si = (struct sysv_inode_info *)p;
@@ -333,7 +327,7 @@ static void init_once(void *p)
333 327
334const struct super_operations sysv_sops = { 328const struct super_operations sysv_sops = {
335 .alloc_inode = sysv_alloc_inode, 329 .alloc_inode = sysv_alloc_inode,
336 .destroy_inode = sysv_destroy_inode, 330 .free_inode = sysv_free_in_core_inode,
337 .write_inode = sysv_write_inode, 331 .write_inode = sysv_write_inode,
338 .evict_inode = sysv_evict_inode, 332 .evict_inode = sysv_evict_inode,
339 .put_super = sysv_put_super, 333 .put_super = sysv_put_super,
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 12628184772c..c2307c423638 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -272,19 +272,13 @@ static struct inode *ubifs_alloc_inode(struct super_block *sb)
272 return &ui->vfs_inode; 272 return &ui->vfs_inode;
273}; 273};
274 274
275static void ubifs_i_callback(struct rcu_head *head) 275static void ubifs_free_inode(struct inode *inode)
276{ 276{
277 struct inode *inode = container_of(head, struct inode, i_rcu);
278 struct ubifs_inode *ui = ubifs_inode(inode); 277 struct ubifs_inode *ui = ubifs_inode(inode);
279 kfree(ui->data); 278 kfree(ui->data);
280 kmem_cache_free(ubifs_inode_slab, ui); 279 kmem_cache_free(ubifs_inode_slab, ui);
281} 280}
282 281
283static void ubifs_destroy_inode(struct inode *inode)
284{
285 call_rcu(&inode->i_rcu, ubifs_i_callback);
286}
287
288/* 282/*
289 * Note, Linux write-back code calls this without 'i_mutex'. 283 * Note, Linux write-back code calls this without 'i_mutex'.
290 */ 284 */
@@ -1977,7 +1971,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
1977 1971
1978const struct super_operations ubifs_super_operations = { 1972const struct super_operations ubifs_super_operations = {
1979 .alloc_inode = ubifs_alloc_inode, 1973 .alloc_inode = ubifs_alloc_inode,
1980 .destroy_inode = ubifs_destroy_inode, 1974 .free_inode = ubifs_free_inode,
1981 .put_super = ubifs_put_super, 1975 .put_super = ubifs_put_super,
1982 .write_inode = ubifs_write_inode, 1976 .write_inode = ubifs_write_inode,
1983 .evict_inode = ubifs_evict_inode, 1977 .evict_inode = ubifs_evict_inode,
diff --git a/fs/udf/super.c b/fs/udf/super.c
index ffd8038ff728..f64691f2168a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -161,17 +161,11 @@ static struct inode *udf_alloc_inode(struct super_block *sb)
161 return &ei->vfs_inode; 161 return &ei->vfs_inode;
162} 162}
163 163
164static void udf_i_callback(struct rcu_head *head) 164static void udf_free_in_core_inode(struct inode *inode)
165{ 165{
166 struct inode *inode = container_of(head, struct inode, i_rcu);
167 kmem_cache_free(udf_inode_cachep, UDF_I(inode)); 166 kmem_cache_free(udf_inode_cachep, UDF_I(inode));
168} 167}
169 168
170static void udf_destroy_inode(struct inode *inode)
171{
172 call_rcu(&inode->i_rcu, udf_i_callback);
173}
174
175static void init_once(void *foo) 169static void init_once(void *foo)
176{ 170{
177 struct udf_inode_info *ei = (struct udf_inode_info *)foo; 171 struct udf_inode_info *ei = (struct udf_inode_info *)foo;
@@ -206,7 +200,7 @@ static void destroy_inodecache(void)
206/* Superblock operations */ 200/* Superblock operations */
207static const struct super_operations udf_sb_ops = { 201static const struct super_operations udf_sb_ops = {
208 .alloc_inode = udf_alloc_inode, 202 .alloc_inode = udf_alloc_inode,
209 .destroy_inode = udf_destroy_inode, 203 .free_inode = udf_free_in_core_inode,
210 .write_inode = udf_write_inode, 204 .write_inode = udf_write_inode,
211 .evict_inode = udf_evict_inode, 205 .evict_inode = udf_evict_inode,
212 .put_super = udf_put_super, 206 .put_super = udf_put_super,
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index a4e07e910f1b..84c0c5178cd2 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1449,17 +1449,11 @@ static struct inode *ufs_alloc_inode(struct super_block *sb)
1449 return &ei->vfs_inode; 1449 return &ei->vfs_inode;
1450} 1450}
1451 1451
1452static void ufs_i_callback(struct rcu_head *head) 1452static void ufs_free_in_core_inode(struct inode *inode)
1453{ 1453{
1454 struct inode *inode = container_of(head, struct inode, i_rcu);
1455 kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); 1454 kmem_cache_free(ufs_inode_cachep, UFS_I(inode));
1456} 1455}
1457 1456
1458static void ufs_destroy_inode(struct inode *inode)
1459{
1460 call_rcu(&inode->i_rcu, ufs_i_callback);
1461}
1462
1463static void init_once(void *foo) 1457static void init_once(void *foo)
1464{ 1458{
1465 struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; 1459 struct ufs_inode_info *ei = (struct ufs_inode_info *) foo;
@@ -1494,7 +1488,7 @@ static void destroy_inodecache(void)
1494 1488
1495static const struct super_operations ufs_super_ops = { 1489static const struct super_operations ufs_super_ops = {
1496 .alloc_inode = ufs_alloc_inode, 1490 .alloc_inode = ufs_alloc_inode,
1497 .destroy_inode = ufs_destroy_inode, 1491 .free_inode = ufs_free_in_core_inode,
1498 .write_inode = ufs_write_inode, 1492 .write_inode = ufs_write_inode,
1499 .evict_inode = ufs_evict_inode, 1493 .evict_inode = ufs_evict_inode,
1500 .put_super = ufs_put_super, 1494 .put_super = ufs_put_super,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dd28e7679089..92732286b748 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -694,7 +694,10 @@ struct inode {
694#ifdef CONFIG_IMA 694#ifdef CONFIG_IMA
695 atomic_t i_readcount; /* struct files open RO */ 695 atomic_t i_readcount; /* struct files open RO */
696#endif 696#endif
697 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 697 union {
698 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
699 void (*free_inode)(struct inode *);
700 };
698 struct file_lock_context *i_flctx; 701 struct file_lock_context *i_flctx;
699 struct address_space i_data; 702 struct address_space i_data;
700 struct list_head i_devices; 703 struct list_head i_devices;
@@ -1903,6 +1906,7 @@ extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
1903struct super_operations { 1906struct super_operations {
1904 struct inode *(*alloc_inode)(struct super_block *sb); 1907 struct inode *(*alloc_inode)(struct super_block *sb);
1905 void (*destroy_inode)(struct inode *); 1908 void (*destroy_inode)(struct inode *);
1909 void (*free_inode)(struct inode *);
1906 1910
1907 void (*dirty_inode) (struct inode *, int flags); 1911 void (*dirty_inode) (struct inode *, int flags);
1908 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1912 int (*write_inode) (struct inode *, struct writeback_control *wbc);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index aea30530c472..ba44164ea1f9 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -419,17 +419,11 @@ static struct inode *mqueue_alloc_inode(struct super_block *sb)
419 return &ei->vfs_inode; 419 return &ei->vfs_inode;
420} 420}
421 421
422static void mqueue_i_callback(struct rcu_head *head) 422static void mqueue_free_inode(struct inode *inode)
423{ 423{
424 struct inode *inode = container_of(head, struct inode, i_rcu);
425 kmem_cache_free(mqueue_inode_cachep, MQUEUE_I(inode)); 424 kmem_cache_free(mqueue_inode_cachep, MQUEUE_I(inode));
426} 425}
427 426
428static void mqueue_destroy_inode(struct inode *inode)
429{
430 call_rcu(&inode->i_rcu, mqueue_i_callback);
431}
432
433static void mqueue_evict_inode(struct inode *inode) 427static void mqueue_evict_inode(struct inode *inode)
434{ 428{
435 struct mqueue_inode_info *info; 429 struct mqueue_inode_info *info;
@@ -1562,7 +1556,7 @@ static const struct file_operations mqueue_file_operations = {
1562 1556
1563static const struct super_operations mqueue_super_ops = { 1557static const struct super_operations mqueue_super_ops = {
1564 .alloc_inode = mqueue_alloc_inode, 1558 .alloc_inode = mqueue_alloc_inode,
1565 .destroy_inode = mqueue_destroy_inode, 1559 .free_inode = mqueue_free_inode,
1566 .evict_inode = mqueue_evict_inode, 1560 .evict_inode = mqueue_evict_inode,
1567 .statfs = simple_statfs, 1561 .statfs = simple_statfs,
1568}; 1562};
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 4a8f390a2b82..bc53e5b20ddc 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -566,9 +566,8 @@ static int bpf_show_options(struct seq_file *m, struct dentry *root)
566 return 0; 566 return 0;
567} 567}
568 568
569static void bpf_destroy_inode_deferred(struct rcu_head *head) 569static void bpf_free_inode(struct inode *inode)
570{ 570{
571 struct inode *inode = container_of(head, struct inode, i_rcu);
572 enum bpf_type type; 571 enum bpf_type type;
573 572
574 if (S_ISLNK(inode->i_mode)) 573 if (S_ISLNK(inode->i_mode))
@@ -578,16 +577,11 @@ static void bpf_destroy_inode_deferred(struct rcu_head *head)
578 free_inode_nonrcu(inode); 577 free_inode_nonrcu(inode);
579} 578}
580 579
581static void bpf_destroy_inode(struct inode *inode)
582{
583 call_rcu(&inode->i_rcu, bpf_destroy_inode_deferred);
584}
585
586static const struct super_operations bpf_super_ops = { 580static const struct super_operations bpf_super_ops = {
587 .statfs = simple_statfs, 581 .statfs = simple_statfs,
588 .drop_inode = generic_delete_inode, 582 .drop_inode = generic_delete_inode,
589 .show_options = bpf_show_options, 583 .show_options = bpf_show_options,
590 .destroy_inode = bpf_destroy_inode, 584 .free_inode = bpf_free_inode,
591}; 585};
592 586
593enum { 587enum {
diff --git a/mm/shmem.c b/mm/shmem.c
index 2275a0ff7c30..f4dce9c8670d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3631,9 +3631,8 @@ static struct inode *shmem_alloc_inode(struct super_block *sb)
3631 return &info->vfs_inode; 3631 return &info->vfs_inode;
3632} 3632}
3633 3633
3634static void shmem_destroy_callback(struct rcu_head *head) 3634static void shmem_free_in_core_inode(struct inode *inode)
3635{ 3635{
3636 struct inode *inode = container_of(head, struct inode, i_rcu);
3637 if (S_ISLNK(inode->i_mode)) 3636 if (S_ISLNK(inode->i_mode))
3638 kfree(inode->i_link); 3637 kfree(inode->i_link);
3639 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); 3638 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
@@ -3643,7 +3642,6 @@ static void shmem_destroy_inode(struct inode *inode)
3643{ 3642{
3644 if (S_ISREG(inode->i_mode)) 3643 if (S_ISREG(inode->i_mode))
3645 mpol_free_shared_policy(&SHMEM_I(inode)->policy); 3644 mpol_free_shared_policy(&SHMEM_I(inode)->policy);
3646 call_rcu(&inode->i_rcu, shmem_destroy_callback);
3647} 3645}
3648 3646
3649static void shmem_init_inode(void *foo) 3647static void shmem_init_inode(void *foo)
@@ -3734,6 +3732,7 @@ static const struct inode_operations shmem_special_inode_operations = {
3734 3732
3735static const struct super_operations shmem_ops = { 3733static const struct super_operations shmem_ops = {
3736 .alloc_inode = shmem_alloc_inode, 3734 .alloc_inode = shmem_alloc_inode,
3735 .free_inode = shmem_free_in_core_inode,
3737 .destroy_inode = shmem_destroy_inode, 3736 .destroy_inode = shmem_destroy_inode,
3738#ifdef CONFIG_TMPFS 3737#ifdef CONFIG_TMPFS
3739 .statfs = shmem_statfs, 3738 .statfs = shmem_statfs,
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 69663681bf9d..979d23646e33 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -202,18 +202,11 @@ rpc_alloc_inode(struct super_block *sb)
202} 202}
203 203
204static void 204static void
205rpc_i_callback(struct rcu_head *head) 205rpc_free_inode(struct inode *inode)
206{ 206{
207 struct inode *inode = container_of(head, struct inode, i_rcu);
208 kmem_cache_free(rpc_inode_cachep, RPC_I(inode)); 207 kmem_cache_free(rpc_inode_cachep, RPC_I(inode));
209} 208}
210 209
211static void
212rpc_destroy_inode(struct inode *inode)
213{
214 call_rcu(&inode->i_rcu, rpc_i_callback);
215}
216
217static int 210static int
218rpc_pipe_open(struct inode *inode, struct file *filp) 211rpc_pipe_open(struct inode *inode, struct file *filp)
219{ 212{
@@ -1123,7 +1116,7 @@ void rpc_remove_cache_dir(struct dentry *dentry)
1123 */ 1116 */
1124static const struct super_operations s_ops = { 1117static const struct super_operations s_ops = {
1125 .alloc_inode = rpc_alloc_inode, 1118 .alloc_inode = rpc_alloc_inode,
1126 .destroy_inode = rpc_destroy_inode, 1119 .free_inode = rpc_free_inode,
1127 .statfs = simple_statfs, 1120 .statfs = simple_statfs,
1128}; 1121};
1129 1122
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index b9298d2e8165..9ab5613fe07c 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -123,22 +123,16 @@ static int aafs_show_path(struct seq_file *seq, struct dentry *dentry)
123 return 0; 123 return 0;
124} 124}
125 125
126static void aafs_i_callback(struct rcu_head *head) 126static void aafs_free_inode(struct inode *inode)
127{ 127{
128 struct inode *inode = container_of(head, struct inode, i_rcu);
129 if (S_ISLNK(inode->i_mode)) 128 if (S_ISLNK(inode->i_mode))
130 kfree(inode->i_link); 129 kfree(inode->i_link);
131 free_inode_nonrcu(inode); 130 free_inode_nonrcu(inode);
132} 131}
133 132
134static void aafs_destroy_inode(struct inode *inode)
135{
136 call_rcu(&inode->i_rcu, aafs_i_callback);
137}
138
139static const struct super_operations aafs_super_ops = { 133static const struct super_operations aafs_super_ops = {
140 .statfs = simple_statfs, 134 .statfs = simple_statfs,
141 .destroy_inode = aafs_destroy_inode, 135 .free_inode = aafs_free_inode,
142 .show_path = aafs_show_path, 136 .show_path = aafs_show_path,
143}; 137};
144 138
diff --git a/security/inode.c b/security/inode.c
index 421dd72b5876..aacc4dabba7d 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -27,22 +27,16 @@
27static struct vfsmount *mount; 27static struct vfsmount *mount;
28static int mount_count; 28static int mount_count;
29 29
30static void securityfs_i_callback(struct rcu_head *head) 30static void securityfs_free_inode(struct inode *inode)
31{ 31{
32 struct inode *inode = container_of(head, struct inode, i_rcu);
33 if (S_ISLNK(inode->i_mode)) 32 if (S_ISLNK(inode->i_mode))
34 kfree(inode->i_link); 33 kfree(inode->i_link);
35 free_inode_nonrcu(inode); 34 free_inode_nonrcu(inode);
36} 35}
37 36
38static void securityfs_destroy_inode(struct inode *inode)
39{
40 call_rcu(&inode->i_rcu, securityfs_i_callback);
41}
42
43static const struct super_operations securityfs_super_operations = { 37static const struct super_operations securityfs_super_operations = {
44 .statfs = simple_statfs, 38 .statfs = simple_statfs,
45 .destroy_inode = securityfs_destroy_inode, 39 .free_inode = securityfs_free_inode,
46}; 40};
47 41
48static int fill_super(struct super_block *sb, void *data, int silent) 42static int fill_super(struct super_block *sb, void *data, int silent)