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, 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?

> + 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?

> +
> +out:
> + kfree(buffer);
> +}
> +
> (...)


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