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: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Jeff Mahoney 2016-06-09 17:27:55 -04:00 committed by David Sterba
parent cb001095ca
commit bc074524e1
6 changed files with 186 additions and 158 deletions

View File

@ -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,
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,
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,
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);

View File

@ -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,
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,
*/ */
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,
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);

View File

@ -1453,8 +1453,9 @@ 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_delayed_ref_root *delayed_refs,
struct btrfs_qgroup_extent_record *record) 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;
@ -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,
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,
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,
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) {
/* /*

View File

@ -63,8 +63,9 @@ 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_delayed_ref_root *delayed_refs,
struct btrfs_qgroup_extent_record *record); 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,
@ -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);

View File

@ -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);

View File

@ -66,6 +66,21 @@ struct btrfs_qgroup_extent_record;
{ BTRFS_BLOCK_GROUP_RAID6, "RAID6"} { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
#define BTRFS_UUID_SIZE 16 #define BTRFS_UUID_SIZE 16
#define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_UUID_SIZE)
#define TP_fast_assign_fsid(fs_info) \
memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE)
#define TP_STRUCT__entry_btrfs(args...) \
TP_STRUCT__entry( \
TP_STRUCT__entry_fsid \
args)
#define TP_fast_assign_btrfs(fs_info, args...) \
TP_fast_assign( \
TP_fast_assign_fsid(fs_info); \
args)
#define TP_printk_btrfs(fmt, args...) \
TP_printk("%pU: " fmt, __entry->fsid, args)
TRACE_EVENT(btrfs_transaction_commit, TRACE_EVENT(btrfs_transaction_commit,
@ -73,17 +88,17 @@ TRACE_EVENT(btrfs_transaction_commit,
TP_ARGS(root), TP_ARGS(root),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, generation ) __field( u64, generation )
__field( u64, root_objectid ) __field( u64, root_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
__entry->generation = root->fs_info->generation; __entry->generation = root->fs_info->generation;
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), gen = %llu", TP_printk_btrfs("root = %llu(%s), gen = %llu",
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
(unsigned long long)__entry->generation) (unsigned long long)__entry->generation)
); );
@ -94,7 +109,7 @@ DECLARE_EVENT_CLASS(btrfs__inode,
TP_ARGS(inode), TP_ARGS(inode),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( ino_t, ino ) __field( ino_t, ino )
__field( blkcnt_t, blocks ) __field( blkcnt_t, blocks )
__field( u64, disk_i_size ) __field( u64, disk_i_size )
@ -104,7 +119,7 @@ DECLARE_EVENT_CLASS(btrfs__inode,
__field( u64, root_objectid ) __field( u64, root_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
__entry->ino = inode->i_ino; __entry->ino = inode->i_ino;
__entry->blocks = inode->i_blocks; __entry->blocks = inode->i_blocks;
__entry->disk_i_size = BTRFS_I(inode)->disk_i_size; __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
@ -115,7 +130,7 @@ DECLARE_EVENT_CLASS(btrfs__inode,
BTRFS_I(inode)->root->root_key.objectid; BTRFS_I(inode)->root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " TP_printk_btrfs("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
"disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
(unsigned long long)__entry->generation, (unsigned long long)__entry->generation,
@ -175,7 +190,7 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
TP_CONDITION(map), TP_CONDITION(map),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, root_objectid ) __field( u64, root_objectid )
__field( u64, start ) __field( u64, start )
__field( u64, len ) __field( u64, len )
@ -187,7 +202,7 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
__field( unsigned int, compress_type ) __field( unsigned int, compress_type )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
__entry->start = map->start; __entry->start = map->start;
__entry->len = map->len; __entry->len = map->len;
@ -199,7 +214,7 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
__entry->compress_type = map->compress_type; __entry->compress_type = map->compress_type;
), ),
TP_printk("root = %llu(%s), start = %llu, len = %llu, " TP_printk_btrfs("root = %llu(%s), start = %llu, len = %llu, "
"orig_start = %llu, block_start = %llu(%s), " "orig_start = %llu, block_start = %llu(%s), "
"block_len = %llu, flags = %s, refs = %u, " "block_len = %llu, flags = %s, refs = %u, "
"compress_type = %u", "compress_type = %u",
@ -233,7 +248,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent,
TP_ARGS(inode, ordered), TP_ARGS(inode, ordered),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( ino_t, ino ) __field( ino_t, ino )
__field( u64, file_offset ) __field( u64, file_offset )
__field( u64, start ) __field( u64, start )
@ -246,7 +261,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent,
__field( u64, root_objectid ) __field( u64, root_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
__entry->ino = inode->i_ino; __entry->ino = inode->i_ino;
__entry->file_offset = ordered->file_offset; __entry->file_offset = ordered->file_offset;
__entry->start = ordered->start; __entry->start = ordered->start;
@ -260,7 +275,7 @@ DECLARE_EVENT_CLASS(btrfs__ordered_extent,
BTRFS_I(inode)->root->root_key.objectid; BTRFS_I(inode)->root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " TP_printk_btrfs("root = %llu(%s), ino = %llu, file_offset = %llu, "
"start = %llu, len = %llu, disk_len = %llu, " "start = %llu, len = %llu, disk_len = %llu, "
"bytes_left = %llu, flags = %s, compress_type = %d, " "bytes_left = %llu, flags = %s, compress_type = %d, "
"refs = %d", "refs = %d",
@ -310,7 +325,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
TP_ARGS(page, inode, wbc), TP_ARGS(page, inode, wbc),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( ino_t, ino ) __field( ino_t, ino )
__field( pgoff_t, index ) __field( pgoff_t, index )
__field( long, nr_to_write ) __field( long, nr_to_write )
@ -324,7 +339,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
__field( u64, root_objectid ) __field( u64, root_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
__entry->ino = inode->i_ino; __entry->ino = inode->i_ino;
__entry->index = page->index; __entry->index = page->index;
__entry->nr_to_write = wbc->nr_to_write; __entry->nr_to_write = wbc->nr_to_write;
@ -339,7 +354,7 @@ DECLARE_EVENT_CLASS(btrfs__writepage,
BTRFS_I(inode)->root->root_key.objectid; BTRFS_I(inode)->root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " TP_printk_btrfs("root = %llu(%s), ino = %lu, page_index = %lu, "
"nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
"range_end = %llu, for_kupdate = %d, " "range_end = %llu, for_kupdate = %d, "
"for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
@ -366,7 +381,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook,
TP_ARGS(page, start, end, uptodate), TP_ARGS(page, start, end, uptodate),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( ino_t, ino ) __field( ino_t, ino )
__field( pgoff_t, index ) __field( pgoff_t, index )
__field( u64, start ) __field( u64, start )
@ -375,7 +390,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook,
__field( u64, root_objectid ) __field( u64, root_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb),
__entry->ino = page->mapping->host->i_ino; __entry->ino = page->mapping->host->i_ino;
__entry->index = page->index; __entry->index = page->index;
__entry->start = start; __entry->start = start;
@ -385,7 +400,7 @@ TRACE_EVENT(btrfs_writepage_end_io_hook,
BTRFS_I(page->mapping->host)->root->root_key.objectid; BTRFS_I(page->mapping->host)->root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " TP_printk_btrfs("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
"end = %llu, uptodate = %d", "end = %llu, uptodate = %d",
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
(unsigned long)__entry->ino, (unsigned long)__entry->index, (unsigned long)__entry->ino, (unsigned long)__entry->index,
@ -399,7 +414,7 @@ TRACE_EVENT(btrfs_sync_file,
TP_ARGS(file, datasync), TP_ARGS(file, datasync),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( ino_t, ino ) __field( ino_t, ino )
__field( ino_t, parent ) __field( ino_t, parent )
__field( int, datasync ) __field( int, datasync )
@ -410,6 +425,7 @@ TRACE_EVENT(btrfs_sync_file,
struct dentry *dentry = file->f_path.dentry; struct dentry *dentry = file->f_path.dentry;
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb));
__entry->ino = inode->i_ino; __entry->ino = inode->i_ino;
__entry->parent = d_inode(dentry->d_parent)->i_ino; __entry->parent = d_inode(dentry->d_parent)->i_ino;
__entry->datasync = datasync; __entry->datasync = datasync;
@ -417,7 +433,7 @@ TRACE_EVENT(btrfs_sync_file,
BTRFS_I(inode)->root->root_key.objectid; BTRFS_I(inode)->root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", TP_printk_btrfs("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
(unsigned long)__entry->ino, (unsigned long)__entry->parent, (unsigned long)__entry->ino, (unsigned long)__entry->parent,
__entry->datasync) __entry->datasync)
@ -425,19 +441,19 @@ TRACE_EVENT(btrfs_sync_file,
TRACE_EVENT(btrfs_sync_fs, TRACE_EVENT(btrfs_sync_fs,
TP_PROTO(int wait), TP_PROTO(struct btrfs_fs_info *fs_info, int wait),
TP_ARGS(wait), TP_ARGS(fs_info, wait),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( int, wait ) __field( int, wait )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->wait = wait; __entry->wait = wait;
), ),
TP_printk("wait = %d", __entry->wait) TP_printk_btrfs("wait = %d", __entry->wait)
); );
TRACE_EVENT(btrfs_add_block_group, TRACE_EVENT(btrfs_add_block_group,
@ -490,13 +506,14 @@ TRACE_EVENT(btrfs_add_block_group,
DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_tree_ref *full_ref, struct btrfs_delayed_tree_ref *full_ref,
int action), int action),
TP_ARGS(ref, full_ref, action), TP_ARGS(fs_info, ref, full_ref, action),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bytenr ) __field( u64, bytenr )
__field( u64, num_bytes ) __field( u64, num_bytes )
__field( int, action ) __field( int, action )
@ -507,7 +524,7 @@ DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
__field( u64, seq ) __field( u64, seq )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->bytenr = ref->bytenr; __entry->bytenr = ref->bytenr;
__entry->num_bytes = ref->num_bytes; __entry->num_bytes = ref->num_bytes;
__entry->action = action; __entry->action = action;
@ -518,7 +535,7 @@ DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
__entry->seq = ref->seq; __entry->seq = ref->seq;
), ),
TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " TP_printk_btrfs("bytenr = %llu, num_bytes = %llu, action = %s, "
"parent = %llu(%s), ref_root = %llu(%s), level = %d, " "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
"type = %s, seq = %llu", "type = %s, seq = %llu",
(unsigned long long)__entry->bytenr, (unsigned long long)__entry->bytenr,
@ -532,31 +549,34 @@ DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref,
DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_tree_ref *full_ref, struct btrfs_delayed_tree_ref *full_ref,
int action), int action),
TP_ARGS(ref, full_ref, action) TP_ARGS(fs_info, ref, full_ref, action)
); );
DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_tree_ref *full_ref, struct btrfs_delayed_tree_ref *full_ref,
int action), int action),
TP_ARGS(ref, full_ref, action) TP_ARGS(fs_info, ref, full_ref, action)
); );
DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_data_ref *full_ref, struct btrfs_delayed_data_ref *full_ref,
int action), int action),
TP_ARGS(ref, full_ref, action), TP_ARGS(fs_info, ref, full_ref, action),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bytenr ) __field( u64, bytenr )
__field( u64, num_bytes ) __field( u64, num_bytes )
__field( int, action ) __field( int, action )
@ -568,7 +588,7 @@ DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
__field( u64, seq ) __field( u64, seq )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->bytenr = ref->bytenr; __entry->bytenr = ref->bytenr;
__entry->num_bytes = ref->num_bytes; __entry->num_bytes = ref->num_bytes;
__entry->action = action; __entry->action = action;
@ -580,7 +600,7 @@ DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
__entry->seq = ref->seq; __entry->seq = ref->seq;
), ),
TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " TP_printk_btrfs("bytenr = %llu, num_bytes = %llu, action = %s, "
"parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
"offset = %llu, type = %s, seq = %llu", "offset = %llu, type = %s, seq = %llu",
(unsigned long long)__entry->bytenr, (unsigned long long)__entry->bytenr,
@ -596,45 +616,48 @@ DECLARE_EVENT_CLASS(btrfs_delayed_data_ref,
DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_data_ref *full_ref, struct btrfs_delayed_data_ref *full_ref,
int action), int action),
TP_ARGS(ref, full_ref, action) TP_ARGS(fs_info, ref, full_ref, action)
); );
DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_data_ref *full_ref, struct btrfs_delayed_data_ref *full_ref,
int action), int action),
TP_ARGS(ref, full_ref, action) TP_ARGS(fs_info, ref, full_ref, action)
); );
DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_ref_head *head_ref, struct btrfs_delayed_ref_head *head_ref,
int action), int action),
TP_ARGS(ref, head_ref, action), TP_ARGS(fs_info, ref, head_ref, action),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bytenr ) __field( u64, bytenr )
__field( u64, num_bytes ) __field( u64, num_bytes )
__field( int, action ) __field( int, action )
__field( int, is_data ) __field( int, is_data )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->bytenr = ref->bytenr; __entry->bytenr = ref->bytenr;
__entry->num_bytes = ref->num_bytes; __entry->num_bytes = ref->num_bytes;
__entry->action = action; __entry->action = action;
__entry->is_data = head_ref->is_data; __entry->is_data = head_ref->is_data;
), ),
TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", TP_printk_btrfs("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
(unsigned long long)__entry->bytenr, (unsigned long long)__entry->bytenr,
(unsigned long long)__entry->num_bytes, (unsigned long long)__entry->num_bytes,
show_ref_action(__entry->action), show_ref_action(__entry->action),
@ -643,20 +666,22 @@ DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,
DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_ref_head *head_ref, struct btrfs_delayed_ref_head *head_ref,
int action), int action),
TP_ARGS(ref, head_ref, action) TP_ARGS(fs_info, ref, head_ref, action)
); );
DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head,
TP_PROTO(struct btrfs_delayed_ref_node *ref, TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_delayed_ref_node *ref,
struct btrfs_delayed_ref_head *head_ref, struct btrfs_delayed_ref_head *head_ref,
int action), int action),
TP_ARGS(ref, head_ref, action) TP_ARGS(fs_info, ref, head_ref, action)
); );
#define show_chunk_type(type) \ #define show_chunk_type(type) \
@ -678,7 +703,7 @@ DECLARE_EVENT_CLASS(btrfs__chunk,
TP_ARGS(root, map, offset, size), TP_ARGS(root, map, offset, size),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( int, num_stripes ) __field( int, num_stripes )
__field( u64, type ) __field( u64, type )
__field( int, sub_stripes ) __field( int, sub_stripes )
@ -687,7 +712,7 @@ DECLARE_EVENT_CLASS(btrfs__chunk,
__field( u64, root_objectid ) __field( u64, root_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
__entry->num_stripes = map->num_stripes; __entry->num_stripes = map->num_stripes;
__entry->type = map->type; __entry->type = map->type;
__entry->sub_stripes = map->sub_stripes; __entry->sub_stripes = map->sub_stripes;
@ -696,7 +721,7 @@ DECLARE_EVENT_CLASS(btrfs__chunk,
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
), ),
TP_printk("root = %llu(%s), offset = %llu, size = %llu, " TP_printk_btrfs("root = %llu(%s), offset = %llu, size = %llu, "
"num_stripes = %d, sub_stripes = %d, type = %s", "num_stripes = %d, sub_stripes = %d, type = %s",
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
(unsigned long long)__entry->offset, (unsigned long long)__entry->offset,
@ -728,7 +753,7 @@ TRACE_EVENT(btrfs_cow_block,
TP_ARGS(root, buf, cow), TP_ARGS(root, buf, cow),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, root_objectid ) __field( u64, root_objectid )
__field( u64, buf_start ) __field( u64, buf_start )
__field( int, refs ) __field( int, refs )
@ -737,7 +762,7 @@ TRACE_EVENT(btrfs_cow_block,
__field( int, cow_level ) __field( int, cow_level )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
__entry->buf_start = buf->start; __entry->buf_start = buf->start;
__entry->refs = atomic_read(&buf->refs); __entry->refs = atomic_read(&buf->refs);
@ -746,7 +771,7 @@ TRACE_EVENT(btrfs_cow_block,
__entry->cow_level = btrfs_header_level(cow); __entry->cow_level = btrfs_header_level(cow);
), ),
TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " TP_printk_btrfs("root = %llu(%s), refs = %d, orig_buf = %llu "
"(orig_level = %d), cow_buf = %llu (cow_level = %d)", "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
__entry->refs, __entry->refs,
@ -763,24 +788,22 @@ TRACE_EVENT(btrfs_space_reservation,
TP_ARGS(fs_info, type, val, bytes, reserve), TP_ARGS(fs_info, type, val, bytes, reserve),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__array( u8, fsid, BTRFS_UUID_SIZE )
__string( type, type ) __string( type, type )
__field( u64, val ) __field( u64, val )
__field( u64, bytes ) __field( u64, bytes )
__field( int, reserve ) __field( int, reserve )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
__assign_str(type, type); __assign_str(type, type);
__entry->val = val; __entry->val = val;
__entry->bytes = bytes; __entry->bytes = bytes;
__entry->reserve = reserve; __entry->reserve = reserve;
), ),
TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val,
__entry->val, __entry->reserve ? "reserve" : "release", __entry->reserve ? "reserve" : "release",
__entry->bytes) __entry->bytes)
); );
@ -872,22 +895,19 @@ DECLARE_EVENT_CLASS(btrfs__reserved_extent,
TP_ARGS(root, start, len), TP_ARGS(root, start, len),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__array( u8, fsid, BTRFS_UUID_SIZE )
__field( u64, root_objectid ) __field( u64, root_objectid )
__field( u64, start ) __field( u64, start )
__field( u64, len ) __field( u64, len )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
memcpy(__entry->fsid, root->fs_info->fsid, BTRFS_UUID_SIZE);
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
__entry->start = start; __entry->start = start;
__entry->len = len; __entry->len = len;
), ),
TP_printk("%pU: root = %llu(%s), start = %llu, len = %llu", TP_printk_btrfs("root = %llu(%s), start = %llu, len = %llu",
__entry->fsid,
show_root_type(__entry->root_objectid), show_root_type(__entry->root_objectid),
(unsigned long long)__entry->start, (unsigned long long)__entry->start,
(unsigned long long)__entry->len) (unsigned long long)__entry->len)
@ -914,21 +934,21 @@ TRACE_EVENT(find_free_extent,
TP_ARGS(root, num_bytes, empty_size, data), TP_ARGS(root, num_bytes, empty_size, data),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, root_objectid ) __field( u64, root_objectid )
__field( u64, num_bytes ) __field( u64, num_bytes )
__field( u64, empty_size ) __field( u64, empty_size )
__field( u64, data ) __field( u64, data )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
__entry->num_bytes = num_bytes; __entry->num_bytes = num_bytes;
__entry->empty_size = empty_size; __entry->empty_size = empty_size;
__entry->data = data; __entry->data = data;
), ),
TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " TP_printk_btrfs("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
"flags = %Lu(%s)", show_root_type(__entry->root_objectid), "flags = %Lu(%s)", show_root_type(__entry->root_objectid),
__entry->num_bytes, __entry->empty_size, __entry->data, __entry->num_bytes, __entry->empty_size, __entry->data,
__print_flags((unsigned long)__entry->data, "|", __print_flags((unsigned long)__entry->data, "|",
@ -943,8 +963,7 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent,
TP_ARGS(root, block_group, start, len), TP_ARGS(root, block_group, start, len),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__array( u8, fsid, BTRFS_UUID_SIZE )
__field( u64, root_objectid ) __field( u64, root_objectid )
__field( u64, bg_objectid ) __field( u64, bg_objectid )
__field( u64, flags ) __field( u64, flags )
@ -952,8 +971,7 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent,
__field( u64, len ) __field( u64, len )
), ),
TP_fast_assign( TP_fast_assign_btrfs(root->fs_info,
memcpy(__entry->fsid, root->fs_info->fsid, BTRFS_UUID_SIZE);
__entry->root_objectid = root->root_key.objectid; __entry->root_objectid = root->root_key.objectid;
__entry->bg_objectid = block_group->key.objectid; __entry->bg_objectid = block_group->key.objectid;
__entry->flags = block_group->flags; __entry->flags = block_group->flags;
@ -961,8 +979,8 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent,
__entry->len = len; __entry->len = len;
), ),
TP_printk("%pU: root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " TP_printk_btrfs("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
"start = %Lu, len = %Lu", __entry->fsid, "start = %Lu, len = %Lu",
show_root_type(__entry->root_objectid), __entry->bg_objectid, show_root_type(__entry->root_objectid), __entry->bg_objectid,
__entry->flags, __print_flags((unsigned long)__entry->flags, __entry->flags, __print_flags((unsigned long)__entry->flags,
"|", BTRFS_GROUP_FLAGS), "|", BTRFS_GROUP_FLAGS),
@ -994,7 +1012,7 @@ TRACE_EVENT(btrfs_find_cluster,
TP_ARGS(block_group, start, bytes, empty_size, min_bytes), TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bg_objectid ) __field( u64, bg_objectid )
__field( u64, flags ) __field( u64, flags )
__field( u64, start ) __field( u64, start )
@ -1003,7 +1021,7 @@ TRACE_EVENT(btrfs_find_cluster,
__field( u64, min_bytes ) __field( u64, min_bytes )
), ),
TP_fast_assign( TP_fast_assign_btrfs(block_group->fs_info,
__entry->bg_objectid = block_group->key.objectid; __entry->bg_objectid = block_group->key.objectid;
__entry->flags = block_group->flags; __entry->flags = block_group->flags;
__entry->start = start; __entry->start = start;
@ -1012,7 +1030,7 @@ TRACE_EVENT(btrfs_find_cluster,
__entry->min_bytes = min_bytes; __entry->min_bytes = min_bytes;
), ),
TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," TP_printk_btrfs("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
" empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid,
__entry->flags, __entry->flags,
__print_flags((unsigned long)__entry->flags, "|", __print_flags((unsigned long)__entry->flags, "|",
@ -1026,15 +1044,15 @@ TRACE_EVENT(btrfs_failed_cluster_setup,
TP_ARGS(block_group), TP_ARGS(block_group),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bg_objectid ) __field( u64, bg_objectid )
), ),
TP_fast_assign( TP_fast_assign_btrfs(block_group->fs_info,
__entry->bg_objectid = block_group->key.objectid; __entry->bg_objectid = block_group->key.objectid;
), ),
TP_printk("block_group = %Lu", __entry->bg_objectid) TP_printk_btrfs("block_group = %Lu", __entry->bg_objectid)
); );
TRACE_EVENT(btrfs_setup_cluster, TRACE_EVENT(btrfs_setup_cluster,
@ -1044,7 +1062,7 @@ TRACE_EVENT(btrfs_setup_cluster,
TP_ARGS(block_group, cluster, size, bitmap), TP_ARGS(block_group, cluster, size, bitmap),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bg_objectid ) __field( u64, bg_objectid )
__field( u64, flags ) __field( u64, flags )
__field( u64, start ) __field( u64, start )
@ -1053,7 +1071,7 @@ TRACE_EVENT(btrfs_setup_cluster,
__field( int, bitmap ) __field( int, bitmap )
), ),
TP_fast_assign( TP_fast_assign_btrfs(block_group->fs_info,
__entry->bg_objectid = block_group->key.objectid; __entry->bg_objectid = block_group->key.objectid;
__entry->flags = block_group->flags; __entry->flags = block_group->flags;
__entry->start = cluster->window_start; __entry->start = cluster->window_start;
@ -1062,7 +1080,7 @@ TRACE_EVENT(btrfs_setup_cluster,
__entry->bitmap = bitmap; __entry->bitmap = bitmap;
), ),
TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " TP_printk_btrfs("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
"size = %Lu, max_size = %Lu, bitmap = %d", "size = %Lu, max_size = %Lu, bitmap = %d",
__entry->bg_objectid, __entry->bg_objectid,
__entry->flags, __entry->flags,
@ -1120,7 +1138,7 @@ DECLARE_EVENT_CLASS(btrfs__work,
TP_ARGS(work), TP_ARGS(work),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( void *, work ) __field( void *, work )
__field( void *, wq ) __field( void *, wq )
__field( void *, func ) __field( void *, func )
@ -1129,7 +1147,7 @@ DECLARE_EVENT_CLASS(btrfs__work,
__field( void *, normal_work ) __field( void *, normal_work )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_work_owner(work),
__entry->work = work; __entry->work = work;
__entry->wq = work->wq; __entry->wq = work->wq;
__entry->func = work->func; __entry->func = work->func;
@ -1138,7 +1156,7 @@ DECLARE_EVENT_CLASS(btrfs__work,
__entry->normal_work = &work->normal_work; __entry->normal_work = &work->normal_work;
), ),
TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p," TP_printk_btrfs("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p,"
" ordered_free=%p", " ordered_free=%p",
__entry->work, __entry->normal_work, __entry->wq, __entry->work, __entry->normal_work, __entry->wq,
__entry->func, __entry->ordered_func, __entry->ordered_free) __entry->func, __entry->ordered_func, __entry->ordered_free)
@ -1151,15 +1169,15 @@ DECLARE_EVENT_CLASS(btrfs__work__done,
TP_ARGS(work), TP_ARGS(work),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( void *, work ) __field( void *, work )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_work_owner(work),
__entry->work = work; __entry->work = work;
), ),
TP_printk("work->%p", __entry->work) TP_printk_btrfs("work->%p", __entry->work)
); );
DEFINE_EVENT(btrfs__work, btrfs_work_queued, DEFINE_EVENT(btrfs__work, btrfs_work_queued,
@ -1196,19 +1214,19 @@ DECLARE_EVENT_CLASS(btrfs__workqueue,
TP_ARGS(wq, name, high), TP_ARGS(wq, name, high),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( void *, wq ) __field( void *, wq )
__string( name, name ) __string( name, name )
__field( int , high ) __field( int , high )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
__entry->wq = wq; __entry->wq = wq;
__assign_str(name, name); __assign_str(name, name);
__entry->high = high; __entry->high = high;
), ),
TP_printk("name=%s%s, wq=%p", __get_str(name), TP_printk_btrfs("name=%s%s, wq=%p", __get_str(name),
__print_flags(__entry->high, "", __print_flags(__entry->high, "",
{(WQ_HIGHPRI), "-high"}), {(WQ_HIGHPRI), "-high"}),
__entry->wq) __entry->wq)
@ -1227,15 +1245,15 @@ DECLARE_EVENT_CLASS(btrfs__workqueue_done,
TP_ARGS(wq), TP_ARGS(wq),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( void *, wq ) __field( void *, wq )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_workqueue_owner(wq),
__entry->wq = wq; __entry->wq = wq;
), ),
TP_printk("wq=%p", __entry->wq) TP_printk_btrfs("wq=%p", __entry->wq)
); );
DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
@ -1251,19 +1269,19 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_data_map,
TP_ARGS(inode, free_reserved), TP_ARGS(inode, free_reserved),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, rootid ) __field( u64, rootid )
__field( unsigned long, ino ) __field( unsigned long, ino )
__field( u64, free_reserved ) __field( u64, free_reserved )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
__entry->rootid = BTRFS_I(inode)->root->objectid; __entry->rootid = BTRFS_I(inode)->root->objectid;
__entry->ino = inode->i_ino; __entry->ino = inode->i_ino;
__entry->free_reserved = free_reserved; __entry->free_reserved = free_reserved;
), ),
TP_printk("rootid=%llu, ino=%lu, free_reserved=%llu", TP_printk_btrfs("rootid=%llu, ino=%lu, free_reserved=%llu",
__entry->rootid, __entry->ino, __entry->free_reserved) __entry->rootid, __entry->ino, __entry->free_reserved)
); );
@ -1292,7 +1310,7 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
TP_ARGS(inode, start, len, reserved, op), TP_ARGS(inode, start, len, reserved, op),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, rootid ) __field( u64, rootid )
__field( unsigned long, ino ) __field( unsigned long, ino )
__field( u64, start ) __field( u64, start )
@ -1301,7 +1319,7 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
__field( int, op ) __field( int, op )
), ),
TP_fast_assign( TP_fast_assign_btrfs(btrfs_sb(inode->i_sb),
__entry->rootid = BTRFS_I(inode)->root->objectid; __entry->rootid = BTRFS_I(inode)->root->objectid;
__entry->ino = inode->i_ino; __entry->ino = inode->i_ino;
__entry->start = start; __entry->start = start;
@ -1310,7 +1328,7 @@ DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data,
__entry->op = op; __entry->op = op;
), ),
TP_printk("root=%llu, ino=%lu, start=%llu, len=%llu, reserved=%llu, op=%s", TP_printk_btrfs("root=%llu, ino=%lu, start=%llu, len=%llu, reserved=%llu, op=%s",
__entry->rootid, __entry->ino, __entry->start, __entry->len, __entry->rootid, __entry->ino, __entry->start, __entry->len,
__entry->reserved, __entry->reserved,
__print_flags((unsigned long)__entry->op, "", __print_flags((unsigned long)__entry->op, "",
@ -1334,86 +1352,90 @@ DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data,
DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref,
TP_PROTO(u64 ref_root, u64 reserved), TP_PROTO(struct btrfs_fs_info *fs_info, u64 ref_root, u64 reserved),
TP_ARGS(ref_root, reserved), TP_ARGS(fs_info, ref_root, reserved),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, ref_root ) __field( u64, ref_root )
__field( u64, reserved ) __field( u64, reserved )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->ref_root = ref_root; __entry->ref_root = ref_root;
__entry->reserved = reserved; __entry->reserved = reserved;
), ),
TP_printk("root=%llu, reserved=%llu, op=free", TP_printk_btrfs("root=%llu, reserved=%llu, op=free",
__entry->ref_root, __entry->reserved) __entry->ref_root, __entry->reserved)
); );
DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref,
TP_PROTO(u64 ref_root, u64 reserved), TP_PROTO(struct btrfs_fs_info *fs_info, u64 ref_root, u64 reserved),
TP_ARGS(ref_root, reserved) TP_ARGS(fs_info, ref_root, reserved)
); );
DECLARE_EVENT_CLASS(btrfs_qgroup_extent, DECLARE_EVENT_CLASS(btrfs_qgroup_extent,
TP_PROTO(struct btrfs_qgroup_extent_record *rec), TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup_extent_record *rec),
TP_ARGS(rec), TP_ARGS(fs_info, rec),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bytenr ) __field( u64, bytenr )
__field( u64, num_bytes ) __field( u64, num_bytes )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->bytenr = rec->bytenr, __entry->bytenr = rec->bytenr,
__entry->num_bytes = rec->num_bytes; __entry->num_bytes = rec->num_bytes;
), ),
TP_printk("bytenr = %llu, num_bytes = %llu", TP_printk_btrfs("bytenr = %llu, num_bytes = %llu",
(unsigned long long)__entry->bytenr, (unsigned long long)__entry->bytenr,
(unsigned long long)__entry->num_bytes) (unsigned long long)__entry->num_bytes)
); );
DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents,
TP_PROTO(struct btrfs_qgroup_extent_record *rec), TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup_extent_record *rec),
TP_ARGS(rec) TP_ARGS(fs_info, rec)
); );
DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_insert_dirty_extent, DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_insert_dirty_extent,
TP_PROTO(struct btrfs_qgroup_extent_record *rec), TP_PROTO(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup_extent_record *rec),
TP_ARGS(rec) TP_ARGS(fs_info, rec)
); );
TRACE_EVENT(btrfs_qgroup_account_extent, TRACE_EVENT(btrfs_qgroup_account_extent,
TP_PROTO(u64 bytenr, u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), TP_PROTO(struct btrfs_fs_info *fs_info, u64 bytenr,
u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots),
TP_ARGS(bytenr, num_bytes, nr_old_roots, nr_new_roots), TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, bytenr ) __field( u64, bytenr )
__field( u64, num_bytes ) __field( u64, num_bytes )
__field( u64, nr_old_roots ) __field( u64, nr_old_roots )
__field( u64, nr_new_roots ) __field( u64, nr_new_roots )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->bytenr = bytenr; __entry->bytenr = bytenr;
__entry->num_bytes = num_bytes; __entry->num_bytes = num_bytes;
__entry->nr_old_roots = nr_old_roots; __entry->nr_old_roots = nr_old_roots;
__entry->nr_new_roots = nr_new_roots; __entry->nr_new_roots = nr_new_roots;
), ),
TP_printk("bytenr = %llu, num_bytes = %llu, nr_old_roots = %llu, " TP_printk_btrfs("bytenr = %llu, num_bytes = %llu, nr_old_roots = %llu, "
"nr_new_roots = %llu", "nr_new_roots = %llu",
__entry->bytenr, __entry->bytenr,
__entry->num_bytes, __entry->num_bytes,
@ -1423,23 +1445,24 @@ TRACE_EVENT(btrfs_qgroup_account_extent,
TRACE_EVENT(qgroup_update_counters, TRACE_EVENT(qgroup_update_counters,
TP_PROTO(u64 qgid, u64 cur_old_count, u64 cur_new_count), TP_PROTO(struct btrfs_fs_info *fs_info, u64 qgid,
u64 cur_old_count, u64 cur_new_count),
TP_ARGS(qgid, cur_old_count, cur_new_count), TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, qgid ) __field( u64, qgid )
__field( u64, cur_old_count ) __field( u64, cur_old_count )
__field( u64, cur_new_count ) __field( u64, cur_new_count )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->qgid = qgid; __entry->qgid = qgid;
__entry->cur_old_count = cur_old_count; __entry->cur_old_count = cur_old_count;
__entry->cur_new_count = cur_new_count; __entry->cur_new_count = cur_new_count;
), ),
TP_printk("qgid = %llu, cur_old_count = %llu, cur_new_count = %llu", TP_printk_btrfs("qgid = %llu, cur_old_count = %llu, cur_new_count = %llu",
__entry->qgid, __entry->qgid,
__entry->cur_old_count, __entry->cur_old_count,
__entry->cur_new_count) __entry->cur_new_count)