[lttng-dev] [PATCH lttng-modules 3/3] Fix: Update btrfs instrumentation for v4.15

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Jan 9 21:29:55 UTC 2018


----- On Jan 9, 2018, at 3:43 PM, Michael Jeanson mjeanson at efficios.com wrote:

> See upstream commit:
> 
>  commit d278850eff3053ef166cf64c16f798dfe36278a2
>  Author: Josef Bacik <josef at toxicpanda.com>
>  Date:   Fri Sep 29 15:43:57 2017 -0400
> 
>    btrfs: remove delayed_ref_node from ref_head
> 
>    This is just excessive information in the ref_head, and makes the code
>    complicated.  It is a relic from when we had the heads and the refs in
>    the same tree, which is no longer the case.  With this removal I've
>    cleaned up a bunch of the cruft around this old assumption as well.

In 3.12, this becomes a DECLARE_EVENT_CLASS with associated DEFINE_EVENT
using the class. Example code snippet from a 4.15-rc kernel:

DECLARE_EVENT_CLASS(btrfs_delayed_ref_head,

        TP_PROTO(const struct btrfs_fs_info *fs_info,
                 const struct btrfs_delayed_ref_head *head_ref,
                 int action),

        TP_ARGS(fs_info, head_ref, action),

        TP_STRUCT__entry_btrfs(
                __field(        u64,  bytenr            )
                __field(        u64,  num_bytes         )
                __field(        int,  action            )
                __field(        int,  is_data           )
        ),

        TP_fast_assign_btrfs(fs_info,
                __entry->bytenr         = head_ref->bytenr;
                __entry->num_bytes      = head_ref->num_bytes;
                __entry->action         = action;
                __entry->is_data        = head_ref->is_data;
        ),

        TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d",
                  (unsigned long long)__entry->bytenr,
                  (unsigned long long)__entry->num_bytes,
                  show_ref_action(__entry->action),
                  __entry->is_data)
);

DEFINE_EVENT(btrfs_delayed_ref_head,  add_delayed_ref_head,

        TP_PROTO(const struct btrfs_fs_info *fs_info,
                 const struct btrfs_delayed_ref_head *head_ref,
                 int action),

        TP_ARGS(fs_info, head_ref, action)
);

DEFINE_EVENT(btrfs_delayed_ref_head,  run_delayed_ref_head,

        TP_PROTO(const struct btrfs_fs_info *fs_info,
                 const struct btrfs_delayed_ref_head *head_ref,
                 int action),

        TP_ARGS(fs_info, head_ref, action)
);

It appears that this instrumentation has not been hooked on any actual
tracepoint for quite some time in lttng-modules.

We should adapt the lttng-modules instrumentation accordingly. I would
not be surprised that the 4.8.0 kernel version range is also incorrect:
it should apply to the "new" events based on the tracepoint class.

Thanks,

Mathieu

> 
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
> instrumentation/events/lttng-module/btrfs.h | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/instrumentation/events/lttng-module/btrfs.h
> b/instrumentation/events/lttng-module/btrfs.h
> index b529e8e..7901f05 100644
> --- a/instrumentation/events/lttng-module/btrfs.h
> +++ b/instrumentation/events/lttng-module/btrfs.h
> @@ -680,7 +680,23 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_data_ref,
> 	)
> )
> 
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> +LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
> +
> +	TP_PROTO(struct btrfs_fs_info *fs_info,
> +		 struct btrfs_delayed_ref_head *head_ref,
> +		 int action),
> +
> +	TP_ARGS(fs_info, head_ref, action),
> +
> +	TP_FIELDS(
> +		ctf_integer(u64, bytenr, head_ref->bytenr)
> +		ctf_integer(u64, num_bytes, head_ref->num_bytes)
> +		ctf_integer(int, action, action)
> +		ctf_integer(int, is_data, head_ref->is_data)
> +	)
> +)
> +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
> LTTNG_TRACEPOINT_EVENT(btrfs_delayed_ref_head,
> 
> 	TP_PROTO(struct btrfs_fs_info *fs_info,
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list