Blob Blame History Raw
From: Josef Bacik <josef@toxicpanda.com>
Date: Thu, 22 Aug 2019 15:10:56 -0400
Subject: btrfs: add space reservation tracepoint for reserved bytes
Git-commit: a43c383574d80503f3ba9cd08de16dad2590ca1b
Patch-mainline: v5.4-rc1
References: bsc#1165949

I noticed when folding the trace_btrfs_space_reservation() tracepoint
into the btrfs_space_info_update_* helpers that we didn't emit a
tracepoint when doing btrfs_add_reserved_bytes().  I know this is
because we were swapping bytes_may_use for bytes_reserved, so in my mind
there was no reason to have the tracepoint there.  But now there is
because we always emit the unreserve for the bytes_may_use side, and
this would have broken if compression was on anyway.  Add a tracepoint
to cover the bytes_reserved counter so the math still comes out right.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Acked-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/block-group.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -2782,7 +2782,7 @@ int btrfs_add_reserved_bytes(struct btrf
 		space_info->bytes_reserved += num_bytes;
 		trace_btrfs_space_reservation(cache->fs_info,
 				"space_info", space_info->flags,
-				ram_bytes, 0);
+				ram_bytes, 1);
 		btrfs_space_info_update_bytes_may_use(cache->fs_info,
 						      space_info, -ram_bytes);
 		if (delalloc)