diff options
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r-- | fs/hugetlbfs/inode.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ffdad4e64671..8f94feb24c0a 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -231,25 +231,28 @@ static void hugetlbfs_delete_inode(struct inode *inode) | |||
231 | 231 | ||
232 | static void hugetlbfs_forget_inode(struct inode *inode) | 232 | static void hugetlbfs_forget_inode(struct inode *inode) |
233 | { | 233 | { |
234 | struct super_block *super_block = inode->i_sb; | 234 | struct super_block *sb = inode->i_sb; |
235 | 235 | ||
236 | if (hlist_unhashed(&inode->i_hash)) | 236 | if (!hlist_unhashed(&inode->i_hash)) { |
237 | goto out_truncate; | 237 | if (!(inode->i_state & (I_DIRTY|I_LOCK))) |
238 | 238 | list_move(&inode->i_list, &inode_unused); | |
239 | if (!(inode->i_state & (I_DIRTY|I_LOCK))) { | 239 | inodes_stat.nr_unused++; |
240 | list_del(&inode->i_list); | 240 | if (!sb || (sb->s_flags & MS_ACTIVE)) { |
241 | list_add(&inode->i_list, &inode_unused); | 241 | spin_unlock(&inode_lock); |
242 | } | 242 | return; |
243 | inodes_stat.nr_unused++; | 243 | } |
244 | if (!super_block || (super_block->s_flags & MS_ACTIVE)) { | 244 | inode->i_state |= I_WILL_FREE; |
245 | spin_unlock(&inode_lock); | 245 | spin_unlock(&inode_lock); |
246 | return; | 246 | /* |
247 | * write_inode_now is a noop as we set BDI_CAP_NO_WRITEBACK | ||
248 | * in our backing_dev_info. | ||
249 | */ | ||
250 | write_inode_now(inode, 1); | ||
251 | spin_lock(&inode_lock); | ||
252 | inode->i_state &= ~I_WILL_FREE; | ||
253 | inodes_stat.nr_unused--; | ||
254 | hlist_del_init(&inode->i_hash); | ||
247 | } | 255 | } |
248 | |||
249 | /* write_inode_now() ? */ | ||
250 | inodes_stat.nr_unused--; | ||
251 | hlist_del_init(&inode->i_hash); | ||
252 | out_truncate: | ||
253 | list_del_init(&inode->i_list); | 256 | list_del_init(&inode->i_list); |
254 | list_del_init(&inode->i_sb_list); | 257 | list_del_init(&inode->i_sb_list); |
255 | inode->i_state |= I_FREEING; | 258 | inode->i_state |= I_FREEING; |
@@ -257,7 +260,6 @@ out_truncate: | |||
257 | spin_unlock(&inode_lock); | 260 | spin_unlock(&inode_lock); |
258 | if (inode->i_data.nrpages) | 261 | if (inode->i_data.nrpages) |
259 | truncate_hugepages(&inode->i_data, 0); | 262 | truncate_hugepages(&inode->i_data, 0); |
260 | |||
261 | clear_inode(inode); | 263 | clear_inode(inode); |
262 | destroy_inode(inode); | 264 | destroy_inode(inode); |
263 | } | 265 | } |