Commit f46b24c9 authored by David Sterba's avatar David Sterba

btrfs: use fs_info for btrfs_handle_em_exist tracepoint

We really want to know to which filesystem the extent map events belong,
but as it cannot be reached from the extent_map pointers, we need to
pass it down the callchain.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0e08eb9b
...@@ -518,6 +518,7 @@ static noinline int merge_extent_mapping(struct extent_map_tree *em_tree, ...@@ -518,6 +518,7 @@ static noinline int merge_extent_mapping(struct extent_map_tree *em_tree,
/** /**
* btrfs_add_extent_mapping - add extent mapping into em_tree * btrfs_add_extent_mapping - add extent mapping into em_tree
* @fs_info - used for tracepoint
* @em_tree - the extent tree into which we want to insert the extent mapping * @em_tree - the extent tree into which we want to insert the extent mapping
* @em_in - extent we are inserting * @em_in - extent we are inserting
* @start - start of the logical range btrfs_get_extent() is requesting * @start - start of the logical range btrfs_get_extent() is requesting
...@@ -535,7 +536,8 @@ static noinline int merge_extent_mapping(struct extent_map_tree *em_tree, ...@@ -535,7 +536,8 @@ static noinline int merge_extent_mapping(struct extent_map_tree *em_tree,
* Return 0 on success, otherwise -EEXIST. * Return 0 on success, otherwise -EEXIST.
* *
*/ */
int btrfs_add_extent_mapping(struct extent_map_tree *em_tree, int btrfs_add_extent_mapping(struct btrfs_fs_info *fs_info,
struct extent_map_tree *em_tree,
struct extent_map **em_in, u64 start, u64 len) struct extent_map **em_in, u64 start, u64 len)
{ {
int ret; int ret;
...@@ -553,7 +555,7 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree, ...@@ -553,7 +555,7 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree,
existing = search_extent_mapping(em_tree, start, len); existing = search_extent_mapping(em_tree, start, len);
trace_btrfs_handle_em_exist(existing, em, start, len); trace_btrfs_handle_em_exist(fs_info, existing, em, start, len);
/* /*
* existing will always be non-NULL, since there must be * existing will always be non-NULL, since there must be
......
...@@ -92,7 +92,8 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen ...@@ -92,7 +92,8 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen
void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em); void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em);
struct extent_map *search_extent_mapping(struct extent_map_tree *tree, struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
u64 start, u64 len); u64 start, u64 len);
int btrfs_add_extent_mapping(struct extent_map_tree *em_tree, int btrfs_add_extent_mapping(struct btrfs_fs_info *fs_info,
struct extent_map_tree *em_tree,
struct extent_map **em_in, u64 start, u64 len); struct extent_map **em_in, u64 start, u64 len);
#endif #endif
...@@ -7083,7 +7083,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -7083,7 +7083,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
err = 0; err = 0;
write_lock(&em_tree->lock); write_lock(&em_tree->lock);
err = btrfs_add_extent_mapping(em_tree, &em, start, len); err = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len);
write_unlock(&em_tree->lock); write_unlock(&em_tree->lock);
out: out:
......
...@@ -91,7 +91,7 @@ static void test_case_1(struct btrfs_fs_info *fs_info, ...@@ -91,7 +91,7 @@ static void test_case_1(struct btrfs_fs_info *fs_info,
em->len = len; em->len = len;
em->block_start = start; em->block_start = start;
em->block_len = len; em->block_len = len;
ret = btrfs_add_extent_mapping(em_tree, &em, em->start, em->len); ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, em->start, em->len);
if (ret) if (ret)
test_msg("case1 [%llu %llu]: ret %d\n", start, start + len, ret); test_msg("case1 [%llu %llu]: ret %d\n", start, start + len, ret);
if (em && if (em &&
...@@ -155,7 +155,7 @@ static void test_case_2(struct btrfs_fs_info *fs_info, ...@@ -155,7 +155,7 @@ static void test_case_2(struct btrfs_fs_info *fs_info,
em->len = SZ_1K; em->len = SZ_1K;
em->block_start = EXTENT_MAP_INLINE; em->block_start = EXTENT_MAP_INLINE;
em->block_len = (u64)-1; em->block_len = (u64)-1;
ret = btrfs_add_extent_mapping(em_tree, &em, em->start, em->len); ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, em->start, em->len);
if (ret) if (ret)
test_msg("case2 [0 1K]: ret %d\n", ret); test_msg("case2 [0 1K]: ret %d\n", ret);
if (em && if (em &&
...@@ -201,7 +201,7 @@ static void __test_case_3(struct btrfs_fs_info *fs_info, ...@@ -201,7 +201,7 @@ static void __test_case_3(struct btrfs_fs_info *fs_info,
em->len = SZ_16K; em->len = SZ_16K;
em->block_start = 0; em->block_start = 0;
em->block_len = SZ_16K; em->block_len = SZ_16K;
ret = btrfs_add_extent_mapping(em_tree, &em, start, len); ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len);
if (ret) if (ret)
test_msg("case3 [0x%llx 0x%llx): ret %d\n", test_msg("case3 [0x%llx 0x%llx): ret %d\n",
start, start + len, ret); start, start + len, ret);
...@@ -288,7 +288,7 @@ static void __test_case_4(struct btrfs_fs_info *fs_info, ...@@ -288,7 +288,7 @@ static void __test_case_4(struct btrfs_fs_info *fs_info,
em->len = SZ_32K; em->len = SZ_32K;
em->block_start = 0; em->block_start = 0;
em->block_len = SZ_32K; em->block_len = SZ_32K;
ret = btrfs_add_extent_mapping(em_tree, &em, start, len); ret = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len);
if (ret) if (ret)
test_msg("case4 [0x%llx 0x%llx): ret %d\n", test_msg("case4 [0x%llx 0x%llx): ret %d\n",
start, len, ret); start, len, ret);
......
...@@ -256,11 +256,13 @@ TRACE_EVENT_CONDITION(btrfs_get_extent, ...@@ -256,11 +256,13 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
TRACE_EVENT(btrfs_handle_em_exist, TRACE_EVENT(btrfs_handle_em_exist,
TP_PROTO(const struct extent_map *existing, const struct extent_map *map, u64 start, u64 len), TP_PROTO(struct btrfs_fs_info *fs_info,
const struct extent_map *existing, const struct extent_map *map,
u64 start, u64 len),
TP_ARGS(existing, map, start, len), TP_ARGS(fs_info, existing, map, start, len),
TP_STRUCT__entry( TP_STRUCT__entry_btrfs(
__field( u64, e_start ) __field( u64, e_start )
__field( u64, e_len ) __field( u64, e_len )
__field( u64, map_start ) __field( u64, map_start )
...@@ -269,7 +271,7 @@ TRACE_EVENT(btrfs_handle_em_exist, ...@@ -269,7 +271,7 @@ TRACE_EVENT(btrfs_handle_em_exist,
__field( u64, len ) __field( u64, len )
), ),
TP_fast_assign( TP_fast_assign_btrfs(fs_info,
__entry->e_start = existing->start; __entry->e_start = existing->start;
__entry->e_len = existing->len; __entry->e_len = existing->len;
__entry->map_start = map->start; __entry->map_start = map->start;
...@@ -278,7 +280,7 @@ TRACE_EVENT(btrfs_handle_em_exist, ...@@ -278,7 +280,7 @@ TRACE_EVENT(btrfs_handle_em_exist,
__entry->len = len; __entry->len = len;
), ),
TP_printk("start=%llu len=%llu " TP_printk_btrfs("start=%llu len=%llu "
"existing(start=%llu len=%llu) " "existing(start=%llu len=%llu) "
"em(start=%llu len=%llu)", "em(start=%llu len=%llu)",
__entry->start, __entry->start,
......
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