* [PATCH] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local
@ 2012-04-23 18:50 Sasikanth V
2012-04-23 19:08 ` KOSAKI Motohiro
0 siblings, 1 reply; 4+ messages in thread
From: Sasikanth V @ 2012-04-23 18:50 UTC (permalink / raw)
To: Andrew Morton, Mel Gorman, Christoph Lameter, David Rientjes,
KOSAKI Motohiro
Cc: linux-mm, linux-kernel, Sasikanth V
Removed debug fs files and directory on failure. Since no one using "extfrag_debug_root" dentry outside of function
extfrag_debug_init made it local to the function.
Signed-off-by: Sasikanth V <sasikanth.v19@gmail.com>
---
mm/vmstat.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f600557..ddae476 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1220,7 +1220,6 @@ module_init(setup_vmstat)
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
#include <linux/debugfs.h>
-static struct dentry *extfrag_debug_root;
/*
* Return an index indicating how much of the available free memory is
@@ -1358,17 +1357,23 @@ static const struct file_operations extfrag_file_ops = {
static int __init extfrag_debug_init(void)
{
+ struct dentry *extfrag_debug_root;
+
extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
if (!extfrag_debug_root)
return -ENOMEM;
if (!debugfs_create_file("unusable_index", 0444,
- extfrag_debug_root, NULL, &unusable_file_ops))
+ extfrag_debug_root, NULL, &unusable_file_ops)) {
+ debugfs_remove (extfrag_debug_root);
return -ENOMEM;
+ }
if (!debugfs_create_file("extfrag_index", 0444,
- extfrag_debug_root, NULL, &extfrag_file_ops))
+ extfrag_debug_root, NULL, &extfrag_file_ops)) {
+ debugfs_remove_recursive (extfrag_debug_root);
return -ENOMEM;
+ }
return 0;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local
2012-04-23 18:50 [PATCH] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local Sasikanth V
@ 2012-04-23 19:08 ` KOSAKI Motohiro
0 siblings, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2012-04-23 19:08 UTC (permalink / raw)
To: Sasikanth V
Cc: Andrew Morton, Mel Gorman, Christoph Lameter, David Rientjes,
linux-mm, linux-kernel
On Mon, Apr 23, 2012 at 2:50 PM, Sasikanth V <sasikanth.v19@gmail.com> wrote:
> Removed debug fs files and directory on failure. Since no one using "extfrag_debug_root" dentry outside of function
> extfrag_debug_init made it local to the function.
>
> Signed-off-by: Sasikanth V <sasikanth.v19@gmail.com>
> ---
> mm/vmstat.c | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index f600557..ddae476 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1220,7 +1220,6 @@ module_init(setup_vmstat)
> #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
> #include <linux/debugfs.h>
>
> -static struct dentry *extfrag_debug_root;
>
> /*
> * Return an index indicating how much of the available free memory is
> @@ -1358,17 +1357,23 @@ static const struct file_operations extfrag_file_ops = {
>
> static int __init extfrag_debug_init(void)
> {
> + struct dentry *extfrag_debug_root;
> +
> extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
> if (!extfrag_debug_root)
> return -ENOMEM;
>
> if (!debugfs_create_file("unusable_index", 0444,
> - extfrag_debug_root, NULL, &unusable_file_ops))
> + extfrag_debug_root, NULL, &unusable_file_ops)) {
> + debugfs_remove (extfrag_debug_root);
> return -ENOMEM;
> + }
>
> if (!debugfs_create_file("extfrag_index", 0444,
> - extfrag_debug_root, NULL, &extfrag_file_ops))
> + extfrag_debug_root, NULL, &extfrag_file_ops)) {
> + debugfs_remove_recursive (extfrag_debug_root);
> return -ENOMEM;
> + }
Looks good.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local
2012-04-23 19:08 Sasikantha babu
@ 2012-04-23 20:35 ` David Rientjes
0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2012-04-23 20:35 UTC (permalink / raw)
To: Sasikantha babu
Cc: Andrew Morton, Mel Gorman, Christoph Lameter, KOSAKI Motohiro,
linux-mm, linux-kernel
On Tue, 24 Apr 2012, Sasikantha babu wrote:
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index f600557..ddae476 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1220,7 +1220,6 @@ module_init(setup_vmstat)
> #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
> #include <linux/debugfs.h>
>
> -static struct dentry *extfrag_debug_root;
>
> /*
> * Return an index indicating how much of the available free memory is
> @@ -1358,17 +1357,23 @@ static const struct file_operations extfrag_file_ops = {
>
> static int __init extfrag_debug_init(void)
> {
> + struct dentry *extfrag_debug_root;
> +
> extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
> if (!extfrag_debug_root)
> return -ENOMEM;
>
> if (!debugfs_create_file("unusable_index", 0444,
> - extfrag_debug_root, NULL, &unusable_file_ops))
> + extfrag_debug_root, NULL, &unusable_file_ops)) {
> + debugfs_remove (extfrag_debug_root);
> return -ENOMEM;
> + }
>
> if (!debugfs_create_file("extfrag_index", 0444,
> - extfrag_debug_root, NULL, &extfrag_file_ops))
> + extfrag_debug_root, NULL, &extfrag_file_ops)) {
> + debugfs_remove_recursive (extfrag_debug_root);
> return -ENOMEM;
> + }
>
> return 0;
> }
Probably easier to do something like "goto fail" and then have a
return 0;
fail:
debugfs_remove_recursive(extfrag_debug_root);
return -ENOMEM;
at the end of the function.
Please run scripts/checkpatch.pl on your patch before proposing it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local
@ 2012-04-23 19:08 Sasikantha babu
2012-04-23 20:35 ` David Rientjes
0 siblings, 1 reply; 4+ messages in thread
From: Sasikantha babu @ 2012-04-23 19:08 UTC (permalink / raw)
To: Andrew Morton, Mel Gorman, Christoph Lameter, David Rientjes,
KOSAKI Motohiro
Cc: linux-mm, linux-kernel, Sasikantha babu
"Please Ignore my previous patch in which I had used alias name"
Removed debug fs files and directory on failure. Since no one using "extfrag_debug_root" dentry outside of function
extfrag_debug_init made it local to the function.
Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
---
mm/vmstat.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f600557..ddae476 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1220,7 +1220,6 @@ module_init(setup_vmstat)
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
#include <linux/debugfs.h>
-static struct dentry *extfrag_debug_root;
/*
* Return an index indicating how much of the available free memory is
@@ -1358,17 +1357,23 @@ static const struct file_operations extfrag_file_ops = {
static int __init extfrag_debug_init(void)
{
+ struct dentry *extfrag_debug_root;
+
extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
if (!extfrag_debug_root)
return -ENOMEM;
if (!debugfs_create_file("unusable_index", 0444,
- extfrag_debug_root, NULL, &unusable_file_ops))
+ extfrag_debug_root, NULL, &unusable_file_ops)) {
+ debugfs_remove (extfrag_debug_root);
return -ENOMEM;
+ }
if (!debugfs_create_file("extfrag_index", 0444,
- extfrag_debug_root, NULL, &extfrag_file_ops))
+ extfrag_debug_root, NULL, &extfrag_file_ops)) {
+ debugfs_remove_recursive (extfrag_debug_root);
return -ENOMEM;
+ }
return 0;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-23 20:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 18:50 [PATCH] mm:vmstat - Removed debug fs entries on failure of file creation and made extfrag_debug_root dentry local Sasikanth V
2012-04-23 19:08 ` KOSAKI Motohiro
2012-04-23 19:08 Sasikantha babu
2012-04-23 20:35 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).