Skip to content

Commit 71ff643

Browse files
jeffmahoneykdave
authored andcommitted
btrfs: convert extent-tree tracepoints to use fs_info
The extent-tree tracepoints all operate on the extent root, regardless of which root is passed in. Let's just use the extent root objectid instead. If it turns out that nobody is depending on the format of this tracepoint, we can drop the root printing entirely. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent ccdf9b3 commit 71ff643

2 files changed

Lines changed: 30 additions & 36 deletions

File tree

‎fs/btrfs/extent-tree.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7244,7 +7244,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
72447244
btrfs_add_free_space(cache, buf->start, buf->len);
72457245
btrfs_free_reserved_bytes(cache, buf->len, 0);
72467246
btrfs_put_block_group(cache);
7247-
trace_btrfs_reserved_extent_free(root, buf->start, buf->len);
7247+
trace_btrfs_reserved_extent_free(fs_info, buf->start, buf->len);
72487248
pin = 0;
72497249
}
72507250
out:
@@ -7493,7 +7493,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
74937493
ins->objectid = 0;
74947494
ins->offset = 0;
74957495

7496-
trace_find_free_extent(orig_root, num_bytes, empty_size, flags);
7496+
trace_find_free_extent(fs_info, num_bytes, empty_size, flags);
74977497

74987498
space_info = __find_space_info(fs_info, flags);
74997499
if (!space_info) {
@@ -7652,7 +7652,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
76527652
if (offset) {
76537653
/* we have a block, we're done */
76547654
spin_unlock(&last_ptr->refill_lock);
7655-
trace_btrfs_reserve_extent_cluster(root,
7655+
trace_btrfs_reserve_extent_cluster(fs_info,
76567656
used_block_group,
76577657
search_start, num_bytes);
76587658
if (used_block_group != block_group) {
@@ -7725,7 +7725,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
77257725
if (offset) {
77267726
/* we found one, proceed */
77277727
spin_unlock(&last_ptr->refill_lock);
7728-
trace_btrfs_reserve_extent_cluster(root,
7728+
trace_btrfs_reserve_extent_cluster(fs_info,
77297729
block_group, search_start,
77307730
num_bytes);
77317731
goto checks;
@@ -7823,7 +7823,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
78237823
ins->objectid = search_start;
78247824
ins->offset = num_bytes;
78257825

7826-
trace_btrfs_reserve_extent(orig_root, block_group,
7826+
trace_btrfs_reserve_extent(fs_info, block_group,
78277827
search_start, num_bytes);
78287828
btrfs_release_block_group(block_group, delalloc);
78297829
break;
@@ -8048,7 +8048,7 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root,
80488048
ret = btrfs_discard_extent(root, start, len, NULL);
80498049
btrfs_add_free_space(cache, start, len);
80508050
btrfs_free_reserved_bytes(cache, len, delalloc);
8051-
trace_btrfs_reserved_extent_free(root, start, len);
8051+
trace_btrfs_reserved_extent_free(fs_info, start, len);
80528052
}
80538053

80548054
btrfs_put_block_group(cache);
@@ -8139,8 +8139,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
81398139
ins->objectid, ins->offset);
81408140
BUG();
81418141
}
8142-
trace_btrfs_reserved_extent_alloc(fs_info->extent_root,
8143-
ins->objectid, ins->offset);
8142+
trace_btrfs_reserved_extent_alloc(fs_info, ins->objectid, ins->offset);
81448143
return ret;
81458144
}
81468145

@@ -8226,7 +8225,7 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
82268225
BUG();
82278226
}
82288227

8229-
trace_btrfs_reserved_extent_alloc(root, ins->objectid,
8228+
trace_btrfs_reserved_extent_alloc(fs_info, ins->objectid,
82308229
fs_info->nodesize);
82318230
return ret;
82328231
}

‎include/trace/events/btrfs.h‎

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -891,88 +891,82 @@ TRACE_EVENT(btrfs_flush_space,
891891

892892
DECLARE_EVENT_CLASS(btrfs__reserved_extent,
893893

894-
TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
894+
TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len),
895895

896-
TP_ARGS(root, start, len),
896+
TP_ARGS(fs_info, start, len),
897897

898898
TP_STRUCT__entry_btrfs(
899-
__field( u64, root_objectid )
900899
__field( u64, start )
901900
__field( u64, len )
902901
),
903902

904-
TP_fast_assign_btrfs(root->fs_info,
905-
__entry->root_objectid = root->root_key.objectid;
903+
TP_fast_assign_btrfs(fs_info,
906904
__entry->start = start;
907905
__entry->len = len;
908906
),
909907

910908
TP_printk_btrfs("root = %llu(%s), start = %llu, len = %llu",
911-
show_root_type(__entry->root_objectid),
909+
show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
912910
(unsigned long long)__entry->start,
913911
(unsigned long long)__entry->len)
914912
);
915913

916914
DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
917915

918-
TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
916+
TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len),
919917

920-
TP_ARGS(root, start, len)
918+
TP_ARGS(fs_info, start, len)
921919
);
922920

923921
DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
924922

925-
TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
923+
TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len),
926924

