diff mbox

Btrfs: add 'inode' for extent map tracepoint

Message ID 1480628641-17476-1-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State Superseded
Headers show

Commit Message

Liu Bo Dec. 1, 2016, 9:44 p.m. UTC
'inode' is an important field for btrfs_get_extent, lets trace it.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/inode.c             |  2 +-
 include/trace/events/btrfs.h | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

Comments

David Sterba Dec. 12, 2016, 1:08 p.m. UTC | #1
On Thu, Dec 01, 2016 at 01:44:01PM -0800, Liu Bo wrote:
>  	TP_STRUCT__entry_btrfs(
>  		__field(	u64,  root_objectid	)
> +		__field(	u64,  ino		)
>  		__field(	u64,  start		)
>  		__field(	u64,  len		)
>  		__field(	u64,  orig_start	)
> @@ -204,7 +206,8 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
>  
>  	TP_fast_assign_btrfs(root->fs_info,
>  		__entry->root_objectid	= root->root_key.objectid;
> -		__entry->start 		= map->start;
> +		__entry->ino		= btrfs_ino(inode);
> +		__entry->start		= map->start;
>  		__entry->len		= map->len;
>  		__entry->orig_start	= map->orig_start;
>  		__entry->block_start	= map->block_start;
> @@ -214,12 +217,12 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
>  		__entry->compress_type	= map->compress_type;
>  	),
>  
> -	TP_printk_btrfs("root = %llu(%s), start = %llu, len = %llu, "
> +	TP_printk_btrfs("root = %llu(%s), ino = %llu start = %llu, len = %llu, "
>  		  "orig_start = %llu, block_start = %llu(%s), "
>  		  "block_len = %llu, flags = %s, refs = %u, "
>  		  "compress_type = %u",
>  		  show_root_type(__entry->root_objectid),
> -		  (unsigned long long)__entry->start,
> +		  __entry->ino, (unsigned long long)__entry->start,

I think the (unsigned long long) cast should be used here as well, at
least for consistency with the other u64.

>  		  (unsigned long long)__entry->len,
>  		  (unsigned long long)__entry->orig_start,
>  		  show_map_type(__entry->block_start),
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 603dd492..79f35b6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7095,7 +7095,7 @@  struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
 	write_unlock(&em_tree->lock);
 out:
 
-	trace_btrfs_get_extent(root, em);
+	trace_btrfs_get_extent(root, inode, em);
 
 	btrfs_free_path(path);
 	if (trans) {
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index e030d6f..0e04208 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -184,14 +184,16 @@  DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
 
 TRACE_EVENT_CONDITION(btrfs_get_extent,
 
-	TP_PROTO(struct btrfs_root *root, struct extent_map *map),
+	TP_PROTO(struct btrfs_root *root, struct inode *inode,
+		 struct extent_map *map),
 
-	TP_ARGS(root, map),
+	TP_ARGS(root, inode, map),
 
 	TP_CONDITION(map),
 
 	TP_STRUCT__entry_btrfs(
 		__field(	u64,  root_objectid	)
+		__field(	u64,  ino		)
 		__field(	u64,  start		)
 		__field(	u64,  len		)
 		__field(	u64,  orig_start	)
@@ -204,7 +206,8 @@  TRACE_EVENT_CONDITION(btrfs_get_extent,
 
 	TP_fast_assign_btrfs(root->fs_info,
 		__entry->root_objectid	= root->root_key.objectid;
-		__entry->start 		= map->start;
+		__entry->ino		= btrfs_ino(inode);
+		__entry->start		= map->start;
 		__entry->len		= map->len;
 		__entry->orig_start	= map->orig_start;
 		__entry->block_start	= map->block_start;
@@ -214,12 +217,12 @@  TRACE_EVENT_CONDITION(btrfs_get_extent,
 		__entry->compress_type	= map->compress_type;
 	),
 
-	TP_printk_btrfs("root = %llu(%s), start = %llu, len = %llu, "
+	TP_printk_btrfs("root = %llu(%s), ino = %llu start = %llu, len = %llu, "
 		  "orig_start = %llu, block_start = %llu(%s), "
 		  "block_len = %llu, flags = %s, refs = %u, "
 		  "compress_type = %u",
 		  show_root_type(__entry->root_objectid),
-		  (unsigned long long)__entry->start,
+		  __entry->ino, (unsigned long long)__entry->start,
 		  (unsigned long long)__entry->len,
 		  (unsigned long long)__entry->orig_start,
 		  show_map_type(__entry->block_start),