summaryrefslogtreecommitdiff
path: root/include/trace
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2026-04-17 17:43:19 +0100
committerDavid Sterba <dsterba@suse.com>2026-06-08 15:53:33 +0200
commite1ad307c7ab1af0b5c14549b23982464c22996cc (patch)
treee6f5cec6f875e56497bc7306d0a22567fa3a5b59 /include/trace
parentd5ccc38b755fe65ee1214c0b8a46c77af982f187 (diff)
downloadlinux-next-e1ad307c7ab1af0b5c14549b23982464c22996cc.tar.gz
linux-next-e1ad307c7ab1af0b5c14549b23982464c22996cc.zip
btrfs: tracepoints: pass a transaction handle to transaction commit event
The transaction commit tracepoint prints fs_info->generation as if it were the ID of the committed transaction but this does not always match that ID. This is because the trace point is called in the transaction commit path after the transaction is in the TRANS_STATE_COMPLETED state, which means another transaction may have already started (which can happen as soon as the transaction state was set to TRANS_STATE_UNBLOCKED), in which case fs_info->generation was incremented and does not correspond to the committed transaction anymore. So fix this by passing a transaction handle to the trace event instead of fs_info. This will also allow later for the trace event to dump other useful information about the transaction. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/btrfs.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index a8cdc50677a5..4cec2f8838f5 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -31,6 +31,7 @@ struct btrfs_space_info;
struct btrfs_raid_bio;
struct raid56_bio_trace_info;
struct find_free_extent_ctl;
+struct btrfs_trans_handle;
#define show_ref_type(type) \
__print_symbolic(type, \
@@ -182,16 +183,16 @@ FLUSH_STATES
TRACE_EVENT(btrfs_transaction_commit,
- TP_PROTO(const struct btrfs_fs_info *fs_info),
+ TP_PROTO(const struct btrfs_trans_handle *trans),
- TP_ARGS(fs_info),
+ TP_ARGS(trans),
TP_STRUCT__entry_btrfs(
__field( u64, generation )
),
- TP_fast_assign_btrfs(fs_info,
- __entry->generation = fs_info->generation;
+ TP_fast_assign_btrfs(trans->fs_info,
+ __entry->generation = trans->transid;
),
TP_printk_btrfs("gen=%llu", __entry->generation)