Commit 0b95aaae authored by Qu Wenruo's avatar Qu Wenruo Committed by Greg Kroah-Hartman

btrfs: tracepoints: Fix bad entry members of qgroup events

commit 1b2442b4 upstream.

[BUG]
For btrfs:qgroup_meta_reserve event, the trace event can output garbage:

  qgroup_meta_reserve: 9c7f6acc-b342-4037-bc47-7f6e4d2232d7: refroot=5(FS_TREE) type=DATA diff=2
  qgroup_meta_reserve: 9c7f6acc-b342-4037-bc47-7f6e4d2232d7: refroot=5(FS_TREE) type=0x258792 diff=2

The @type can be completely garbage, as DATA type is not possible for
trace_qgroup_meta_reserve() trace event.

[CAUSE]
Ther are several problems related to qgroup trace events:
- Unassigned entry member
  Member entry::type of trace_qgroup_update_reserve() and
  trace_qgourp_meta_reserve() is not assigned

- Redundant entry member
  Member entry::type is completely useless in
  trace_qgroup_meta_convert()

Fixes: 4ee0d883 ("btrfs: qgroup: Update trace events for metadata reservation")
CC: stable@vger.kernel.org # 4.10+
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1b921b5b
...@@ -1655,6 +1655,7 @@ TRACE_EVENT(qgroup_update_reserve, ...@@ -1655,6 +1655,7 @@ TRACE_EVENT(qgroup_update_reserve,
__entry->qgid = qgroup->qgroupid; __entry->qgid = qgroup->qgroupid;
__entry->cur_reserved = qgroup->rsv.values[type]; __entry->cur_reserved = qgroup->rsv.values[type];
__entry->diff = diff; __entry->diff = diff;
__entry->type = type;
), ),
TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
...@@ -1677,6 +1678,7 @@ TRACE_EVENT(qgroup_meta_reserve, ...@@ -1677,6 +1678,7 @@ TRACE_EVENT(qgroup_meta_reserve,
TP_fast_assign_btrfs(root->fs_info, TP_fast_assign_btrfs(root->fs_info,
__entry->refroot = root->objectid; __entry->refroot = root->objectid;
__entry->diff = diff; __entry->diff = diff;
__entry->type = type;
), ),
TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
...@@ -1693,7 +1695,6 @@ TRACE_EVENT(qgroup_meta_convert, ...@@ -1693,7 +1695,6 @@ TRACE_EVENT(qgroup_meta_convert,
TP_STRUCT__entry_btrfs( TP_STRUCT__entry_btrfs(
__field( u64, refroot ) __field( u64, refroot )
__field( s64, diff ) __field( s64, diff )
__field( int, type )
), ),
TP_fast_assign_btrfs(root->fs_info, TP_fast_assign_btrfs(root->fs_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment