Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154807
b: refs/heads/master
c: a970b0a
h: refs/heads/master
i:
  154805: 9766d1f
  154803: 5b9d818
  154799: e7d7092
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Jul 2, 2009
1 parent a241f35 commit 2c609cb
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: c8a894d77de4a1e0a544577fd4eabc9aacd453a8
refs/heads/master: a970b0a16cc416a509d5ae8b1d70978664e6f4fe
12 changes: 11 additions & 1 deletion trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5103,6 +5103,7 @@ static long btrfs_fallocate(struct inode *inode, int mode,
u64 mask = BTRFS_I(inode)->root->sectorsize - 1;
struct extent_map *em;
struct btrfs_trans_handle *trans;
struct btrfs_root *root;
int ret;

alloc_start = offset & ~mask;
Expand All @@ -5121,14 +5122,21 @@ static long btrfs_fallocate(struct inode *inode, int mode,
goto out;
}

root = BTRFS_I(inode)->root;

ret = btrfs_check_data_free_space(root, inode,
alloc_end - alloc_start);
if (ret)
goto out;

locked_end = alloc_end - 1;
while (1) {
struct btrfs_ordered_extent *ordered;

trans = btrfs_start_transaction(BTRFS_I(inode)->root, 1);
if (!trans) {
ret = -EIO;
goto out;
goto out_free;
}

/* the extent lock is ordered inside the running
Expand Down Expand Up @@ -5189,6 +5197,8 @@ static long btrfs_fallocate(struct inode *inode, int mode,
GFP_NOFS);

btrfs_end_transaction(trans, BTRFS_I(inode)->root);
out_free:
btrfs_free_reserved_data_space(root, inode, alloc_end - alloc_start);
out:
mutex_unlock(&inode->i_mutex);
return ret;
Expand Down

0 comments on commit 2c609cb

Please sign in to comment.