public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: Allison Henderson <allison.henderson@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v22 05/16] xfs: Add state machine tracepoints
Date: Wed, 28 Jul 2021 19:12:36 +0530	[thread overview]
Message-ID: <87v94uv9kj.fsf@garuda> (raw)
In-Reply-To: <20210727062053.11129-6-allison.henderson@oracle.com>

On 27 Jul 2021 at 11:50, Allison Henderson wrote:
> This is a quick patch to add a new xfs_attr_*_return tracepoints.  We
> use these to track when ever a new state is set or -EAGAIN is returned
>
> Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/libxfs/xfs_attr.c        | 28 ++++++++++++++++++++++++++--
>  fs/xfs/libxfs/xfs_attr_remote.c |  1 +
>  fs/xfs/xfs_trace.h              | 24 ++++++++++++++++++++++++
>  3 files changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 5040fc1..b0c6c62 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/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;

if __xfs_attr_rmtval_remove() successfully removes all the remote blocks, we
transition over to XFS_DAS_RD_LEAF state and return -EAGAIN. A tracepoint
is probably required for this as well?

>  
> @@ -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;

A transition to XFS_DAS_CLR_FLAG state probably requires a tracepoint call.

>  
> @@ -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;
> +			}
>

if the call to __xfs_attr_rmtval_remove() is successful, we transition over to
XFS_DAS_RM_NAME state and return -EAGAIN. Maybe tracepoint is required here as
well?

>  			/*
>  			 * 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/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
> index 0c8bee3..70f880d 100644
> --- a/fs/xfs/libxfs/xfs_attr_remote.c
> +++ b/fs/xfs/libxfs/xfs_attr_remote.c
> @@ -696,6 +696,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;
>  	}
>  
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index f9d8d60..f9840dd 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -3987,6 +3987,30 @@ DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
>  DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
>  DEFINE_ICLOG_EVENT(xlog_iclog_write);
>  
> +DECLARE_EVENT_CLASS(xfs_das_state_class,
> +	TP_PROTO(int das, struct xfs_inode *ip),
> +	TP_ARGS(das, ip),
> +	TP_STRUCT__entry(
> +		__field(int, das)
> +		__field(xfs_ino_t, ino)
> +	),
> +	TP_fast_assign(
> +		__entry->das = das;
> +		__entry->ino = ip->i_ino;
> +	),
> +	TP_printk("state change %d ino 0x%llx",
> +		  __entry->das, __entry->ino)
> +)
> +
> +#define DEFINE_DAS_STATE_EVENT(name) \
> +DEFINE_EVENT(xfs_das_state_class, name, \
> +	TP_PROTO(int das, struct xfs_inode *ip), \
> +	TP_ARGS(das, ip))
> +DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
> +DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
> +DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
> +DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
> +DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
>  #endif /* _TRACE_XFS_H */
>  
>  #undef TRACE_INCLUDE_PATH


-- 
chandan

  reply	other threads:[~2021-07-28 13:42 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  6:20 [PATCH v22 00/16] Delayed Attributes Allison Henderson
2021-07-27  6:20 ` [PATCH v22 01/16] xfs: allow setting and clearing of log incompat feature flags Allison Henderson
2021-07-27 12:24   ` Chandan Babu R
2021-07-28  9:01     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 02/16] xfs: clear log incompat feature bits when the log is idle Allison Henderson
2021-07-27 12:46   ` Chandan Babu R
2021-07-28  9:02     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 03/16] xfs: refactor xfs_iget calls from log intent recovery Allison Henderson
2021-07-28 11:54   ` Chandan Babu R
2021-07-30  9:17     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 04/16] xfs: Return from xfs_attr_set_iter if there are no more rmtblks to process Allison Henderson
2021-07-27 23:30   ` Darrick J. Wong
2021-07-28  9:01     ` Allison Henderson
2021-07-28 12:18   ` Chandan Babu R
2021-07-30  9:17     ` Allison Henderson
2021-08-09 17:24   ` Darrick J. Wong
2021-07-27  6:20 ` [PATCH v22 05/16] xfs: Add state machine tracepoints Allison Henderson
2021-07-28 13:42   ` Chandan Babu R [this message]
2021-07-30  9:17     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 06/16] xfs: Rename __xfs_attr_rmtval_remove Allison Henderson
2021-07-29  7:56   ` Chandan Babu R
2021-07-30  9:17     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 07/16] xfs: Handle krealloc errors in xlog_recover_add_to_cont_trans Allison Henderson
2021-07-29  8:27   ` Chandan Babu R
2021-07-30  9:17     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 08/16] xfs: Set up infrastructure for deferred attribute operations Allison Henderson
2021-07-28  0:56   ` Darrick J. Wong
2021-07-28  9:04     ` Allison Henderson
2021-07-30  4:46   ` Chandan Babu R
2021-07-30  9:17     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 09/16] xfs: Implement attr logging and replay Allison Henderson
2021-07-27  9:38   ` Chandan Babu R
2021-07-28  9:01     ` Allison Henderson
2021-07-28  0:39   ` Darrick J. Wong
2021-07-28  9:05     ` Allison Henderson
2021-07-30 12:21   ` Chandan Babu R
2021-08-02  8:33     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 10/16] RFC xfs: Skip flip flags for delayed attrs Allison Henderson
2021-07-28 19:18   ` Darrick J. Wong
2021-07-31  5:11     ` Allison Henderson
2021-08-02  7:47       ` Allison Henderson
2021-07-30 14:40   ` Chandan Babu R
2021-08-02  8:33     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 11/16] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Allison Henderson
2021-07-28 19:24   ` Darrick J. Wong
2021-08-02  8:18     ` Allison Henderson
2021-07-30 14:58   ` Chandan Babu R
2021-08-02  8:33     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 12/16] xfs: Remove unused xfs_attr_*_args Allison Henderson
2021-07-28 19:31   ` Darrick J. Wong
2021-08-02  8:11     ` Allison Henderson
2021-08-02  3:26   ` Chandan Babu R
2021-08-02  8:33     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 13/16] xfs: Add delayed attributes error tag Allison Henderson
2021-08-02  3:27   ` Chandan Babu R
2021-08-02  8:33     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 14/16] xfs: Add delattr mount option Allison Henderson
2021-07-28  0:47   ` Darrick J. Wong
2021-07-28  2:13     ` Dave Chinner
2021-07-28  9:05       ` Allison Henderson
2021-07-28  9:02     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 15/16] xfs: Merge xfs_delattr_context into xfs_attr_item Allison Henderson
2021-08-02  3:27   ` Chandan Babu R
2021-08-02  8:33     ` Allison Henderson
2021-07-27  6:20 ` [PATCH v22 16/16] xfs: Add helper function xfs_attr_leaf_addname Allison Henderson
2021-07-28 19:52   ` Darrick J. Wong
2021-08-02  8:18     ` Allison Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v94uv9kj.fsf@garuda \
    --to=chandanrlinux@gmail.com \
    --cc=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox