aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/Kconfig10
-rw-r--r--fs/jbd/journal.c64
-rw-r--r--include/linux/jbd.h2
3 files changed, 27 insertions, 49 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index e31f3691b151..cc28a69246a7 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -220,7 +220,7 @@ config JBD
220 220
221config JBD_DEBUG 221config JBD_DEBUG
222 bool "JBD (ext3) debugging support" 222 bool "JBD (ext3) debugging support"
223 depends on JBD 223 depends on JBD && DEBUG_FS
224 help 224 help
225 If you are using the ext3 journaled file system (or potentially any 225 If you are using the ext3 journaled file system (or potentially any
226 other file system/device using JBD), this option allows you to 226 other file system/device using JBD), this option allows you to
@@ -229,10 +229,10 @@ config JBD_DEBUG
229 debugging output will be turned off. 229 debugging output will be turned off.
230 230
231 If you select Y here, then you will be able to turn on debugging 231 If you select Y here, then you will be able to turn on debugging
232 with "echo N > /proc/sys/fs/jbd-debug", where N is a number between 232 with "echo N > /sys/kernel/debug/jbd/jbd-debug", where N is a
233 1 and 5, the higher the number, the more debugging output is 233 number between 1 and 5, the higher the number, the more debugging
234 generated. To turn debugging off again, do 234 output is generated. To turn debugging off again, do
235 "echo 0 > /proc/sys/fs/jbd-debug". 235 "echo 0 > /sys/kernel/debug/jbd/jbd-debug".
236 236
237config JBD2 237config JBD2
238 tristate 238 tristate
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index f810047a7195..5d14243499d4 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -35,6 +35,7 @@
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>
38 39
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40#include <asm/page.h> 41#include <asm/page.h>
@@ -1851,64 +1852,41 @@ void journal_put_journal_head(struct journal_head *jh)
1851} 1852}
1852 1853
1853/* 1854/*
1854 * /proc tunables 1855 * debugfs tunables
1855 */ 1856 */
1856#if defined(CONFIG_JBD_DEBUG) 1857#ifdef CONFIG_JBD_DEBUG
1857int journal_enable_debug;
1858EXPORT_SYMBOL(journal_enable_debug);
1859#endif
1860 1858
1861#if defined(CONFIG_JBD_DEBUG) && defined(CONFIG_PROC_FS) 1859u8 journal_enable_debug __read_mostly;
1860EXPORT_SYMBOL(journal_enable_debug);
1862 1861
1863static struct proc_dir_entry *proc_jbd_debug; 1862static struct dentry *jbd_debugfs_dir;
1863static struct dentry *jbd_debug;
1864 1864
1865static int read_jbd_debug(char *page, char **start, off_t off, 1865static void __init jbd_create_debugfs_entry(void)
1866 int count, int *eof, void *data)
1867{ 1866{
1868 int ret; 1867 jbd_debugfs_dir = debugfs_create_dir("jbd", NULL);
1869 1868 if (jbd_debugfs_dir)
1870 ret = sprintf(page + off, "%d\n", journal_enable_debug); 1869 jbd_debug = debugfs_create_u8("jbd-debug", S_IRUGO,
1871 *eof = 1; 1870 jbd_debugfs_dir,
1872 return ret; 1871 &journal_enable_debug);
1873} 1872}
1874 1873
1875static int write_jbd_debug(struct file *file, const char __user *buffer, 1874static void __exit jbd_remove_debugfs_entry(void)
1876 unsigned long count, void *data)
1877{ 1875{
1878 char buf[32]; 1876 debugfs_remove(jbd_debug);
1879 1877 debugfs_remove(jbd_debugfs_dir);
1880 if (count > ARRAY_SIZE(buf) - 1)
1881 count = ARRAY_SIZE(buf) - 1;
1882 if (copy_from_user(buf, buffer, count))
1883 return -EFAULT;
1884 buf[ARRAY_SIZE(buf) - 1] = '\0';
1885 journal_enable_debug = simple_strtoul(buf, NULL, 10);
1886 return count;
1887} 1878}
1888 1879
1889#define JBD_PROC_NAME "sys/fs/jbd-debug" 1880#else
1890 1881
1891static void __init create_jbd_proc_entry(void) 1882static inline void jbd_create_debugfs_entry(void)
1892{ 1883{
1893 proc_jbd_debug = create_proc_entry(JBD_PROC_NAME, 0644, NULL);
1894 if (proc_jbd_debug) {
1895 /* Why is this so hard? */
1896 proc_jbd_debug->read_proc = read_jbd_debug;
1897 proc_jbd_debug->write_proc = write_jbd_debug;
1898 }
1899} 1884}
1900 1885
1901static void __exit remove_jbd_proc_entry(void) 1886static inline void jbd_remove_debugfs_entry(void)
1902{ 1887{
1903 if (proc_jbd_debug)
1904 remove_proc_entry(JBD_PROC_NAME, NULL);
1905} 1888}
1906 1889
1907#else
1908
1909#define create_jbd_proc_entry() do {} while (0)
1910#define remove_jbd_proc_entry() do {} while (0)
1911
1912#endif 1890#endif
1913 1891
1914struct kmem_cache *jbd_handle_cache; 1892struct kmem_cache *jbd_handle_cache;
@@ -1965,7 +1943,7 @@ static int __init journal_init(void)
1965 ret = journal_init_caches(); 1943 ret = journal_init_caches();
1966 if (ret != 0) 1944 if (ret != 0)
1967 journal_destroy_caches(); 1945 journal_destroy_caches();
1968 create_jbd_proc_entry(); 1946 jbd_create_debugfs_entry();
1969 return ret; 1947 return ret;
1970} 1948}
1971 1949
@@ -1976,7 +1954,7 @@ static void __exit journal_exit(void)
1976 if (n) 1954 if (n)
1977 printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n); 1955 printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n);
1978#endif 1956#endif
1979 remove_jbd_proc_entry(); 1957 jbd_remove_debugfs_entry();
1980 journal_destroy_caches(); 1958 journal_destroy_caches();
1981} 1959}
1982 1960
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index d77f67d954f8..16e7ed855a18 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -58,7 +58,7 @@
58 * CONFIG_JBD_DEBUG is on. 58 * CONFIG_JBD_DEBUG is on.
59 */ 59 */
60#define JBD_EXPENSIVE_CHECKING 60#define JBD_EXPENSIVE_CHECKING
61extern int journal_enable_debug; 61extern u8 journal_enable_debug;
62 62
63#define jbd_debug(n, f, a...) \ 63#define jbd_debug(n, f, a...) \
64 do { \ 64 do { \