All of lore.kernel.org
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: linux-btrfs@vger.kernel.org
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [PATCH] qgroup: Add trace events for reserve and free_ref_root
Date: Sun, 19 Feb 2017 07:30:37 -0600	[thread overview]
Message-ID: <20170219133037.20888-1-rgoldwyn@suse.de> (raw)

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

These commits show the current value of qg->reserved and
the amount modified. Though these are frequently called function,
we may require to monitor qg->reserved for some operations.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/btrfs/qgroup.c            |  4 ++++
 include/trace/events/btrfs.h | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index dfd9986..4700cac 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2159,6 +2159,8 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
 
 		qg = u64_to_ptr(unode->aux);
 
+		trace_btrfs_qgroup_reserve(fs_info, qg->qgroupid, qg->reserved, num_bytes);
+
 		qg->reserved += num_bytes;
 	}
 
@@ -2204,6 +2206,8 @@ void btrfs_qgroup_free_refroot(struct btrfs_fs_info *fs_info,
 
 		qg = u64_to_ptr(unode->aux);
 
+		trace_btrfs_qgroup_free_refroot(fs_info, qg->qgroupid, qg->reserved, num_bytes);
+
 		qg->reserved -= num_bytes;
 
 		list_for_each_entry(glist, &qg->groups, next_group) {
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 6d7fe11..f6a9f8c 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -1472,6 +1472,46 @@ TRACE_EVENT(qgroup_update_counters,
 		  __entry->cur_new_count)
 );
 
+DECLARE_EVENT_CLASS(btrfs_qgroup_reserved,
+
+	TP_PROTO(struct btrfs_fs_info *fs_info, u64 qgid,
+		 u64 reserved, u64 num_bytes),
+
+	TP_ARGS(fs_info, qgid, reserved, num_bytes),
+
+	TP_STRUCT__entry_btrfs(
+		__field(	u64,  qgid			)
+		__field(	u64,  reserved		)
+		__field(	u64,  num_bytes		)
+	),
+
+	TP_fast_assign_btrfs(fs_info,
+		__entry->qgid		= qgid;
+		__entry->reserved	= reserved;
+		__entry->num_bytes	= num_bytes;
+	),
+
+	TP_printk_btrfs("qgid = %llu, reserved = %llu, num_bytes = %llu",
+		  __entry->qgid,
+		  __entry->reserved,
+		  __entry->num_bytes)
+);
+
+
+DEFINE_EVENT(btrfs_qgroup_reserved, btrfs_qgroup_reserve,
+
+	TP_PROTO(struct btrfs_fs_info *fs_info, u64 qgid, u64 reserved, u64 num_bytes),
+
+	TP_ARGS(fs_info, qgid, reserved, num_bytes)
+);
+
+DEFINE_EVENT(btrfs_qgroup_reserved, btrfs_qgroup_free_refroot,
+
+	TP_PROTO(struct btrfs_fs_info *fs_info, u64 qgid, u64 reserved, u64 num_bytes),
+
+	TP_ARGS(fs_info, qgid, reserved, num_bytes)
+);
+
 #endif /* _TRACE_BTRFS_H */
 
 /* This part must be outside protection */
-- 
2.10.2


             reply	other threads:[~2017-02-19 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-19 13:30 Goldwyn Rodrigues [this message]
2017-02-20  3:02 ` [PATCH] qgroup: Add trace events for reserve and free_ref_root Qu Wenruo

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=20170219133037.20888-1-rgoldwyn@suse.de \
    --to=rgoldwyn@suse.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    /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.