summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2016-03-25 13:25:55 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-07 18:45:53 +0200
commitf485c9ee32531794e39631437fcedc82d5b8e650 (patch)
tree2120d5a76b712dd0c6590f0c980def0a405f36e9
parentc51e7bb1845079fda515a7acf0514e289aa6a07c (diff)
downloadlinux-f485c9ee32531794e39631437fcedc82d5b8e650.tar.gz
linux-f485c9ee32531794e39631437fcedc82d5b8e650.tar.bz2
linux-f485c9ee32531794e39631437fcedc82d5b8e650.zip
Btrfs: fix delalloc reservation amount tracepoint
We can sometimes drop the reservation we had for our inode, so we need to remove that amount from to_reserve so that our tracepoint reports a valid amount of space. Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/extent-tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9aa64f1aa413..5d24ec44d99b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6000,8 +6000,10 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
spin_lock(&BTRFS_I(inode)->lock);
if (test_and_set_bit(BTRFS_INODE_DELALLOC_META_RESERVED,
- &BTRFS_I(inode)->runtime_flags))
+ &BTRFS_I(inode)->runtime_flags)) {
+ to_reserve -= btrfs_calc_trans_metadata_size(root, 1);
release_extra = true;
+ }
BTRFS_I(inode)->reserved_extents += nr_extents;
spin_unlock(&BTRFS_I(inode)->lock);