[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111207091820.GA7656@localhost>
Date: Wed, 7 Dec 2011 17:18:20 +0800
From: Wu Fengguang <fengguang.wu@...el.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andi Kleen <andi@...stfloor.org>, Ingo Molnar <mingo@...e.hu>,
Jens Axboe <axboe@...nel.dk>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Rik van Riel <riel@...hat.com>,
Linux Memory Management List <linux-mm@...ck.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH 7/9] readahead: add vfs/readahead tracing event
On Tue, Dec 06, 2011 at 11:30:25PM +0800, Christoph Hellwig wrote:
> > + TP_printk("readahead-%s(dev=%d:%d, ino=%lu, "
>
> please don't duplicate the tracepoint name in the output string.
> Also don't use braces, as it jsut complicates parsing.
OK. Changed to this format:
TP_printk("pattern=%s bdi=%s ino=%lu "
"req=%lu+%lu ra=%lu+%d-%d async=%d actual=%d",
> > + "req=%lu+%lu, ra=%lu+%d-%d, async=%d) = %d",
> > + ra_pattern_names[__entry->pattern],
>
> Instead of doing a manual array lookup please use __print_symbolic so
> that users of the binary interface (like trace-cmd) also get the
> right output.
The patch actually started with
+#define show_pattern_name(val) \
+ __print_symbolic(val, \
+ { RA_PATTERN_INITIAL, "initial" }, \
+ { RA_PATTERN_SUBSEQUENT, "subsequent" }, \
+ { RA_PATTERN_CONTEXT, "context" }, \
+ { RA_PATTERN_THRASH, "thrash" }, \
+ { RA_PATTERN_MMAP_AROUND, "around" }, \
+ { RA_PATTERN_FADVISE, "fadvise" }, \
+ { RA_PATTERN_RANDOM, "random" }, \
+ { RA_PATTERN_ALL, "all" })
It's then converted to the current form so as to avoid duplicating the
num<>string mapping in two places.
The recently added writeback reason shares the same problem:
TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
"kupdate=%d range_cyclic=%d background=%d reason=%s",
...
wb_reason_name[__entry->reason]
)
Fortunately that's newly introduced in 3.2-rc1, so it's still the good
time to fix the writeback traces.
However the problem is, are we going to keep adding duplicate mappings
like this in future?
> > --- linux-next.orig/mm/readahead.c 2011-11-29 20:58:53.000000000 +0800
> > +++ linux-next/mm/readahead.c 2011-11-29 20:59:20.000000000 +0800
> > @@ -29,6 +29,9 @@ static const char * const ra_pattern_nam
> > [RA_PATTERN_ALL] = "all",
> > };
> >
> > +#define CREATE_TRACE_POINTS
> > +#include <trace/events/vfs.h>
>
> Maybe we should create a new fs/trace.c just for this instead of stickin
> it into the first file that created a tracepoint in the "vfs" namespace.
Yeah, it looks better to move it to a more general place.
Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists