diff mbox series

[01/15] xfs: fix incorrect unit conversion in scrub tracepoint

Message ID 162924373760.761813.14269643495581366455.stgit@magnolia (mailing list archive)
State Accepted, archived
Headers show
Series xfs: clean up ftrace field tags and formats | expand

Commit Message

Darrick J. Wong Aug. 17, 2021, 11:42 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

XFS_DADDR_TO_FSB converts a raw disk address (in units of 512b blocks)
to a raw disk address (in units of fs blocks).  Unfortunately, the
xchk_block_error_class tracepoints incorrectly uses this to decode
xfs_daddr_t into segmented AG number and AG block addresses.  Use the
correct translation code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/trace.h |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Dave Chinner Aug. 19, 2021, 2:29 a.m. UTC | #1
On Tue, Aug 17, 2021 at 04:42:17PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> XFS_DADDR_TO_FSB converts a raw disk address (in units of 512b blocks)
> to a raw disk address (in units of fs blocks).  Unfortunately, the
> xchk_block_error_class tracepoints incorrectly uses this to decode
> xfs_daddr_t into segmented AG number and AG block addresses.  Use the
> correct translation code.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/scrub/trace.h |   16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Carlos Maiolino Aug. 19, 2021, 7:57 a.m. UTC | #2
On Tue, Aug 17, 2021 at 04:42:17PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> XFS_DADDR_TO_FSB converts a raw disk address (in units of 512b blocks)
> to a raw disk address (in units of fs blocks).  Unfortunately, the
> xchk_block_error_class tracepoints incorrectly uses this to decode
> xfs_daddr_t into segmented AG number and AG block addresses.  Use the
> correct translation code.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

>  fs/xfs/scrub/trace.h |   16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> 
> diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
> index e46f5cef90da..29f1d0ac7ec5 100644
> --- a/fs/xfs/scrub/trace.h
> +++ b/fs/xfs/scrub/trace.h
> @@ -193,29 +193,21 @@ DECLARE_EVENT_CLASS(xchk_block_error_class,
>  		__field(dev_t, dev)
>  		__field(unsigned int, type)
>  		__field(xfs_agnumber_t, agno)
> -		__field(xfs_agblock_t, bno)
> +		__field(xfs_agblock_t, agbno)
>  		__field(void *, ret_ip)
>  	),
>  	TP_fast_assign(
> -		xfs_fsblock_t	fsbno;
> -		xfs_agnumber_t	agno;
> -		xfs_agblock_t	bno;
> -
> -		fsbno = XFS_DADDR_TO_FSB(sc->mp, daddr);
> -		agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
> -		bno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
> -
>  		__entry->dev = sc->mp->m_super->s_dev;
>  		__entry->type = sc->sm->sm_type;
> -		__entry->agno = agno;
> -		__entry->bno = bno;
> +		__entry->agno = xfs_daddr_to_agno(sc->mp, daddr);
> +		__entry->agbno = xfs_daddr_to_agbno(sc->mp, daddr);
>  		__entry->ret_ip = ret_ip;
>  	),
>  	TP_printk("dev %d:%d type %s agno %u agbno %u ret_ip %pS",
>  		  MAJOR(__entry->dev), MINOR(__entry->dev),
>  		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
>  		  __entry->agno,
> -		  __entry->bno,
> +		  __entry->agbno,
>  		  __entry->ret_ip)
>  )
>  
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
index e46f5cef90da..29f1d0ac7ec5 100644
--- a/fs/xfs/scrub/trace.h
+++ b/fs/xfs/scrub/trace.h
@@ -193,29 +193,21 @@  DECLARE_EVENT_CLASS(xchk_block_error_class,
 		__field(dev_t, dev)
 		__field(unsigned int, type)
 		__field(xfs_agnumber_t, agno)
-		__field(xfs_agblock_t, bno)
+		__field(xfs_agblock_t, agbno)
 		__field(void *, ret_ip)
 	),
 	TP_fast_assign(
-		xfs_fsblock_t	fsbno;
-		xfs_agnumber_t	agno;
-		xfs_agblock_t	bno;
-
-		fsbno = XFS_DADDR_TO_FSB(sc->mp, daddr);
-		agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
-		bno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
-
 		__entry->dev = sc->mp->m_super->s_dev;
 		__entry->type = sc->sm->sm_type;
-		__entry->agno = agno;
-		__entry->bno = bno;
+		__entry->agno = xfs_daddr_to_agno(sc->mp, daddr);
+		__entry->agbno = xfs_daddr_to_agbno(sc->mp, daddr);
 		__entry->ret_ip = ret_ip;
 	),
 	TP_printk("dev %d:%d type %s agno %u agbno %u ret_ip %pS",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
 		  __entry->agno,
-		  __entry->bno,
+		  __entry->agbno,
 		  __entry->ret_ip)
 )