Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 09/10] Btrfs: add tracepoint for em's EEXIST case
Date: Fri, 22 Dec 2017 11:07:18 -0800	[thread overview]
Message-ID: <20171222190718.GD21643@lim.localdomain> (raw)
In-Reply-To: <066b86a5-2836-b0a3-16b3-3c20e7ee2cf8@suse.com>

On Fri, Dec 22, 2017 at 10:56:31AM +0200, Nikolay Borisov wrote:
> 
> 
> On 22.12.2017 00:42, Liu Bo wrote:
> > This is adding a tracepoint 'btrfs_handle_em_exist' to help debug the
> > subtle bugs around merge_extent_mapping.
> 
> In the next patch you are already making the function which takes all
> these values noinline, meaning you can attach a kprobe so you can
> interrogate the args via systemtap,perf probe or even bpf. So I'd rather
> not add this tracepoint since the general sentiment seems to be that
> tracepoints are ABI and so have to be maintained.
>

The following patch of noinline function is inside the else {} branch,
so kprobe would give us something back only when it runs to else{}.

Since subtle bugs may lie in this area, a simple tracepoint like this
can help us understand them more efficiently.

thanks,
-liubo

> > 
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> > ---
> >  fs/btrfs/extent_map.c        |  1 +
> >  include/trace/events/btrfs.h | 35 +++++++++++++++++++++++++++++++++++
> >  2 files changed, 36 insertions(+)
> > 
> > diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
> > index a8b7e24..40e4d30 100644
> > --- a/fs/btrfs/extent_map.c
> > +++ b/fs/btrfs/extent_map.c
> > @@ -539,6 +539,7 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree,
> >  		ret = 0;
> >  
> >  		existing = search_extent_mapping(em_tree, start, len);
> > +		trace_btrfs_handle_em_exist(existing, em, start, len);
> >  
> >  		/*
> >  		 * existing will always be non-NULL, since there must be
> > diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
> > index 4342a32..b7ffcf7 100644
> > --- a/include/trace/events/btrfs.h
> > +++ b/include/trace/events/btrfs.h
> > @@ -249,6 +249,41 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
> >  		  __entry->refs, __entry->compress_type)
> >  );
> >  
> > +TRACE_EVENT(btrfs_handle_em_exist,
> > +
> > +	TP_PROTO(const struct extent_map *existing, const struct extent_map *map, u64 start, u64 len),
> > +
> > +	TP_ARGS(existing, map, start, len),
> > +
> > +	TP_STRUCT__entry(
> > +		__field(	u64,  e_start		)
> > +		__field(	u64,  e_len		)
> > +		__field(	u64,  map_start		)
> > +		__field(	u64,  map_len		)
> > +		__field(	u64,  start		)
> > +		__field(	u64,  len		)
> > +	),
> > +
> > +	TP_fast_assign(
> > +		__entry->e_start	= existing->start;
> > +		__entry->e_len		= existing->len;
> > +		__entry->map_start	= map->start;
> > +		__entry->map_len	= map->len;
> > +		__entry->start		= start;
> > +		__entry->len		= len;
> > +	),
> > +
> > +	TP_printk("start=%llu len=%llu "
> > +		  "existing(start=%llu len=%llu) "
> > +		  "em(start=%llu len=%llu)",
> > +		  (unsigned long long)__entry->start,
> > +		  (unsigned long long)__entry->len,
> > +		  (unsigned long long)__entry->e_start,
> > +		  (unsigned long long)__entry->e_len,
> > +		  (unsigned long long)__entry->map_start,
> > +		  (unsigned long long)__entry->map_len)
> > +);
> > +
> >  /* file extent item */
> >  DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,
> >  
> > 

  reply	other threads:[~2017-12-22 19:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 22:42 [PATCH 00/10] bugfixes and regression tests of btrfs_get_extent Liu Bo
2017-12-21 22:42 ` [PATCH 01/10] Btrfs: add helper for em merge logic Liu Bo
2017-12-22  7:23   ` Nikolay Borisov
2017-12-22 18:45     ` Liu Bo
2017-12-21 22:42 ` [PATCH 02/10] Btrfs: move extent map specific code to extent_map.c Liu Bo
2017-12-21 22:42 ` [PATCH 03/10] Btrfs: add extent map selftests Liu Bo
2017-12-22  7:42   ` Nikolay Borisov
2017-12-22 18:53     ` Liu Bo
2017-12-21 22:42 ` [PATCH 04/10] Btrfs: extent map selftest: buffered write vs dio read Liu Bo
2017-12-22  7:51   ` Nikolay Borisov
2017-12-22 18:58     ` Liu Bo
2017-12-21 22:42 ` [PATCH 05/10] Btrfs: extent map selftest: dio " Liu Bo
2017-12-21 22:42 ` [PATCH 06/10] Btrfs: fix incorrect block_len in merge_extent_mapping Liu Bo
2017-12-21 22:42 ` [PATCH 07/10] Btrfs: fix unexpected EEXIST from btrfs_get_extent Liu Bo
2017-12-22 12:10   ` Nikolay Borisov
2017-12-22 19:19     ` Liu Bo
2017-12-21 22:42 ` [PATCH 08/10] Btrfs: add WARN_ONCE to detect unexpected error from merge_extent_mapping Liu Bo
2017-12-22  8:52   ` Nikolay Borisov
2017-12-21 22:42 ` [PATCH 09/10] Btrfs: add tracepoint for em's EEXIST case Liu Bo
2017-12-22  8:56   ` Nikolay Borisov
2017-12-22 19:07     ` Liu Bo [this message]
2017-12-23  7:39       ` Nikolay Borisov
2018-01-02 18:02         ` Liu Bo
2017-12-21 22:42 ` [PATCH 10/10] Btrfs: noinline merge_extent_mapping Liu Bo

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=20171222190718.GD21643@lim.localdomain \
    --to=bo.li.liu@oracle.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