aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index fd105c172c8b..faef1d64394d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2549,7 +2549,6 @@ static long btrfs_fallocate(struct file *file, int mode,
2549{ 2549{
2550 struct inode *inode = file_inode(file); 2550 struct inode *inode = file_inode(file);
2551 struct extent_state *cached_state = NULL; 2551 struct extent_state *cached_state = NULL;
2552 struct btrfs_root *root = BTRFS_I(inode)->root;
2553 u64 cur_offset; 2552 u64 cur_offset;
2554 u64 last_byte; 2553 u64 last_byte;
2555 u64 alloc_start; 2554 u64 alloc_start;
@@ -2577,11 +2576,6 @@ static long btrfs_fallocate(struct file *file, int mode,
2577 ret = btrfs_check_data_free_space(inode, alloc_end - alloc_start); 2576 ret = btrfs_check_data_free_space(inode, alloc_end - alloc_start);
2578 if (ret) 2577 if (ret)
2579 return ret; 2578 return ret;
2580 if (root->fs_info->quota_enabled) {
2581 ret = btrfs_qgroup_reserve(root, alloc_end - alloc_start);
2582 if (ret)
2583 goto out_reserve_fail;
2584 }
2585 2579
2586 mutex_lock(&inode->i_mutex); 2580 mutex_lock(&inode->i_mutex);
2587 ret = inode_newsize_ok(inode, alloc_end); 2581 ret = inode_newsize_ok(inode, alloc_end);
@@ -2674,6 +2668,7 @@ static long btrfs_fallocate(struct file *file, int mode,
2674 } else if (actual_end > inode->i_size && 2668 } else if (actual_end > inode->i_size &&
2675 !(mode & FALLOC_FL_KEEP_SIZE)) { 2669 !(mode & FALLOC_FL_KEEP_SIZE)) {
2676 struct btrfs_trans_handle *trans; 2670 struct btrfs_trans_handle *trans;
2671 struct btrfs_root *root = BTRFS_I(inode)->root;
2677 2672
2678 /* 2673 /*
2679 * We didn't need to allocate any more space, but we 2674 * We didn't need to allocate any more space, but we
@@ -2710,9 +2705,6 @@ static long btrfs_fallocate(struct file *file, int mode,
2710 &cached_state, GFP_NOFS); 2705 &cached_state, GFP_NOFS);
2711out: 2706out:
2712 mutex_unlock(&inode->i_mutex); 2707 mutex_unlock(&inode->i_mutex);
2713 if (root->fs_info->quota_enabled)
2714 btrfs_qgroup_free(root, alloc_end - alloc_start);
2715out_reserve_fail:
2716 /* Let go of our reservation. */ 2708 /* Let go of our reservation. */
2717 btrfs_free_reserved_data_space(inode, alloc_end - alloc_start); 2709 btrfs_free_reserved_data_space(inode, alloc_end - alloc_start);
2718 return ret; 2710 return ret;