Patchwork [2/2] ext4: add a variable to record the value of map->m_flags in tracepoint

login
register
mail settings
Submitter Zheng Liu
Date Oct. 16, 2012, 7:24 a.m.
Message ID <1350372294-17939-2-git-send-email-wenqing.lz@taobao.com>
Download mbox | patch
Permalink /patch/191739/
State New
Headers show

Comments

Zheng Liu - Oct. 16, 2012, 7:24 a.m.
From: Zheng Liu <wenqing.lz@taobao.com>

When we use trace_ext4_ext/ind_map_blocks_exit, we will print the value of
map->m_flags in order that we can understand what currently status is.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 fs/ext4/extents.c           |  2 +-
 fs/ext4/indirect.c          |  4 ++--
 include/trace/events/ext4.h | 18 ++++++++++--------
 3 files changed, 13 insertions(+), 11 deletions(-)
Lukas Czerner - Oct. 16, 2012, 10:41 a.m.
On Tue, 16 Oct 2012, Zheng Liu wrote:

> Date: Tue, 16 Oct 2012 15:24:54 +0800
> From: Zheng Liu <gnehzuil.liu@gmail.com>
> To: linux-ext4@vger.kernel.org
> Cc: Zheng Liu <wenqing.lz@taobao.com>
> Subject: [PATCH 2/2] ext4: add a variable to record the value of map->m_flags
>     in tracepoint
> 
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> When we use trace_ext4_ext/ind_map_blocks_exit, we will print the value of
> map->m_flags in order that we can understand what currently status is.
> 
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
>  fs/ext4/extents.c           |  2 +-
>  fs/ext4/indirect.c          |  4 ++--
>  include/trace/events/ext4.h | 18 ++++++++++--------
>  3 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 4ecc210..204bafa 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4250,7 +4250,7 @@ out2:
>  	}
>  
>  	trace_ext4_ext_map_blocks_exit(inode, map->m_lblk,
> -		newblock, map->m_len, err ? err : allocated);
> +		newblock, map->m_len, map->m_flags, err ? err : allocated);
>  
>  	return err ? err : allocated;
>  }
> diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
> index 792e388..a22d296 100644
> --- a/fs/ext4/indirect.c
> +++ b/fs/ext4/indirect.c
> @@ -755,8 +755,8 @@ cleanup:
>  		partial--;
>  	}
>  out:
> -	trace_ext4_ind_map_blocks_exit(inode, map->m_lblk,
> -				map->m_pblk, map->m_len, err);
> +	trace_ext4_ind_map_blocks_exit(inode, map->m_lblk, map->m_pblk,
> +					map->m_len, map->m_flags, err);
>  	return err;
>  }
>  
> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index 66d78dc..680c249b 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -1520,9 +1520,9 @@ DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
>  
>  DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
>  	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
> -		 ext4_fsblk_t pblk, unsigned int len, int ret),
> +		 ext4_fsblk_t pblk, unsigned int len, int flags, int ret),

What about the whole struct ext4_map_blocks instead of m_lblk, m_len
and m_flags separately ?

>  
> -	TP_ARGS(inode, lblk, pblk, len, ret),
> +	TP_ARGS(inode, lblk, pblk, len, flags, ret),
>  
>  	TP_STRUCT__entry(
>  		__field(	dev_t,		dev		)
> @@ -1530,6 +1530,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
>  		__field(	ext4_fsblk_t,	pblk		)
>  		__field(	ext4_lblk_t,	lblk		)
>  		__field(	unsigned int,	len		)
> +		__field(	int,		flags		)

map->m_flags is unsigned int.

>  		__field(	int,		ret		)
>  	),
>  
> @@ -1539,28 +1540,29 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
>  		__entry->pblk	= pblk;
>  		__entry->lblk	= lblk;
>  		__entry->len	= len;
> +		__entry->flags	= flags;
>  		__entry->ret	= ret;
>  	),
>  
> -	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
> +	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d",

It's better to be consistent. If we agree that using %x for flags is
better format then be it, but change the first patch as well.

Thanks!
-Lukas

