Source kernel commit: fbc8d6bb875915e0afd8ff6cd4364b368a6f894f This is a quick patch to add a new tracepoint: xfs_das_state_return. We use this to track when ever a new state is set or -EAGAIN is returned Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- include/xfs_trace.h | 6 ++++++ libxfs/xfs_attr.c | 28 ++++++++++++++++++++++++++-- libxfs/xfs_attr_remote.c | 1 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/xfs_trace.h b/include/xfs_trace.h index a847b50..2169c27 100644 --- a/include/xfs_trace.h +++ b/include/xfs_trace.h @@ -312,4 +312,10 @@ #define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c)) #define trace_xfs_perag_put(a,b,c,d) ((c) = (c)) +#define trace_xfs_attr_sf_addname_return(a,b) ((void) 0) +#define trace_xfs_attr_set_iter_return(a,b) ((void) 0) +#define trace_xfs_attr_node_addname_return(a,b) ((void) 0) +#define trace_xfs_attr_remove_iter_return(a,b) ((void) 0) +#define trace_xfs_attr_rmtval_remove_return(a,b) ((void) 0) + #endif /* __TRACE_H__ */ diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 84b88f9..6380cae 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -335,6 +335,7 @@ xfs_attr_sf_addname( * the attr fork to leaf format and will restart with the leaf * add. */ + trace_xfs_attr_sf_addname_return(XFS_DAS_UNINIT, args->dp); dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -394,6 +395,8 @@ xfs_attr_set_iter( * handling code below */ dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } else if (error) { return error; @@ -418,6 +421,7 @@ xfs_attr_set_iter( dac->dela_state = XFS_DAS_FOUND_NBLK; } + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: /* @@ -445,6 +449,8 @@ xfs_attr_set_iter( error = xfs_attr_rmtval_set_blk(dac); if (error) return error; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); return -EAGAIN; } @@ -479,6 +485,7 @@ xfs_attr_set_iter( * series. */ dac->dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FLIP_LFLAG: /* @@ -496,6 +503,9 @@ xfs_attr_set_iter( dac->dela_state = XFS_DAS_RM_LBLK; if (args->rmtblkno) { error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); if (error) return error; @@ -549,6 +559,8 @@ xfs_attr_set_iter( error = xfs_attr_rmtval_set_blk(dac); if (error) return error; + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -584,6 +596,7 @@ xfs_attr_set_iter( * series */ dac->dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FLIP_NFLAG: @@ -603,6 +616,10 @@ xfs_attr_set_iter( dac->dela_state = XFS_DAS_RM_NBLK; if (args->rmtblkno) { error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); + if (error) return error; @@ -1183,6 +1200,8 @@ xfs_attr_node_addname( * this point. */ dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_node_addname_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -1429,10 +1448,13 @@ xfs_attr_remove_iter( * blocks are removed. */ error = __xfs_attr_rmtval_remove(dac); - if (error == -EAGAIN) + if (error == -EAGAIN) { + trace_xfs_attr_remove_iter_return( + dac->dela_state, args->dp); return error; - else if (error) + } else if (error) { goto out; + } /* * Refill the state structure with buffers (the prior @@ -1473,6 +1495,8 @@ xfs_attr_remove_iter( dac->flags |= XFS_DAC_DEFER_FINISH; dac->dela_state = XFS_DAS_RM_SHRINK; + trace_xfs_attr_remove_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index d474ad7..137e569 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -695,6 +695,7 @@ __xfs_attr_rmtval_remove( */ if (!done) { dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); return -EAGAIN; } -- 2.7.4