mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
vfs: split generic_forget_inode() so that hugetlbfs does not have to copy it
Hugetlbfs needs to do special things instead of truncate_inode_pages(). Currently, it copied generic_forget_inode() except for truncate_inode_pages() call which is asking for trouble (the code there isn't trivial). So create a separate function generic_detach_inode() which does all the list magic done in generic_forget_inode() and call it from hugetlbfs_forget_inode(). Signed-off-by: Jan Kara <[email protected]> Cc: Al Viro <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
af0d9ae811
commit
22fe404218
3 changed files with 24 additions and 31 deletions
|
|
@ -380,36 +380,11 @@ static void hugetlbfs_delete_inode(struct inode *inode)
|
|||
|
||||
static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock)
|
||||
{
|
||||
struct super_block *sb = inode->i_sb;
|
||||
|
||||
if (!hlist_unhashed(&inode->i_hash)) {
|
||||
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
|
||||
list_move(&inode->i_list, &inode_unused);
|
||||
inodes_stat.nr_unused++;
|
||||
if (!sb || (sb->s_flags & MS_ACTIVE)) {
|
||||
spin_unlock(&inode_lock);
|
||||
return;
|
||||
}
|
||||
inode->i_state |= I_WILL_FREE;
|
||||
spin_unlock(&inode_lock);
|
||||
/*
|
||||
* write_inode_now is a noop as we set BDI_CAP_NO_WRITEBACK
|
||||
* in our backing_dev_info.
|
||||
*/
|
||||
write_inode_now(inode, 1);
|
||||
spin_lock(&inode_lock);
|
||||
inode->i_state &= ~I_WILL_FREE;
|
||||
inodes_stat.nr_unused--;
|
||||
hlist_del_init(&inode->i_hash);
|
||||
if (generic_detach_inode(inode)) {
|
||||
truncate_hugepages(inode, 0);
|
||||
clear_inode(inode);
|
||||
destroy_inode(inode);
|
||||
}
|
||||
list_del_init(&inode->i_list);
|
||||
list_del_init(&inode->i_sb_list);
|
||||
inode->i_state |= I_FREEING;
|
||||
inodes_stat.nr_inodes--;
|
||||
spin_unlock(&inode_lock);
|
||||
truncate_hugepages(inode, 0);
|
||||
clear_inode(inode);
|
||||
destroy_inode(inode);
|
||||
}
|
||||
|
||||
static void hugetlbfs_drop_inode(struct inode *inode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue