linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
	Nikolay Borisov <nborisov@suse.com>
Subject: Re: [PATCH v3 11/12] btrfs: adjust the flush trace point to include the source
Date: Tue, 26 Jan 2021 20:13:49 +0100	[thread overview]
Message-ID: <20210126191349.GX1993@twin.jikos.cz> (raw)
In-Reply-To: <cbc33fd7a2d39ca651ba1f1e44345663f5c369cc.1602249928.git.josef@toxicpanda.com>

On Fri, Oct 09, 2020 at 09:28:28AM -0400, Josef Bacik wrote:
> Since we have normal ticketed flushing and preemptive flushing, adjust
> the tracepoint so that we know the source of the flushing action to make
> it easier to debug problems.
> 
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  fs/btrfs/space-info.c        | 20 ++++++++++++--------
>  include/trace/events/btrfs.h | 10 ++++++----
>  2 files changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 5ee698c12a7b..30474fa30985 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -664,7 +664,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,
>   */
>  static void flush_space(struct btrfs_fs_info *fs_info,
>  		       struct btrfs_space_info *space_info, u64 num_bytes,
> -		       enum btrfs_flush_state state)
> +		       enum btrfs_flush_state state, bool for_preempt)
>  {
>  	struct btrfs_root *root = fs_info->extent_root;
>  	struct btrfs_trans_handle *trans;
> @@ -747,7 +747,7 @@ static void flush_space(struct btrfs_fs_info *fs_info,
>  	}
>  
>  	trace_btrfs_flush_space(fs_info, space_info->flags, num_bytes, state,
> -				ret);
> +				ret, for_preempt);
>  	return;
>  }
>  
> @@ -973,7 +973,8 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work)
>  
>  	flush_state = FLUSH_DELAYED_ITEMS_NR;
>  	do {
> -		flush_space(fs_info, space_info, to_reclaim, flush_state);
> +		flush_space(fs_info, space_info, to_reclaim, flush_state,
> +			    false);
>  		spin_lock(&space_info->lock);
>  		if (list_empty(&space_info->tickets)) {
>  			space_info->flush = 0;
> @@ -1109,7 +1110,7 @@ static void btrfs_preempt_reclaim_metadata_space(struct work_struct *work)
>  		to_reclaim >>= 2;
>  		if (!to_reclaim)
>  			to_reclaim = btrfs_calc_insert_metadata_size(fs_info, 1);
> -		flush_space(fs_info, space_info, to_reclaim, flush);
> +		flush_space(fs_info, space_info, to_reclaim, flush, true);
>  		cond_resched();
>  		spin_lock(&space_info->lock);
>  	}
> @@ -1200,7 +1201,8 @@ static void btrfs_async_reclaim_data_space(struct work_struct *work)
>  	spin_unlock(&space_info->lock);
>  
>  	while (!space_info->full) {
> -		flush_space(fs_info, space_info, U64_MAX, ALLOC_CHUNK_FORCE);
> +		flush_space(fs_info, space_info, U64_MAX, ALLOC_CHUNK_FORCE,
> +			    false);
>  		spin_lock(&space_info->lock);
>  		if (list_empty(&space_info->tickets)) {
>  			space_info->flush = 0;
> @@ -1213,7 +1215,7 @@ static void btrfs_async_reclaim_data_space(struct work_struct *work)
>  
>  	while (flush_state < ARRAY_SIZE(data_flush_states)) {
>  		flush_space(fs_info, space_info, U64_MAX,
> -			    data_flush_states[flush_state]);
> +			    data_flush_states[flush_state], false);
>  		spin_lock(&space_info->lock);
>  		if (list_empty(&space_info->tickets)) {
>  			space_info->flush = 0;
> @@ -1286,7 +1288,8 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info,
>  
>  	flush_state = 0;
>  	do {
> -		flush_space(fs_info, space_info, to_reclaim, states[flush_state]);
> +		flush_space(fs_info, space_info, to_reclaim, states[flush_state],
> +			    false);
>  		flush_state++;
>  		spin_lock(&space_info->lock);
>  		if (ticket->bytes == 0) {
> @@ -1302,7 +1305,8 @@ static void priority_reclaim_data_space(struct btrfs_fs_info *fs_info,
>  					struct reserve_ticket *ticket)
>  {
>  	while (!space_info->full) {
> -		flush_space(fs_info, space_info, U64_MAX, ALLOC_CHUNK_FORCE);
> +		flush_space(fs_info, space_info, U64_MAX, ALLOC_CHUNK_FORCE,
> +			    false);
>  		spin_lock(&space_info->lock);
>  		if (ticket->bytes == 0) {
>  			spin_unlock(&space_info->lock);
> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> index 0a3d35d952c4..6d93637bae02 100644
> --- a/include/trace/events/btrfs.h
> +++ b/include/trace/events/btrfs.h
> @@ -1112,15 +1112,16 @@ TRACE_EVENT(btrfs_trigger_flush,
>  TRACE_EVENT(btrfs_flush_space,
>  
>  	TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes,
> -		 int state, int ret),
> +		 int state, int ret, int for_preempt),

for_preempt should be bool

>  
> -	TP_ARGS(fs_info, flags, num_bytes, state, ret),
> +	TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt),
>  
>  	TP_STRUCT__entry_btrfs(
>  		__field(	u64,	flags			)
>  		__field(	u64,	num_bytes		)
>  		__field(	int,	state			)
>  		__field(	int,	ret			)
> +		__field(	int,	for_preempt		)
>  	),
>  
>  	TP_fast_assign_btrfs(fs_info,
> @@ -1128,15 +1129,16 @@ TRACE_EVENT(btrfs_flush_space,
>  		__entry->num_bytes	=	num_bytes;
>  		__entry->state		=	state;
>  		__entry->ret		=	ret;
> +		__entry->for_preempt	=	for_preempt;
>  	),
>  
> -	TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d",
> +	TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d",
>  		  __entry->state,
>  		  __print_symbolic(__entry->state, FLUSH_STATES),
>  		  __entry->flags,
>  		  __print_flags((unsigned long)__entry->flags, "|",
>  				BTRFS_GROUP_FLAGS),
> -		  __entry->num_bytes, __entry->ret)
> +		  __entry->num_bytes, __entry->ret, __entry->for_preempt)
>  );
>  
>  DECLARE_EVENT_CLASS(btrfs__reserved_extent,
> -- 
> 2.26.2

  reply	other threads:[~2021-01-27 10:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09 13:28 [PATCH v3 00/12] Improve preemptive ENOSPC flushing Josef Bacik
2020-10-09 13:28 ` [PATCH v3 01/12] btrfs: make flush_space take a enum btrfs_flush_state instead of int Josef Bacik
2020-10-12 13:49   ` Nikolay Borisov
2021-01-26 18:36   ` David Sterba
2021-01-26 20:32     ` Josef Bacik
2021-01-27 15:27       ` David Sterba
2020-10-09 13:28 ` [PATCH v3 02/12] btrfs: add a trace point for reserve tickets Josef Bacik
2021-01-26 19:41   ` David Sterba
2020-10-09 13:28 ` [PATCH v3 03/12] btrfs: track ordered bytes instead of just dio ordered bytes Josef Bacik
2020-10-12 13:50   ` Nikolay Borisov
2020-10-09 13:28 ` [PATCH v3 04/12] btrfs: introduce a FORCE_COMMIT_TRANS flush operation Josef Bacik
2020-10-12 13:50   ` Nikolay Borisov
2020-10-29 17:03   ` David Sterba
2021-01-26 18:41     ` David Sterba
2020-10-09 13:28 ` [PATCH v3 05/12] btrfs: improve preemptive background space flushing Josef Bacik
2020-10-13 11:29   ` Nikolay Borisov
2020-10-09 13:28 ` [PATCH v3 06/12] btrfs: rename need_do_async_reclaim Josef Bacik
2021-01-26 18:51   ` David Sterba
2020-10-09 13:28 ` [PATCH v3 07/12] btrfs: check reclaim_size in need_preemptive_reclaim Josef Bacik
2020-10-09 13:28 ` [PATCH v3 08/12] btrfs: rework btrfs_calc_reclaim_metadata_size Josef Bacik
2020-10-09 13:28 ` [PATCH v3 09/12] btrfs: simplify the logic in need_preemptive_flushing Josef Bacik
2020-10-13 12:18   ` Nikolay Borisov
2020-10-09 13:28 ` [PATCH v3 10/12] btrfs: implement space clamping for preemptive flushing Josef Bacik
2020-10-29 17:48   ` David Sterba
2020-10-09 13:28 ` [PATCH v3 11/12] btrfs: adjust the flush trace point to include the source Josef Bacik
2021-01-26 19:13   ` David Sterba [this message]
2020-10-09 13:28 ` [PATCH v3 12/12] btrfs: add a trace class for dumping the current ENOSPC state Josef Bacik

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=20210126191349.GX1993@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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;
as well as URLs for NNTP newsgroup(s).