]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: remove bookkeeper
authorSage Weil <sage@newdream.net>
Tue, 19 May 2009 19:26:12 +0000 (12:26 -0700)
committerSage Weil <sage@newdream.net>
Tue, 19 May 2009 19:26:12 +0000 (12:26 -0700)
src/Makefile.am
src/crush/crush.c
src/kernel/Kconfig
src/kernel/Makefile
src/kernel/bookkeeper.c [deleted file]
src/kernel/bookkeeper.h [deleted file]
src/kernel/ceph_debug.h
src/kernel/debugfs.c
src/kernel/import_patch_set_into_linux_git.sh
src/kernel/super.c
src/kernel/super.h

index aeaa3b51ca2be881026357ba6521e6d525c59362..10632e321de74788440f3e63a51355ecfb1c5bce 100644 (file)
@@ -381,8 +381,6 @@ noinst_HEADERS = \
        kernel/Kconfig\
         kernel/Makefile\
        kernel/addr.c\
-       kernel/bookkeeper.c\
-       kernel/bookkeeper.h\
        kernel/caps.c\
        kernel/ceph_debug.h\
        kernel/ceph_fs.h\
index 705d6acf5964aae819dcf832ef801ecf7518b321..d0f11287c3e021d2cf5bba29adf0facd2c8a4ebe 100644 (file)
@@ -1,7 +1,6 @@
 
 #ifdef __KERNEL__
 # include <linux/slab.h>
-# include "../bookkeeper.h"
 #else
 # include <stdlib.h>
 # include <assert.h>
index 874657549909a76eeb0cb0deeae96d7c323d67dc..32090d3f547394c7051c642671b30534f7d1dd4d 100644 (file)
@@ -12,9 +12,3 @@ config CEPH_FS
 
          If unsure, say N.
 
-config CEPH_BOOKKEEPER
-       bool "Ceph leaks detection tool"
-       depends on CEPH_FS
-       help
-         Leaks detection tool for the Ceph fs.
-
index 483e5564160409685081a507f552e3b1d7558002..ba1e6a59f651a4b5528d2c9cf99ab94f29a42ea6 100644 (file)
@@ -12,7 +12,7 @@ ceph-objs := super.o inode.o dir.o file.o addr.o ioctl.o \
        mds_client.o mdsmap.o \
        mon_client.o \
        osd_client.o osdmap.o crush/crush.o crush/mapper.o \
-       debugfs.o bookkeeper.o
+       debugfs.o
 
 else
 #Otherwise we were called directly from the command
