public inbox for linux-btrfs@vger.kernel.org
 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: trace: Add trace points for unused block groups
Date: Thu, 26 Apr 2018 15:24:59 +0200	[thread overview]
Message-ID: <20180426132459.GU21272@twin.jikos.cz> (raw)
In-Reply-To: <20180426091720.24185-1-wqu@suse.com>

On Thu, Apr 26, 2018 at 05:17:20PM +0800, Qu Wenruo wrote:
> This patch will add the following trace events:
> 1) btrfs_remove_block_group
>    For btrfs_remove_block_group() function.
>    Triggered when a block group is really removed.
> 
> 2) btrfs_add_unused_block_group
>    Triggered which block group is added to unused_bgs list.
> 
> 3) btrfs_skip_unused_block_group
>    Triggered which unused block group is not deleted.
> 
> These trace events is pretty handy to debug case related to block group
> auto remove.

Sounds useful.

> Signed-off-by: Qu Wenruo <wqu@suse.com>

> +DECLARE_EVENT_CLASS(btrfs__block_group,
> +	TP_PROTO(const struct btrfs_block_group_cache *bg_cache),
> +
> +	TP_ARGS(bg_cache),
> +
> +	TP_STRUCT__entry_btrfs(
> +		__field(	u64,	bytenr		)
> +		__field(	u64,	flags		)
> +		__field(	u64,	len		)
> +		__field(	u64,	used		)
> +	),
> +
> +	TP_fast_assign_btrfs(bg_cache->fs_info,
> +		__entry->bytenr = bg_cache->key.objectid,
> +		__entry->len	= bg_cache->key.offset,
> +		__entry->flags	= bg_cache->flags;
> +		__entry->used	= btrfs_block_group_used(&bg_cache->item);
> +	),
> +
> +	TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)",
> +		__entry->bytenr, __entry->len, __entry->used, __entry->flags,
> +		__print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS))

I've reorered the fields so they're sorted the same way in all 3
sections, as defined in the printk (bytenr, len, used, flags).

Reviewed-by: David Sterba <dsterba@suse.com>

      reply	other threads:[~2018-04-26 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26  9:17 [PATCH] btrfs: trace: Add trace points for unused block groups Qu Wenruo
2018-04-26 13:24 ` 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=20180426132459.GU21272@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