summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-12-17 16:01:41 -0500
committerChris Mason <chris.mason@oracle.com>2009-12-17 16:01:41 -0500
commit7a5d24b1067823e870bf23e62bf8a788bd73818d (patch)
tree8b7b32d651f57fe1c12b8826f071b2e196032012 /fs
parentebfee3d71d5a29102aac1fb2e756b8258f753592 (diff)
parent3a1abec9f6880cf406593c392636199ea1c6c917 (diff)
downloadlinux-7a5d24b1067823e870bf23e62bf8a788bd73818d.tar.gz
linux-7a5d24b1067823e870bf23e62bf8a788bd73818d.tar.bz2
linux-7a5d24b1067823e870bf23e62bf8a788bd73818d.zip
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable into for-linus
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index da76cad92ecf..5440bab23635 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5802,23 +5802,23 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
while (num_bytes > 0) {
alloc_size = min(num_bytes, root->fs_info->max_extent);
+ trans = btrfs_start_transaction(root, 1);
+
ret = btrfs_reserve_extent(trans, root, alloc_size,
root->sectorsize, 0, alloc_hint,
(u64)-1, &ins, 1);
if (ret) {
WARN_ON(1);
- break;
+ goto stop_trans;
}
ret = btrfs_reserve_metadata_space(root, 3);
if (ret) {
btrfs_free_reserved_extent(root, ins.objectid,
ins.offset);
- break;
+ goto stop_trans;
}
- trans = btrfs_start_transaction(root, 1);
-
ret = insert_reserved_file_extent(trans, inode,
cur_offset, ins.objectid,
ins.offset, ins.offset,
@@ -5847,6 +5847,11 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
btrfs_unreserve_metadata_space(root, 3);
}
return ret;
+
+stop_trans:
+ btrfs_end_transaction(trans, root);
+ return ret;
+
}
static long btrfs_fallocate(struct inode *inode, int mode,