diff --git a/src/kernel/bookkeeper.c b/src/kernel/bookkeeper.c
deleted file mode 100644 (file)
index 5e281ca..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <linux/spinlock.h>
-#include <linux/slab.h>
-#include <linux/kallsyms.h>
-
-#define CEPH_OVERRIDE_BOOKKEEPER /* avoid kmalloc/kfree recursion */
-
-#define CEPH_BK_MAGIC 0x140985AC
-
-#include "ceph_debug.h"
-
-int ceph_debug_tools __read_mostly = -1;
-#define DOUT_VAR ceph_debug_tools
-#define DOUT_MASK DOUT_MASK_TOOLS
-#include "super.h"
-
-static struct list_head _bk_allocs;
-
-static DEFINE_SPINLOCK(_bk_lock);
-
-static size_t _total_alloc;
-static size_t _total_free;
-
-struct alloc_data {
-       u32 prefix_magic;
-       struct list_head node;
-       size_t size;
-       char *fname;
-       int line;
-       u32 suffix_magic;
-};
-
-void *ceph_kmalloc(char *fname, int line, size_t size, gfp_t flags)
-{
-       struct alloc_data *p = kmalloc(size+sizeof(struct alloc_data), flags);
-
-       if (!p)
-               return NULL;
-
-       p->prefix_magic = CEPH_BK_MAGIC;
-       p->size = size;
-       p->fname = fname;
-       p->line = line;
-       p->suffix_magic = CEPH_BK_MAGIC;
-
-       spin_lock(&_bk_lock);
-       _total_alloc += size;
-
-       list_add_tail(&p->node, &_bk_allocs);
-       spin_unlock(&_bk_lock);
-
-       return ((void *)p)+sizeof(struct alloc_data);
-}
-
-void ceph_kfree(const void *ptr)
-{
-       struct alloc_data *p = (struct alloc_data *)(ptr -
-                                                    sizeof(struct alloc_data));
-       int overrun = 0;
-
-       if (!ptr)
-               return;
-
-       if (p->prefix_magic != CEPH_BK_MAGIC) {
-               derr(0, "ERROR: memory overrun (under)!\n");
-               overrun = 1;
-       }
-
-       if (p->suffix_magic != CEPH_BK_MAGIC) {
-               derr(0, "ERROR: Memory overrun (over)!\n");
-               overrun = 1;
-       }
-
-       if (overrun) {
-               derr(0, "Memory allocated at %s(%d): p=%p (%zu bytes)\n",
-                    p->fname, p->line, ((void *)p)+sizeof(struct alloc_data),
-                    p->size);
-       }
-
-       BUG_ON(overrun);
-
-       spin_lock(&_bk_lock);
-       _total_free += p->size;
-       list_del(&p->node);
-       spin_unlock(&_bk_lock);
-
-       kfree(p);
-
-       return;
-}
-
-
-void ceph_bookkeeper_dump(void)
-{
-       struct list_head *p;
-       struct alloc_data *entry;
-
-       dout(1, "bookkeeper: total bytes alloc: %zu\n", _total_alloc);
-       dout(1, "bookkeeper: total bytes free: %zu\n", _total_free);
-
-       if (_total_alloc != _total_free) {
-               list_for_each(p, &_bk_allocs) {
-                       entry = list_entry(p, struct alloc_data, node);
-                       dout(1, "%s(%d): p=%p (%zu bytes)\n", entry->fname,
-                            entry->line,
-                            ((void *)entry)+sizeof(struct alloc_data),
-                            entry->size);
-               }
-       } else {
-               dout(1, "No leaks found! Yay!\n");
-       }
-}
-
-void ceph_bookkeeper_init(void)
-{
-       dout(10, "bookkeeper: start\n");
-       INIT_LIST_HEAD(&_bk_allocs);
-}
-
-void ceph_bookkeeper_finalize(void)
-{
-       ceph_bookkeeper_dump();
-}
diff --git a/src/kernel/bookkeeper.h b/src/kernel/bookkeeper.h
deleted file mode 100644 (file)
index 7b73dbf..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifdef CONFIG_CEPH_BOOKKEEPER
-
-#ifndef _FS_CEPH_BOOKKEEPER_H
-#define _FS_CEPH_BOOKKEEPER_H
-
-extern void ceph_bookkeeper_dump(void);
-extern void ceph_bookkeeper_init(void);
-extern void ceph_bookkeeper_finalize(void);
-extern void *ceph_kmalloc(char *fname, int line, size_t size, gfp_t flags);
-extern void ceph_kfree(const void *ptr);
-
-#endif
-
-
-#ifndef CEPH_OVERRIDE_BOOKKEEPER
-#define CEPH_BOOKKEEPER_DEFINED
-#define kmalloc(size, flags)   ceph_kmalloc(__FILE__, __LINE__, size, flags)
-#define kzalloc(size, flags)   ceph_kmalloc(__FILE__, __LINE__, size, \
-                                            flags | __GFP_ZERO)
-#define kfree  ceph_kfree
-#endif
-
-#ifdef CEPH_DISABLE_BOOKKEEPER
-#ifdef CEPH_BOOKKEEPER_DEFINED
-#undef kmalloc
-#undef kzalloc
-#undef kfree
-#endif
-#endif
-
-#endif
index c8f3f406b98c3820b786d4291c5dfbb0d6bb580a..c5cfaece18d45e76cb89a794982cc84d2e6cfda5 100644 (file)
@@ -3,8 +3,6 @@
 
 #include <linux/string.h>
 
-#include "bookkeeper.h"
-
 extern int ceph_debug __read_mostly;         /* debug level. */
 extern int ceph_debug_console __read_mostly; /* send debug output to console? */
 extern int ceph_debug_mask __read_mostly;
index 1d4a9c4d95cd4c92385cd44d220157b81f455265..45468d744d50ac217ac3c8b8e37071f7de46a9f5 100644 (file)
@@ -5,7 +5,6 @@
 
 #include "super.h"
 #include "mds_client.h"
-#include "bookkeeper.h"
 
 static struct dentry *ceph_debugfs_dir;
 static struct dentry *ceph_debugfs_debug;
@@ -13,9 +12,6 @@ static struct dentry *ceph_debugfs_debug_msgr;
 static struct dentry *ceph_debugfs_debug_console;
 static struct dentry *ceph_debugfs_debug_mask;
 static struct dentry *ceph_debugfs_caps_reservation;