927-
TP_ARGS(root, start, len)
925+
TP_ARGS(fs_info, start, len)
928926
);
929927

930928
TRACE_EVENT(find_free_extent,
931929

932-
TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
930+
TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
933931
u64 data),
934932

935-
TP_ARGS(root, num_bytes, empty_size, data),
933+
TP_ARGS(fs_info, num_bytes, empty_size, data),
936934

937935
TP_STRUCT__entry_btrfs(
938-
__field( u64, root_objectid )
939936
__field( u64, num_bytes )
940937
__field( u64, empty_size )
941938
__field( u64, data )
942939
),
943940

944-
TP_fast_assign_btrfs(root->fs_info,
945-
__entry->root_objectid = root->root_key.objectid;
941+
TP_fast_assign_btrfs(fs_info,
946942
__entry->num_bytes = num_bytes;
947943
__entry->empty_size = empty_size;
948944
__entry->data = data;
949945
),
950946

951-
TP_printk_btrfs("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
952-
"flags = %Lu(%s)", show_root_type(__entry->root_objectid),
947+
TP_printk_btrfs("root = %Lu(%s), len = %Lu, empty_size = %Lu, flags = %Lu(%s)",
948+
show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
953949
__entry->num_bytes, __entry->empty_size, __entry->data,
954950
__print_flags((unsigned long)__entry->data, "|",
955951
BTRFS_GROUP_FLAGS))
956952
);
957953

958954
DECLARE_EVENT_CLASS(btrfs__reserve_extent,
959955

960-
TP_PROTO(struct btrfs_root *root,
956+
TP_PROTO(struct btrfs_fs_info *fs_info,
961957
struct btrfs_block_group_cache *block_group, u64 start,
962958
u64 len),
963959

964-
TP_ARGS(root, block_group, start, len),
960+
TP_ARGS(fs_info, block_group, start, len),
965961

966962
TP_STRUCT__entry_btrfs(
967-
__field( u64, root_objectid )
968963
__field( u64, bg_objectid )
969964
__field( u64, flags )
970965
__field( u64, start )
971966
__field( u64, len )
972967
),
973968

974-
TP_fast_assign_btrfs(root->fs_info,
975-
__entry->root_objectid = root->root_key.objectid;
969+
TP_fast_assign_btrfs(fs_info,
976970
__entry->bg_objectid = block_group->key.objectid;
977971
__entry->flags = block_group->flags;
978972
__entry->start = start;
@@ -981,28 +975,29 @@ DECLARE_EVENT_CLASS(btrfs__reserve_extent,
981975

982976
TP_printk_btrfs("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
983977
"start = %Lu, len = %Lu",
984-
show_root_type(__entry->root_objectid), __entry->bg_objectid,
978+
show_root_type(BTRFS_EXTENT_TREE_OBJECTID),
979+
__entry->bg_objectid,
985980
__entry->flags, __print_flags((unsigned long)__entry->flags,
986981
"|", BTRFS_GROUP_FLAGS),
987982
__entry->start, __entry->len)
988983
);
989984

990985
DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
991986

992-
TP_PROTO(struct btrfs_root *root,
987+
TP_PROTO(struct btrfs_fs_info *fs_info,
993988
struct btrfs_block_group_cache *block_group, u64 start,
994989
u64 len),
995990

996-
TP_ARGS(root, block_group, start, len)
991+
TP_ARGS(fs_info, block_group, start, len)
997992
);
998993

999994
DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
1000995

1001-
TP_PROTO(struct btrfs_root *root,
996+
TP_PROTO(struct btrfs_fs_info *fs_info,
1002997
struct btrfs_block_group_cache *block_group, u64 start,
1003998
u64 len),
1004999

1005-
TP_ARGS(root, block_group, start, len)
1000+
TP_ARGS(fs_info, block_group, start, len)
10061001
);
10071002

10081003
TRACE_EVENT(btrfs_find_cluster,

0 commit comments

Comments
 (0)