All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Sorenson <sorenson@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: dwysocha@redhat.com, lvaz@redhat.com
Subject: [PATCH 3/5] fs: add trace events for freeze_super() and thaw_super()
Date: Wed,  2 Mar 2016 13:01:57 -0600	[thread overview]
Message-ID: <1456945319-16283-4-git-send-email-sorenson@redhat.com> (raw)
In-Reply-To: <1456945319-16283-1-git-send-email-sorenson@redhat.com>

There is currently no visibility into when or how
a filesystem became frozen, and no record of freeze/
thaw activity.  Add tracepoints for these events.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
 include/trace/events/fs.h | 109 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 include/trace/events/fs.h

diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h
new file mode 100644
index 0000000..d7d933e
--- /dev/null
+++ b/include/trace/events/fs.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc., All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM fs
+#define TRACE_INCLUDE_FILE fs
+
+#if !defined(_TRACE_FS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_FS_H_
+#include <linux/tracepoint.h>
+
+struct block_device;
+struct super_block;
+#include <linux/fs.h>
+
+#define SUPER_ID_MAX_LEN FIELD_SIZEOF(struct super_block, s_id)
+#define FSTYPE_MAX_LEN 32 /* choose an arbitrary limit */
+
+DECLARE_EVENT_CLASS(super_freezethaw_class,
+	TP_PROTO(struct super_block *sb),
+	TP_ARGS(sb),
+	TP_STRUCT__entry(
+		__array(char,	comm,		TASK_COMM_LEN		)
+		__array(char,	super_id,	SUPER_ID_MAX_LEN	)
+		__array(char,	fstype,		FSTYPE_MAX_LEN		)
+		__field(dev_t,	dev					)
+		__field(int,	frozen					)
+		__field(pid_t,	pid					)
+	),
+	TP_fast_assign(
+		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		memcpy(__entry->super_id, sb->s_id, SUPER_ID_MAX_LEN);
+		memcpy(__entry->fstype, sb->s_type->name, FSTYPE_MAX_LEN);
+		__entry->dev = sb->s_dev;
+		__entry->frozen = sb->s_writers.frozen;
+		__entry->pid	= current->pid;
+	),
+	TP_printk("comm=%s pid=%d for %s filesystem '%s' (%d:%d) frozen=%d",
+		__entry->comm, __entry->pid, __entry->fstype,
+		__entry->super_id,
+		MAJOR(__entry->dev), MINOR(__entry->dev),
+		__entry->frozen
+	)
+);
+
+DECLARE_EVENT_CLASS(super_freezethaw_exit_class,
+	TP_PROTO(struct super_block *sb, int ret),
+	TP_ARGS(sb, ret),
+	TP_STRUCT__entry(
+		__array(char,	comm,		TASK_COMM_LEN		)
+		__array(char,	super_id,	SUPER_ID_MAX_LEN	)
+		__array(char,	fstype,		FSTYPE_MAX_LEN		)
+		__field(dev_t,	dev					)
+		__field(int,	frozen					)
+		__field(pid_t,	pid					)
+		__field(int,	ret					)
+	),
+	TP_fast_assign(
+		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+		memcpy(__entry->super_id, sb->s_id, SUPER_ID_MAX_LEN);
+		memcpy(__entry->fstype, sb->s_type->name, FSTYPE_MAX_LEN);
+		__entry->dev = sb->s_dev;
+		__entry->frozen = sb->s_writers.frozen;
+		__entry->pid	= current->pid;
+		__entry->ret = ret;
+	),
+	TP_printk("comm=%s pid=%d for %s filesystem '%s' (%d:%d) frozen=%d ret=%d",
+		__entry->comm, __entry->pid, __entry->fstype,
+		__entry->super_id,
+		MAJOR(__entry->dev), MINOR(__entry->dev),
+		__entry->frozen, __entry->ret
+	)
+);
+
+DEFINE_EVENT(super_freezethaw_class, freeze_super_enter,
+	TP_PROTO(struct super_block *sb),
+	TP_ARGS(sb)
+);
+DEFINE_EVENT(super_freezethaw_exit_class, freeze_super_exit,
+	TP_PROTO(struct super_block *sb, int ret),
+	TP_ARGS(sb, ret)
+);
+
+DEFINE_EVENT(super_freezethaw_class, thaw_super_enter,
+	TP_PROTO(struct super_block *sb),
+	TP_ARGS(sb)
+);
+DEFINE_EVENT(super_freezethaw_exit_class, thaw_super_exit,
+	TP_PROTO(struct super_block *sb, int ret),
+	TP_ARGS(sb, ret)
+);
+
+#endif /* _TRACE_FS_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
-- 
1.8.3.1


  parent reply	other threads:[~2016-03-02 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 19:01 [PATCH 0/5] Add trace events for filesystem freeze/thaw events Frank Sorenson
2016-03-02 19:01 ` [PATCH 1/5] fs: simplify freeze_super()/thaw_super() exit handling Frank Sorenson
2016-03-02 20:06   ` Al Viro
2016-03-02 19:01 ` [PATCH 2/5] fs/block_dev.c: simplify freeze_bdev() and thaw_bdev() " Frank Sorenson
2016-03-02 19:01 ` Frank Sorenson [this message]
2016-03-02 20:12   ` [PATCH 3/5] fs: add trace events for freeze_super() and thaw_super() Al Viro
2016-03-02 19:01 ` [PATCH 4/5] fs/block_dev.c: add trace events for freeze_bdev() and thaw_bdev() Frank Sorenson
2016-03-02 19:01 ` [PATCH 5/5] fs: enable filesystem freeze/thaw events Frank Sorenson
2016-03-02 20:15   ` Al Viro
2016-03-02 21:47 ` [PATCH 0/5] Add trace events for " Al Viro
2016-03-02 22:47   ` Dave Chinner
2016-03-02 23:22     ` Al Viro
2016-03-02 23:52       ` Dave Chinner
2016-03-03 11:18 ` Dave Wysochanski

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=1456945319-16283-4-git-send-email-sorenson@redhat.com \
    --to=sorenson@redhat.com \
    --cc=dwysocha@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lvaz@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.