>  		  MAJOR(__entry->dev), MINOR(__entry->dev),
>  		  (unsigned long) __entry->ino,
>  		  __entry->lblk, __entry->pblk,
> -		  __entry->len, __entry->ret)
> +		  __entry->len, __entry->flags, __entry->ret)
>  );
>  
>  DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
>  	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
> -		 ext4_fsblk_t pblk, unsigned len, int ret),
> +		 ext4_fsblk_t pblk, unsigned len, int flags, int ret),
>  
> -	TP_ARGS(inode, lblk, pblk, len, ret)
> +	TP_ARGS(inode, lblk, pblk, len, flags, ret)
>  );
>  
>  DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
>  	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
> -		 ext4_fsblk_t pblk, unsigned len, int ret),
> +		 ext4_fsblk_t pblk, unsigned len, int flags, int ret),
>  
> -	TP_ARGS(inode, lblk, pblk, len, ret)
> +	TP_ARGS(inode, lblk, pblk, len, flags, ret)
>  );
>  
>  TRACE_EVENT(ext4_ext_load_extent,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zheng Liu - Oct. 16, 2012, 10:56 a.m.
On Tue, Oct 16, 2012 at 12:41:33PM +0200, Lukáš Czerner wrote:
> On Tue, 16 Oct 2012, Zheng Liu wrote:
> 
> > Date: Tue, 16 Oct 2012 15:24:54 +0800
> > From: Zheng Liu <gnehzuil.liu@gmail.com>
> > To: linux-ext4@vger.kernel.org
> > Cc: Zheng Liu <wenqing.lz@taobao.com>
> > Subject: [PATCH 2/2] ext4: add a variable to record the value of map->m_flags
> >     in tracepoint
> > 
> > From: Zheng Liu <wenqing.lz@taobao.com>
> > 
> > When we use trace_ext4_ext/ind_map_blocks_exit, we will print the value of
> > map->m_flags in order that we can understand what currently status is.
> > 
> > Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> > ---
> >  fs/ext4/extents.c           |  2 +-
> >  fs/ext4/indirect.c          |  4 ++--
> >  include/trace/events/ext4.h | 18 ++++++++++--------
> >  3 files changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> > index 4ecc210..204bafa 100644
> > --- a/fs/ext4/extents.c
> > +++ b/fs/ext4/extents.c
> > @@ -4250,7 +4250,7 @@ out2:
> >  	}
> >  
> >  	trace_ext4_ext_map_blocks_exit(inode, map->m_lblk,
> > -		newblock, map->m_len, err ? err : allocated);
> > +		newblock, map->m_len, map->m_flags, err ? err : allocated);
> >  
> >  	return err ? err : allocated;
> >  }
> > diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
> > index 792e388..a22d296 100644
> > --- a/fs/ext4/indirect.c
> > +++ b/fs/ext4/indirect.c
> > @@ -755,8 +755,8 @@ cleanup:
> >  		partial--;
> >  	}
> >  out:
> > -	trace_ext4_ind_map_blocks_exit(inode, map->m_lblk,
> > -				map->m_pblk, map->m_len, err);
> > +	trace_ext4_ind_map_blocks_exit(inode, map->m_lblk, map->m_pblk,
> > +					map->m_len, map->m_flags, err);
> >  	return err;
> >  }
> >  
> > diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> > index 66d78dc..680c249b 100644
> > --- a/include/trace/events/ext4.h
> > +++ b/include/trace/events/ext4.h
> > @@ -1520,9 +1520,9 @@ DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
> >  
> >  DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
> >  	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
> > -		 ext4_fsblk_t pblk, unsigned int len, int ret),
> > +		 ext4_fsblk_t pblk, unsigned int len, int flags, int ret),
> 
> What about the whole struct ext4_map_blocks instead of m_lblk, m_len
> and m_flags separately ?

Agree.  I will fix it.

> 
> >  
> > -	TP_ARGS(inode, lblk, pblk, len, ret),
> > +	TP_ARGS(inode, lblk, pblk, len, flags, ret),
> >  
> >  	TP_STRUCT__entry(
> >  		__field(	dev_t,		dev		)
> > @@ -1530,6 +1530,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
> >  		__field(	ext4_fsblk_t,	pblk		)
> >  		__field(	ext4_lblk_t,	lblk		)
> >  		__field(	unsigned int,	len		)
> > +		__field(	int,		flags		)
> 
> map->m_flags is unsigned int.

Oops, I will fix it in second version.
> 
> >  		__field(	int,		ret		)
> >  	),
> >  
> > @@ -1539,28 +1540,29 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
> >  		__entry->pblk	= pblk;
> >  		__entry->lblk	= lblk;
> >  		__entry->len	= len;
> > +		__entry->flags	= flags;
> >  		__entry->ret	= ret;
> >  	),
> >  
> > -	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
> > +	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d",
> 
> It's better to be consistent. If we agree that using %x for flags is
> better format then be it, but change the first patch as well.

