diff mbox series

[3/4] ext4: indicate via a block bitmap read is prefetched via a tracepoint

Message ID 20200717155352.1053040-4-tytso@mit.edu
State Superseded
Headers show
Series ex4 block bitmap prefetching | expand

Commit Message

Theodore Ts'o July 17, 2020, 3:53 p.m. UTC
Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
whether a block bitmap is being prefetched.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/balloc.c            |  2 +-
 include/trace/events/ext4.h | 24 ++++++++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

Comments

Andreas Dilger July 21, 2020, 7:51 a.m. UTC | #1
On Jul 17, 2020, at 9:53 AM, Theodore Ts'o <tytso@mit.edu> wrote:
> 
> Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> whether a block bitmap is being prefetched.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

I can't really say I know much about tracepoints, but the changes
look fine compared to other ext4 tracepoints.

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/ext4/balloc.c            |  2 +-
> include/trace/events/ext4.h | 24 ++++++++++++++++++++----
> 2 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index aaa9ec5212c8..5a2f8837200c 100644
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -494,7 +494,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group,
> 	 * submit the buffer_head for reading
> 	 */
> 	set_buffer_new(bh);
> -	trace_ext4_read_block_bitmap_load(sb, block_group);
> +	trace_ext4_read_block_bitmap_load(sb, block_group, ignore_locked);
> 	bh->b_end_io = ext4_end_bitmap_read;
> 	get_bh(bh);
> 	submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO |
> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index cc41d692ae8e..cbcd2e1a608d 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -1312,18 +1312,34 @@ DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> 	TP_ARGS(sb, group)
> );
> 
> -DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
> +DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
> 
> 	TP_PROTO(struct super_block *sb, unsigned long group),
> 
> 	TP_ARGS(sb, group)
> );
> 
> -DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
> +TRACE_EVENT(ext4_read_block_bitmap_load,
> +	TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> 
> -	TP_PROTO(struct super_block *sb, unsigned long group),
> +	TP_ARGS(sb, group, prefetch),
> 
> -	TP_ARGS(sb, group)
> +	TP_STRUCT__entry(
> +		__field(	dev_t,	dev			)
> +		__field(	__u32,	group			)
> +		__field(	bool,	prefetch		)
> +
> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev	= sb->s_dev;
> +		__entry->group	= group;
> +		__entry->prefetch = prefetch;
> +	),
> +
> +	TP_printk("dev %d,%d group %u prefetch %d",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->group, __entry->prefetch)
> );
> 
> TRACE_EVENT(ext4_direct_IO_enter,
> --
> 2.24.1
> 


Cheers, Andreas
Artem Blagodarenko July 24, 2020, 12:04 p.m. UTC | #2
I have used this tracepoint for verifying other patches in the series. Useful. The patch looks good.

Reviewed-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>

> On 17 Jul 2020, at 18:53, Theodore Ts'o <tytso@mit.edu> wrote:
> 
> Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> whether a block bitmap is being prefetched.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
> fs/ext4/balloc.c            |  2 +-
> include/trace/events/ext4.h | 24 ++++++++++++++++++++----
> 2 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index aaa9ec5212c8..5a2f8837200c 100644
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -494,7 +494,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group,
> 	 * submit the buffer_head for reading
> 	 */
> 	set_buffer_new(bh);
> -	trace_ext4_read_block_bitmap_load(sb, block_group);
> +	trace_ext4_read_block_bitmap_load(sb, block_group, ignore_locked);
> 	bh->b_end_io = ext4_end_bitmap_read;
> 	get_bh(bh);
> 	submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO |
> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index cc41d692ae8e..cbcd2e1a608d 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -1312,18 +1312,34 @@ DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> 	TP_ARGS(sb, group)
> );
> 
> -DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
> +DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
> 
> 	TP_PROTO(struct super_block *sb, unsigned long group),
> 
> 	TP_ARGS(sb, group)
> );
> 
> -DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
> +TRACE_EVENT(ext4_read_block_bitmap_load,
> +	TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> 
> -	TP_PROTO(struct super_block *sb, unsigned long group),
> +	TP_ARGS(sb, group, prefetch),
> 
> -	TP_ARGS(sb, group)
> +	TP_STRUCT__entry(
> +		__field(	dev_t,	dev			)
> +		__field(	__u32,	group			)
> +		__field(	bool,	prefetch		)
> +
> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev	= sb->s_dev;
> +		__entry->group	= group;
> +		__entry->prefetch = prefetch;
> +	),
> +
> +	TP_printk("dev %d,%d group %u prefetch %d",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->group, __entry->prefetch)
> );
> 
> TRACE_EVENT(ext4_direct_IO_enter,
> -- 
> 2.24.1
>
diff mbox series

Patch

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index aaa9ec5212c8..5a2f8837200c 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -494,7 +494,7 @@  ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group,
 	 * submit the buffer_head for reading
 	 */
 	set_buffer_new(bh);
-	trace_ext4_read_block_bitmap_load(sb, block_group);
+	trace_ext4_read_block_bitmap_load(sb, block_group, ignore_locked);
 	bh->b_end_io = ext4_end_bitmap_read;
 	get_bh(bh);
 	submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index cc41d692ae8e..cbcd2e1a608d 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -1312,18 +1312,34 @@  DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
 	TP_ARGS(sb, group)
 );
 
-DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
+DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
 
 	TP_PROTO(struct super_block *sb, unsigned long group),
 
 	TP_ARGS(sb, group)
 );
 
-DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
+TRACE_EVENT(ext4_read_block_bitmap_load,
+	TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
 
-	TP_PROTO(struct super_block *sb, unsigned long group),
+	TP_ARGS(sb, group, prefetch),
 
-	TP_ARGS(sb, group)
+	TP_STRUCT__entry(
+		__field(	dev_t,	dev			)
+		__field(	__u32,	group			)
+		__field(	bool,	prefetch		)
+
+	),
+
+	TP_fast_assign(
+		__entry->dev	= sb->s_dev;
+		__entry->group	= group;
+		__entry->prefetch = prefetch;
+	),
+
+	TP_printk("dev %d,%d group %u prefetch %d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->group, __entry->prefetch)
 );
 
 TRACE_EVENT(ext4_direct_IO_enter,