mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
Merge branch 'work.icache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs inode freeing updates from Al Viro: "Introduction of separate method for RCU-delayed part of ->destroy_inode() (if any). Pretty much as posted, except that destroy_inode() stashes ->free_inode into the victim (anon-unioned with ->i_fops) before scheduling i_callback() and the last two patches (sockfs conversion and folding struct socket_wq into struct socket) are excluded - that pair should go through netdev once davem reopens his tree" * 'work.icache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (58 commits) orangefs: make use of ->free_inode() shmem: make use of ->free_inode() hugetlb: make use of ->free_inode() overlayfs: make use of ->free_inode() jfs: switch to ->free_inode() fuse: switch to ->free_inode() ext4: make use of ->free_inode() ecryptfs: make use of ->free_inode() ceph: use ->free_inode() btrfs: use ->free_inode() afs: switch to use of ->free_inode() dax: make use of ->free_inode() ntfs: switch to ->free_inode() securityfs: switch to ->free_inode() apparmor: switch to ->free_inode() rpcpipe: switch to ->free_inode() bpf: switch to ->free_inode() mqueue: switch to ->free_inode() ufs: switch to ->free_inode() coda: switch to ->free_inode() ...
This commit is contained in:
56
fs/inode.c
56
fs/inode.c
@@ -202,12 +202,28 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL(inode_init_always);
|
||||
|
||||
void free_inode_nonrcu(struct inode *inode)
|
||||
{
|
||||
kmem_cache_free(inode_cachep, inode);
|
||||
}
|
||||
EXPORT_SYMBOL(free_inode_nonrcu);
|
||||
|
||||
static void i_callback(struct rcu_head *head)
|
||||
{
|
||||
struct inode *inode = container_of(head, struct inode, i_rcu);
|
||||
if (inode->free_inode)
|
||||
inode->free_inode(inode);
|
||||
else
|
||||
free_inode_nonrcu(inode);
|
||||
}
|
||||
|
||||
static struct inode *alloc_inode(struct super_block *sb)
|
||||
{
|
||||
const struct super_operations *ops = sb->s_op;
|
||||
struct inode *inode;
|
||||
|
||||
if (sb->s_op->alloc_inode)
|
||||
inode = sb->s_op->alloc_inode(sb);
|
||||
if (ops->alloc_inode)
|
||||
inode = ops->alloc_inode(sb);
|
||||
else
|
||||
inode = kmem_cache_alloc(inode_cachep, GFP_KERNEL);
|
||||
|
||||
@@ -215,22 +231,19 @@ static struct inode *alloc_inode(struct super_block *sb)
|
||||
return NULL;
|
||||
|
||||
if (unlikely(inode_init_always(sb, inode))) {
|
||||
if (inode->i_sb->s_op->destroy_inode)
|
||||
inode->i_sb->s_op->destroy_inode(inode);
|
||||
else
|
||||
kmem_cache_free(inode_cachep, inode);
|
||||
if (ops->destroy_inode) {
|
||||
ops->destroy_inode(inode);
|
||||
if (!ops->free_inode)
|
||||
return NULL;
|
||||
}
|
||||
inode->free_inode = ops->free_inode;
|
||||
i_callback(&inode->i_rcu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return inode;
|
||||
}
|
||||
|
||||
void free_inode_nonrcu(struct inode *inode)
|
||||
{
|
||||
kmem_cache_free(inode_cachep, inode);
|
||||
}
|
||||
EXPORT_SYMBOL(free_inode_nonrcu);
|
||||
|
||||
void __destroy_inode(struct inode *inode)
|
||||
{
|
||||
BUG_ON(inode_has_buffers(inode));
|
||||
@@ -253,20 +266,19 @@ void __destroy_inode(struct inode *inode)
|
||||
}
|
||||
EXPORT_SYMBOL(__destroy_inode);
|
||||
|
||||
static void i_callback(struct rcu_head *head)
|
||||
{
|
||||
struct inode *inode = container_of(head, struct inode, i_rcu);
|
||||
kmem_cache_free(inode_cachep, inode);
|
||||
}
|
||||
|
||||
static void destroy_inode(struct inode *inode)
|
||||
{
|
||||
const struct super_operations *ops = inode->i_sb->s_op;
|
||||
|
||||
BUG_ON(!list_empty(&inode->i_lru));
|
||||
__destroy_inode(inode);
|
||||
if (inode->i_sb->s_op->destroy_inode)
|
||||
inode->i_sb->s_op->destroy_inode(inode);
|
||||
else
|
||||
call_rcu(&inode->i_rcu, i_callback);
|
||||
if (ops->destroy_inode) {
|
||||
ops->destroy_inode(inode);
|
||||
if (!ops->free_inode)
|
||||
return;
|
||||
}
|
||||
inode->free_inode = ops->free_inode;
|
||||
call_rcu(&inode->i_rcu, i_callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user