Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroup: Fix wrong parameter order for trace events
Date: Wed, 16 Oct 2019 20:40:44 +0200	[thread overview]
Message-ID: <20191016184043.GC2751@twin.jikos.cz> (raw)
In-Reply-To: <20191016073149.23244-1-wqu@suse.com>

On Wed, Oct 16, 2019 at 03:31:49PM +0800, Qu Wenruo wrote:
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -3629,7 +3629,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes,
>  		return 0;
>  
>  	BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
> -	trace_qgroup_meta_reserve(root, type, (s64)num_bytes);
> +	trace_qgroup_meta_reserve(root, (s64)num_bytes, type);
>  	ret = qgroup_reserve(root, num_bytes, enforce, type);
>  	if (ret < 0)
>  		return ret;
> @@ -3676,7 +3676,7 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes,
>  	 */
>  	num_bytes = sub_root_meta_rsv(root, num_bytes, type);
>  	BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
> -	trace_qgroup_meta_reserve(root, type, -(s64)num_bytes);
> +	trace_qgroup_meta_reserve(root, -(s64)num_bytes, type);
>  	btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid,
>  				  num_bytes, type);
>  }

It would be good to split the changes, one is swapping the order and the
other fixing the uninitialized type.

> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> index 5df604de4f11..0ebcaa153f93 100644
> --- a/include/trace/events/btrfs.h
> +++ b/include/trace/events/btrfs.h
> @@ -1710,6 +1710,7 @@ TRACE_EVENT(qgroup_meta_reserve,
>  	TP_fast_assign_btrfs(root->fs_info,
>  		__entry->refroot	= root->root_key.objectid;
>  		__entry->diff		= diff;
> +		__entry->type		= type;

And there's more, missing type assignment in qgroup_update_reserve,
redundant entry::type in qgroup_meta_convert.

I've briefly checked more tracepoint initialization, seems ok. It really
helps to have the same order for definition and for the assignments.

      parent reply	other threads:[~2019-10-16 18:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  7:31 [PATCH] btrfs: qgroup: Fix wrong parameter order for trace events Qu Wenruo
2019-10-16  7:37 ` Nikolay Borisov
2019-10-16 18:40 ` David Sterba [this message]

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=20191016184043.GC2751@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@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