diff options
author | Josef Bacik <jbacik@fb.com> | 2016-03-25 13:25:52 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-07-07 18:45:53 +0200 |
commit | c83f8effefa46c15f2fd43de598d9839d0056096 (patch) | |
tree | c94b37edea283c007446965fb5ea4bd8d7158b63 | |
parent | d555b6c380c644af63dbdaa7cc14bba041a4e4dd (diff) | |
download | op-kernel-dev-c83f8effefa46c15f2fd43de598d9839d0056096.zip op-kernel-dev-c83f8effefa46c15f2fd43de598d9839d0056096.tar.gz |
Btrfs: add tracepoint for adding block groups
I'm writing a tool to visualize the enospc system inside btrfs, I need this
tracepoint in order to keep track of the block groups in the system. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | include/trace/events/btrfs.h | 40 |
2 files changed, 42 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a1355a3..aae7b04 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -9994,6 +9994,7 @@ int btrfs_read_block_groups(struct btrfs_root *root) goto error; } + trace_btrfs_add_block_group(root->fs_info, cache, 0); ret = update_space_info(info, cache->flags, found_key.offset, btrfs_block_group_used(&cache->item), cache->bytes_super, &space_info); @@ -10164,6 +10165,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, * Now that our block group has its ->space_info set and is inserted in * the rbtree, update the space info's counters. */ + trace_btrfs_add_block_group(root->fs_info, cache, 1); ret = update_space_info(root->fs_info, cache->flags, size, bytes_used, cache->bytes_super, &cache->space_info); if (ret) { diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index e90e82a..985e01b 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -440,6 +440,46 @@ TRACE_EVENT(btrfs_sync_fs, TP_printk("wait = %d", __entry->wait) ); +TRACE_EVENT(btrfs_add_block_group, + + TP_PROTO(struct btrfs_fs_info *fs_info, + struct btrfs_block_group_cache *block_group, int create), + + TP_ARGS(fs_info, block_group, create), + + TP_STRUCT__entry( + __array( u8, fsid, BTRFS_UUID_SIZE ) + __field( u64, offset ) + __field( u64, size ) + __field( u64, flags ) + __field( u64, bytes_used ) + __field( u64, bytes_super ) + __field( int, create ) + ), + + TP_fast_assign( + memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); + __entry->offset = block_group->key.objectid; + __entry->size = block_group->key.offset; + __entry->flags = block_group->flags; + __entry->bytes_used = + btrfs_block_group_used(&block_group->item); + __entry->bytes_super = block_group->bytes_super; + __entry->create = create; + ), + + TP_printk("%pU: block_group offset = %llu, size = %llu, " + "flags = %llu(%s), bytes_used = %llu, bytes_super = %llu, " + "create = %d", __entry->fsid, + (unsigned long long)__entry->offset, + (unsigned long long)__entry->size, + (unsigned long long)__entry->flags, + __print_flags((unsigned long)__entry->flags, "|", + BTRFS_GROUP_FLAGS), + (unsigned long long)__entry->bytes_used, + (unsigned long long)__entry->bytes_super, __entry->create) +); + #define show_ref_action(action) \ __print_symbolic(action, \ { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ |