lkml.org 
[lkml]   [2008]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ftrace: add an fsync tracer
On Wed, 5 Nov 2008 20:43:31 +0100
Marcin Slusarz <marcin.slusarz@gmail.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@redhat.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


\
 
 \ /
  Last update: 2008-11-05 21:37    [W:0.117 / U:3.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site