Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroup: Fix wrong parameter order for trace events
Date: Wed, 16 Oct 2019 10:37:08 +0300	[thread overview]
Message-ID: <f1976eb6-73d6-623e-5c16-79b036eabcb6@suse.com> (raw)
In-Reply-To: <20191016073149.23244-1-wqu@suse.com>



On 16.10.19 г. 10:31 ч., Qu Wenruo wrote:
> [BUG]
> For btrfs:qgroup_meta_reserve event, the trace event can output garbage:
> qgroup_meta_reserve: 9c7f6acc-b342-4037-bc47-7f6e4d2232d7: refroot=5(FS_TREE) type=DATA diff=2
> qgroup_meta_reserve: 9c7f6acc-b342-4037-bc47-7f6e4d2232d7: refroot=5(FS_TREE) type=0x258792 diff=2
> 
> Since we're in qgroup_meta_reserve() trace event, the @type should never
> be DATA, while diff must be aligned to sectorsize (4K in this case).
> 
> Only UUID and refroot is correct.
> 
> [CAUSE]
> There are two causes for this bug:
> 
> - Bad parameter order
>   For trace event btrfs:qgroup_meta_reserve, we're passing wrong
>   parameters.
> 
>   The correct parameters are:
>   struct btrfs_root, s64 diff, int type.
> 
>   However the used order is:
>   struct btrfs_root, int type, s64 diff.
> 
> - @type is not even assigned
>   What I was doing !? /facepalm
> 
> [FIX]
> Fix the super stupid bug.
> 
> Now everything works fine:
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PERTRANS diff=81920
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=16384
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=0
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=16384
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=-16384
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=16384
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=-16384
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=16384
> qgroup_meta_reserve: 0477ad60-9aeb-4040-8a03-1900844d46ba: refroot=5(FS_TREE) type=META_PREALLOC diff=-16384
> 
> Fixes: 4ee0d8832c2e ("btrfs: qgroup: Update trace events for metadata reservation")
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>


  reply	other threads:[~2019-10-16  7:37 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 [this message]
2019-10-16 18:40 ` David Sterba

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=f1976eb6-73d6-623e-5c16-79b036eabcb6@suse.com \
    --to=nborisov@suse.com \
    --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