diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-12-17 16:01:41 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-12-17 16:01:41 -0500 |
commit | 7a5d24b1067823e870bf23e62bf8a788bd73818d (patch) | |
tree | 8b7b32d651f57fe1c12b8826f071b2e196032012 | |
parent | ebfee3d71d5a29102aac1fb2e756b8258f753592 (diff) | |
parent | 3a1abec9f6880cf406593c392636199ea1c6c917 (diff) |
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable into for-linus
-rw-r--r-- | fs/btrfs/inode.c | 13 |
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, | |||
5802 | while (num_bytes > 0) { | 5802 | while (num_bytes > 0) { |
5803 | alloc_size = min(num_bytes, root->fs_info->max_extent); | 5803 | alloc_size = min(num_bytes, root->fs_info->max_extent); |
5804 | 5804 | ||
5805 | trans = btrfs_start_transaction(root, 1); | ||
5806 | |||
5805 | ret = btrfs_reserve_extent(trans, root, alloc_size, | 5807 | ret = btrfs_reserve_extent(trans, root, alloc_size, |
5806 | root->sectorsize, 0, alloc_hint, | 5808 | root->sectorsize, 0, alloc_hint, |
5807 | (u64)-1, &ins, 1); | 5809 | (u64)-1, &ins, 1); |
5808 | if (ret) { | 5810 | if (ret) { |
5809 | WARN_ON(1); | 5811 | WARN_ON(1); |
5810 | break; | 5812 | goto stop_trans; |
5811 | } | 5813 | } |
5812 | 5814 | ||
5813 | ret = btrfs_reserve_metadata_space(root, 3); | 5815 | ret = btrfs_reserve_metadata_space(root, 3); |
5814 | if (ret) { | 5816 | if (ret) { |
5815 | btrfs_free_reserved_extent(root, ins.objectid, | 5817 | btrfs_free_reserved_extent(root, ins.objectid, |
5816 | ins.offset); | 5818 | ins.offset); |
5817 | break; | 5819 | goto stop_trans; |
5818 | } | 5820 | } |
5819 | 5821 | ||
5820 | trans = btrfs_start_transaction(root, 1); | ||
5821 | |||
5822 | ret = insert_reserved_file_extent(trans, inode, | 5822 | ret = insert_reserved_file_extent(trans, inode, |
5823 | cur_offset, ins.objectid, | 5823 | cur_offset, ins.objectid, |
5824 | ins.offset, ins.offset, | 5824 | ins.offset, ins.offset, |
@@ -5847,6 +5847,11 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5847 | btrfs_unreserve_metadata_space(root, 3); | 5847 | btrfs_unreserve_metadata_space(root, 3); |
5848 | } | 5848 | } |
5849 | return ret; | 5849 | return ret; |
5850 | |||
5851 | stop_trans: | ||
5852 | btrfs_end_transaction(trans, root); | ||
5853 | return ret; | ||
5854 | |||
5850 | } | 5855 | } |
5851 | 5856 | ||
5852 | static long btrfs_fallocate(struct inode *inode, int mode, | 5857 | static long btrfs_fallocate(struct inode *inode, int mode, |