aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd
diff options
context:
space:
mode:
authorJose R. Santos <jrs@us.ibm.com>2007-10-19 02:39:22 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:35 -0400
commitc2a9159cdd8b334a0dfaf69d8b07cd57b5272baa (patch)
tree5a1d45afd49cd11d488173f6351bcfe432c2139a /fs/jbd
parent1c099244485ff8bb93c2cd41304a445adc7f54e6 (diff)
jbd: config_jbd_debug cannot create /proc entry
The jbd-debug file used to be located in /proc/sys/fs/jbd-debug, but create_proc_entry() does not do lookups on file names that are more that one directory deep. This causes the entry creation to fail and hence, no proc file is created. Instead of fixing this on procfs might as well move the jbd2-debug file to debugfs which would be the preferred location for this kind of tunable. The new location is now /sys/kernel/debug/jbd/jbd-debug. [akpm@linux-foundation.org: zillions of cleanups] Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Acked-by: Jan Kara <jack@suse.cz> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/jbd')
-rw-r--r--fs/jbd/journal.c64
1 files changed, 21 insertions, 43 deletions
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