-#ifdef CONFIG_CEPH_BOOKKEEPER
-static struct dentry *ceph_debugfs_bookkeeper;
-#endif
 
 /*
  * ceph_debug_mask
@@ -431,24 +427,6 @@ DEFINE_SHOW_FUNC(osdc_show)
 DEFINE_SHOW_FUNC(caps_reservation_show)
 DEFINE_SHOW_FUNC(dentry_lru_show)
 
-#ifdef CONFIG_CEPH_BOOKKEEPER
-static int debugfs_bookkeeper_set(void *data, u64 val)
-{
-       if (val)
-               ceph_bookkeeper_dump();
-       return 0;
-}
-
-static int debugfs_bookkeeper_get(void *data, u64 *val)
-{
-       *val = 0;
-       return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(bookkeeper_fops, debugfs_bookkeeper_get,
-                       debugfs_bookkeeper_set, "%llu\n");
-#endif
-
 int ceph_debugfs_init(void)
 {
        int ret = -ENOMEM;
@@ -495,15 +473,6 @@ int ceph_debugfs_init(void)
        if (!ceph_debugfs_caps_reservation)
                goto out;
 
-#ifdef CONFIG_CEPH_BOOKKEEPER
-       ceph_debugfs_bookkeeper = debugfs_create_file("show_bookkeeper",
-                                       0600,
-                                       ceph_debugfs_dir,
-                                       NULL,
-                                       &bookkeeper_fops);
-       if (!ceph_debugfs_bookkeeper)
-               goto out;
-#endif
        return 0;
 
 out:
@@ -518,9 +487,6 @@ void ceph_debugfs_cleanup(void)
        debugfs_remove(ceph_debugfs_debug_mask);
        debugfs_remove(ceph_debugfs_debug_msgr);
        debugfs_remove(ceph_debugfs_debug);
-#ifdef CONFIG_CEPH_BOOKKEEPER
-       debugfs_remove(ceph_debugfs_bookkeeper);
-#endif
        debugfs_remove(ceph_debugfs_dir);
 }
 
index 7ee2210cbc576e4e5130865da87163624c568917..cbc9d05e5f78faa76f6053303b5691e6e0874b93 100755 (executable)
@@ -288,14 +288,11 @@ parameters.
 EOF
 
 git add fs/ceph/ceph_debug.h
-git add fs/ceph/bookkeeper.h
-git add fs/ceph/bookkeeper.c
 git commit -F - <<EOF
 ceph: debugging
 
 Some debugging infrastructure, including the ability to adjust the
-level of debug output on a per-file basis.  A memory leak detection
-tool can also be enabled via .config.
+level of debug output on a per-file basis.
 
 EOF
 
index becb8265f22224733674de3aa37e3a6ca531cb0b..3c3860ce77f9907382e218867cd1877e5200f58c 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "ceph_debug.h"
 #include "ceph_ver.h"
-#include "bookkeeper.h"
 #include "decode.h"
 
 /*
@@ -1177,9 +1176,6 @@ static int __init init_ceph(void)
        dout(1, "init_ceph\n");
        dout(0, "ceph (%s)\n", STRINGIFY(CEPH_GIT_VER));
 
-#ifdef CONFIG_CEPH_BOOKKEEPER
-       ceph_bookkeeper_init();
-#endif
        ret = ceph_debugfs_init();
        if (ret < 0)
                goto out;
@@ -1217,9 +1213,6 @@ static void __exit exit_ceph(void)
        destroy_caches();
        ceph_msgr_exit();
        ceph_debugfs_cleanup();
-#ifdef CONFIG_CEPH_BOOKKEEPER
-       ceph_bookkeeper_finalize();
-#endif
 }
 
 module_init(init_ceph);
index f151cf555873d14ea750beda896c7a8f01a95921..fea804898588e41d163b9e5491f1724a9f35fcf4 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef _FS_CEPH_SUPER_H
 #define _FS_CEPH_SUPER_H
 
-#define CEPH_DISABLE_BOOKKEEPER
-#include "bookkeeper.h"
-
 #include <linux/fs.h>
 #include <linux/wait.h>
 #include <linux/completion.h>
@@ -11,9 +8,6 @@
 #include <linux/exportfs.h>
 #include <linux/backing-dev.h>
 
-#undef CEPH_DISABLE_BOOKKEEPER
-#include "bookkeeper.h"
-
 #include "types.h"
 #include "ceph_debug.h"
 #include "messenger.h"
@@ -21,7 +15,6 @@
 #include "mds_client.h"
 #include "osd_client.h"
 #include "ceph_fs.h"
-#include "bookkeeper.h"
 
 /* f_type in struct statfs */
 #define CEPH_SUPER_MAGIC 0x00c36400