[PATCH 1/2] mm: backing-dev - Removed debug_stats entry from backing_dev_info and handled debug fs failue cases

From: Sasikantha babu
Date: Wed Apr 25 2012 - 15:58:56 EST


1) "stats" file part of "bdi->debug_dir" directory we dont have to maintain, especially
for removal purpose (directory recursive removal is will do), another dentry for "stats" file
in backing_dev_info.

2) Handled failure casess of debug fs entry creation


Signed-off-by: Sasikantha babu <sasikanth.v19@xxxxxxxxx>
---
include/linux/backing-dev.h | 1 -
mm/backing-dev.c | 15 ++++++++++-----
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index b1038bd..a9ad582 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -106,7 +106,6 @@ struct backing_dev_info {

#ifdef CONFIG_DEBUG_FS
struct dentry *debug_dir;
- struct dentry *debug_stats;
#endif
};

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index dd8e2aa..00ee55c 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -136,15 +136,20 @@ static const struct file_operations bdi_debug_stats_fops = {

static void bdi_debug_register(struct backing_dev_info *bdi, const char *name)
{
- bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
- bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir,
- bdi, &bdi_debug_stats_fops);
+ if (bdi_debug_root) {
+
+ bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
+
+ if (bdi->debug_dir)
+ debugfs_create_file("stats", 0444, bdi->debug_dir, bdi,
+ &bdi_debug_stats_fops);
+ }
}

static void bdi_debug_unregister(struct backing_dev_info *bdi)
{
- debugfs_remove(bdi->debug_stats);
- debugfs_remove(bdi->debug_dir);
+ if (bdi->debug_dir)
+ debugfs_remove_recursive(bdi->debug_dir);
}
#else
static inline void bdi_debug_init(void)
--
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/