diff options
author | Qu Wenruo <wqu@suse.com> | 2018-05-02 21:59:02 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-05-28 12:07:30 -0400 |
commit | c9f6f3cd1c6fc4df959ce2bce15e5e6ce660bfd4 (patch) | |
tree | 5c00feff81afe60902b45f1f20c72365ded6949e | |
parent | f5686e3acdfd8b2559ed6988f85374c36e1fed4c (diff) |
btrfs: qgroup: Allow trace_btrfs_qgroup_account_extent() to record its transid
When debugging quota rescan race, some times btrfs rescan could account
some old (committed) leaf and then re-account newly committed leaf
in next generation.
This race needs extra transid to locate, so add @transid for
trace_btrfs_qgroup_account_extent() for such debug.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/qgroup.c | 4 | ||||
-rw-r--r-- | include/trace/events/btrfs.h | 20 |
2 files changed, 14 insertions, 10 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index ec2339a49ec3..9fdac5b46aa9 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -2014,8 +2014,8 @@ btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, | |||
2014 | 2014 | ||
2015 | BUG_ON(!fs_info->quota_root); | 2015 | BUG_ON(!fs_info->quota_root); |
2016 | 2016 | ||
2017 | trace_btrfs_qgroup_account_extent(fs_info, bytenr, num_bytes, | 2017 | trace_btrfs_qgroup_account_extent(fs_info, trans->transid, bytenr, |
2018 | nr_old_roots, nr_new_roots); | 2018 | num_bytes, nr_old_roots, nr_new_roots); |
2019 | 2019 | ||
2020 | qgroups = ulist_alloc(GFP_NOFS); | 2020 | qgroups = ulist_alloc(GFP_NOFS); |
2021 | if (!qgroups) { | 2021 | if (!qgroups) { |
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 29f9b14412ad..39b94ec965be 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
@@ -1578,12 +1578,14 @@ DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, | |||
1578 | 1578 | ||
1579 | TRACE_EVENT(btrfs_qgroup_account_extent, | 1579 | TRACE_EVENT(btrfs_qgroup_account_extent, |
1580 | 1580 | ||
1581 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr, | 1581 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, |
1582 | u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), | 1582 | u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), |
1583 | 1583 | ||
1584 | TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots), | 1584 | TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, |
1585 | nr_new_roots), | ||
1585 | 1586 | ||
1586 | TP_STRUCT__entry_btrfs( | 1587 | TP_STRUCT__entry_btrfs( |
1588 | __field( u64, transid ) | ||
1587 | __field( u64, bytenr ) | 1589 | __field( u64, bytenr ) |
1588 | __field( u64, num_bytes ) | 1590 | __field( u64, num_bytes ) |
1589 | __field( u64, nr_old_roots ) | 1591 | __field( u64, nr_old_roots ) |
@@ -1591,18 +1593,20 @@ TRACE_EVENT(btrfs_qgroup_account_extent, | |||
1591 | ), | 1593 | ), |
1592 | 1594 | ||
1593 | TP_fast_assign_btrfs(fs_info, | 1595 | TP_fast_assign_btrfs(fs_info, |
1596 | __entry->transid = transid; | ||
1594 | __entry->bytenr = bytenr; | 1597 | __entry->bytenr = bytenr; |
1595 | __entry->num_bytes = num_bytes; | 1598 | __entry->num_bytes = num_bytes; |
1596 | __entry->nr_old_roots = nr_old_roots; | 1599 | __entry->nr_old_roots = nr_old_roots; |
1597 | __entry->nr_new_roots = nr_new_roots; | 1600 | __entry->nr_new_roots = nr_new_roots; |
1598 | ), | 1601 | ), |
1599 | 1602 | ||
1600 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu " | 1603 | TP_printk_btrfs( |
1601 | "nr_new_roots=%llu", | 1604 | "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", |
1602 | __entry->bytenr, | 1605 | __entry->transid, |
1603 | __entry->num_bytes, | 1606 | __entry->bytenr, |
1604 | __entry->nr_old_roots, | 1607 | __entry->num_bytes, |
1605 | __entry->nr_new_roots) | 1608 | __entry->nr_old_roots, |
1609 | __entry->nr_new_roots) | ||
1606 | ); | 1610 | ); |
1607 | 1611 | ||
1608 | TRACE_EVENT(qgroup_update_counters, | 1612 | TRACE_EVENT(qgroup_update_counters, |