summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-06-21 16:37:03 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-07-02 11:50:45 -0400
commit7ee9e4405f264e9eda808aa5ca4522746a1af9c1 (patch)
tree66b0ebcb2594309044e3f25ab6836b09662c7601 /fs/btrfs/extent-tree.c
parent925a6efb8ff0c2bdbec107ed9890e62650c83306 (diff)
downloadlinux-7ee9e4405f264e9eda808aa5ca4522746a1af9c1.tar.gz
linux-7ee9e4405f264e9eda808aa5ca4522746a1af9c1.tar.bz2
linux-7ee9e4405f264e9eda808aa5ca4522746a1af9c1.zip
Btrfs: check if we can nocow if we don't have data space
We always just try and reserve data space when we write, but if we are out of space but have prealloc'ed extents we should still successfully write. This patch will try and see if we can write to prealloc'ed space and if we can go ahead and allow the write to continue. With this patch we now pass xfstests generic/274. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5154b91f6380..11ba82e43e8b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3666,6 +3666,7 @@ void btrfs_free_reserved_data_space(struct inode *inode, u64 bytes)
data_sinfo = root->fs_info->data_sinfo;
spin_lock(&data_sinfo->lock);
+ WARN_ON(data_sinfo->bytes_may_use < bytes);
data_sinfo->bytes_may_use -= bytes;
trace_btrfs_space_reservation(root->fs_info, "space_info",
data_sinfo->flags, bytes, 0);