mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Christoph Hellwig <hch@lst.de>,
	Naohiro Aota <naohiro.aota@wdc.com>, Qu Wenruo <wqu@suse.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 10/11] btrfs: add trace events for RST
Date: Tue, 12 Sep 2023 22:46:41 +0200	[thread overview]
Message-ID: <20230912204641.GG20408@twin.jikos.cz> (raw)
In-Reply-To: <20230911-raid-stripe-tree-v8-10-647676fa852c@wdc.com>

On Mon, Sep 11, 2023 at 05:52:11AM -0700, Johannes Thumshirn wrote:
> Add trace events for raid-stripe-tree operations.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  fs/btrfs/raid-stripe-tree.c  |  8 +++++
>  include/trace/events/btrfs.h | 75 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 83 insertions(+)
> 
> diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c
> index 7ed02e4b79ec..5a9952cf557c 100644
> --- a/fs/btrfs/raid-stripe-tree.c
> +++ b/fs/btrfs/raid-stripe-tree.c
> @@ -62,6 +62,9 @@ int btrfs_delete_raid_extent(struct btrfs_trans_handle *trans, u64 start,
>  		if (found_end <= start)
>  			break;
>  
> +		trace_btrfs_raid_extent_delete(fs_info, start, end,
> +					       found_start, found_end);
> +
>  		ASSERT(found_start >= start && found_end <= end);
>  		ret = btrfs_del_item(trans, stripe_root, path);
>  		if (ret)
> @@ -120,6 +123,8 @@ static int btrfs_insert_one_raid_extent(struct btrfs_trans_handle *trans,
>  		return -ENOMEM;
>  	}
>  
> +	trace_btrfs_insert_one_raid_extent(fs_info, bioc->logical, bioc->size,
> +					   num_stripes);
>  	btrfs_set_stack_stripe_extent_encoding(stripe_extent, encoding);
>  	for (int i = 0; i < num_stripes; i++) {
>  		u64 devid = bioc->stripes[i].dev->devid;
> @@ -445,6 +450,9 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info,
>  
>  		stripe->physical = physical + offset;
>  
> +		trace_btrfs_get_raid_extent_offset(fs_info, logical, *length,
> +						   stripe->physical, devid);
> +
>  		ret = 0;
>  		goto free_path;
>  	}
> diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> index b2db2c2f1c57..e2c6f1199212 100644
> --- a/include/trace/events/btrfs.h
> +++ b/include/trace/events/btrfs.h
> @@ -2497,6 +2497,81 @@ DEFINE_EVENT(btrfs_raid56_bio, raid56_write,
>  	TP_ARGS(rbio, bio, trace_info)
>  );
>  
> +TRACE_EVENT(btrfs_insert_one_raid_extent,
> +
> +	TP_PROTO(struct btrfs_fs_info *fs_info, u64 logical, u64 length,

const struct fs_info

> +		 int num_stripes),
> +
> +	TP_ARGS(fs_info, logical, length, num_stripes),
> +
> +	TP_STRUCT__entry_btrfs(
> +		__field(	u64,	logical		)
> +		__field(	u64,	length		)
> +		__field(	int,	num_stripes	)
> +	),
> +
> +	TP_fast_assign_btrfs(fs_info,
> +		__entry->logical	= logical;
> +		__entry->length		= length;
> +		__entry->num_stripes	= num_stripes;
> +	),
> +
> +	TP_printk_btrfs("logical=%llu, length=%llu, num_stripes=%d",
> +			__entry->logical, __entry->length,
> +			__entry->num_stripes)

Tracepoint messages should follow the formatting guidelines
https://btrfs.readthedocs.io/en/latest/dev/Development-notes.html#tracepoints

> +);
> +
> +TRACE_EVENT(btrfs_raid_extent_delete,
> +
> +	TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 end,
> +		 u64 found_start, u64 found_end),
> +
> +	TP_ARGS(fs_info, start, end, found_start, found_end),
> +
> +	TP_STRUCT__entry_btrfs(
> +		__field(	u64,	start		)
> +		__field(	u64,	end		)
> +		__field(	u64,	found_start	)
> +		__field(	u64,	found_end	)
> +	),
> +
> +	TP_fast_assign_btrfs(fs_info,
> +		__entry->start	=	start;
> +		__entry->end	=	end;
> +		__entry->found_start =	found_start;
> +		__entry->found_end =	found_end;

Tracepoints follow the fancy spacing and alignment in the assign blocks.

> +	),
> +
> +	TP_printk_btrfs("start=%llu, end=%llu, found_start=%llu, found_end=%llu",
> +			__entry->start, __entry->end, __entry->found_start,
> +			__entry->found_end)
> +);

  reply	other threads:[~2023-09-12 20:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 12:52 [PATCH v8 00/11] btrfs: introduce RAID stripe tree Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 01/11] btrfs: add raid stripe tree definitions Johannes Thumshirn
2023-09-11 21:00   ` Damien Le Moal
2023-09-12  6:09     ` Johannes Thumshirn
2023-09-12 20:32   ` David Sterba
2023-09-13  6:02     ` Johannes Thumshirn
2023-09-13 14:49       ` David Sterba
2023-09-13 14:57         ` Johannes Thumshirn
2023-09-13 16:06           ` David Sterba
2023-09-11 12:52 ` [PATCH v8 02/11] btrfs: read raid-stripe-tree from disk Johannes Thumshirn
2023-09-14  9:27   ` Qu Wenruo
2023-09-14  9:33     ` Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 03/11] btrfs: add support for inserting raid stripe extents Johannes Thumshirn
2023-09-13 16:50   ` David Sterba
2023-09-13 16:57   ` David Sterba
2023-09-14  9:25   ` Qu Wenruo
2023-09-14  9:51     ` Johannes Thumshirn
2023-09-14 10:06       ` Qu Wenruo
2023-09-14 15:35         ` Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 04/11] btrfs: delete stripe extent on extent deletion Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 05/11] btrfs: lookup physical address from stripe extent Johannes Thumshirn
2023-09-14  9:18   ` Qu Wenruo
2023-09-14  9:45     ` Johannes Thumshirn
2023-09-14 14:16     ` Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 06/11] btrfs: implement RST version of scrub Johannes Thumshirn
2023-09-13  9:51   ` Qu Wenruo
2023-09-13 16:59   ` David Sterba
2023-09-11 12:52 ` [PATCH v8 07/11] btrfs: zoned: allow zoned RAID Johannes Thumshirn
2023-09-12 20:49   ` David Sterba
2023-09-13  5:41     ` Johannes Thumshirn
2023-09-13 14:52       ` David Sterba
2023-09-13 14:59         ` Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 08/11] btrfs: add raid stripe tree pretty printer Johannes Thumshirn
2023-09-12 20:42   ` David Sterba
2023-09-13  5:34     ` Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 09/11] btrfs: announce presence of raid-stripe-tree in sysfs Johannes Thumshirn
2023-09-11 12:52 ` [PATCH v8 10/11] btrfs: add trace events for RST Johannes Thumshirn
2023-09-12 20:46   ` David Sterba [this message]
2023-09-11 12:52 ` [PATCH v8 11/11] btrfs: add raid-stripe-tree to features enabled with debug Johannes Thumshirn

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=20230912204641.GG20408@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dlemoal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --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

all inboxes | Powered by JetHome®