From 58e8268c7bae538ccb8b7eccc817c1c28bcd4da2 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 5 Jun 2010 19:40:56 -0400 Subject: switch ufs to ->evict_inode() Signed-off-by: Al Viro --- fs/ufs/inode.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'fs/ufs/inode.c') diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 45cafa937a4b..2b251f2093af 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -911,24 +911,33 @@ int ufs_sync_inode (struct inode *inode) return ufs_update_inode (inode, 1); } -void ufs_delete_inode (struct inode * inode) +void ufs_evict_inode(struct inode * inode) { - loff_t old_i_size; + int want_delete = 0; + + if (!inode->i_nlink && !is_bad_inode(inode)) + want_delete = 1; truncate_inode_pages(&inode->i_data, 0); - if (is_bad_inode(inode)) - goto no_delete; - /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/ - lock_kernel(); - mark_inode_dirty(inode); - ufs_update_inode(inode, IS_SYNC(inode)); - old_i_size = inode->i_size; - inode->i_size = 0; - if (inode->i_blocks && ufs_truncate(inode, old_i_size)) - ufs_warning(inode->i_sb, __func__, "ufs_truncate failed\n"); - ufs_free_inode (inode); - unlock_kernel(); - return; -no_delete: - clear_inode(inode); /* We must guarantee clearing of inode... */ + if (want_delete) { + loff_t old_i_size; + /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/ + lock_kernel(); + mark_inode_dirty(inode); + ufs_update_inode(inode, IS_SYNC(inode)); + old_i_size = inode->i_size; + inode->i_size = 0; + if (inode->i_blocks && ufs_truncate(inode, old_i_size)) + ufs_warning(inode->i_sb, __func__, "ufs_truncate failed\n"); + unlock_kernel(); + } + + invalidate_inode_buffers(inode); + end_writeback(inode); + + if (want_delete) { + lock_kernel(); + ufs_free_inode (inode); + unlock_kernel(); + } } -- cgit v1.2.3