* [PATCH] Btrfs: add file item tracepoint
@ 2017-03-04 2:41 Liu Bo
2017-03-07 15:48 ` David Sterba
2017-03-10 19:09 ` [PATCH v2] " Liu Bo
0 siblings, 2 replies; 7+ messages in thread
From: Liu Bo @ 2017-03-04 2:41 UTC (permalink / raw
To: linux-btrfs; +Cc: David Sterba
While debugging truncate problems, I found that these tracepoints could
help us quickly know what went wrong.
Two sets of tracepoints are created to track regular/prealloc file item
and inline file item respectively, I put inline as a separate one since
what inline file items cares about are way less than the regular one.
This adds four tracepoints:
- btrfs_get_extent_show_fi_regular
- btrfs_get_extent_show_fi_inline
- btrfs_truncate_show_fi_regular
- btrfs_truncate_show_fi_inline
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/inode.c | 15 +++++
include/trace/events/btrfs.h | 133 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 148 insertions(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5652f5f..8a26712 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4401,9 +4401,17 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
if (extent_type != BTRFS_FILE_EXTENT_INLINE) {
item_end +=
btrfs_file_extent_num_bytes(leaf, fi);
+
+ trace_btrfs_truncate_show_fi_regular(
+ BTRFS_I(inode), leaf, fi,
+ found_key.offset);
} else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
item_end += btrfs_file_extent_inline_len(leaf,
path->slots[0], fi);
+
+ trace_btrfs_truncate_show_fi_inline(
+ BTRFS_I(inode), leaf, fi, path->slots[0],
+ found_key.offset);
}
item_end--;
}
@@ -6814,11 +6822,18 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
found_type == BTRFS_FILE_EXTENT_PREALLOC) {
extent_end = extent_start +
btrfs_file_extent_num_bytes(leaf, item);
+
+ trace_btrfs_get_extent_show_fi_regular(inode, leaf, item,
+ extent_start);
} else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
size_t size;
size = btrfs_file_extent_inline_len(leaf, path->slots[0], item);
extent_end = ALIGN(extent_start + size,
fs_info->sectorsize);
+
+ trace_btrfs_get_extent_show_fi_inline(inode, leaf, item,
+ path->slots[0],
+ extent_start);
}
next:
if (start >= extent_end) {
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index a3c3cab..6353d0f 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -12,6 +12,7 @@ struct btrfs_root;
struct btrfs_fs_info;
struct btrfs_inode;
struct extent_map;
+struct btrfs_file_extent_item;
struct btrfs_ordered_extent;
struct btrfs_delayed_ref_node;
struct btrfs_delayed_tree_ref;
@@ -54,6 +55,12 @@ struct btrfs_qgroup_extent_record;
(obj >= BTRFS_ROOT_TREE_OBJECTID && \
obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
+#define show_fi_type(type) \
+ __print_symbolic(type, \
+ { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
+ { BTRFS_FILE_EXTENT_REG, "REG" }, \
+ { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
+
#define BTRFS_GROUP_FLAGS \
{ BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
{ BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
@@ -232,6 +239,132 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
__entry->refs, __entry->compress_type)
);
+/* file extent item */
+DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
+
+ TP_ARGS(bi, l, fi, start),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, root_obj )
+ __field( u64, ino )
+ __field( loff_t, isize )
+ __field( u64, disk_isize )
+ __field( u64, num_bytes )
+ __field( u64, ram_bytes )
+ __field( u64, disk_bytenr )
+ __field( u64, disk_num_bytes )
+ __field( u64, extent_offset )
+ __field( u8, extent_type )
+ __field( u8, compression )
+ __field( u64, extent_start )
+ __field( u64, extent_end )
+ ),
+
+ TP_fast_assign_btrfs(bi->root->fs_info,
+ __entry->root_obj = bi->root->objectid;
+ __entry->ino = btrfs_ino(bi);
+ __entry->isize = bi->vfs_inode.i_size;
+ __entry->disk_isize = bi->disk_i_size;
+ __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi);
+ __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi);
+ __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi);
+ __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi);
+ __entry->extent_offset = btrfs_file_extent_offset(l, fi);
+ __entry->extent_type = btrfs_file_extent_type(l, fi);
+ __entry->compression = btrfs_file_extent_compression(l, fi);
+ __entry->extent_start = start;
+ __entry->extent_end = (start + __entry->num_bytes);
+ ),
+
+ TP_printk_btrfs(
+ "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
+ "file extent range [0x%llx 0x%llx] "
+ "(num_bytes 0x%llx ram_bytes 0x%llx disk_bytenr 0x%llx "
+ "disk_num_bytes 0x%llx extent_offset 0x%llx type (%s) "
+ "compression %u",
+ show_root_type(__entry->root_obj), __entry->ino,
+ __entry->isize,
+ __entry->disk_isize, __entry->extent_start,
+ __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
+ __entry->disk_bytenr, __entry->disk_num_bytes,
+ __entry->extent_offset, show_fi_type(__entry->extent_type),
+ __entry->compression)
+);
+
+DECLARE_EVENT_CLASS(
+ btrfs__file_extent_item_inline,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, int slot, u64 start),
+
+ TP_ARGS(bi, l, fi, slot, start),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, root_obj )
+ __field( u64, ino )
+ __field( loff_t, isize )
+ __field( u64, disk_isize )
+ __field( u8, extent_type )
+ __field( u8, compression )
+ __field( u64, extent_start )
+ __field( u64, extent_end )
+ ),
+
+ TP_fast_assign_btrfs(
+ bi->root->fs_info,
+ __entry->root_obj = bi->root->objectid;
+ __entry->ino = btrfs_ino(bi);
+ __entry->isize = bi->vfs_inode.i_size;
+ __entry->disk_isize = bi->disk_i_size;
+ __entry->extent_type = btrfs_file_extent_type(l, fi);
+ __entry->compression = btrfs_file_extent_compression(l, fi);
+ __entry->extent_start = start;
+ __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi));
+ ),
+
+ TP_printk_btrfs(
+ "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
+ "file extent range [0x%llx 0x%llx] "
+ "extent_type (%s) compression %u",
+ show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
+ __entry->disk_isize, __entry->extent_start,
+ __entry->extent_end, show_fi_type(__entry->extent_type),
+ __entry->compression)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
+
+ TP_ARGS(bi, l, fi, start)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
+
+ TP_ARGS(bi, l, fi, start)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, int slot, u64 start),
+
+ TP_ARGS(bi, l, fi, slot, start)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, int slot, u64 start),
+
+ TP_ARGS(bi, l, fi, slot, start)
+);
+
#define show_ordered_flags(flags) \
__print_flags(flags, "|", \
{ (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
--
2.5.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Btrfs: add file item tracepoint
2017-03-04 2:41 [PATCH] Btrfs: add file item tracepoint Liu Bo
@ 2017-03-07 15:48 ` David Sterba
2017-03-07 16:49 ` Liu Bo
2017-03-10 19:09 ` [PATCH v2] " Liu Bo
1 sibling, 1 reply; 7+ messages in thread
From: David Sterba @ 2017-03-07 15:48 UTC (permalink / raw
To: Liu Bo; +Cc: linux-btrfs, David Sterba
On Fri, Mar 03, 2017 at 06:41:27PM -0800, Liu Bo wrote:
> + TP_printk_btrfs(
> + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> + "file extent range [0x%llx 0x%llx] "
> + "(num_bytes 0x%llx ram_bytes 0x%llx disk_bytenr 0x%llx "
> + "disk_num_bytes 0x%llx extent_offset 0x%llx type (%s) "
> + "compression %u",
> + TP_printk_btrfs(
> + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> + "file extent range [0x%llx 0x%llx] "
> + "extent_type (%s) compression %u",
Please update the message formats according to
https://btrfs.wiki.kernel.org/index.php/Development_notes#Tracepoints
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Btrfs: add file item tracepoint
2017-03-07 15:48 ` David Sterba
@ 2017-03-07 16:49 ` Liu Bo
2017-03-09 12:52 ` David Sterba
0 siblings, 1 reply; 7+ messages in thread
From: Liu Bo @ 2017-03-07 16:49 UTC (permalink / raw
To: dsterba, linux-btrfs
On Tue, Mar 07, 2017 at 04:48:24PM +0100, David Sterba wrote:
> On Fri, Mar 03, 2017 at 06:41:27PM -0800, Liu Bo wrote:
> > + TP_printk_btrfs(
> > + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> > + "file extent range [0x%llx 0x%llx] "
> > + "(num_bytes 0x%llx ram_bytes 0x%llx disk_bytenr 0x%llx "
> > + "disk_num_bytes 0x%llx extent_offset 0x%llx type (%s) "
> > + "compression %u",
>
> > + TP_printk_btrfs(
> > + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> > + "file extent range [0x%llx 0x%llx] "
> > + "extent_type (%s) compression %u",
>
> Please update the message formats according to
> https://btrfs.wiki.kernel.org/index.php/Development_notes#Tracepoints
I feel like for size and offset, if using '%llu' rather than '%llx', it
is not easy to tell whether the size/offset is aligned to 4K or not.
Thanks,
-liubo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Btrfs: add file item tracepoint
2017-03-07 16:49 ` Liu Bo
@ 2017-03-09 12:52 ` David Sterba
2017-03-09 18:36 ` Liu Bo
0 siblings, 1 reply; 7+ messages in thread
From: David Sterba @ 2017-03-09 12:52 UTC (permalink / raw
To: Liu Bo; +Cc: dsterba, linux-btrfs
On Tue, Mar 07, 2017 at 08:49:42AM -0800, Liu Bo wrote:
> On Tue, Mar 07, 2017 at 04:48:24PM +0100, David Sterba wrote:
> > On Fri, Mar 03, 2017 at 06:41:27PM -0800, Liu Bo wrote:
> > > + TP_printk_btrfs(
> > > + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> > > + "file extent range [0x%llx 0x%llx] "
> > > + "(num_bytes 0x%llx ram_bytes 0x%llx disk_bytenr 0x%llx "
> > > + "disk_num_bytes 0x%llx extent_offset 0x%llx type (%s) "
> > > + "compression %u",
> >
> > > + TP_printk_btrfs(
> > > + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> > > + "file extent range [0x%llx 0x%llx] "
> > > + "extent_type (%s) compression %u",
> >
> > Please update the message formats according to
> > https://btrfs.wiki.kernel.org/index.php/Development_notes#Tracepoints
>
> I feel like for size and offset, if using '%llu' rather than '%llx', it
> is not easy to tell whether the size/offset is aligned to 4K or not.
I think we'll have to do some conversion either way, and I don't see
%llx used anywhere in our thacepoints.
If the alignment is useful for certain values, we can extend the format
to signify that, for example: "start=4097!".
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Btrfs: add file item tracepoint
2017-03-09 12:52 ` David Sterba
@ 2017-03-09 18:36 ` Liu Bo
0 siblings, 0 replies; 7+ messages in thread
From: Liu Bo @ 2017-03-09 18:36 UTC (permalink / raw
To: dsterba, linux-btrfs
On Thu, Mar 09, 2017 at 01:52:22PM +0100, David Sterba wrote:
> On Tue, Mar 07, 2017 at 08:49:42AM -0800, Liu Bo wrote:
> > On Tue, Mar 07, 2017 at 04:48:24PM +0100, David Sterba wrote:
> > > On Fri, Mar 03, 2017 at 06:41:27PM -0800, Liu Bo wrote:
> > > > + TP_printk_btrfs(
> > > > + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> > > > + "file extent range [0x%llx 0x%llx] "
> > > > + "(num_bytes 0x%llx ram_bytes 0x%llx disk_bytenr 0x%llx "
> > > > + "disk_num_bytes 0x%llx extent_offset 0x%llx type (%s) "
> > > > + "compression %u",
> > >
> > > > + TP_printk_btrfs(
> > > > + "root %llu(%s) ino %llu sz 0x%llx disk_isz 0x%llx "
> > > > + "file extent range [0x%llx 0x%llx] "
> > > > + "extent_type (%s) compression %u",
> > >
> > > Please update the message formats according to
> > > https://btrfs.wiki.kernel.org/index.php/Development_notes#Tracepoints
> >
> > I feel like for size and offset, if using '%llu' rather than '%llx', it
> > is not easy to tell whether the size/offset is aligned to 4K or not.
>
> I think we'll have to do some conversion either way, and I don't see
> %llx used anywhere in our thacepoints.
>
> If the alignment is useful for certain values, we can extend the format
> to signify that, for example: "start=4097!".
OK, I'll update this patch to comply with the wiki so you can take it,
and then make a new patch to convert %llu to %llx to see if any
objections.
Thanks,
-liubo
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] Btrfs: add file item tracepoint
2017-03-04 2:41 [PATCH] Btrfs: add file item tracepoint Liu Bo
2017-03-07 15:48 ` David Sterba
@ 2017-03-10 19:09 ` Liu Bo
2017-03-14 12:42 ` David Sterba
1 sibling, 1 reply; 7+ messages in thread
From: Liu Bo @ 2017-03-10 19:09 UTC (permalink / raw
To: linux-btrfs; +Cc: David Sterba
While debugging truncate problems, I found that these tracepoints could
help us quickly know what went wrong.
Two sets of tracepoints are created to track regular/prealloc file item
and inline file item respectively, I put inline as a separate one since
what inline file items cares about are way less than the regular one.
This adds four tracepoints:
- btrfs_get_extent_show_fi_regular
- btrfs_get_extent_show_fi_inline
- btrfs_truncate_show_fi_regular
- btrfs_truncate_show_fi_inline
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: follow the current TP format to use %llu instead of 0x%llx noted in wiki.
fs/btrfs/inode.c | 15 +++++
include/trace/events/btrfs.h | 133 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 148 insertions(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f6a9d2b..a2fe01f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4401,9 +4401,17 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
if (extent_type != BTRFS_FILE_EXTENT_INLINE) {
item_end +=
btrfs_file_extent_num_bytes(leaf, fi);
+
+ trace_btrfs_truncate_show_fi_regular(
+ BTRFS_I(inode), leaf, fi,
+ found_key.offset);
} else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
item_end += btrfs_file_extent_inline_len(leaf,
path->slots[0], fi);
+
+ trace_btrfs_truncate_show_fi_inline(
+ BTRFS_I(inode), leaf, fi, path->slots[0],
+ found_key.offset);
}
item_end--;
}
@@ -6814,11 +6822,18 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
found_type == BTRFS_FILE_EXTENT_PREALLOC) {
extent_end = extent_start +
btrfs_file_extent_num_bytes(leaf, item);
+
+ trace_btrfs_get_extent_show_fi_regular(inode, leaf, item,
+ extent_start);
} else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
size_t size;
size = btrfs_file_extent_inline_len(leaf, path->slots[0], item);
extent_end = ALIGN(extent_start + size,
fs_info->sectorsize);
+
+ trace_btrfs_get_extent_show_fi_inline(inode, leaf, item,
+ path->slots[0],
+ extent_start);
}
next:
if (start >= extent_end) {
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index a3c3cab..967f476 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -12,6 +12,7 @@ struct btrfs_root;
struct btrfs_fs_info;
struct btrfs_inode;
struct extent_map;
+struct btrfs_file_extent_item;
struct btrfs_ordered_extent;
struct btrfs_delayed_ref_node;
struct btrfs_delayed_tree_ref;
@@ -54,6 +55,12 @@ struct btrfs_qgroup_extent_record;
(obj >= BTRFS_ROOT_TREE_OBJECTID && \
obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
+#define show_fi_type(type) \
+ __print_symbolic(type, \
+ { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \
+ { BTRFS_FILE_EXTENT_REG, "REG" }, \
+ { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"})
+
#define BTRFS_GROUP_FLAGS \
{ BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
{ BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
@@ -232,6 +239,132 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
__entry->refs, __entry->compress_type)
);
+/* file extent item */
+DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
+
+ TP_ARGS(bi, l, fi, start),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, root_obj )
+ __field( u64, ino )
+ __field( loff_t, isize )
+ __field( u64, disk_isize )
+ __field( u64, num_bytes )
+ __field( u64, ram_bytes )
+ __field( u64, disk_bytenr )
+ __field( u64, disk_num_bytes )
+ __field( u64, extent_offset )
+ __field( u8, extent_type )
+ __field( u8, compression )
+ __field( u64, extent_start )
+ __field( u64, extent_end )
+ ),
+
+ TP_fast_assign_btrfs(bi->root->fs_info,
+ __entry->root_obj = bi->root->objectid;
+ __entry->ino = btrfs_ino(bi);
+ __entry->isize = bi->vfs_inode.i_size;
+ __entry->disk_isize = bi->disk_i_size;
+ __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi);
+ __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi);
+ __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi);
+ __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi);
+ __entry->extent_offset = btrfs_file_extent_offset(l, fi);
+ __entry->extent_type = btrfs_file_extent_type(l, fi);
+ __entry->compression = btrfs_file_extent_compression(l, fi);
+ __entry->extent_start = start;
+ __entry->extent_end = (start + __entry->num_bytes);
+ ),
+
+ TP_printk_btrfs(
+ "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
+ "file extent range=[%llu %llu] "
+ "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu "
+ "disk_num_bytes=%llu extent_offset=%llu type=%s "
+ "compression=%u",
+ show_root_type(__entry->root_obj), __entry->ino,
+ __entry->isize,
+ __entry->disk_isize, __entry->extent_start,
+ __entry->extent_end, __entry->num_bytes, __entry->ram_bytes,
+ __entry->disk_bytenr, __entry->disk_num_bytes,
+ __entry->extent_offset, show_fi_type(__entry->extent_type),
+ __entry->compression)
+);
+
+DECLARE_EVENT_CLASS(
+ btrfs__file_extent_item_inline,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, int slot, u64 start),
+
+ TP_ARGS(bi, l, fi, slot, start),
+
+ TP_STRUCT__entry_btrfs(
+ __field( u64, root_obj )
+ __field( u64, ino )
+ __field( loff_t, isize )
+ __field( u64, disk_isize )
+ __field( u8, extent_type )
+ __field( u8, compression )
+ __field( u64, extent_start )
+ __field( u64, extent_end )
+ ),
+
+ TP_fast_assign_btrfs(
+ bi->root->fs_info,
+ __entry->root_obj = bi->root->objectid;
+ __entry->ino = btrfs_ino(bi);
+ __entry->isize = bi->vfs_inode.i_size;
+ __entry->disk_isize = bi->disk_i_size;
+ __entry->extent_type = btrfs_file_extent_type(l, fi);
+ __entry->compression = btrfs_file_extent_compression(l, fi);
+ __entry->extent_start = start;
+ __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi));
+ ),
+
+ TP_printk_btrfs(
+ "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu "
+ "file extent range=[%llu %llu] "
+ "extent_type=%s compression=%u",
+ show_root_type(__entry->root_obj), __entry->ino, __entry->isize,
+ __entry->disk_isize, __entry->extent_start,
+ __entry->extent_end, show_fi_type(__entry->extent_type),
+ __entry->compression)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
+
+ TP_ARGS(bi, l, fi, start)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
+
+ TP_ARGS(bi, l, fi, start)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, int slot, u64 start),
+
+ TP_ARGS(bi, l, fi, slot, start)
+);
+
+DEFINE_EVENT(
+ btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline,
+
+ TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, int slot, u64 start),
+
+ TP_ARGS(bi, l, fi, slot, start)
+);
+
#define show_ordered_flags(flags) \
__print_flags(flags, "|", \
{ (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \
--
2.5.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Btrfs: add file item tracepoint
2017-03-10 19:09 ` [PATCH v2] " Liu Bo
@ 2017-03-14 12:42 ` David Sterba
0 siblings, 0 replies; 7+ messages in thread
From: David Sterba @ 2017-03-14 12:42 UTC (permalink / raw
To: Liu Bo; +Cc: linux-btrfs, David Sterba
On Fri, Mar 10, 2017 at 11:09:48AM -0800, Liu Bo wrote:
> While debugging truncate problems, I found that these tracepoints could
> help us quickly know what went wrong.
>
> Two sets of tracepoints are created to track regular/prealloc file item
> and inline file item respectively, I put inline as a separate one since
> what inline file items cares about are way less than the regular one.
>
> This adds four tracepoints:
> - btrfs_get_extent_show_fi_regular
> - btrfs_get_extent_show_fi_inline
> - btrfs_truncate_show_fi_regular
> - btrfs_truncate_show_fi_inline
>
> Cc: David Sterba <dsterba@suse.cz>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
> + TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, struct btrfs_file_extent_item *fi, u64 start),
The 80-chars per line rule still applies, I've fixed them.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-03-14 12:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-04 2:41 [PATCH] Btrfs: add file item tracepoint Liu Bo
2017-03-07 15:48 ` David Sterba
2017-03-07 16:49 ` Liu Bo
2017-03-09 12:52 ` David Sterba
2017-03-09 18:36 ` Liu Bo
2017-03-10 19:09 ` [PATCH v2] " Liu Bo
2017-03-14 12:42 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.