From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759389AbbBIGBr (ORCPT ); Mon, 9 Feb 2015 01:01:47 -0500 Received: from lgeamrelo02.lge.com ([156.147.1.126]:38864 "EHLO lgeamrelo02.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758965AbbBIGBp (ORCPT ); Mon, 9 Feb 2015 01:01:45 -0500 X-Original-SENDERIP: 10.177.220.203 X-Original-MAILFROM: namhyung@kernel.org Date: Mon, 9 Feb 2015 15:00:02 +0900 From: Namhyung Kim To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Al Viro , Greg Kroah-Hartman , Ingo Molnar , Andrew Morton Subject: Re: [for-next][PATCH 5/7] tracing: Automatically mount tracefs on debugfs/tracing Message-ID: <20150209060002.GB30788@sejong> References: <20150204143420.290584004@goodmis.org> <20150204143755.694479564@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150204143755.694479564@goodmis.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 04, 2015 at 09:34:25AM -0500, Steven Rostedt wrote: > From: "Steven Rostedt (Red Hat)" > > As tools currently rely on the tracing directory in debugfs, we can not > just created a tracefs infrastructure and expect sysadmins to mount > the new tracefs to have their old tools work. > > Instead, the debugfs tracing directory is still created and the tracefs > file system is mounted there when the debugfs filesystem is mounted. > > No longer does the tracing infrastructure update the debugfs file system, > but instead interacts with the tracefs file system. But now, it still > appears to the user like nothing changed, except you also have the feature > of mounting just the tracing system without needing all of debugfs! One question. Is it possible to have both of the old /sys/kernel/debug/tracing and new /sys/kernel/tracing directories? > > Cc: Al Viro > Signed-off-by: Steven Rostedt > --- > kernel/trace/trace.c | 36 +++++++++++++++++++++++++++++++++--- > 1 file changed, 33 insertions(+), 3 deletions(-) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 6c4739bee4bb..b4aa936509d2 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -32,6 +32,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -6535,6 +6536,28 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer) > > } > > +static struct vfsmount *trace_automount(void *ingore) > +{ > + struct vfsmount *mnt; > + struct file_system_type *type; > + > + /* > + * To maintain backward compatibility for tools that mount > + * debugfs to get to the tracing facility, tracefs is automatically > + * mounted to the debugfs/tracing directory. > + */ > + type = get_fs_type("tracefs"); > + if (!type) > + return NULL; > + mnt = vfs_kern_mount(type, 0, "tracefs", NULL); > + put_filesystem(type); > + if (IS_ERR(mnt)) > + return NULL; > + mntget(mnt); > + > + return mnt; > +} > + > /** > * tracing_init_dentry - initialize top level trace array > * > @@ -6546,14 +6569,21 @@ struct dentry *tracing_init_dentry(void) > { > struct trace_array *tr = &global_trace; > > + /* The top level trace array uses NULL as parent */ > if (tr->dir) > - return tr->dir; > + return NULL; > > if (WARN_ON(!debugfs_initialized())) > return ERR_PTR(-ENODEV); > > - tr->dir = debugfs_create_dir("tracing", NULL); > - > + /* > + * As there may still be users that expect the tracing > + * files to exist in debugfs/tracing, we must automount > + * the tracefs file system there, so older tools still > + * work with the newer kerenl. s/kerenl/kernel/ Thanks, Namhyung > + */ > + tr->dir = debugfs_create_automount("tracing", NULL, > + trace_automount, NULL); > if (!tr->dir) { > pr_warn_once("Could not create debugfs directory 'tracing'\n"); > return ERR_PTR(-ENOMEM); > -- > 2.1.4 > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/