Yes, %x is better.  I will fix it in first patch.

Regards,
Zheng

> 
> Thanks!
> -Lukas
> 
> >  		  MAJOR(__entry->dev), MINOR(__entry->dev),
> >  		  (unsigned long) __entry->ino,
> >  		  __entry->lblk, __entry->pblk,
> > -		  __entry->len, __entry->ret)
> > +		  __entry->len, __entry->flags, __entry->ret)
> >  );
> >  
> >  DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
> >  	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
> > -		 ext4_fsblk_t pblk, unsigned len, int ret),
> > +		 ext4_fsblk_t pblk, unsigned len, int flags, int ret),
> >  
> > -	TP_ARGS(inode, lblk, pblk, len, ret)
> > +	TP_ARGS(inode, lblk, pblk, len, flags, ret)
> >  );
> >  
> >  DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
> >  	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
> > -		 ext4_fsblk_t pblk, unsigned len, int ret),
> > +		 ext4_fsblk_t pblk, unsigned len, int flags, int ret),
> >  
> > -	TP_ARGS(inode, lblk, pblk, len, ret)
> > +	TP_ARGS(inode, lblk, pblk, len, flags, ret)
> >  );
> >  
> >  TRACE_EVENT(ext4_ext_load_extent,
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 4ecc210..204bafa 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4250,7 +4250,7 @@  out2:
 	}
 
 	trace_ext4_ext_map_blocks_exit(inode, map->m_lblk,
-		newblock, map->m_len, err ? err : allocated);
+		newblock, map->m_len, map->m_flags, err ? err : allocated);
 
 	return err ? err : allocated;
 }
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 792e388..a22d296 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -755,8 +755,8 @@  cleanup:
 		partial--;
 	}
 out:
-	trace_ext4_ind_map_blocks_exit(inode, map->m_lblk,
-				map->m_pblk, map->m_len, err);
+	trace_ext4_ind_map_blocks_exit(inode, map->m_lblk, map->m_pblk,
+					map->m_len, map->m_flags, err);
 	return err;
 }
 
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 66d78dc..680c249b 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -1520,9 +1520,9 @@  DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
 
 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
-		 ext4_fsblk_t pblk, unsigned int len, int ret),
+		 ext4_fsblk_t pblk, unsigned int len, int flags, int ret),
 
-	TP_ARGS(inode, lblk, pblk, len, ret),
+	TP_ARGS(inode, lblk, pblk, len, flags, ret),
 
 	TP_STRUCT__entry(
 		__field(	dev_t,		dev		)
@@ -1530,6 +1530,7 @@  DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
 		__field(	ext4_fsblk_t,	pblk		)
 		__field(	ext4_lblk_t,	lblk		)
 		__field(	unsigned int,	len		)
+		__field(	int,		flags		)
 		__field(	int,		ret		)
 	),
 
@@ -1539,28 +1540,29 @@  DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
 		__entry->pblk	= pblk;
 		__entry->lblk	= lblk;
 		__entry->len	= len;
+		__entry->flags	= flags;
 		__entry->ret	= ret;
 	),
 
-	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
+	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  (unsigned long) __entry->ino,
 		  __entry->lblk, __entry->pblk,
-		  __entry->len, __entry->ret)
+		  __entry->len, __entry->flags, __entry->ret)
 );
 
 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
-		 ext4_fsblk_t pblk, unsigned len, int ret),
+		 ext4_fsblk_t pblk, unsigned len, int flags, int ret),
 
-	TP_ARGS(inode, lblk, pblk, len, ret)
+	TP_ARGS(inode, lblk, pblk, len, flags, ret)
 );
 
 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
-		 ext4_fsblk_t pblk, unsigned len, int ret),
+		 ext4_fsblk_t pblk, unsigned len, int flags, int ret),
 
-	TP_ARGS(inode, lblk, pblk, len, ret)
+	TP_ARGS(inode, lblk, pblk, len, flags, ret)
 );
 
 TRACE_EVENT(ext4_ext_load_extent,