* [PATCH] btrfs: trace: Allow trace_qgroup_update_counters() to record old rfer/excl value
@ 2018-04-30 7:04 Qu Wenruo
2018-05-01 14:56 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2018-04-30 7:04 UTC (permalink / raw)
To: linux-btrfs
Origin trace_qgroup_update_counters() only records qgroup id and its
reference count change.
It's good enough to debug qgroup accounting change, but when rescan race
is involved, it's pretty hard to distinguish which modification belongs
to which rescan.
So add old_rfer and old_excl trace output to help distinguishing
different rescan instance.
(Different rescan instance should reset its qgroup->rfer to 0)
For trace event parameter, it just changes from u64 qgroup_id to struct
btrfs_qgroup *qgroup, so number of parameters is not changed at all.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/qgroup.c | 4 ++--
include/trace/events/btrfs.h | 18 +++++++++++-------
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 9fb758d5077a..ec2339a49ec3 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1882,8 +1882,8 @@ static int qgroup_update_counters(struct btrfs_fs_info *fs_info,
cur_old_count = btrfs_qgroup_get_old_refcnt(qg, seq);
cur_new_count = btrfs_qgroup_get_new_refcnt(qg, seq);
- trace_qgroup_update_counters(fs_info, qg->qgroupid,
- cur_old_count, cur_new_count);
+ trace_qgroup_update_counters(fs_info, qg, cur_old_count,
+ cur_new_count);
/* Rfer update part */
if (cur_old_count == 0 && cur_new_count > 0) {
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 38f444bf55fe..cfcbcd2eb338 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -1607,27 +1607,31 @@ TRACE_EVENT(btrfs_qgroup_account_extent,
TRACE_EVENT(qgroup_update_counters,
- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid,
+ TP_PROTO(const struct btrfs_fs_info *fs_info,
+ struct btrfs_qgroup *qgroup,
u64 cur_old_count, u64 cur_new_count),
- TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
+ TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count),
TP_STRUCT__entry_btrfs(
__field( u64, qgid )
+ __field( u64, old_rfer )
+ __field( u64, old_excl )
__field( u64, cur_old_count )
__field( u64, cur_new_count )
),
TP_fast_assign_btrfs(fs_info,
- __entry->qgid = qgid;
+ __entry->qgid = qgroup->qgroupid;
+ __entry->old_rfer = qgroup->rfer;
+ __entry->old_excl = qgroup->excl;
__entry->cur_old_count = cur_old_count;
__entry->cur_new_count = cur_new_count;
),
- TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu",
- __entry->qgid,
- __entry->cur_old_count,
- __entry->cur_new_count)
+ TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu",
+ __entry->qgid, __entry->old_rfer, __entry->old_excl,
+ __entry->cur_old_count, __entry->cur_new_count)
);
TRACE_EVENT(qgroup_update_reserve,
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] btrfs: trace: Allow trace_qgroup_update_counters() to record old rfer/excl value
2018-04-30 7:04 [PATCH] btrfs: trace: Allow trace_qgroup_update_counters() to record old rfer/excl value Qu Wenruo
@ 2018-05-01 14:56 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2018-05-01 14:56 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs
On Mon, Apr 30, 2018 at 03:04:44PM +0800, Qu Wenruo wrote:
> Origin trace_qgroup_update_counters() only records qgroup id and its
> reference count change.
>
> It's good enough to debug qgroup accounting change, but when rescan race
> is involved, it's pretty hard to distinguish which modification belongs
> to which rescan.
>
> So add old_rfer and old_excl trace output to help distinguishing
> different rescan instance.
> (Different rescan instance should reset its qgroup->rfer to 0)
>
> For trace event parameter, it just changes from u64 qgroup_id to struct
> btrfs_qgroup *qgroup, so number of parameters is not changed at all.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-01 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-30 7:04 [PATCH] btrfs: trace: Allow trace_qgroup_update_counters() to record old rfer/excl value Qu Wenruo
2018-05-01 14:56 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox