]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
btrfs: trace: Allow trace_qgroup_update_counters() to record old rfer/excl value
authorQu Wenruo <wqu@suse.com>
Mon, 30 Apr 2018 07:04:44 +0000 (15:04 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:29 +0000 (18:07 +0200)
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>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/qgroup.c
include/trace/events/btrfs.h

index 9fb758d5077a8441e994df53652fe32f771c2a49..ec2339a49ec30d76df04b503b4283eabd718de79 100644 (file)
@@ -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) {
index 914ddb7a6d2587b98bb3963ec4bd5c50a7a4ba78..29f9b14412ad72d526881a7a57edfd95420c87d7 100644 (file)
@@ -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,