From: 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, jens.axboe@oracle.com,
fweisbec@gmail.com, rostedt@goodmis.org, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:tracing/blktrace] blktrace: fix the original blktrace
Date: Wed, 25 Mar 2009 11:54:43 GMT [thread overview]
Message-ID: <tip-29d661309424188942aeea9edcd362c1bd7414ab@git.kernel.org> (raw)
In-Reply-To: <49C9F796.9040503@cn.fujitsu.com>
Commit-ID: 29d661309424188942aeea9edcd362c1bd7414ab
Gitweb: http://git.kernel.org/tip/29d661309424188942aeea9edcd362c1bd7414ab
Author: Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Wed, 25 Mar 2009 17:21:26 +0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 25 Mar 2009 12:05:39 +0100
blktrace: fix the original blktrace
Currently the original blktrace, which is using relay and is used via
ioctl, is broken. You can use ftrace to see the output of blktrace,
but user-space blktrace is unusable.
It's broken by "blktrace: add ftrace plugin"
(c71a896154119f4ca9e89d6078f5f63ad60ef199)
- if (unlikely(bt->trace_state != Blktrace_running))
+ if (unlikely(bt->trace_state != Blktrace_running || !blk_tracer_enabled))
return;
With this patch, both ioctl and ftrace can be used, but of course you
can't use both of them at the same time.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <49C9F796.9040503@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/trace/blktrace.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 95f89fa..a7f7ff5 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -110,7 +110,7 @@ void __trace_note_message(struct blk_trace *bt, const char *fmt, ...)
unsigned long flags;
char *buf;
- if (blk_tr) {
+ if (blk_tracer_enabled) {
va_start(args, fmt);
ftrace_vprintk(fmt, args);
va_end(args);
@@ -169,7 +169,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
pid_t pid;
int cpu, pc = 0;
- if (unlikely(bt->trace_state != Blktrace_running ||
+ if (unlikely(bt->trace_state != Blktrace_running &&
!blk_tracer_enabled))
return;
@@ -185,7 +185,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
return;
cpu = raw_smp_processor_id();
- if (blk_tr) {
+ if (blk_tracer_enabled) {
tracing_record_cmdline(current);
pc = preempt_count();
@@ -235,7 +235,7 @@ record_it:
if (pdu_len)
memcpy((void *) t + sizeof(*t), pdu_data, pdu_len);
- if (blk_tr) {
+ if (blk_tracer_enabled) {
trace_buffer_unlock_commit(blk_tr, event, 0, pc);
return;
}
@@ -267,8 +267,7 @@ int blk_trace_remove(struct request_queue *q)
if (!bt)
return -EINVAL;
- if (bt->trace_state == Blktrace_setup ||
- bt->trace_state == Blktrace_stopped)
+ if (bt->trace_state != Blktrace_running)
blk_trace_cleanup(bt);
return 0;
@@ -1273,7 +1272,6 @@ static int blk_trace_setup_queue(struct request_queue *q, dev_t dev)
bt->dev = dev;
bt->act_mask = (u16)-1;
bt->end_lba = -1ULL;
- bt->trace_state = Blktrace_running;
old_bt = xchg(&q->blk_trace, bt);
if (old_bt != NULL) {
next prev parent reply other threads:[~2009-03-25 11:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 9:18 [PATCH 1/3] blktrace: fix timestamp in binary output Li Zefan
2009-03-25 9:19 ` [PATCH 2/3] blktrace: fix a race when creating blk_tree_root in debugfs Li Zefan
2009-03-25 11:54 ` [tip:tracing/blktrace] " Li Zefan
2009-03-25 9:21 ` [PATCH 3/3] blktrace: fix the original blktrace Li Zefan
2009-03-25 10:14 ` Ingo Molnar
2009-03-25 10:17 ` Jens Axboe
2009-03-25 11:47 ` Ingo Molnar
2009-03-25 13:51 ` Arnaldo Carvalho de Melo
2009-03-25 13:56 ` Jens Axboe
2009-03-25 14:07 ` Arnaldo Carvalho de Melo
2009-03-26 2:13 ` Li Zefan
2009-03-26 8:29 ` Jens Axboe
2009-03-26 13:37 ` Ingo Molnar
2009-03-26 15:14 ` Arnaldo Carvalho de Melo
2009-03-26 15:44 ` Jens Axboe
2009-03-26 17:07 ` Arnaldo Carvalho de Melo
2009-03-27 0:21 ` Li Zefan
2009-03-25 11:54 ` Li Zefan [this message]
2009-03-25 11:54 ` [tip:tracing/blktrace] blktrace: fix timestamp in binary output Li Zefan
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-29d661309424188942aeea9edcd362c1bd7414ab@git.kernel.org \
--to=lizf@cn.fujitsu.com \
--cc=acme@redhat.com \
--cc=fweisbec@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=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome