aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/mballoc.c47
-rw-r--r--fs/ext4/mballoc.h4
2 files changed, 11 insertions, 40 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e350885aec30..6540ebe058e3 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -23,11 +23,18 @@
23 23
24#include "ext4_jbd2.h" 24#include "ext4_jbd2.h"
25#include "mballoc.h" 25#include "mballoc.h"
26#include <linux/debugfs.h>
27#include <linux/log2.h> 26#include <linux/log2.h>
27#include <linux/module.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <trace/events/ext4.h> 29#include <trace/events/ext4.h>
30 30
31#ifdef CONFIG_EXT4_DEBUG
32ushort ext4_mballoc_debug __read_mostly;
33
34module_param_named(mballoc_debug, ext4_mballoc_debug, ushort, 0644);
35MODULE_PARM_DESC(mballoc_debug, "Debugging level for ext4's mballoc");
36#endif
37
31/* 38/*
32 * MUSTDO: 39 * MUSTDO:
33 * - test ext4_ext_search_left() and ext4_ext_search_right() 40 * - test ext4_ext_search_left() and ext4_ext_search_right()
@@ -2660,40 +2667,6 @@ static void ext4_free_data_callback(struct super_block *sb,
2660 mb_debug(1, "freed %u blocks in %u structures\n", count, count2); 2667 mb_debug(1, "freed %u blocks in %u structures\n", count, count2);
2661} 2668}
2662 2669
2663#ifdef CONFIG_EXT4_DEBUG
2664u8 mb_enable_debug __read_mostly;
2665
2666static struct dentry *debugfs_dir;
2667static struct dentry *debugfs_debug;
2668
2669static void __init ext4_create_debugfs_entry(void)
2670{
2671 debugfs_dir = debugfs_create_dir("ext4", NULL);
2672 if (debugfs_dir)
2673 debugfs_debug = debugfs_create_u8("mballoc-debug",
2674 S_IRUGO | S_IWUSR,
2675 debugfs_dir,
2676 &mb_enable_debug);
2677}
2678
2679static void ext4_remove_debugfs_entry(void)
2680{
2681 debugfs_remove(debugfs_debug);
2682 debugfs_remove(debugfs_dir);
2683}
2684
2685#else
2686
2687static void __init ext4_create_debugfs_entry(void)
2688{
2689}
2690
2691static void ext4_remove_debugfs_entry(void)
2692{
2693}
2694
2695#endif
2696
2697int __init ext4_init_mballoc(void) 2670int __init ext4_init_mballoc(void)
2698{ 2671{
2699 ext4_pspace_cachep = KMEM_CACHE(ext4_prealloc_space, 2672 ext4_pspace_cachep = KMEM_CACHE(ext4_prealloc_space,
@@ -2715,7 +2688,6 @@ int __init ext4_init_mballoc(void)
2715 kmem_cache_destroy(ext4_ac_cachep); 2688 kmem_cache_destroy(ext4_ac_cachep);
2716 return -ENOMEM; 2689 return -ENOMEM;
2717 } 2690 }
2718 ext4_create_debugfs_entry();
2719 return 0; 2691 return 0;
2720} 2692}
2721 2693
@@ -2730,7 +2702,6 @@ void ext4_exit_mballoc(void)
2730 kmem_cache_destroy(ext4_ac_cachep); 2702 kmem_cache_destroy(ext4_ac_cachep);
2731 kmem_cache_destroy(ext4_free_data_cachep); 2703 kmem_cache_destroy(ext4_free_data_cachep);
2732 ext4_groupinfo_destroy_slabs(); 2704 ext4_groupinfo_destroy_slabs();
2733 ext4_remove_debugfs_entry();
2734} 2705}
2735 2706
2736 2707
@@ -3876,7 +3847,7 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
3876 struct super_block *sb = ac->ac_sb; 3847 struct super_block *sb = ac->ac_sb;
3877 ext4_group_t ngroups, i; 3848 ext4_group_t ngroups, i;
3878 3849
3879 if (!mb_enable_debug || 3850 if (!ext4_mballoc_debug ||
3880 (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)) 3851 (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED))
3881 return; 3852 return;
3882 3853
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 3ccd889ba953..08481ee84cd5 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -37,11 +37,11 @@
37/* 37/*
38 */ 38 */
39#ifdef CONFIG_EXT4_DEBUG 39#ifdef CONFIG_EXT4_DEBUG
40extern u8 mb_enable_debug; 40extern ushort ext4_mballoc_debug;
41 41
42#define mb_debug(n, fmt, a...) \ 42#define mb_debug(n, fmt, a...) \
43 do { \ 43 do { \
44 if ((n) <= mb_enable_debug) { \ 44 if ((n) <= ext4_mballoc_debug) { \
45 printk(KERN_DEBUG "(%s, %d): %s: ", \ 45 printk(KERN_DEBUG "(%s, %d): %s: ", \
46 __FILE__, __LINE__, __func__); \ 46 __FILE__, __LINE__, __func__); \
47 printk(fmt, ## a); \ 47 printk(fmt, ## a); \