Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274635
b: refs/heads/master
c: 726c35f
h: refs/heads/master
i:
  274633: 4af5626
  274631: 8a9710c
v: v3
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent 04ee9ea commit 8e8bf2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1728366efa5ebf48bd2ed544afa8700cd07ba822
refs/heads/master: 726c35fa0edf1d9b8a88b73255532e73089aedda
12 changes: 11 additions & 1 deletion trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ void btrfs_evict_inode(struct inode *inode)
{
struct btrfs_trans_handle *trans;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_block_rsv *rsv;
struct btrfs_block_rsv *rsv, *global_rsv;
u64 min_size = btrfs_calc_trunc_metadata_size(root, 1);
unsigned long nr;
int ret;
Expand Down Expand Up @@ -3561,6 +3561,7 @@ void btrfs_evict_inode(struct inode *inode)
goto no_delete;
}
rsv->size = min_size;
global_rsv = &root->fs_info->global_block_rsv;

btrfs_i_size_write(inode, 0);

Expand All @@ -3577,6 +3578,15 @@ void btrfs_evict_inode(struct inode *inode)
*/
while (1) {
ret = btrfs_block_rsv_check(root, rsv, min_size, 0, 1);

/*
* Try and steal from the global reserve since we will
* likely not use this space anyway, we want to try as
* hard as possible to get this to work.
*/
if (ret)
ret = btrfs_block_rsv_migrate(global_rsv, rsv, min_size);

if (ret) {
printk(KERN_WARNING "Could not get space for a "
"delete, will truncate on mount %d\n", ret);
Expand Down

0 comments on commit 8e8bf2c

Please sign in to comment.