jfs: switch to ->free_inode()

synchronous part can be moved to ->evict_inode(), the rest -
->free_inode() fodder

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2019-04-15 22:48:59 -04:00
parent 9baf28bbfe
commit b3b4a6e356
2 changed files with 16 additions and 21 deletions

View File

@ -31,6 +31,7 @@
#include "jfs_extent.h" #include "jfs_extent.h"
#include "jfs_unicode.h" #include "jfs_unicode.h"
#include "jfs_debug.h" #include "jfs_debug.h"
#include "jfs_dmap.h"
struct inode *jfs_iget(struct super_block *sb, unsigned long ino) struct 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)
void jfs_evict_inode(struct inode *inode) void jfs_evict_inode(struct inode *inode)
{ {
struct jfs_inode_info *ji = JFS_IP(inode);
jfs_info("In jfs_evict_inode, inode = 0x%p", inode); jfs_info("In jfs_evict_inode, inode = 0x%p", inode);
if (!inode->i_nlink && !is_bad_inode(inode)) { if (!inode->i_nlink && !is_bad_inode(inode)) {
@ -173,6 +176,16 @@ void jfs_evict_inode(struct inode *inode)
} }
clear_inode(inode); clear_inode(inode);
dquot_drop(inode); dquot_drop(inode);
BUG_ON(!list_empty(&ji->anon_inode_list));
spin_lock_irq(&ji->ag_lock);
if (ji->active_ag != -1) {
struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
atomic_dec(&bmap->db_active[ji->active_ag]);
ji->active_ag = -1;
}
spin_unlock_irq(&ji->ag_lock);
} }
void jfs_dirty_inode(struct inode *inode, int flags) void jfs_dirty_inode(struct inode *inode, int flags)

View File

@ -124,27 +124,9 @@ static struct inode *jfs_alloc_inode(struct super_block *sb)
return &jfs_inode->vfs_inode; return &jfs_inode->vfs_inode;
} }
static void jfs_i_callback(struct rcu_head *head) static void jfs_free_inode(struct inode *inode)
{ {
struct inode *inode = container_of(head, struct inode, i_rcu); kmem_cache_free(jfs_inode_cachep, JFS_IP(inode));
struct jfs_inode_info *ji = JFS_IP(inode);
kmem_cache_free(jfs_inode_cachep, ji);
}
static void jfs_destroy_inode(struct inode *inode)
{
struct jfs_inode_info *ji = JFS_IP(inode);
BUG_ON(!list_empty(&ji->anon_inode_list));
spin_lock_irq(&ji->ag_lock);
if (ji->active_ag != -1) {
struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
atomic_dec(&bmap->db_active[ji->active_ag]);
ji->active_ag = -1;
}
spin_unlock_irq(&ji->ag_lock);
call_rcu(&inode->i_rcu, jfs_i_callback);
} }
static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
@ -912,7 +894,7 @@ static int jfs_quota_off(struct super_block *sb, int type)
static const struct super_operations jfs_super_operations = { static const struct super_operations jfs_super_operations = {
.alloc_inode = jfs_alloc_inode, .alloc_inode = jfs_alloc_inode,
.destroy_inode = jfs_destroy_inode, .free_inode = jfs_free_inode,
.dirty_inode = jfs_dirty_inode, .dirty_inode = jfs_dirty_inode,
.write_inode = jfs_write_inode, .write_inode = jfs_write_inode,
.evict_inode = jfs_evict_inode, .evict_inode = jfs_evict_inode,