diff options
author | liubo <liubo2009@cn.fujitsu.com> | 2011-03-24 07:18:59 -0400 |
---|---|---|
committer | root <Chris Mason chris.mason@oracle.com> | 2011-03-28 05:37:33 -0400 |
commit | 1abe9b8a138c9988ba8f7bfded6453649a31541f (patch) | |
tree | 9fe0c181e78b075b65f6b1802f0a5092e7afbc6a /fs/btrfs/inode.c | |
parent | 240f62c8756df285da11469259b3900f32883168 (diff) |
Btrfs: add initial tracepoint support for btrfs
Tracepoints can provide insight into why btrfs hits bugs and be greatly
helpful for debugging, e.g
dd-7822 [000] 2121.641088: btrfs_inode_request: root = 5(FS_TREE), gen = 4, ino = 256, blocks = 8, disk_i_size = 0, last_trans = 8, logged_trans = 0
dd-7822 [000] 2121.641100: btrfs_inode_new: root = 5(FS_TREE), gen = 8, ino = 257, blocks = 0, disk_i_size = 0, last_trans = 0, logged_trans = 0
btrfs-transacti-7804 [001] 2146.935420: btrfs_cow_block: root = 2(EXTENT_TREE), refs = 2, orig_buf = 29368320 (orig_level = 0), cow_buf = 29388800 (cow_level = 0)
btrfs-transacti-7804 [001] 2146.935473: btrfs_cow_block: root = 1(ROOT_TREE), refs = 2, orig_buf = 29364224 (orig_level = 0), cow_buf = 29392896 (cow_level = 0)
btrfs-transacti-7804 [001] 2146.972221: btrfs_transaction_commit: root = 1(ROOT_TREE), gen = 8
flush-btrfs-2-7821 [001] 2155.824210: btrfs_chunk_alloc: root = 3(CHUNK_TREE), offset = 1103101952, size = 1073741824, num_stripes = 1, sub_stripes = 0, type = DATA
flush-btrfs-2-7821 [001] 2155.824241: btrfs_cow_block: root = 2(EXTENT_TREE), refs = 2, orig_buf = 29388800 (orig_level = 0), cow_buf = 29396992 (cow_level = 0)
flush-btrfs-2-7821 [001] 2155.824255: btrfs_cow_block: root = 4(DEV_TREE), refs = 2, orig_buf = 29372416 (orig_level = 0), cow_buf = 29401088 (cow_level = 0)
flush-btrfs-2-7821 [000] 2155.824329: btrfs_cow_block: root = 3(CHUNK_TREE), refs = 2, orig_buf = 20971520 (orig_level = 0), cow_buf = 20975616 (cow_level = 0)
btrfs-endio-wri-7800 [001] 2155.898019: btrfs_cow_block: root = 5(FS_TREE), refs = 2, orig_buf = 29384704 (orig_level = 0), cow_buf = 29405184 (cow_level = 0)
btrfs-endio-wri-7800 [001] 2155.898043: btrfs_cow_block: root = 7(CSUM_TREE), refs = 2, orig_buf = 29376512 (orig_level = 0), cow_buf = 29409280 (cow_level = 0)
Here is what I have added:
1) ordere_extent:
btrfs_ordered_extent_add
btrfs_ordered_extent_remove
btrfs_ordered_extent_start
btrfs_ordered_extent_put
These provide critical information to understand how ordered_extents are
updated.
2) extent_map:
btrfs_get_extent
extent_map is used in both read and write cases, and it is useful for tracking
how btrfs specific IO is running.
3) writepage:
__extent_writepage
btrfs_writepage_end_io_hook
Pages are cirtical resourses and produce a lot of corner cases during writeback,
so it is valuable to know how page is written to disk.
4) inode:
btrfs_inode_new
btrfs_inode_request
btrfs_inode_evict
These can show where and when a inode is created, when a inode is evicted.
5) sync:
btrfs_sync_file
btrfs_sync_fs
These show sync arguments.
6) transaction:
btrfs_transaction_commit
In transaction based filesystem, it will be useful to know the generation and
who does commit.
7) back reference and cow:
btrfs_delayed_tree_ref
btrfs_delayed_data_ref
btrfs_delayed_ref_head
btrfs_cow_block
Btrfs natively supports back references, these tracepoints are helpful on
understanding btrfs's COW mechanism.
8) chunk:
btrfs_chunk_alloc
btrfs_chunk_free
Chunk is a link between physical offset and logical offset, and stands for space
infomation in btrfs, and these are helpful on tracing space things.
9) reserved_extent:
btrfs_reserved_extent_alloc
btrfs_reserved_extent_free
These can show how btrfs uses its space.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e9813bd7d556..eaa271484199 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1787,6 +1787,8 @@ out: | |||
1787 | static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | 1787 | static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, |
1788 | struct extent_state *state, int uptodate) | 1788 | struct extent_state *state, int uptodate) |
1789 | { | 1789 | { |
1790 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); | ||
1791 | |||
1790 | ClearPagePrivate2(page); | 1792 | ClearPagePrivate2(page); |
1791 | return btrfs_finish_ordered_io(page->mapping->host, start, end); | 1793 | return btrfs_finish_ordered_io(page->mapping->host, start, end); |
1792 | } | 1794 | } |
@@ -3718,6 +3720,8 @@ void btrfs_evict_inode(struct inode *inode) | |||
3718 | unsigned long nr; | 3720 | unsigned long nr; |
3719 | int ret; | 3721 | int ret; |
3720 | 3722 | ||
3723 | trace_btrfs_inode_evict(inode); | ||
3724 | |||
3721 | truncate_inode_pages(&inode->i_data, 0); | 3725 | truncate_inode_pages(&inode->i_data, 0); |
3722 | if (inode->i_nlink && (btrfs_root_refs(&root->root_item) != 0 || | 3726 | if (inode->i_nlink && (btrfs_root_refs(&root->root_item) != 0 || |
3723 | root == root->fs_info->tree_root)) | 3727 | root == root->fs_info->tree_root)) |
@@ -4510,6 +4514,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
4510 | return ERR_PTR(-ENOMEM); | 4514 | return ERR_PTR(-ENOMEM); |
4511 | 4515 | ||
4512 | if (dir) { | 4516 | if (dir) { |
4517 | trace_btrfs_inode_request(dir); | ||
4518 | |||
4513 | ret = btrfs_set_inode_index(dir, index); | 4519 | ret = btrfs_set_inode_index(dir, index); |
4514 | if (ret) { | 4520 | if (ret) { |
4515 | iput(inode); | 4521 | iput(inode); |
@@ -4584,6 +4590,9 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
4584 | 4590 | ||
4585 | insert_inode_hash(inode); | 4591 | insert_inode_hash(inode); |
4586 | inode_tree_add(inode); | 4592 | inode_tree_add(inode); |
4593 | |||
4594 | trace_btrfs_inode_new(inode); | ||
4595 | |||
4587 | return inode; | 4596 | return inode; |
4588 | fail: | 4597 | fail: |
4589 | if (dir) | 4598 | if (dir) |
@@ -5261,6 +5270,9 @@ insert: | |||
5261 | } | 5270 | } |
5262 | write_unlock(&em_tree->lock); | 5271 | write_unlock(&em_tree->lock); |
5263 | out: | 5272 | out: |
5273 | |||
5274 | trace_btrfs_get_extent(root, em); | ||
5275 | |||
5264 | if (path) | 5276 | if (path) |
5265 | btrfs_free_path(path); | 5277 | btrfs_free_path(path); |
5266 | if (trans) { | 5278 | if (trans) { |