Commit 190519cd authored by Ed Cashin's avatar Ed Cashin Committed by Linus Torvalds

aoe: create and destroy debugfs directory for aoe

This series adds the debugging information that the coraid.com-distributed
aoe driver exports via sysfs, but instead of sysfs, it uses debugfs.

With these patches applied, even without AoE targets on the network, KEDR
reports new possible memory leaks, but these are from callers outside the
aoe driver that have used aoe_devnode to get the name of the character
devices through the aoe_class->devnode callback, and I believe they're
responsible for freeing that memory.

This patch:

Create and destroy the debugfs directory.
Signed-off-by: default avatarEd Cashin <ecashin@coraid.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0bd42136
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/debugfs.h>
#include <scsi/sg.h> #include <scsi/sg.h>
#include "aoe.h" #include "aoe.h"
static DEFINE_MUTEX(aoeblk_mutex); static DEFINE_MUTEX(aoeblk_mutex);
static struct kmem_cache *buf_pool_cache; static struct kmem_cache *buf_pool_cache;
static struct dentry *aoe_debugfs_dir;
/* GPFS needs a larger value than the default. */ /* GPFS needs a larger value than the default. */
static int aoe_maxsectors; static int aoe_maxsectors;
...@@ -351,6 +353,8 @@ aoeblk_gdalloc(void *vp) ...@@ -351,6 +353,8 @@ aoeblk_gdalloc(void *vp)
void void
aoeblk_exit(void) aoeblk_exit(void)
{ {
debugfs_remove_recursive(aoe_debugfs_dir);
aoe_debugfs_dir = NULL;
kmem_cache_destroy(buf_pool_cache); kmem_cache_destroy(buf_pool_cache);
} }
...@@ -362,7 +366,11 @@ aoeblk_init(void) ...@@ -362,7 +366,11 @@ aoeblk_init(void)
0, 0, NULL); 0, 0, NULL);
if (buf_pool_cache == NULL) if (buf_pool_cache == NULL)
return -ENOMEM; return -ENOMEM;
aoe_debugfs_dir = debugfs_create_dir("aoe", NULL);
if (IS_ERR_OR_NULL(aoe_debugfs_dir)) {
pr_info("aoe: cannot create debugfs directory\n");
aoe_debugfs_dir = NULL;
}
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment