summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 7cb9d73..075854e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4772,9 +4772,14 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
* ret != 0 here means the qgroup reservation failed, we go straight to
* the shared error handling then.
*/
- if (ret == 0)
+ if (ret == 0) {
ret = reserve_metadata_bytes(root, block_rsv,
to_reserve, flush);
+ if (ret && root->fs_info->quota_enabled) {
+ btrfs_qgroup_free(root, num_bytes +
+ nr_extents * root->leafsize);
+ }
+ }
if (ret) {
u64 to_free = 0;
@@ -4805,10 +4810,6 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
btrfs_ino(inode),
to_free, 0);
}
- if (root->fs_info->quota_enabled) {
- btrfs_qgroup_free(root, num_bytes +
- nr_extents * root->leafsize);
- }
if (delalloc_lock)
mutex_unlock(&BTRFS_I(inode)->delalloc_mutex);
return ret;
OpenPOWER on IntegriCloud