Skip to content

Commit

Permalink
btrfs: tracepoints: Fix bad entry members of qgroup events
Browse files Browse the repository at this point in the history
commit 1b2442b 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: 4ee0d88 ("btrfs: qgroup: Update trace events for metadata reservation")
CC: [email protected] # 4.10+
Reviewed-by: Nikolay Borisov <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
adam900710 authored and gregkh committed Oct 29, 2019
1 parent c5c9278 commit 03ad9b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/trace/events/btrfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,7 @@ TRACE_EVENT(qgroup_update_reserve,
__entry->qgid = qgroup->qgroupid;
__entry->cur_reserved = qgroup->rsv.values[type];
__entry->diff = diff;
__entry->type = type;
),

TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
Expand All @@ -1709,6 +1710,7 @@ TRACE_EVENT(qgroup_meta_reserve,
TP_fast_assign_btrfs(root->fs_info,
__entry->refroot = root->root_key.objectid;
__entry->diff = diff;
__entry->type = type;
),

TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
Expand All @@ -1725,7 +1727,6 @@ TRACE_EVENT(qgroup_meta_convert,
TP_STRUCT__entry_btrfs(
__field( u64, refroot )
__field( s64, diff )
__field( int, type )
),

TP_fast_assign_btrfs(root->fs_info,
Expand Down

0 comments on commit 03ad9b7

Please sign in to comment.