[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081105123604.633105ca@infradead.org>
Date: Wed, 5 Nov 2008 12:36:04 -0800
From: Arjan van de Ven <arjan@...radead.org>
To: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org,
mingo@...e.hu
Subject: Re: [PATCH] ftrace: add an fsync tracer
On Wed, 5 Nov 2008 20:43:31 +0100
Marcin Slusarz <marcin.slusarz@...il.com> wrote:
> On Wed, Nov 05, 2008 at 09:49:02AM -0800, Arjan van de Ven wrote:
> > --- /dev/null
> > +++ b/kernel/trace/trace_fsync.c
> > @@ -0,0 +1,165 @@
> > +/*
> > + * trace fsync calls
> > + * Copyright (C) 2008 Intel Corporation
> > + *
> > + * Based extensively on trace_sched_switch.c
> > + * Copyright (C) 2007 Steven Rostedt <srostedt@...hat.com>
> > + *
> > + */
> > +#include <linux/module.h>
> > +#include <linux/fs.h>
> > +#include <linux/debugfs.h>
> > +#include <linux/kallsyms.h>
> > +#include <linux/uaccess.h>
> > +#include <linux/ftrace.h>
> > +#include <trace/fs.h>
> > +
> > +#include "trace.h"
> > +
> > +static struct trace_array *ctx_trace;
> > +static int __read_mostly tracer_enabled;
> > +static atomic_t fsync_ref;
> > +
> > +static void
> > +probe_do_fsync(struct file *file, int datasync)
> > +{
> > + char *buffer;
> > + char *err;
> > +
> > + if (!atomic_read(&fsync_ref))
> > + return;
> > +
> > + if (!tracer_enabled)
> > + return;
> > +
> > + buffer = kmalloc(4096, GFP_KERNEL);
> > + if (!buffer)
> > + return;
> > +
> > + memset(buffer, 0, 4096);
>
> kzalloc?
could do I suppose
>
> > + err = d_path(&file->f_path, buffer, 4096);
> > +
> > + if (IS_ERR(err))
> > + goto out;
> > +
> > + ftrace_printk("Process %s is calling fsync on %s\n",
> > + current->comm, err);
>
> err? not buffer?
correct, not buffer
it won't work if you use buffer.
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
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