diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-06-07 11:35:40 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:48:22 -0400 |
commit | bd55597520a2eaa0d71dd7683513a14bfd1bdf5c (patch) | |
tree | b99685fe2d9b6c9ad87b7d3e6a8fc47a5ac248ce /fs/btrfs/inode.c | |
parent | d5c1515cf374951f07e5bf97b6ff3718d3401b6f (diff) |
convert btrfs to ->evict_inode()
NB: do we want btrfs_wait_ordered_range() on eviction of
inodes with positive i_nlink on subvolume with zero root_refs?
If not, btrfs_evict_inode() can be simplified by unconditionally
bailing out in case of i_nlink > 0 in the very beginning...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 95eac0116963..ce02199ec4e5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3668,7 +3668,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3668 | return err; | 3668 | return err; |
3669 | } | 3669 | } |
3670 | 3670 | ||
3671 | void btrfs_delete_inode(struct inode *inode) | 3671 | void btrfs_evict_inode(struct inode *inode) |
3672 | { | 3672 | { |
3673 | struct btrfs_trans_handle *trans; | 3673 | struct btrfs_trans_handle *trans; |
3674 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3674 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -3676,10 +3676,14 @@ void btrfs_delete_inode(struct inode *inode) | |||
3676 | int ret; | 3676 | int ret; |
3677 | 3677 | ||
3678 | truncate_inode_pages(&inode->i_data, 0); | 3678 | truncate_inode_pages(&inode->i_data, 0); |
3679 | if (inode->i_nlink && btrfs_root_refs(&root->root_item) != 0) | ||
3680 | goto no_delete; | ||
3681 | |||
3679 | if (is_bad_inode(inode)) { | 3682 | if (is_bad_inode(inode)) { |
3680 | btrfs_orphan_del(NULL, inode); | 3683 | btrfs_orphan_del(NULL, inode); |
3681 | goto no_delete; | 3684 | goto no_delete; |
3682 | } | 3685 | } |
3686 | /* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */ | ||
3683 | btrfs_wait_ordered_range(inode, 0, (u64)-1); | 3687 | btrfs_wait_ordered_range(inode, 0, (u64)-1); |
3684 | 3688 | ||
3685 | if (root->fs_info->log_root_recovering) { | 3689 | if (root->fs_info->log_root_recovering) { |
@@ -3729,7 +3733,7 @@ void btrfs_delete_inode(struct inode *inode) | |||
3729 | btrfs_end_transaction(trans, root); | 3733 | btrfs_end_transaction(trans, root); |
3730 | btrfs_btree_balance_dirty(root, nr); | 3734 | btrfs_btree_balance_dirty(root, nr); |
3731 | no_delete: | 3735 | no_delete: |
3732 | clear_inode(inode); | 3736 | end_writeback(inode); |
3733 | return; | 3737 | return; |
3734 | } | 3738 | } |
3735 | 3739 | ||