aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-02-09 16:29:20 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-02-09 16:29:20 -0500
commitb6e96d0067d81f6a300bedee661b5ece8164e210 (patch)
tree0c44eb0c27044a235cdf279016afc1e2d7800e7b /fs/jbd2
parenta0b30c12297eb63e9b994164f9c0937d29b9352d (diff)
jbd2: use module parameters instead of debugfs for jbd_debug
There are multiple reasons to move away from debugfs. First of all, we are only using it for a single parameter, and it is much more complicated to set up (some 30 lines of code compared to 3), and one more thing that might fail while loading the jbd2 module. Secondly, as a module paramter it can be specified as a boot option if jbd2 is built into the kernel, or as a parameter when the module is loaded, and it can also be manipulated dynamically under /sys/module/jbd2/parameters/jbd2_debug. So it is more flexible. Ultimately we want to move away from using jbd_debug() towards tracepoints, but for now this is still a useful simplification of the code base. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/journal.c50
1 files changed, 8 insertions, 42 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 4ba2e81e35ac..ed10991ab006 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -35,7 +35,6 @@
35#include <linux/kthread.h> 35#include <linux/kthread.h>
36#include <linux/poison.h> 36#include <linux/poison.h>
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/debugfs.h>
39#include <linux/seq_file.h> 38#include <linux/seq_file.h>
40#include <linux/math64.h> 39#include <linux/math64.h>
41#include <linux/hash.h> 40#include <linux/hash.h>
@@ -51,6 +50,14 @@
51#include <asm/uaccess.h> 50#include <asm/uaccess.h>
52#include <asm/page.h> 51#include <asm/page.h>
53 52
53#ifdef CONFIG_JBD2_DEBUG
54ushort jbd2_journal_enable_debug __read_mostly;
55EXPORT_SYMBOL(jbd2_journal_enable_debug);
56
57module_param_named(jbd2_debug, jbd2_journal_enable_debug, ushort, 0644);
58MODULE_PARM_DESC(jbd2_debug, "Debugging level for jbd2");
59#endif
60
54EXPORT_SYMBOL(jbd2_journal_extend); 61EXPORT_SYMBOL(jbd2_journal_extend);
55EXPORT_SYMBOL(jbd2_journal_stop); 62EXPORT_SYMBOL(jbd2_journal_stop);
56EXPORT_SYMBOL(jbd2_journal_lock_updates); 63EXPORT_SYMBOL(jbd2_journal_lock_updates);
@@ -2495,45 +2502,6 @@ restart:
2495 spin_unlock(&journal->j_list_lock); 2502 spin_unlock(&journal->j_list_lock);
2496} 2503}
2497 2504
2498/*
2499 * debugfs tunables
2500 */
2501#ifdef CONFIG_JBD2_DEBUG
2502u8 jbd2_journal_enable_debug __read_mostly;
2503EXPORT_SYMBOL(jbd2_journal_enable_debug);
2504
2505#define JBD2_DEBUG_NAME "jbd2-debug"
2506
2507static struct dentry *jbd2_debugfs_dir;
2508static struct dentry *jbd2_debug;
2509
2510static void __init jbd2_create_debugfs_entry(void)
2511{
2512 jbd2_debugfs_dir = debugfs_create_dir("jbd2", NULL);
2513 if (jbd2_debugfs_dir)
2514 jbd2_debug = debugfs_create_u8(JBD2_DEBUG_NAME,
2515 S_IRUGO | S_IWUSR,
2516 jbd2_debugfs_dir,
2517 &jbd2_journal_enable_debug);
2518}
2519
2520static void __exit jbd2_remove_debugfs_entry(void)
2521{
2522 debugfs_remove(jbd2_debug);
2523 debugfs_remove(jbd2_debugfs_dir);
2524}
2525
2526#else
2527
2528static void __init jbd2_create_debugfs_entry(void)
2529{
2530}
2531
2532static void __exit jbd2_remove_debugfs_entry(void)
2533{
2534}
2535
2536#endif
2537 2505
2538#ifdef CONFIG_PROC_FS 2506#ifdef CONFIG_PROC_FS
2539 2507
@@ -2619,7 +2587,6 @@ static int __init journal_init(void)
2619 2587
2620 ret = journal_init_caches(); 2588 ret = journal_init_caches();
2621 if (ret == 0) { 2589 if (ret == 0) {
2622 jbd2_create_debugfs_entry();
2623 jbd2_create_jbd_stats_proc_entry(); 2590 jbd2_create_jbd_stats_proc_entry();
2624 } else { 2591 } else {
2625 jbd2_journal_destroy_caches(); 2592 jbd2_journal_destroy_caches();
@@ -2634,7 +2601,6 @@ static void __exit journal_exit(void)
2634 if (n) 2601 if (n)
2635 printk(KERN_EMERG "JBD2: leaked %d journal_heads!\n", n); 2602 printk(KERN_EMERG "JBD2: leaked %d journal_heads!\n", n);
2636#endif 2603#endif
2637 jbd2_remove_debugfs_entry();
2638 jbd2_remove_jbd_stats_proc_entry(); 2604 jbd2_remove_jbd_stats_proc_entry();
2639 jbd2_journal_destroy_caches(); 2605 jbd2_journal_destroy_caches();
2640} 2606}