All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Li Zefan <lizf@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, hpa@zytor.com,
	mingo@redhat.com, lizf@cn.fujitsu.com, tytso@mit.edu,
	jens.axboe@oracle.com, duyuyang@gmail.com, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:tracing/core] blktrace: add trace/ to /sys/block/sda
Date: Thu, 16 Apr 2009 16:15:43 GMT	[thread overview]
Message-ID: <tip-1d54ad6da9192fed5dd3b60224d9f2dfea0dcd82@git.kernel.org> (raw)
In-Reply-To: <49E42665.6020506@cn.fujitsu.com>

Commit-ID:  1d54ad6da9192fed5dd3b60224d9f2dfea0dcd82
Gitweb:     http://git.kernel.org/tip/1d54ad6da9192fed5dd3b60224d9f2dfea0dcd82
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Tue, 14 Apr 2009 14:00:05 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 16 Apr 2009 10:10:59 +0200

blktrace: add trace/ to /sys/block/sda

Impact: allow ftrace-plugin blktrace to trace device-mapper devices

To trace a single partition:
  # echo 1 > /sys/block/sda/sda1/enable

To trace the whole sda instead:
  # echo 1 > /sys/block/sda/enable

Thus we also fix an issue reported by Ted, that ftrace-plugin blktrace
can't be used to trace device-mapper devices.

Now:

  # echo 1 > /sys/block/dm-0/trace/enable
  echo: write error: No such device or address
  # mount -t ext4 /dev/dm-0 /mnt
  # echo 1 > /sys/block/dm-0/trace/enable
  # echo blk > /debug/tracing/current_tracer

Reported-by: Theodore Tso <tytso@mit.edu>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Shawn Du <duyuyang@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
LKML-Reference: <49E42665.6020506@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 block/blk-sysfs.c            |    7 ++++++-
 include/linux/blktrace_api.h |    6 ++++++
 kernel/trace/blktrace.c      |    5 +++++
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 73f36be..8653d71 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -387,16 +387,21 @@ struct kobj_type blk_queue_ktype = {
 int blk_register_queue(struct gendisk *disk)
 {
 	int ret;
+	struct device *dev = disk_to_dev(disk);
 
 	struct request_queue *q = disk->queue;
 
 	if (WARN_ON(!q))
 		return -ENXIO;
 
+	ret = blk_trace_init_sysfs(dev);
+	if (ret)
+		return ret;
+
 	if (!q->request_fn)
 		return 0;
 
-	ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
+	ret = kobject_add(&q->kobj, kobject_get(&dev->kobj),
 			  "%s", "queue");
 	if (ret < 0)
 		return ret;
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 267edc4..62763c9 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -198,6 +198,7 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 			   char __user *arg);
 extern int blk_trace_startstop(struct request_queue *q, int start);
 extern int blk_trace_remove(struct request_queue *q);
+extern int blk_trace_init_sysfs(struct device *dev);
 
 extern struct attribute_group blk_trace_attr_group;
 
@@ -210,6 +211,11 @@ extern struct attribute_group blk_trace_attr_group;
 # define blk_trace_startstop(q, start)			(-ENOTTY)
 # define blk_trace_remove(q)				(-ENOTTY)
 # define blk_add_trace_msg(q, fmt, ...)			do { } while (0)
+static inline int blk_trace_init_sysfs(struct device *dev)
+{
+	return 0;
+}
+
 #endif /* CONFIG_BLK_DEV_IO_TRACE */
 
 #endif /* __KERNEL__ */
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index d109898..8e7c5da 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1644,3 +1644,8 @@ out:
 	return ret ? ret : count;
 }
 
+int blk_trace_init_sysfs(struct device *dev)
+{
+	return sysfs_create_group(&dev->kobj, &blk_trace_attr_group);
+}
+

  parent reply	other threads:[~2009-04-16 16:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14  5:58 PATCH 1/3] blktrace: support per-partition tracing Li Zefan
2009-04-14  5:58 ` Li Zefan
2009-04-14  5:59 ` [PATCH 2/3] blktrace: support per-partition tracing for ftrace plugin Li Zefan
2009-04-14  5:59   ` Li Zefan
2009-04-15 10:13   ` [tip:tracing/core] " tip-bot for Li Zefan
2009-04-16 16:15   ` tip-bot for Li Zefan
2009-04-14  6:00 ` [PATCH 3/3] blktrace: add trace/ to /sys/block/sda Li Zefan
2009-04-14  6:00   ` Li Zefan
2009-04-15 10:13   ` [tip:tracing/core] " tip-bot for Li Zefan
2009-04-16 16:15   ` tip-bot for Li Zefan [this message]
2009-04-14  7:59 ` PATCH 1/3] blktrace: support per-partition tracing Ingo Molnar
2009-04-14  7:59   ` Ingo Molnar
2009-04-14  8:14   ` Li Zefan
2009-04-14  8:14     ` Li Zefan
2009-04-14  8:34     ` Ingo Molnar
2009-04-14  8:34       ` Ingo Molnar
2009-04-14  8:09 ` Ingo Molnar
2009-04-14  8:09   ` Ingo Molnar
2009-04-14  8:27   ` Li Zefan
2009-04-14  8:27     ` Li Zefan
2009-04-14  8:38     ` Ingo Molnar
2009-04-14  8:38       ` Ingo Molnar
2009-04-14  8:53       ` Li Zefan
2009-04-14  8:53         ` Li Zefan
2009-04-14  9:43         ` Ingo Molnar
2009-04-14  9:43           ` Ingo Molnar
2009-04-15 10:12 ` [tip:tracing/core] " tip-bot for Shawn Du
2009-04-16 16:15 ` tip-bot for Shawn Du

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=tip-1d54ad6da9192fed5dd3b60224d9f2dfea0dcd82@git.kernel.org \
    --to=lizf@cn.fujitsu.com \
    --cc=acme@redhat.com \
    --cc=duyuyang@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    /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.