btrfs: pass fs_info to trace_btrfs_transaction_commit
authorJosef Bacik <josef@toxicpanda.com>
Fri, 5 Nov 2021 20:45:29 +0000 (16:45 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 3 Jan 2022 14:09:47 +0000 (15:09 +0100)
The root on the trans->root can be anything, and generally we're
committing from the transaction kthread so it's usually the tree_root.
Change this to just take an fs_info, and to maintain compatibility
simply put the ROOT_TREE_OBJECTID as the root objectid for the
tracepoint.  This will allow use to remove trans->root.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/transaction.c
include/trace/events/btrfs.h

index 9683b50..edf837d 100644 (file)
@@ -4989,7 +4989,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
                spin_unlock(&fs_info->trans_lock);
 
                btrfs_put_transaction(t);
-               trace_btrfs_transaction_commit(fs_info->tree_root);
+               trace_btrfs_transaction_commit(fs_info);
                spin_lock(&fs_info->trans_lock);
        }
        spin_unlock(&fs_info->trans_lock);
index 3538980..0f1df04 100644 (file)
@@ -1956,7 +1956,7 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, int err)
        btrfs_put_transaction(cur_trans);
        btrfs_put_transaction(cur_trans);
 
-       trace_btrfs_transaction_commit(trans->root);
+       trace_btrfs_transaction_commit(fs_info);
 
        if (current->journal_info == trans)
                current->journal_info = NULL;
@@ -2361,7 +2361,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
        if (trans->type & __TRANS_FREEZABLE)
                sb_end_intwrite(fs_info->sb);
 
-       trace_btrfs_transaction_commit(trans->root);
+       trace_btrfs_transaction_commit(fs_info);
 
        btrfs_scrub_continue(fs_info);
 
index 8f58fd9..0d72966 100644 (file)
@@ -182,18 +182,18 @@ FLUSH_STATES
 
 TRACE_EVENT(btrfs_transaction_commit,
 
-       TP_PROTO(const struct btrfs_root *root),
+       TP_PROTO(const struct btrfs_fs_info *fs_info),
 
-       TP_ARGS(root),
+       TP_ARGS(fs_info),
 
        TP_STRUCT__entry_btrfs(
                __field(        u64,  generation                )
                __field(        u64,  root_objectid             )
        ),
 
-       TP_fast_assign_btrfs(root->fs_info,
-               __entry->generation     = root->fs_info->generation;
-               __entry->root_objectid  = root->root_key.objectid;
+       TP_fast_assign_btrfs(fs_info,
+               __entry->generation     = fs_info->generation;
+               __entry->root_objectid  = BTRFS_ROOT_TREE_OBJECTID;
        ),
 
        TP_printk_btrfs("root=%llu(%s) gen=%llu",