Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274620
b: refs/heads/master
c: 7ed49f1
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent 58f428a commit 5f5cd5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 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: a9b5fcddce594a408a48d523087b5bb64ce82469
refs/heads/master: 7ed49f187c82821e35f8869399bcf90822a74a23
20 changes: 14 additions & 6 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4025,16 +4025,24 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)

ret = reserve_metadata_bytes(NULL, root, block_rsv, to_reserve, 1);
if (ret) {
u64 to_free = 0;
unsigned dropped;
/*
* We don't need the return value since our reservation failed,
* we just need to clean up our counter.
*/

spin_lock(&BTRFS_I(inode)->lock);
dropped = drop_outstanding_extent(inode);
WARN_ON(dropped > 1);
BTRFS_I(inode)->csum_bytes -= num_bytes;
to_free = calc_csum_metadata_size(inode, num_bytes, 0);
spin_unlock(&BTRFS_I(inode)->lock);
to_free += btrfs_calc_trans_metadata_size(root, dropped);

/*
* Somebody could have come in and twiddled with the
* reservation, so if we have to free more than we would have
* reserved from this reservation go ahead and release those
* bytes.
*/
to_free -= to_reserve;
if (to_free)
btrfs_block_rsv_release(root, block_rsv, to_free);
return ret;
}

Expand Down

0 comments on commit 5f5cd5e

Please sign in to comment.