Commit bc074524 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba

btrfs: prefix fsid to all trace events

When using trace events to debug a problem, it's impossible to determine
which file system generated a particular event.  This patch adds a
macro to prefix standard information to the head of a trace event.

The extent_state alloc/free events are all that's left without an
fs_info available.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent cb001095
...@@ -606,7 +606,8 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info, ...@@ -606,7 +606,8 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
qrecord->num_bytes = num_bytes; qrecord->num_bytes = num_bytes;
qrecord->old_roots = NULL; qrecord->old_roots = NULL;
qexisting = btrfs_qgroup_insert_dirty_extent(delayed_refs, qexisting = btrfs_qgroup_insert_dirty_extent(fs_info,
delayed_refs,
qrecord); qrecord);
if (qexisting) if (qexisting)
kfree(qrecord); kfree(qrecord);
...@@ -615,7 +616,7 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info, ...@@ -615,7 +616,7 @@ add_delayed_ref_head(struct btrfs_fs_info *fs_info,
spin_lock_init(&head_ref->lock); spin_lock_init(&head_ref->lock);
mutex_init(&head_ref->mutex); mutex_init(&head_ref->mutex);
trace_add_delayed_ref_head(ref, head_ref, action); trace_add_delayed_ref_head(fs_info, ref, head_ref, action);
existing = htree_insert(&delayed_refs->href_root, existing = htree_insert(&delayed_refs->href_root,
&head_ref->href_node); &head_ref->href_node);
...@@ -682,7 +683,7 @@ add_delayed_tree_ref(struct btrfs_fs_info *fs_info, ...@@ -682,7 +683,7 @@ add_delayed_tree_ref(struct btrfs_fs_info *fs_info,
ref->type = BTRFS_TREE_BLOCK_REF_KEY; ref->type = BTRFS_TREE_BLOCK_REF_KEY;
full_ref->level = level; full_ref->level = level;
trace_add_delayed_tree_ref(ref, full_ref, action); trace_add_delayed_tree_ref(fs_info, ref, full_ref, action);
ret = add_delayed_ref_tail_merge(trans, delayed_refs, head_ref, ref); ret = add_delayed_ref_tail_merge(trans, delayed_refs, head_ref, ref);
...@@ -739,7 +740,7 @@ add_delayed_data_ref(struct btrfs_fs_info *fs_info, ...@@ -739,7 +740,7 @@ add_delayed_data_ref(struct btrfs_fs_info *fs_info,
full_ref->objectid = owner; full_ref->objectid = owner;
full_ref->offset = offset; full_ref->offset = offset;
trace_add_delayed_data_ref(ref, full_ref, action); trace_add_delayed_data_ref(fs_info, ref, full_ref, action);
ret = add_delayed_ref_tail_merge(trans, delayed_refs, head_ref, ref); ret = add_delayed_ref_tail_merge(trans, delayed_refs, head_ref, ref);
......
...@@ -2204,7 +2204,7 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans, ...@@ -2204,7 +2204,7 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans,
ins.type = BTRFS_EXTENT_ITEM_KEY; ins.type = BTRFS_EXTENT_ITEM_KEY;
ref = btrfs_delayed_node_to_data_ref(node); ref = btrfs_delayed_node_to_data_ref(node);
trace_run_delayed_data_ref(node, ref, node->action); trace_run_delayed_data_ref(root->fs_info, node, ref, node->action);
if (node->type == BTRFS_SHARED_DATA_REF_KEY) if (node->type == BTRFS_SHARED_DATA_REF_KEY)
parent = ref->parent; parent = ref->parent;
...@@ -2359,7 +2359,7 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, ...@@ -2359,7 +2359,7 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans,
SKINNY_METADATA); SKINNY_METADATA);
ref = btrfs_delayed_node_to_tree_ref(node); ref = btrfs_delayed_node_to_tree_ref(node);
trace_run_delayed_tree_ref(node, ref, node->action); trace_run_delayed_tree_ref(root->fs_info, node, ref, node->action);
if (node->type == BTRFS_SHARED_BLOCK_REF_KEY) if (node->type == BTRFS_SHARED_BLOCK_REF_KEY)
parent = ref->parent; parent = ref->parent;
...@@ -2423,7 +2423,8 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans, ...@@ -2423,7 +2423,8 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans,
*/ */
BUG_ON(extent_op); BUG_ON(extent_op);
head = btrfs_delayed_node_to_head(node); head = btrfs_delayed_node_to_head(node);
trace_run_delayed_ref_head(node, head, node->action); trace_run_delayed_ref_head(root->fs_info, node, head,
node->action);
if (insert_reserved) { if (insert_reserved) {
btrfs_pin_extent(root, node->bytenr, btrfs_pin_extent(root, node->bytenr,
...@@ -8542,7 +8543,8 @@ static int record_one_subtree_extent(struct btrfs_trans_handle *trans, ...@@ -8542,7 +8543,8 @@ static int record_one_subtree_extent(struct btrfs_trans_handle *trans,
delayed_refs = &trans->transaction->delayed_refs; delayed_refs = &trans->transaction->delayed_refs;
spin_lock(&delayed_refs->lock); spin_lock(&delayed_refs->lock);
if (btrfs_qgroup_insert_dirty_extent(delayed_refs, qrecord)) if (btrfs_qgroup_insert_dirty_extent(trans->root->fs_info,
delayed_refs, qrecord))
kfree(qrecord); kfree(qrecord);
spin_unlock(&delayed_refs->lock); spin_unlock(&delayed_refs->lock);
......
...@@ -1453,9 +1453,10 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, ...@@ -1453,9 +1453,10 @@ int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans,
return ret; return ret;
} }
struct btrfs_qgroup_extent_record struct btrfs_qgroup_extent_record *
*btrfs_qgroup_insert_dirty_extent(struct btrfs_delayed_ref_root *delayed_refs, btrfs_qgroup_insert_dirty_extent(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup_extent_record *record) struct btrfs_delayed_ref_root *delayed_refs,
struct btrfs_qgroup_extent_record *record)
{ {
struct rb_node **p = &delayed_refs->dirty_extent_root.rb_node; struct rb_node **p = &delayed_refs->dirty_extent_root.rb_node;
struct rb_node *parent_node = NULL; struct rb_node *parent_node = NULL;
...@@ -1463,7 +1464,7 @@ struct btrfs_qgroup_extent_record ...@@ -1463,7 +1464,7 @@ struct btrfs_qgroup_extent_record
u64 bytenr = record->bytenr; u64 bytenr = record->bytenr;
assert_spin_locked(&delayed_refs->lock); assert_spin_locked(&delayed_refs->lock);
trace_btrfs_qgroup_insert_dirty_extent(record); trace_btrfs_qgroup_insert_dirty_extent(fs_info, record);
while (*p) { while (*p) {
parent_node = *p; parent_node = *p;
...@@ -1595,8 +1596,8 @@ static int qgroup_update_counters(struct btrfs_fs_info *fs_info, ...@@ -1595,8 +1596,8 @@ static int qgroup_update_counters(struct btrfs_fs_info *fs_info,
cur_old_count = btrfs_qgroup_get_old_refcnt(qg, seq); cur_old_count = btrfs_qgroup_get_old_refcnt(qg, seq);
cur_new_count = btrfs_qgroup_get_new_refcnt(qg, seq); cur_new_count = btrfs_qgroup_get_new_refcnt(qg, seq);
trace_qgroup_update_counters(qg->qgroupid, cur_old_count, trace_qgroup_update_counters(fs_info, qg->qgroupid,
cur_new_count); cur_old_count, cur_new_count);
/* Rfer update part */ /* Rfer update part */
if (cur_old_count == 0 && cur_new_count > 0) { if (cur_old_count == 0 && cur_new_count > 0) {
...@@ -1687,8 +1688,8 @@ btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, ...@@ -1687,8 +1688,8 @@ btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans,
goto out_free; goto out_free;
BUG_ON(!fs_info->quota_root); BUG_ON(!fs_info->quota_root);
trace_btrfs_qgroup_account_extent(bytenr, num_bytes, nr_old_roots, trace_btrfs_qgroup_account_extent(fs_info, bytenr, num_bytes,
nr_new_roots); nr_old_roots, nr_new_roots);
qgroups = ulist_alloc(GFP_NOFS); qgroups = ulist_alloc(GFP_NOFS);
if (!qgroups) { if (!qgroups) {
...@@ -1759,7 +1760,7 @@ int btrfs_qgroup_account_extents(struct btrfs_trans_handle *trans, ...@@ -1759,7 +1760,7 @@ int btrfs_qgroup_account_extents(struct btrfs_trans_handle *trans,
record = rb_entry(node, struct btrfs_qgroup_extent_record, record = rb_entry(node, struct btrfs_qgroup_extent_record,
node); node);
trace_btrfs_qgroup_account_extents(record); trace_btrfs_qgroup_account_extents(fs_info, record);
if (!ret) { if (!ret) {
/* /*
......
...@@ -63,9 +63,10 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info); ...@@ -63,9 +63,10 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info);
struct btrfs_delayed_extent_op; struct btrfs_delayed_extent_op;
int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans, int btrfs_qgroup_prepare_account_extents(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info); struct btrfs_fs_info *fs_info);
struct btrfs_qgroup_extent_record struct btrfs_qgroup_extent_record *
*btrfs_qgroup_insert_dirty_extent(struct btrfs_delayed_ref_root *delayed_refs, btrfs_qgroup_insert_dirty_extent(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup_extent_record *record); struct btrfs_delayed_ref_root *delayed_refs,
struct btrfs_qgroup_extent_record *record);
int int
btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, struct btrfs_fs_info *fs_info,
...@@ -88,7 +89,7 @@ static inline void btrfs_qgroup_free_delayed_ref(struct btrfs_fs_info *fs_info, ...@@ -88,7 +89,7 @@ static inline void btrfs_qgroup_free_delayed_ref(struct btrfs_fs_info *fs_info,
u64 ref_root, u64 num_bytes) u64 ref_root, u64 num_bytes)
{ {
btrfs_qgroup_free_refroot(fs_info, ref_root, num_bytes); btrfs_qgroup_free_refroot(fs_info, ref_root, num_bytes);
trace_btrfs_qgroup_free_delayed_ref(ref_root, num_bytes); trace_btrfs_qgroup_free_delayed_ref(fs_info, ref_root, num_bytes);
} }
void assert_qgroups_uptodate(struct btrfs_trans_handle *trans); void assert_qgroups_uptodate(struct btrfs_trans_handle *trans);
......
...@@ -1171,7 +1171,7 @@ int btrfs_sync_fs(struct super_block *sb, int wait) ...@@ -1171,7 +1171,7 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
struct btrfs_fs_info *fs_info = btrfs_sb(sb); struct btrfs_fs_info *fs_info = btrfs_sb(sb);
struct btrfs_root *root = fs_info->tree_root; struct btrfs_root *root = fs_info->tree_root;
trace_btrfs_sync_fs(wait); trace_btrfs_sync_fs(fs_info, wait);
if (!wait) { if (!wait) {
filemap_flush(fs_info->btree_inode->i_mapping); filemap_flush(fs_info->btree_inode->i_mapping);
......
This diff is collapsed.
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