Skip to content

Commit b6e96d0

Browse files
committed
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>
1 parent a0b30c1 commit b6e96d0

File tree

2 files changed

+9
-44
lines changed

2 files changed

+9
-44
lines changed

fs/jbd2/journal.c

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <linux/kthread.h>
3636
#include <linux/poison.h>
3737
#include <linux/proc_fs.h>
38-
#include <linux/debugfs.h>
3938
#include <linux/seq_file.h>
4039
#include <linux/math64.h>
4140
#include <linux/hash.h>
@@ -51,6 +50,14 @@
5150
#include <asm/uaccess.h>
5251
#include <asm/page.h>
5352

53+
#ifdef CONFIG_JBD2_DEBUG
54+
ushort jbd2_journal_enable_debug __read_mostly;
55+
EXPORT_SYMBOL(jbd2_journal_enable_debug);
56+
57+
module_param_named(jbd2_debug, jbd2_journal_enable_debug, ushort, 0644);
58+
MODULE_PARM_DESC(jbd2_debug, "Debugging level for jbd2");
59+
#endif
60+
5461
EXPORT_SYMBOL(jbd2_journal_extend);
5562
EXPORT_SYMBOL(jbd2_journal_stop);
5663
EXPORT_SYMBOL(jbd2_journal_lock_updates);
@@ -2495,45 +2502,6 @@ void jbd2_journal_release_jbd_inode(journal_t *journal,
24952502
spin_unlock(&journal->j_list_lock);
24962503
}
24972504

2498-
/*
2499-
* debugfs tunables
2500-
*/
2501-
#ifdef CONFIG_JBD2_DEBUG
2502-
u8 jbd2_journal_enable_debug __read_mostly;
2503-
EXPORT_SYMBOL(jbd2_journal_enable_debug);
2504-
2505-
#define JBD2_DEBUG_NAME "jbd2-debug"
2506-
2507-
static struct dentry *jbd2_debugfs_dir;
2508-
static struct dentry *jbd2_debug;
2509-
2510-
static 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-
2520-
static void __exit jbd2_remove_debugfs_entry(void)
2521-
{
2522-
debugfs_remove(jbd2_debug);
2523-
debugfs_remove(jbd2_debugfs_dir);
2524-
}
2525-
2526-
#else
2527-
2528-
static void __init jbd2_create_debugfs_entry(void)
2529-
{
2530-
}
2531-
2532-
static void __exit jbd2_remove_debugfs_entry(void)
2533-
{
2534-
}
2535-
2536-
#endif
25372505

25382506
#ifdef CONFIG_PROC_FS
25392507

@@ -2619,7 +2587,6 @@ static int __init journal_init(void)
26192587

26202588
ret = journal_init_caches();
26212589
if (ret == 0) {
2622-
jbd2_create_debugfs_entry();
26232590
jbd2_create_jbd_stats_proc_entry();
26242591
} else {
26252592
jbd2_journal_destroy_caches();
@@ -2634,7 +2601,6 @@ static void __exit journal_exit(void)
26342601
if (n)
26352602
printk(KERN_EMERG "JBD2: leaked %d journal_heads!\n", n);
26362603
#endif
2637-
jbd2_remove_debugfs_entry();
26382604
jbd2_remove_jbd_stats_proc_entry();
26392605
jbd2_journal_destroy_caches();
26402606
}

include/linux/jbd2.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#ifndef __KERNEL__
2121
#include "jfs_compat.h"
2222
#define JBD2_DEBUG
23-
#define jfs_debug jbd_debug
2423
#else
2524

2625
#include <linux/types.h>
@@ -57,7 +56,7 @@
5756
* CONFIG_JBD2_DEBUG is on.
5857
*/
5958
#define JBD2_EXPENSIVE_CHECKING
60-
extern u8 jbd2_journal_enable_debug;
59+
extern ushort jbd2_journal_enable_debug;
6160

6261
#define jbd_debug(n, f, a...) \
6362
do { \

0 commit comments

Comments
 (0)