* [ltt-dev] [PATCH] lttng: remove ltt root directory if it's no needed
@ 2009-02-18 8:16 Gui Jianfeng
2009-02-18 8:28 ` Mathieu Desnoyers
0 siblings, 1 reply; 11+ messages in thread
From: Gui Jianfeng @ 2009-02-18 8:16 UTC (permalink / raw)
We have to cleanup the lttng's root directory of debugfs if
there is nobody uses it any more.
This patch is based on 2.6.29-rc3-lttng-0.92.
Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
---
include/linux/ltt-core.h | 1 +
ltt/ltt-core.c | 7 +++++++
ltt/ltt-trace-control.c | 11 +++++++++++
ltt/ltt-userspace-event.c | 10 ++++++++++
4 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h
index bc244c6..e43fc52 100644
--- a/include/linux/ltt-core.h
+++ b/include/linux/ltt-core.h
@@ -30,6 +30,7 @@ extern struct ltt_traces ltt_traces;
/*
* get dentry of ltt's root dir
*/
+void reset_ltt_root(void);
struct dentry *get_ltt_root(void);
/* Keep track of trap nesting inside LTT */
diff --git a/ltt/ltt-core.c b/ltt/ltt-core.c
index 18db91d..26c04b5 100644
--- a/ltt/ltt-core.c
+++ b/ltt/ltt-core.c
@@ -23,6 +23,13 @@ static DEFINE_MUTEX(ltt_traces_mutex);
/* dentry of ltt's root dir */
static struct dentry *ltt_root_dentry;
+
+void reset_ltt_root(void)
+{
+ ltt_root_dentry = NULL;
+}
+EXPORT_SYMBOL_GPL(reset_ltt_root);
+
struct dentry *get_ltt_root(void)
{
if (!ltt_root_dentry) {
diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
index 16502a2..21416b1 100644
--- a/ltt/ltt-trace-control.c
+++ b/ltt/ltt-trace-control.c
@@ -740,6 +740,10 @@ err_create_destroy_trace_file:
err_create_setup_trace_file:
debugfs_remove(ltt_control_dir);
err_create_control_dir:
+ if (list_empty(<t_root_dentry->d_subdirs)) {
+ debugfs_remove(ltt_root_dentry);
+ reset_ltt_root();
+ }
err_no_root:
return err;
}
@@ -747,6 +751,9 @@ err_no_root:
static void __exit ltt_trace_control_exit(void)
{
struct dentry *trace_dir;
+ struct dentry *ltt_root_dentry;
+
+ ltt_root_dentry = get_ltt_root();
/* destory all traces */
list_for_each_entry(trace_dir, <t_control_dir->d_subdirs,
@@ -759,6 +766,10 @@ static void __exit ltt_trace_control_exit(void)
debugfs_remove(ltt_setup_trace_file);
debugfs_remove(ltt_destroy_trace_file);
debugfs_remove_recursive(ltt_control_dir);
+ if (list_empty(<t_root_dentry->d_subdirs)) {
+ debugfs_remove(ltt_root_dentry);
+ reset_ltt_root();
+ }
}
module_init(ltt_trace_control_init);
diff --git a/ltt/ltt-userspace-event.c b/ltt/ltt-userspace-event.c
index 385bd3b..ef4fbb2 100644
--- a/ltt/ltt-userspace-event.c
+++ b/ltt/ltt-userspace-event.c
@@ -117,7 +117,17 @@ err_no_root:
static void __exit ltt_userspace_exit(void)
{
+ struct dentry *ltt_root_dentry;
+
+ ltt_root_dentry = get_ltt_root();
+
debugfs_remove(ltt_event_file);
+ if (ltt_root_dentry) {
+ if (list_empty(<t_root_dentry->d_subdirs)) {
+ debugfs_remove(ltt_root_dentry);
+ reset_ltt_root();
+ }
+ }
}
module_init(ltt_userspace_init);
--
1.5.4.rc3
^ permalink raw reply [flat|nested] 11+ messages in thread* [ltt-dev] [PATCH] lttng: remove ltt root directory if it's no needed
2009-02-18 8:16 [ltt-dev] [PATCH] lttng: remove ltt root directory if it's no needed Gui Jianfeng
@ 2009-02-18 8:28 ` Mathieu Desnoyers
2009-02-18 9:00 ` Gui Jianfeng
2009-02-18 11:50 ` [ltt-dev] [PATCH v2] " Gui Jianfeng
0 siblings, 2 replies; 11+ messages in thread
From: Mathieu Desnoyers @ 2009-02-18 8:28 UTC (permalink / raw)
* Gui Jianfeng (guijianfeng at cn.fujitsu.com) wrote:
> We have to cleanup the lttng's root directory of debugfs if
> there is nobody uses it any more.
>
> This patch is based on 2.6.29-rc3-lttng-0.92.
>
> Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
> ---
> include/linux/ltt-core.h | 1 +
> ltt/ltt-core.c | 7 +++++++
> ltt/ltt-trace-control.c | 11 +++++++++++
> ltt/ltt-userspace-event.c | 10 ++++++++++
> 4 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h
> index bc244c6..e43fc52 100644
> --- a/include/linux/ltt-core.h
> +++ b/include/linux/ltt-core.h
> @@ -30,6 +30,7 @@ extern struct ltt_traces ltt_traces;
> /*
> * get dentry of ltt's root dir
> */
> +void reset_ltt_root(void);
> struct dentry *get_ltt_root(void);
>
> /* Keep track of trap nesting inside LTT */
> diff --git a/ltt/ltt-core.c b/ltt/ltt-core.c
> index 18db91d..26c04b5 100644
> --- a/ltt/ltt-core.c
> +++ b/ltt/ltt-core.c
> @@ -23,6 +23,13 @@ static DEFINE_MUTEX(ltt_traces_mutex);
>
> /* dentry of ltt's root dir */
> static struct dentry *ltt_root_dentry;
> +
> +void reset_ltt_root(void)
> +{
> + ltt_root_dentry = NULL;
> +}
> +EXPORT_SYMBOL_GPL(reset_ltt_root);
> +
> struct dentry *get_ltt_root(void)
> {
> if (!ltt_root_dentry) {
> diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
> index 16502a2..21416b1 100644
> --- a/ltt/ltt-trace-control.c
> +++ b/ltt/ltt-trace-control.c
> @@ -740,6 +740,10 @@ err_create_destroy_trace_file:
> err_create_setup_trace_file:
> debugfs_remove(ltt_control_dir);
> err_create_control_dir:
> + if (list_empty(<t_root_dentry->d_subdirs)) {
> + debugfs_remove(ltt_root_dentry);
> + reset_ltt_root();
> + }
> err_no_root:
> return err;
> }
> @@ -747,6 +751,9 @@ err_no_root:
> static void __exit ltt_trace_control_exit(void)
> {
> struct dentry *trace_dir;
> + struct dentry *ltt_root_dentry;
> +
> + ltt_root_dentry = get_ltt_root();
>
> /* destory all traces */
> list_for_each_entry(trace_dir, <t_control_dir->d_subdirs,
> @@ -759,6 +766,10 @@ static void __exit ltt_trace_control_exit(void)
> debugfs_remove(ltt_setup_trace_file);
> debugfs_remove(ltt_destroy_trace_file);
> debugfs_remove_recursive(ltt_control_dir);
> + if (list_empty(<t_root_dentry->d_subdirs)) {
> + debugfs_remove(ltt_root_dentry);
> + reset_ltt_root();
> + }
Hi Gui,
Don't you have the feeling of doing cut'n'paste here ? ;)
Please move the code above in put_ltt_root in ltt-core.c.
Mathieu
> }
>
> module_init(ltt_trace_control_init);
> diff --git a/ltt/ltt-userspace-event.c b/ltt/ltt-userspace-event.c
> index 385bd3b..ef4fbb2 100644
> --- a/ltt/ltt-userspace-event.c
> +++ b/ltt/ltt-userspace-event.c
> @@ -117,7 +117,17 @@ err_no_root:
>
> static void __exit ltt_userspace_exit(void)
> {
> + struct dentry *ltt_root_dentry;
> +
> + ltt_root_dentry = get_ltt_root();
> +
> debugfs_remove(ltt_event_file);
> + if (ltt_root_dentry) {
> + if (list_empty(<t_root_dentry->d_subdirs)) {
> + debugfs_remove(ltt_root_dentry);
> + reset_ltt_root();
> + }
> + }
> }
>
> module_init(ltt_userspace_init);
> --
> 1.5.4.rc3
>
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 11+ messages in thread* [ltt-dev] [PATCH] lttng: remove ltt root directory if it's no needed
2009-02-18 8:28 ` Mathieu Desnoyers
@ 2009-02-18 9:00 ` Gui Jianfeng
2009-02-18 11:50 ` [ltt-dev] [PATCH v2] " Gui Jianfeng
1 sibling, 0 replies; 11+ messages in thread
From: Gui Jianfeng @ 2009-02-18 9:00 UTC (permalink / raw)
Mathieu Desnoyers wrote:
> * Gui Jianfeng (guijianfeng at cn.fujitsu.com) wrote:
>> We have to cleanup the lttng's root directory of debugfs if
>> there is nobody uses it any more.
>>
>> This patch is based on 2.6.29-rc3-lttng-0.92.
>>
>> Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
>> ---
>> include/linux/ltt-core.h | 1 +
>> ltt/ltt-core.c | 7 +++++++
>> ltt/ltt-trace-control.c | 11 +++++++++++
>> ltt/ltt-userspace-event.c | 10 ++++++++++
>> 4 files changed, 29 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h
>> index bc244c6..e43fc52 100644
>> --- a/include/linux/ltt-core.h
>> +++ b/include/linux/ltt-core.h
>> @@ -30,6 +30,7 @@ extern struct ltt_traces ltt_traces;
>> /*
>> * get dentry of ltt's root dir
>> */
>> +void reset_ltt_root(void);
>> struct dentry *get_ltt_root(void);
>>
>> /* Keep track of trap nesting inside LTT */
>> diff --git a/ltt/ltt-core.c b/ltt/ltt-core.c
>> index 18db91d..26c04b5 100644
>> --- a/ltt/ltt-core.c
>> +++ b/ltt/ltt-core.c
>> @@ -23,6 +23,13 @@ static DEFINE_MUTEX(ltt_traces_mutex);
>>
>> /* dentry of ltt's root dir */
>> static struct dentry *ltt_root_dentry;
>> +
>> +void reset_ltt_root(void)
>> +{
>> + ltt_root_dentry = NULL;
>> +}
>> +EXPORT_SYMBOL_GPL(reset_ltt_root);
>> +
>> struct dentry *get_ltt_root(void)
>> {
>> if (!ltt_root_dentry) {
>> diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
>> index 16502a2..21416b1 100644
>> --- a/ltt/ltt-trace-control.c
>> +++ b/ltt/ltt-trace-control.c
>> @@ -740,6 +740,10 @@ err_create_destroy_trace_file:
>> err_create_setup_trace_file:
>> debugfs_remove(ltt_control_dir);
>> err_create_control_dir:
>> + if (list_empty(<t_root_dentry->d_subdirs)) {
>> + debugfs_remove(ltt_root_dentry);
>> + reset_ltt_root();
>> + }
>> err_no_root:
>> return err;
>> }
>> @@ -747,6 +751,9 @@ err_no_root:
>> static void __exit ltt_trace_control_exit(void)
>> {
>> struct dentry *trace_dir;
>> + struct dentry *ltt_root_dentry;
>> +
>> + ltt_root_dentry = get_ltt_root();
>>
>> /* destory all traces */
>> list_for_each_entry(trace_dir, <t_control_dir->d_subdirs,
>> @@ -759,6 +766,10 @@ static void __exit ltt_trace_control_exit(void)
>> debugfs_remove(ltt_setup_trace_file);
>> debugfs_remove(ltt_destroy_trace_file);
>> debugfs_remove_recursive(ltt_control_dir);
>> + if (list_empty(<t_root_dentry->d_subdirs)) {
>> + debugfs_remove(ltt_root_dentry);
>> + reset_ltt_root();
>> + }
>
> Hi Gui,
>
> Don't you have the feeling of doing cut'n'paste here ? ;)
Yes, really have.... :) Will post v2
>
> Please move the code above in put_ltt_root in ltt-core.c.
>
> Mathieu
>
>> }
>>
>> module_init(ltt_trace_control_init);
>> diff --git a/ltt/ltt-userspace-event.c b/ltt/ltt-userspace-event.c
>> index 385bd3b..ef4fbb2 100644
>> --- a/ltt/ltt-userspace-event.c
>> +++ b/ltt/ltt-userspace-event.c
>> @@ -117,7 +117,17 @@ err_no_root:
>>
>> static void __exit ltt_userspace_exit(void)
>> {
>> + struct dentry *ltt_root_dentry;
>> +
>> + ltt_root_dentry = get_ltt_root();
>> +
>> debugfs_remove(ltt_event_file);
>> + if (ltt_root_dentry) {
>> + if (list_empty(<t_root_dentry->d_subdirs)) {
>> + debugfs_remove(ltt_root_dentry);
>> + reset_ltt_root();
>> + }
>> + }
>> }
>>
>> module_init(ltt_userspace_init);
>> --
>> 1.5.4.rc3
>>
>>
>
--
Regards
Gui Jianfeng
^ permalink raw reply [flat|nested] 11+ messages in thread* [ltt-dev] [PATCH v2] lttng: remove ltt root directory if it's no needed
2009-02-18 8:28 ` Mathieu Desnoyers
2009-02-18 9:00 ` Gui Jianfeng
@ 2009-02-18 11:50 ` Gui Jianfeng
2009-02-18 23:50 ` KOSAKI Motohiro
1 sibling, 1 reply; 11+ messages in thread
From: Gui Jianfeng @ 2009-02-18 11:50 UTC (permalink / raw)
We have to cleanup the lttng's root directory of debugfs if
there is nobody uses it any more.
This patch is based on 2.6.29-rc3-lttng-0.92.
Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
---
include/linux/ltt-core.h | 1 +
ltt/ltt-core.c | 10 ++++++++++
ltt/ltt-trace-control.c | 4 +++-
ltt/ltt-userspace-event.c | 1 +
4 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h
index bc244c6..28394cb 100644
--- a/include/linux/ltt-core.h
+++ b/include/linux/ltt-core.h
@@ -30,6 +30,7 @@ extern struct ltt_traces ltt_traces;
/*
* get dentry of ltt's root dir
*/
+void put_ltt_root(void);
struct dentry *get_ltt_root(void);
/* Keep track of trap nesting inside LTT */
diff --git a/ltt/ltt-core.c b/ltt/ltt-core.c
index 18db91d..314750b 100644
--- a/ltt/ltt-core.c
+++ b/ltt/ltt-core.c
@@ -23,6 +23,16 @@ static DEFINE_MUTEX(ltt_traces_mutex);
/* dentry of ltt's root dir */
static struct dentry *ltt_root_dentry;
+
+void put_ltt_root(void)
+{
+ if (ltt_root_dentry && list_empty(<t_root_dentry->d_subdirs)) {
+ debugfs_remove(ltt_root_dentry);
+ ltt_root_dentry = NULL;
+ }
+}
+EXPORT_SYMBOL_GPL(put_ltt_root);
+
struct dentry *get_ltt_root(void)
{
if (!ltt_root_dentry) {
diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
index 16502a2..0cdeb8a 100644
--- a/ltt/ltt-trace-control.c
+++ b/ltt/ltt-trace-control.c
@@ -740,7 +740,8 @@ err_create_destroy_trace_file:
err_create_setup_trace_file:
debugfs_remove(ltt_control_dir);
err_create_control_dir:
-err_no_root:
+ put_ltt_root();
+ err_no_root:
return err;
}
@@ -759,6 +760,7 @@ static void __exit ltt_trace_control_exit(void)
debugfs_remove(ltt_setup_trace_file);
debugfs_remove(ltt_destroy_trace_file);
debugfs_remove_recursive(ltt_control_dir);
+ put_ltt_root();
}
module_init(ltt_trace_control_init);
diff --git a/ltt/ltt-userspace-event.c b/ltt/ltt-userspace-event.c
index 385bd3b..a48f336 100644
--- a/ltt/ltt-userspace-event.c
+++ b/ltt/ltt-userspace-event.c
@@ -118,6 +118,7 @@ err_no_root:
static void __exit ltt_userspace_exit(void)
{
debugfs_remove(ltt_event_file);
+ put_ltt_root();
}
module_init(ltt_userspace_init);
--
1.5.4.rc3
^ permalink raw reply [flat|nested] 11+ messages in thread* [ltt-dev] [PATCH v2] lttng: remove ltt root directory if it's no needed
2009-02-18 11:50 ` [ltt-dev] [PATCH v2] " Gui Jianfeng
@ 2009-02-18 23:50 ` KOSAKI Motohiro
2009-02-19 1:16 ` Gui Jianfeng
0 siblings, 1 reply; 11+ messages in thread
From: KOSAKI Motohiro @ 2009-02-18 23:50 UTC (permalink / raw)
Hi
> We have to cleanup the lttng's root directory of debugfs if
> there is nobody uses it any more.
Why "have to"?
This description don't explain anything.
diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
> index 16502a2..0cdeb8a 100644
> --- a/ltt/ltt-trace-control.c
> +++ b/ltt/ltt-trace-control.c
> @@ -740,7 +740,8 @@ err_create_destroy_trace_file:
> err_create_setup_trace_file:
> debugfs_remove(ltt_control_dir);
> err_create_control_dir:
> -err_no_root:
> + put_ltt_root();
> + err_no_root:
label indentation is considered bad conding style in lkml.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [ltt-dev] [PATCH v2] lttng: remove ltt root directory if it's no needed
2009-02-18 23:50 ` KOSAKI Motohiro
@ 2009-02-19 1:16 ` Gui Jianfeng
2009-02-19 1:39 ` [ltt-dev] [PATCH v3] " Gui Jianfeng
0 siblings, 1 reply; 11+ messages in thread
From: Gui Jianfeng @ 2009-02-19 1:16 UTC (permalink / raw)
Hi Kosaki-san,
KOSAKI Motohiro wrote:
> Hi
>
>> We have to cleanup the lttng's root directory of debugfs if
>> there is nobody uses it any more.
>
> Why "have to"?
> This description don't explain anything.
Will add more.
>
>
>
> diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
>> index 16502a2..0cdeb8a 100644
>> --- a/ltt/ltt-trace-control.c
>> +++ b/ltt/ltt-trace-control.c
>> @@ -740,7 +740,8 @@ err_create_destroy_trace_file:
>> err_create_setup_trace_file:
>> debugfs_remove(ltt_control_dir);
>> err_create_control_dir:
>> -err_no_root:
>> + put_ltt_root();
>> + err_no_root:
>
> label indentation is considered bad conding style in lkml.
Thanks for pointing this out. I guess emacs is the culprit.
Emacs add this blank automatically, i missed this. :(
Will post a new one.
>
>
>
>
>
>
>
>
--
Regards
Gui Jianfeng
^ permalink raw reply [flat|nested] 11+ messages in thread
* [ltt-dev] [PATCH v3] lttng: remove ltt root directory if it's no needed
2009-02-19 1:16 ` Gui Jianfeng
@ 2009-02-19 1:39 ` Gui Jianfeng
2009-02-19 2:02 ` KOSAKI Motohiro
2009-02-19 3:14 ` Mathieu Desnoyers
0 siblings, 2 replies; 11+ messages in thread
From: Gui Jianfeng @ 2009-02-19 1:39 UTC (permalink / raw)
We have to cleanup the lttng's root directory of debugfs if
there is nobody uses it any more. Because any related lttng
modules are unloaded, no need to keep this directory.
This patch is based on 2.6.29-rc3-lttng-0.92.
Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
---
include/linux/ltt-core.h | 1 +
ltt/ltt-core.c | 10 ++++++++++
ltt/ltt-trace-control.c | 2 ++
ltt/ltt-userspace-event.c | 1 +
4 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h
index bc244c6..28394cb 100644
--- a/include/linux/ltt-core.h
+++ b/include/linux/ltt-core.h
@@ -30,6 +30,7 @@ extern struct ltt_traces ltt_traces;
/*
* get dentry of ltt's root dir
*/
+void put_ltt_root(void);
struct dentry *get_ltt_root(void);
/* Keep track of trap nesting inside LTT */
diff --git a/ltt/ltt-core.c b/ltt/ltt-core.c
index 18db91d..314750b 100644
--- a/ltt/ltt-core.c
+++ b/ltt/ltt-core.c
@@ -23,6 +23,16 @@ static DEFINE_MUTEX(ltt_traces_mutex);
/* dentry of ltt's root dir */
static struct dentry *ltt_root_dentry;
+
+void put_ltt_root(void)
+{
+ if (ltt_root_dentry && list_empty(<t_root_dentry->d_subdirs)) {
+ debugfs_remove(ltt_root_dentry);
+ ltt_root_dentry = NULL;
+ }
+}
+EXPORT_SYMBOL_GPL(put_ltt_root);
+
struct dentry *get_ltt_root(void)
{
if (!ltt_root_dentry) {
diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
index 16502a2..d7c9119 100644
--- a/ltt/ltt-trace-control.c
+++ b/ltt/ltt-trace-control.c
@@ -740,6 +740,7 @@ err_create_destroy_trace_file:
err_create_setup_trace_file:
debugfs_remove(ltt_control_dir);
err_create_control_dir:
+ put_ltt_root();
err_no_root:
return err;
}
@@ -759,6 +760,7 @@ static void __exit ltt_trace_control_exit(void)
debugfs_remove(ltt_setup_trace_file);
debugfs_remove(ltt_destroy_trace_file);
debugfs_remove_recursive(ltt_control_dir);
+ put_ltt_root();
}
module_init(ltt_trace_control_init);
diff --git a/ltt/ltt-userspace-event.c b/ltt/ltt-userspace-event.c
index 385bd3b..a48f336 100644
--- a/ltt/ltt-userspace-event.c
+++ b/ltt/ltt-userspace-event.c
@@ -118,6 +118,7 @@ err_no_root:
static void __exit ltt_userspace_exit(void)
{
debugfs_remove(ltt_event_file);
+ put_ltt_root();
}
module_init(ltt_userspace_init);
--
1.5.4.rc3
^ permalink raw reply [flat|nested] 11+ messages in thread* [ltt-dev] [PATCH v3] lttng: remove ltt root directory if it's no needed
2009-02-19 1:39 ` [ltt-dev] [PATCH v3] " Gui Jianfeng
@ 2009-02-19 2:02 ` KOSAKI Motohiro
2009-02-19 2:19 ` Gui Jianfeng
2009-02-19 2:38 ` Mathieu Desnoyers
2009-02-19 3:14 ` Mathieu Desnoyers
1 sibling, 2 replies; 11+ messages in thread
From: KOSAKI Motohiro @ 2009-02-19 2:02 UTC (permalink / raw)
> We have to cleanup the lttng's root directory of debugfs if
> there is nobody uses it any more. Because any related lttng
> modules are unloaded, no need to keep this directory.
>
> This patch is based on 2.6.29-rc3-lttng-0.92.
hmhm. There is one meta question.
Why do we need ltt-control unloadability?
We expect merge lttng into mainline in nearly future.
At that time, Who need ltt core kernel module (not any specific probe).
IOW, why ca't we do following?
config LTT_TRACE_CONTROL
- tristate "Linux Trace Toolkit Trace Controller"
+ bool "Linux Trace Toolkit Trace Controller"
depends on LTT_TRACER
default m
help
If you enable this option, the debugfs-based Linux Trace Toolkit Trace
Controller will be either built in the kernel or as module.
^ permalink raw reply [flat|nested] 11+ messages in thread* [ltt-dev] [PATCH v3] lttng: remove ltt root directory if it's no needed
2009-02-19 2:02 ` KOSAKI Motohiro
@ 2009-02-19 2:19 ` Gui Jianfeng
2009-02-19 2:38 ` Mathieu Desnoyers
1 sibling, 0 replies; 11+ messages in thread
From: Gui Jianfeng @ 2009-02-19 2:19 UTC (permalink / raw)
KOSAKI Motohiro wrote:
>> We have to cleanup the lttng's root directory of debugfs if
>> there is nobody uses it any more. Because any related lttng
>> modules are unloaded, no need to keep this directory.
>>
>> This patch is based on 2.6.29-rc3-lttng-0.92.
>
> hmhm. There is one meta question.
>
> Why do we need ltt-control unloadability?
> We expect merge lttng into mainline in nearly future.
>
> At that time, Who need ltt core kernel module (not any specific probe).
>
> IOW, why ca't we do following?
>
>
> config LTT_TRACE_CONTROL
> - tristate "Linux Trace Toolkit Trace Controller"
> + bool "Linux Trace Toolkit Trace Controller"
> depends on LTT_TRACER
> default m
> help
> If you enable this option, the debugfs-based Linux Trace Toolkit Trace
> Controller will be either built in the kernel or as module.
That sounds reasonalbe. :)
I guess this mainly because there are multiple ways to do ltt controling.
We can do it through debugfs interface, also the netlink interface is still
available. But I think the netlink interface is not needed anymore by now,
can be removed...
>
>
>
>
>
>
--
Regards
Gui Jianfeng
^ permalink raw reply [flat|nested] 11+ messages in thread
* [ltt-dev] [PATCH v3] lttng: remove ltt root directory if it's no needed
2009-02-19 2:02 ` KOSAKI Motohiro
2009-02-19 2:19 ` Gui Jianfeng
@ 2009-02-19 2:38 ` Mathieu Desnoyers
1 sibling, 0 replies; 11+ messages in thread
From: Mathieu Desnoyers @ 2009-02-19 2:38 UTC (permalink / raw)
* KOSAKI Motohiro (kosaki.motohiro at jp.fujitsu.com) wrote:
> > We have to cleanup the lttng's root directory of debugfs if
> > there is nobody uses it any more. Because any related lttng
> > modules are unloaded, no need to keep this directory.
> >
> > This patch is based on 2.6.29-rc3-lttng-0.92.
>
> hmhm. There is one meta question.
>
> Why do we need ltt-control unloadability?
> We expect merge lttng into mainline in nearly future.
>
> At that time, Who need ltt core kernel module (not any specific probe).
>
> IOW, why ca't we do following?
>
The main argument would be that on embedded systems with few memory,
some might want to leave the tracer unloaded until they need it.
Having the whole tracer available as modules makes that possible. If
it's built into the kernel, one has to leave some memory to the tracer
code and data structures even when unneeded. This is why I opted for a
fully modular design for LTTng.
>
> config LTT_TRACE_CONTROL
> - tristate "Linux Trace Toolkit Trace Controller"
> + bool "Linux Trace Toolkit Trace Controller"
> depends on LTT_TRACER
> default m
and that would be default y :-)
Mathieu
> help
> If you enable this option, the debugfs-based Linux Trace Toolkit Trace
> Controller will be either built in the kernel or as module.
>
>
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 11+ messages in thread
* [ltt-dev] [PATCH v3] lttng: remove ltt root directory if it's no needed
2009-02-19 1:39 ` [ltt-dev] [PATCH v3] " Gui Jianfeng
2009-02-19 2:02 ` KOSAKI Motohiro
@ 2009-02-19 3:14 ` Mathieu Desnoyers
1 sibling, 0 replies; 11+ messages in thread
From: Mathieu Desnoyers @ 2009-02-19 3:14 UTC (permalink / raw)
* Gui Jianfeng (guijianfeng at cn.fujitsu.com) wrote:
> We have to cleanup the lttng's root directory of debugfs if
> there is nobody uses it any more. Because any related lttng
> modules are unloaded, no need to keep this directory.
>
> This patch is based on 2.6.29-rc3-lttng-0.92.
>
Merged, thanks !
Mathieu
> Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
> ---
> include/linux/ltt-core.h | 1 +
> ltt/ltt-core.c | 10 ++++++++++
> ltt/ltt-trace-control.c | 2 ++
> ltt/ltt-userspace-event.c | 1 +
> 4 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/ltt-core.h b/include/linux/ltt-core.h
> index bc244c6..28394cb 100644
> --- a/include/linux/ltt-core.h
> +++ b/include/linux/ltt-core.h
> @@ -30,6 +30,7 @@ extern struct ltt_traces ltt_traces;
> /*
> * get dentry of ltt's root dir
> */
> +void put_ltt_root(void);
> struct dentry *get_ltt_root(void);
>
> /* Keep track of trap nesting inside LTT */
> diff --git a/ltt/ltt-core.c b/ltt/ltt-core.c
> index 18db91d..314750b 100644
> --- a/ltt/ltt-core.c
> +++ b/ltt/ltt-core.c
> @@ -23,6 +23,16 @@ static DEFINE_MUTEX(ltt_traces_mutex);
>
> /* dentry of ltt's root dir */
> static struct dentry *ltt_root_dentry;
> +
> +void put_ltt_root(void)
> +{
> + if (ltt_root_dentry && list_empty(<t_root_dentry->d_subdirs)) {
> + debugfs_remove(ltt_root_dentry);
> + ltt_root_dentry = NULL;
> + }
> +}
> +EXPORT_SYMBOL_GPL(put_ltt_root);
> +
> struct dentry *get_ltt_root(void)
> {
> if (!ltt_root_dentry) {
> diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
> index 16502a2..d7c9119 100644
> --- a/ltt/ltt-trace-control.c
> +++ b/ltt/ltt-trace-control.c
> @@ -740,6 +740,7 @@ err_create_destroy_trace_file:
> err_create_setup_trace_file:
> debugfs_remove(ltt_control_dir);
> err_create_control_dir:
> + put_ltt_root();
> err_no_root:
> return err;
> }
> @@ -759,6 +760,7 @@ static void __exit ltt_trace_control_exit(void)
> debugfs_remove(ltt_setup_trace_file);
> debugfs_remove(ltt_destroy_trace_file);
> debugfs_remove_recursive(ltt_control_dir);
> + put_ltt_root();
> }
>
> module_init(ltt_trace_control_init);
> diff --git a/ltt/ltt-userspace-event.c b/ltt/ltt-userspace-event.c
> index 385bd3b..a48f336 100644
> --- a/ltt/ltt-userspace-event.c
> +++ b/ltt/ltt-userspace-event.c
> @@ -118,6 +118,7 @@ err_no_root:
> static void __exit ltt_userspace_exit(void)
> {
> debugfs_remove(ltt_event_file);
> + put_ltt_root();
> }
>
> module_init(ltt_userspace_init);
> --
> 1.5.4.rc3
>
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-02-19 3:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-18 8:16 [ltt-dev] [PATCH] lttng: remove ltt root directory if it's no needed Gui Jianfeng
2009-02-18 8:28 ` Mathieu Desnoyers
2009-02-18 9:00 ` Gui Jianfeng
2009-02-18 11:50 ` [ltt-dev] [PATCH v2] " Gui Jianfeng
2009-02-18 23:50 ` KOSAKI Motohiro
2009-02-19 1:16 ` Gui Jianfeng
2009-02-19 1:39 ` [ltt-dev] [PATCH v3] " Gui Jianfeng
2009-02-19 2:02 ` KOSAKI Motohiro
2009-02-19 2:19 ` Gui Jianfeng
2009-02-19 2:38 ` Mathieu Desnoyers
2009-02-19 3:14 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox