From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH lttng-modules v2] Fix: writeback probe on RHEL >= 3.10.0-327.10.1
Date: Thu, 21 Apr 2016 21:42:47 +0000 (UTC) [thread overview]
Message-ID: <1753860673.66478.1461274967274.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <1461269464-7575-1-git-send-email-mjeanson@efficios.com>
Merged into master, 2.7 and 2.8, thanks!
Mathieu
----- On Apr 21, 2016, at 4:11 PM, Michael Jeanson mjeanson at efficios.com wrote:
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
> instrumentation/events/lttng-module/writeback.h | 37 ++++++++++++++++++-------
> 1 file changed, 27 insertions(+), 10 deletions(-)
>
> diff --git a/instrumentation/events/lttng-module/writeback.h
> b/instrumentation/events/lttng-module/writeback.h
> index a215f55..6006c29 100644
> --- a/instrumentation/events/lttng-module/writeback.h
> +++ b/instrumentation/events/lttng-module/writeback.h
> @@ -13,17 +13,34 @@
> #ifndef _TRACE_WRITEBACK_DEF_
> #define _TRACE_WRITEBACK_DEF_
>
> -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) && \
> - LTTNG_RHEL_VERSION_CODE < LTTNG_RHEL_KERNEL_VERSION(3,10,0,327,10,1))
> -static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
> +/*
> + * Vanilla kernels before 4.0 do not implement inode_to_bdi
> + * RHEL kernels before 3.10.0-327.10.1 do not implement inode_to_bdi
> + * RHEL kernel 3.10.0-327.10.1 has inode_to_bdi
> + * RHEL kernel 3.10.0-327.13.1 includes a partial merge of upstream
> + * commit a212b105b07d75b48b1a166378282e8a77fbf53d which inlines
> + * inode_to_bdi but not sb_is_blkdev_sb making it unusable by modules.
> + */
> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
> +static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> {
> - struct super_block *sb = inode->i_sb;
> + struct super_block *sb;
> +
> + if (!inode)
> + return &noop_backing_dev_info;
> +
> + sb = inode->i_sb;
>
> if (strcmp(sb->s_type->name, "bdev") == 0)
> return inode->i_mapping->backing_dev_info;
>
> return sb->s_bdi;
> }
> +#else
> +static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> +{
> + return inode_to_bdi(inode);
> +}
> #endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
>
> #endif
> @@ -65,7 +82,7 @@ LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
> TP_ARGS(page, mapping),
> TP_FIELDS(
> ctf_array_text(char, name,
> - mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32)
> + mapping ? dev_name(lttng_inode_to_bdi(mapping->host)->dev) : "(unknown)",
> 32)
> ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
> ctf_integer(pgoff_t, index, page->index)
> )
> @@ -77,8 +94,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
> TP_FIELDS(
> /* may be called for files on pseudo FSes w/ unregistered bdi */
> ctf_array_text(char, name,
> - inode_to_bdi(inode)->dev ?
> - dev_name(inode_to_bdi(inode)->dev) : "(unknown)", 32)
> + lttng_inode_to_bdi(inode)->dev ?
> + dev_name(lttng_inode_to_bdi(inode)->dev) : "(unknown)", 32)
> ctf_integer(unsigned long, ino, inode->i_ino)
> ctf_integer(unsigned long, state, inode->i_state)
> ctf_integer(unsigned long, flags, flags)
> @@ -97,7 +114,7 @@ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
> TP_ARGS(inode, wbc),
> TP_FIELDS(
> ctf_array_text(char, name,
> - dev_name(inode_to_bdi(inode)->dev), 32)
> + dev_name(lttng_inode_to_bdi(inode)->dev), 32)
> ctf_integer(unsigned long, ino, inode->i_ino)
> ctf_integer(int, sync_mode, wbc->sync_mode)
> )
> @@ -609,7 +626,7 @@ LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
>
> TP_FIELDS(
> ctf_array_text(char, name,
> - dev_name(inode_to_bdi(inode)->dev), 32)
> + dev_name(lttng_inode_to_bdi(inode)->dev), 32)
> ctf_integer(unsigned long, ino, inode->i_ino)
> ctf_integer(unsigned long, state, inode->i_state)
> ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
> @@ -657,7 +674,7 @@
> LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
>
> TP_FIELDS(
> ctf_array_text(char, name,
> - dev_name(inode_to_bdi(inode)->dev), 32)
> + dev_name(lttng_inode_to_bdi(inode)->dev), 32)
> ctf_integer(unsigned long, ino, inode->i_ino)
> ctf_integer(unsigned long, state, inode->i_state)
> ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
> --
> 2.7.4
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
prev parent reply other threads:[~2016-04-21 21:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 20:11 Michael Jeanson
2016-04-21 21:42 ` Mathieu Desnoyers [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=1753860673.66478.1461274967274.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.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