All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: linux-btrfs@vger.kernel.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Josef Bacik <josef@toxicpanda.com>
Subject: [PATCH v5 10/13] btrfs: add tracepoints for ordered stripes
Date: Wed,  8 Feb 2023 02:57:47 -0800	[thread overview]
Message-ID: <10aae0632d221643b66784b9f1dccdee1c90fc5b.1675853489.git.johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <cover.1675853489.git.johannes.thumshirn@wdc.com>

Add tracepoints to check the lifetime of btrfs_ordered_stripe entries.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/raid-stripe-tree.c  |  3 +++
 fs/btrfs/super.c             |  1 +
 include/trace/events/btrfs.h | 50 ++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c
index 32a428413f5b..4d4c7870547c 100644
--- a/fs/btrfs/raid-stripe-tree.c
+++ b/fs/btrfs/raid-stripe-tree.c
@@ -113,6 +113,7 @@ int btrfs_add_ordered_stripe(struct btrfs_io_context *bioc)
 		write_unlock(&fs_info->stripe_update_lock);
 	}
 
+	trace_btrfs_ordered_stripe_add(fs_info, stripe);
 	return 0;
 }
 
@@ -128,6 +129,7 @@ struct btrfs_ordered_stripe *btrfs_lookup_ordered_stripe(struct btrfs_fs_info *f
 	if (node) {
 		stripe = rb_entry(node, struct btrfs_ordered_stripe, rb_node);
 		refcount_inc(&stripe->ref);
+		trace_btrfs_ordered_stripe_lookup(fs_info, stripe);
 	}
 	read_unlock(&fs_info->stripe_update_lock);
 
@@ -138,6 +140,7 @@ void btrfs_put_ordered_stripe(struct btrfs_fs_info *fs_info,
 				 struct btrfs_ordered_stripe *stripe)
 {
 	write_lock(&fs_info->stripe_update_lock);
+	trace_btrfs_ordered_stripe_put(fs_info, stripe);
 	if (refcount_dec_and_test(&stripe->ref)) {
 		struct rb_node *node = &stripe->rb_node;
 
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index e5136baef9af..7235106e8d08 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -59,6 +59,7 @@
 #include "verity.h"
 #include "super.h"
 #include "extent-tree.h"
+#include "raid-stripe-tree.h"
 #define CREATE_TRACE_POINTS
 #include <trace/events/btrfs.h>
 
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 75d7d22c3a27..8efea1445dd9 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -33,6 +33,7 @@ struct btrfs_space_info;
 struct btrfs_raid_bio;
 struct raid56_bio_trace_info;
 struct find_free_extent_ctl;
+struct btrfs_ordered_stripe;
 
 #define show_ref_type(type)						\
 	__print_symbolic(type,						\
@@ -2492,6 +2493,55 @@ DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read_recover,
 	TP_ARGS(rbio, bio, trace_info)
 );
 
+DECLARE_EVENT_CLASS(btrfs__ordered_stripe,
+
+	TP_PROTO(const struct btrfs_fs_info *fs_info,
+		 const struct btrfs_ordered_stripe *stripe),
+
+	TP_ARGS(fs_info, stripe),
+
+	TP_STRUCT__entry_btrfs(
+		__field(	u64,	logical		)
+		__field(	u64,	num_bytes	)
+		__field(	int,	num_stripes	)
+		__field(	int,	ref		)
+	),
+
+	TP_fast_assign_btrfs(fs_info,
+		__entry->logical	= stripe->logical;
+		__entry->num_bytes	= stripe->num_bytes;
+		__entry->num_stripes	= stripe->num_stripes;
+		__entry->ref		= refcount_read(&stripe->ref);
+	),
+
+	TP_printk_btrfs("logical=%llu, num_bytes=%llu, num_stripes=%d, ref=%d",
+			__entry->logical, __entry->num_bytes,
+			__entry->num_stripes, __entry->ref)
+);
+
+DEFINE_EVENT(btrfs__ordered_stripe, btrfs_ordered_stripe_add,
+
+	     TP_PROTO(const struct btrfs_fs_info *fs_info,
+		      const struct btrfs_ordered_stripe *stripe),
+
+	     TP_ARGS(fs_info, stripe)
+);
+
+DEFINE_EVENT(btrfs__ordered_stripe, btrfs_ordered_stripe_lookup,
+
+	     TP_PROTO(const struct btrfs_fs_info *fs_info,
+		      const struct btrfs_ordered_stripe *stripe),
+
+	     TP_ARGS(fs_info, stripe)
+);
+
+DEFINE_EVENT(btrfs__ordered_stripe, btrfs_ordered_stripe_put,
+
+	     TP_PROTO(const struct btrfs_fs_info *fs_info,
+		      const struct btrfs_ordered_stripe *stripe),
+
+	     TP_ARGS(fs_info, stripe)
+);
 #endif /* _TRACE_BTRFS_H */
 
 /* This part must be outside protection */
-- 
2.39.0


  parent reply	other threads:[~2023-02-08 10:58 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 10:57 [PATCH v5 00/13] btrfs: introduce RAID stripe tree Johannes Thumshirn
2023-02-08 10:57 ` [PATCH v5 01/13] btrfs: re-add trans parameter to insert_delayed_ref Johannes Thumshirn
2023-02-08 19:41   ` Josef Bacik
2023-02-08 10:57 ` [PATCH v5 02/13] btrfs: add raid stripe tree definitions Johannes Thumshirn
2023-02-08 19:42   ` Josef Bacik
2023-02-13  6:50   ` Christoph Hellwig
2023-02-13 11:10     ` Johannes Thumshirn
2023-02-13 11:34   ` Anand Jain
2023-02-08 10:57 ` [PATCH v5 03/13] btrfs: read raid-stripe-tree from disk Johannes Thumshirn
2023-02-08 19:43   ` Josef Bacik
2023-02-13 11:35   ` Anand Jain
2023-02-08 10:57 ` [PATCH v5 04/13] btrfs: add support for inserting raid stripe extents Johannes Thumshirn
2023-02-08 19:47   ` Josef Bacik
2023-02-08 19:52   ` Josef Bacik
2023-02-13  6:57   ` Christoph Hellwig
2023-02-13 10:43     ` Johannes Thumshirn
2023-02-13 13:12       ` Johannes Thumshirn
2023-02-13  7:40   ` Qu Wenruo
2023-02-13 10:49     ` Johannes Thumshirn
2023-02-13 11:12       ` Qu Wenruo
2023-02-13 11:37         ` Johannes Thumshirn
2023-02-08 10:57 ` [PATCH v5 05/13] btrfs: delete stripe extent on extent deletion Johannes Thumshirn
2023-02-08 20:00   ` Josef Bacik
2023-02-13 15:21     ` Johannes Thumshirn
2023-02-08 10:57 ` [PATCH v5 06/13] btrfs: lookup physical address from stripe extent Johannes Thumshirn
2023-02-08 20:16   ` Josef Bacik
2023-02-08 10:57 ` [PATCH v5 07/13] btrfs: add raid stripe tree pretty printer Johannes Thumshirn
2023-02-08 10:57 ` [PATCH v5 08/13] btrfs: zoned: allow zoned RAID Johannes Thumshirn
2023-02-08 20:18   ` Josef Bacik
2023-02-08 10:57 ` [PATCH v5 09/13] btrfs: check for leaks of ordered stripes on umount Johannes Thumshirn
2023-02-08 20:19   ` Josef Bacik
2023-02-08 10:57 ` Johannes Thumshirn [this message]
2023-02-08 10:57 ` [PATCH v5 11/13] btrfs: announce presence of raid-stripe-tree in sysfs Johannes Thumshirn
2023-02-08 20:20   ` Josef Bacik
2023-02-08 10:57 ` [PATCH v5 12/13] btrfs: consult raid-stripe-tree when scrubbing Johannes Thumshirn
2023-02-08 20:21   ` Josef Bacik
2023-02-08 10:57 ` [PATCH v5 13/13] btrfs: add raid-stripe-tree to features enabled with debug Johannes Thumshirn
2023-02-08 20:23   ` Josef Bacik
2023-02-09  0:42 ` [PATCH v5 00/13] btrfs: introduce RAID stripe tree Qu Wenruo
2023-02-09  8:47   ` Johannes Thumshirn
2023-02-09 15:57 ` Phillip Susi
2023-02-10  8:44   ` Johannes Thumshirn
2023-02-10 10:33     ` Johannes Thumshirn
2023-02-13 16:42     ` Phillip Susi
2023-02-13 17:44       ` Johannes Thumshirn
2023-02-13 17:56         ` Phillip Susi
2023-02-14  5:52           ` Christoph Hellwig
2023-02-14  5:51         ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10aae0632d221643b66784b9f1dccdee1c90fc5b.1675853489.git.johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.