convert btrfs to ->evict_inode()
[pandora-kernel.git] / fs / btrfs / inode.c
index 1bff92a..ce02199 100644 (file)
@@ -3656,17 +3656,19 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
                if (err)
                        return err;
        }
-       attr->ia_valid &= ~ATTR_SIZE;
 
-       if (attr->ia_valid)
-               err = inode_setattr(inode, attr);
+       if (attr->ia_valid) {
+               setattr_copy(inode, attr);
+               mark_inode_dirty(inode);
+
+               if (attr->ia_valid & ATTR_MODE)
+                       err = btrfs_acl_chmod(inode);
+       }
 
-       if (!err && ((attr->ia_valid & ATTR_MODE)))
-               err = btrfs_acl_chmod(inode);
        return err;
 }
 
-void btrfs_delete_inode(struct inode *inode)
+void btrfs_evict_inode(struct inode *inode)
 {
        struct btrfs_trans_handle *trans;
        struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -3674,10 +3676,14 @@ void btrfs_delete_inode(struct inode *inode)
        int ret;
 
        truncate_inode_pages(&inode->i_data, 0);
+       if (inode->i_nlink && btrfs_root_refs(&root->root_item) != 0)
+               goto no_delete;
+
        if (is_bad_inode(inode)) {
                btrfs_orphan_del(NULL, inode);
                goto no_delete;
        }
+       /* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */
        btrfs_wait_ordered_range(inode, 0, (u64)-1);
 
        if (root->fs_info->log_root_recovering) {
@@ -3727,7 +3733,7 @@ void btrfs_delete_inode(struct inode *inode)
        btrfs_end_transaction(trans, root);
        btrfs_btree_balance_dirty(root, nr);
 no_delete:
-       clear_inode(inode);
+       end_writeback(inode);
        return;
 }
 
@@ -3858,7 +3864,7 @@ again:
                        p = &parent->rb_right;
                else {
                        WARN_ON(!(entry->vfs_inode.i_state &
-                                 (I_WILL_FREE | I_FREEING | I_CLEAR)));
+                                 (I_WILL_FREE | I_FREEING)));
                        rb_erase(parent, &root->inode_tree);
                        RB_CLEAR_NODE(parent);
                        spin_unlock(&root->inode_lock);