cleanups: Export jbd2-debug via debugfs
Subsystems (3)
PATCH 5/5 cleanups: Export jbd2-debug via debugfs
Quoted 6 lines · Jose R. Santos
Quoted 5 lines
The jbd2-debug file used to be located in
/proc/sys/fs/jbd2-debug, butcreate_proc_entry()does not do lookups on file names with more that one directory deep. This causes the entry creation to fail and hence, no proc file is created. This patch moves the file to/proc/jbd2-degug.
Quoted 6 lines
Quoted 2 lines
The file could be move to
/proc/fs/jbd2/jbd2-debug, but it would require some minor alterations to the jbd-stats patch.I don't think we really want to be adding top-level files in /proc. What about using the "debugfs" filesystem (not to be confused with the e2fsprogs 'debugfs' command)?
How about this then? Moved the file to use debugfs as well as having the nice effect of removing more lines than what it adds.
---
fs/jbd2/journal.c | 62 20 + 42 - 0 ! include/linux/jbd2.h | 2 1 + 1 - 0 ! 2 files changed, 21 insertions(+), 43 deletions(-)
fs/jbd2/journal.c +20 -42
@@ -35,6 +35,7 @@#include <linux/kthread.h> #include <linux/poison.h> #include <linux/proc_fs.h> +#include <linux/debugfs.h> #include <asm/uaccess.h> #include <asm/page.h>
@@ -1954,60 +1955,37 @@* /proc tunables */ #if defined(CONFIG_JBD2_DEBUG ) -int jbd2_journal_enable_debug; +u16 jbd2_journal_enable_debug;EXPORT_SYMBOL (jbd2_journal_enable_debug);#endif -#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_PROC_FS ) +#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_DEBUG_FS ) -static struct proc_dir_entry *proc_jbd_debug; +#define JBD2_DEBUG_NAME "jbd2-debug" -static int read_jbd_debug (char *page,char **start,off_t off, -int count,int *eof,void *data) -{ -int ret; - - ret =sprintf (page + off,"%d\n" , jbd2_journal_enable_debug); - *eof =1 ; -return ret; -} +struct dentry *jbd2_debugfs_dir, *jbd2_debug; -static int write_jbd_debug (struct file *file,const char __user *buffer, -unsigned long count,void *data) +static void __init jbd2_create_debugfs_entry (void ) { -char buf[32 ]; - -if (count >ARRAY_SIZE (buf) -1 ) - count =ARRAY_SIZE (buf) -1 ; -if (copy_from_user (buf, buffer, count)) -return -EFAULT ; - buf[ARRAY_SIZE (buf) -1 ] ='\0' ; - jbd2_journal_enable_debug =simple_strtoul (buf,NULL ,10 ); -return count; -} - -#define JBD_PROC_NAME "sys/fs/jbd2-debug" - -static void __init create_jbd_proc_entry (void ) -{ - proc_jbd_debug =create_proc_entry (JBD_PROC_NAME ,0644 ,NULL ); -if (proc_jbd_debug) { -/* Why is this so hard? */ - proc_jbd_debug->read_proc = read_jbd_debug; - proc_jbd_debug->write_proc = write_jbd_debug; - } + jbd2_debugfs_dir =debugfs_create_dir ("jbd2" ,NULL ); +if (jbd2_debugfs_dir) + jbd2_debug =debugfs_create_u16 (JBD2_DEBUG_NAME ,S_IRUGO , + jbd2_debugfs_dir, + &jbd2_journal_enable_debug); } -static void __exit jbd2_remove_jbd_proc_entry(void) +static void __exit jbd2_remove_debugfs_entry(void) { -if (proc_jbd_debug) -remove_proc_entry (JBD_PROC_NAME ,NULL ); +if (jbd2_debug) +debugfs_remove (jbd2_debug); +if (jbd2_debugfs_dir) +debugfs_remove (jbd2_debugfs_dir); }#else -#define create_jbd_proc_entry () do {} while (0) -#define jbd2_remove_jbd_proc_entry () do {} while (0) +#define jbd2_create_debugfs_entry () do {} while (0) +#define jbd2_remove_debugfs_entry () do {} while (0)#endif
@@ -2067,7 +2045,7 @@ ret =journal_init_caches ();if (ret !=0 )jbd2_journal_destroy_caches (); -create_jbd_proc_entry (); +jbd2_create_debugfs_entry ();return ret; }
@@ -2078,7 +2056,7 @@if (n)printk (KERN_EMERG "JBD: leaked %d journal_heads!\n" , n);#endif -jbd2_remove_jbd_proc_entry (); +jbd2_remove_debugfs_entry ();jbd2_journal_destroy_caches (); }
include/linux/jbd2.h +1 -1
@@ -57,7 +57,7 @@* CONFIG_JBD2_DEBUG is on. */ #define JBD_EXPENSIVE_CHECKING -extern int jbd2_journal_enable_debug; +extern u16 jbd2_journal_enable_debug; #define jbd_debug(n, f, a...) \ do { \
Quoted 9 lines · On Sun, 01 Jul 2007 03:36:48 -0400 Mingming Cao <[email protected]> wrote:
Quoted 9 lines · Jose R. Santos
Quoted 7 lines
The jbd2-debug file used to be located in
/proc/sys/fs/jbd2-debug, butcreate_proc_entry()does not do lookups on file names with more that one directory deep. This causes the entry creation to fail and hence, no proc file is created. This patch moves the file to/proc/jbd2-degug.The file could be move to
/proc/fs/jbd2/jbd2-debug, but it would require some minor alterations to the jbd-stats patch.
Quoted 8 lines
Quoted 3 lines
I don't think we really want to be adding top-level files in /proc. What about using the "debugfs" filesystem (not to be confused with the e2fsprogs 'debugfs' command)?
How about this then? Moved the file to use debugfs as well as having the nice effect of removing more lines than what it adds.
Signed-off-by Jose R. Santos <[email protected]>
Please clean up the changelog.
The changelog should include information about the location and the content of these debugfs files. it should provide any instructions which users will need to be able to create and use those files.
Alternatively (and preferably) do this via an update to Documentation/filesystems/ext4.txt.
Quoted 3 lines
fs/jbd2/journal.c | 62 20 + 42 - 0 ! include/linux/jbd2.h | 2 1 + 1 - 0 ! 2 files changed, 21 insertions(+), 43 deletions(-)
Again, this patch isn't in Ted's kernel.org directory and hasn't been in -mm.
Apart from the lack of testing and review which this causes, it means I can't just do pushpatch name-of-this-patch' and look at it in tkdiff. So I squint at the diff, but that's harder when the diff wasn't prepared with diff -p'. Oh well.
Quoted 13 lines
Index:
linux-2.6.22-rc4/fs/jbd2/journal.c
===================================================================fs/jbd2/journal.c +1
-0@@ -35,6 +35,7 @@#include <linux/kthread.h> #include <linux/poison.h> #include <linux/proc_fs.h> +#include <linux/debugfs.h> #include <asm/uaccess.h> #include <asm/page.h>
fs/jbd2/journal.c line 1962
Quoted 10 lines
fs/jbd2/journal.c +2
-2@@ -1954,60 +1955,37 @@* /proc tunables */ #if defined(CONFIG_JBD2_DEBUG ) -int jbd2_journal_enable_debug; +u16 jbd2_journal_enable_debug;EXPORT_SYMBOL (jbd2_journal_enable_debug);#endif -#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_PROC_FS ) +#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_DEBUG_FS )
Has this been compile-tested with CONFIG_DEBUGFS=n?
fs/jbd2/journal.c line 1988
Quoted 5 lines
fs/jbd2/journal.c +2
-2-#define create_jbd_proc_entry () do {} while (0) -#define jbd2_remove_jbd_proc_entry () do {} while (0) +#define jbd2_create_debugfs_entry () do {} while (0) +#define jbd2_remove_debugfs_entry () do {} while (0)
I suggest that these be converted to (preferable) inline functions while you're there.
Quoted 25 lines
fs/jbd2/journal.c +2
-2#endif @@ -2067,7 +2045,7 @@ ret =journal_init_caches ();if (ret !=0 )jbd2_journal_destroy_caches (); -create_jbd_proc_entry (); +jbd2_create_debugfs_entry ();return ret; }@@ -2078,7 +2056,7 @@if (n)printk (KERN_EMERG "JBD: leaked %d journal_heads!\n" , n);#endif -jbd2_remove_jbd_proc_entry (); +jbd2_remove_debugfs_entry ();jbd2_journal_destroy_caches (); }Index:
linux-2.6.22-rc4/include/linux/jbd2.h
===================================================================
include/linux/jbd2.h line 59
Quoted 3 lines
include/linux/jbd2.h +0
-0@@ -57,7 +57,7 @@* CONFIG_JBD2_DEBUG is on. */ #define JBD_EXPENSIVE_CHECKING
JBD2?
include/linux/jbd2.h line 60
Quoted 2 lines
include/linux/jbd2.h +1
-1-extern int jbd2_journal_enable_debug; +extern u16 jbd2_journal_enable_debug;
Why was this made 16-bit? To save 2 bytes? Could have saved 3 if we're going to do that.
Shoudln't all this debug info be a per-superblock thing rather than kernel-wide?
Quoted 74 lines · Jose R. Santos
Quoted 19 lines · On Tue, 10 Jul 2007 16:30:25 -0700 Andrew Morton <[email protected]>…
Quoted 16 lines · On Sun, 01 Jul 2007 03:36:48 -0400 Mingming Cao <[email protected]> wrote:
Quoted 6 lines · Jose R. Santos
Quoted 5 lines
The jbd2-debug file used to be located in
/proc/sys/fs/jbd2-debug, butcreate_proc_entry()does not do lookups on file names with more that one directory deep. This causes the entry creation to fail and hence, no proc file is created. This patch moves the file to/proc/jbd2-degug.Quoted 6 lines
Quoted 2 lines
The file could be move to
/proc/fs/jbd2/jbd2-debug, but it would require some minor alterations to the jbd-stats patch.I don't think we really want to be adding top-level files in /proc. What about using the "debugfs" filesystem (not to be confused with the e2fsprogs 'debugfs' command)?
How about this then? Moved the file to use debugfs as well as having the nice effect of removing more lines than what it adds.
Quoted 7 lines
Quoted 1 line
Signed-off-by Jose R. Santos <[email protected]>Please clean up the changelog.
The changelog should include information about the location and the content of these debugfs files. it should provide any instructions which users will need to be able to create and use those files.
Will fix.
Quoted 2 lines
Alternatively (and preferably) do this via an update to
Documentation/filesystems/ext4.txt.Seems like I also need to update the doc on
Kconfigas well. Do you prefer this in separate patches? (current patch, kconfig patch, ext4 doc update patch?Quoted 10 lines
Quoted 3 lines
fs/jbd2/journal.c | 62 20 + 42 - 0 ! include/linux/jbd2.h | 2 1 + 1 - 0 ! 2 files changed, 21 insertions(+), 43 deletions(-)Again, this patch isn't in Ted's kernel.org directory and hasn't been in -mm.
Apart from the lack of testing and review which this causes, it means I can't just do
pushpatch name-of-this-patch' and look at it in tkdiff. So I squint at the diff, but that's harder when the diff wasn't prepared withdiff -p'. Oh well.Will fix.
Quoted 22 lines
Quoted 22 lines
Index:
linux-2.6.22-rc4/fs/jbd2/journal.c
===================================================================fs/jbd2/journal.c +2
-1@@ -35,6 +35,7 @@#include <linux/kthread.h> #include <linux/poison.h> #include <linux/proc_fs.h> +#include <linux/debugfs.h> #include <asm/uaccess.h> #include <asm/page.h> @@ -1954,60 +1955,37 @@* /proc tunables */ #if defined(CONFIG_JBD2_DEBUG ) -int jbd2_journal_enable_debug; +u16 jbd2_journal_enable_debug;EXPORT_SYMBOL (jbd2_journal_enable_debug);#endif
Quoted 8 lines
Quoted 4 lines
fs/jbd2/journal.c line 1962
Quoted 2 lines
fs/jbd2/journal.c +1
-1-#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_PROC_FS ) +#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_DEBUG_FS )Has this been compile-tested with
CONFIG_DEBUGFS=n?I think I did, but honestly don't remember. Will check with the new patch. :)
Yes, I remember I did, that discovered some inconsistency in ext4 code, which has already been fixed.
Quoted 61 lines
Quoted 8 lines
fs/jbd2/journal.c line 1988
Quoted 5 lines
fs/jbd2/journal.c +2
-2-#define create_jbd_proc_entry () do {} while (0) -#define jbd2_remove_jbd_proc_entry () do {} while (0) +#define jbd2_create_debugfs_entry () do {} while (0) +#define jbd2_remove_debugfs_entry () do {} while (0)I suggest that these be converted to (preferable) inline functions while you're there.
OK.
Quoted 31 lines
Quoted 25 lines
fs/jbd2/journal.c +2
-2#endif @@ -2067,7 +2045,7 @@ ret =journal_init_caches ();if (ret !=0 )jbd2_journal_destroy_caches (); -create_jbd_proc_entry (); +jbd2_create_debugfs_entry ();return ret; }@@ -2078,7 +2056,7 @@if (n)printk (KERN_EMERG "JBD: leaked %d journal_heads!\n" , n);#endif -jbd2_remove_jbd_proc_entry (); +jbd2_remove_debugfs_entry ();jbd2_journal_destroy_caches (); }Index:
linux-2.6.22-rc4/include/linux/jbd2.h
===================================================================include/linux/jbd2.h line 59
Quoted 3 lines
include/linux/jbd2.h +0
-0@@ -57,7 +57,7 @@* CONFIG_JBD2_DEBUG is on. */ #define JBD_EXPENSIVE_CHECKING JBD2?
Quoted 5 lines
include/linux/jbd2.h line 60
Quoted 2 lines
include/linux/jbd2.h +1
-1-extern int jbd2_journal_enable_debug; +extern u16 jbd2_journal_enable_debug;Why was this made 16-bit? To save 2 bytes? Could have saved 3 if we're going to do that.
OK.
Quoted 2 lines
Shoudln't all this debug info be a per-superblock thing rather than kernel-wide?
I don't think it is worth pursuing this feature since this seems to have been broken for a while now (its been there since the first git revission in ext3) and nobody has noticed it until now. It could be address on a later patch though, since the initial purpose of the patch was to fix the broken
JBD2_DEBUGoption. Of course, this may not be clearly express in the changelog. :)-JRS
Quoted 19 lines · On Tue, 10 Jul 2007 16:30:25 -0700 Andrew Morton <[email protected]>…
Quoted 16 lines · On Sun, 01 Jul 2007 03:36:48 -0400 Mingming Cao <[email protected]> wrote:
Quoted 6 lines · Jose R. Santos
Quoted 5 lines
The jbd2-debug file used to be located in
/proc/sys/fs/jbd2-debug, butcreate_proc_entry()does not do lookups on file names with more that one directory deep. This causes the entry creation to fail and hence, no proc file is created. This patch moves the file to/proc/jbd2-degug.Quoted 6 lines
Quoted 2 lines
The file could be move to
/proc/fs/jbd2/jbd2-debug, but it would require some minor alterations to the jbd-stats patch.I don't think we really want to be adding top-level files in /proc. What about using the "debugfs" filesystem (not to be confused with the e2fsprogs 'debugfs' command)?
How about this then? Moved the file to use debugfs as well as having the nice effect of removing more lines than what it adds.
Quoted 7 lines
Quoted 1 line
Signed-off-by Jose R. Santos <[email protected]>Please clean up the changelog.
The changelog should include information about the location and the content of these debugfs files. it should provide any instructions which users will need to be able to create and use those files.
Will fix.
Quoted 2 lines
Alternatively (and preferably) do this via an update to
Documentation/filesystems/ext4.txt.
Seems like I also need to update the doc on Kconfig as well. Do you prefer this in separate patches? (current patch, kconfig patch, ext4 doc update patch?
Quoted 10 lines
Quoted 3 lines
fs/jbd2/journal.c | 62 20 + 42 - 0 ! include/linux/jbd2.h | 2 1 + 1 - 0 ! 2 files changed, 21 insertions(+), 43 deletions(-)Again, this patch isn't in Ted's kernel.org directory and hasn't been in -mm.
Apart from the lack of testing and review which this causes, it means I can't just do
pushpatch name-of-this-patch' and look at it in tkdiff. So I squint at the diff, but that's harder when the diff wasn't prepared withdiff -p'. Oh well.
Will fix.
Quoted 22 lines
Quoted 22 lines
Index:
linux-2.6.22-rc4/fs/jbd2/journal.c
===================================================================fs/jbd2/journal.c +2
-1@@ -35,6 +35,7 @@#include <linux/kthread.h> #include <linux/poison.h> #include <linux/proc_fs.h> +#include <linux/debugfs.h> #include <asm/uaccess.h> #include <asm/page.h> @@ -1954,60 +1955,37 @@* /proc tunables */ #if defined(CONFIG_JBD2_DEBUG ) -int jbd2_journal_enable_debug; +u16 jbd2_journal_enable_debug;EXPORT_SYMBOL (jbd2_journal_enable_debug);#endif
Quoted 4 lines
fs/jbd2/journal.c line 1962
Quoted 2 lines
fs/jbd2/journal.c +1
-1-#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_PROC_FS ) +#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_DEBUG_FS )Has this been compile-tested with
CONFIG_DEBUGFS=n?
I think I did, but honestly don't remember. Will check with the new patch. :)
Quoted 8 lines
fs/jbd2/journal.c line 1988
Quoted 5 lines
fs/jbd2/journal.c +2
-2-#define create_jbd_proc_entry () do {} while (0) -#define jbd2_remove_jbd_proc_entry () do {} while (0) +#define jbd2_create_debugfs_entry () do {} while (0) +#define jbd2_remove_debugfs_entry () do {} while (0)I suggest that these be converted to (preferable) inline functions while you're there.
OK.
Quoted 31 lines
Quoted 25 lines
fs/jbd2/journal.c +2
-2#endif @@ -2067,7 +2045,7 @@ ret =journal_init_caches ();if (ret !=0 )jbd2_journal_destroy_caches (); -create_jbd_proc_entry (); +jbd2_create_debugfs_entry ();return ret; }@@ -2078,7 +2056,7 @@if (n)printk (KERN_EMERG "JBD: leaked %d journal_heads!\n" , n);#endif -jbd2_remove_jbd_proc_entry (); +jbd2_remove_debugfs_entry ();jbd2_journal_destroy_caches (); }Index:
linux-2.6.22-rc4/include/linux/jbd2.h
===================================================================include/linux/jbd2.h line 59
Quoted 3 lines
include/linux/jbd2.h +0
-0@@ -57,7 +57,7 @@* CONFIG_JBD2_DEBUG is on. */ #define JBD_EXPENSIVE_CHECKING JBD2?
Quoted 5 lines
include/linux/jbd2.h line 60
Quoted 2 lines
include/linux/jbd2.h +1
-1-extern int jbd2_journal_enable_debug; +extern u16 jbd2_journal_enable_debug;Why was this made 16-bit? To save 2 bytes? Could have saved 3 if we're going to do that.
OK.
Quoted 2 lines
Shoudln't all this debug info be a per-superblock thing rather than kernel-wide?
I don't think it is worth pursuing this feature since this seems to have been broken for a while now (its been there since the first git revission in ext3) and nobody has noticed it until now. It could be address on a later patch though, since the initial purpose of the patch was to fix the broken JBD2_DEBUG option. Of course, this may not be clearly express in the changelog. :)
-JRS
Quoted 7 lines · On Wed, 11 Jul 2007 00:38:09 -0500 "Jose R. Santos" <[email protected]> wrote:
Quoted 3 lines
Alternatively (and preferably) do this via an update to
Documentation/filesystems/ext4.txt.Seems like I also need to update the doc on
Kconfigas well. Do you prefer this in separate patches? (current patch, kconfig patch, ext4 doc update patch?
All these changes are logically connected (aren't they?). A single patch is fine.
Quoted 10 lines
Quoted 2 lines
Shoudln't all this debug info be a per-superblock thing rather than kernel-wide?
I don't think it is worth pursuing this feature since this seems to have been broken for a while now (its been there since the first git revission in ext3) and nobody has noticed it until now. It could be address on a later patch though, since the initial purpose of the patch was to fix the broken
JBD2_DEBUGoption. Of course, this may not be clearly express in the changelog. :)
I don't think that making it all per-superblock is worth the effort - it's a developer-only thing and developer will have the knowledge to test ext4 on an otherwise-ext3 setup if they're really fussed about the accuracy.
So yes, a bare make-it-work patch sounds appropriate. Or remove it, but hey, it might be useful. The timestamping stuff certainly looks useful.
The jbd2-debug file used to be located in /proc/sys/fs/jbd2-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/jbd2/jbd2-debug.
---
fs/Kconfig | 10 5 + 5 - 0 ! fs/jbd2/journal.c | 67 27 + 40 - 0 ! include/linux/jbd2.h | 2 1 + 1 - 0 ! 3 files changed, 33 insertions(+), 46 deletions(-)
fs/jbd2/journal.c +27 -40
@@ -35,6 +35,7 @@#include <linux/kthread.h> #include <linux/poison.h> #include <linux/proc_fs.h> +#include <linux/debugfs.h> #include <asm/uaccess.h> #include <asm/page.h>
@@ -1951,64 +1952,50 @@ void jbd2_journal_put_journal_head(struc }/* -* /proc tunables +* debugfs tunables */ #if defined(CONFIG_JBD2_DEBUG ) -int jbd2_journal_enable_debug; +u8 jbd2_journal_enable_debug;EXPORT_SYMBOL (jbd2_journal_enable_debug);#endif -#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_PROC_FS ) +#if defined(CONFIG_JBD2_DEBUG ) && defined(CONFIG_DEBUG_FS ) -static struct proc_dir_entry *proc_jbd_debug; +#define JBD2_DEBUG_NAME "jbd2-debug" -static int read_jbd_debug (char *page,char **start,off_t off, -int count,int *eof,void *data) -{ -int ret; +struct dentry *jbd2_debugfs_dir, *jbd2_debug; - ret =sprintf (page + off,"%d\n" , jbd2_journal_enable_debug); - *eof =1 ; -return ret; +static void __init jbd2_create_debugfs_entry (void ) +{ + jbd2_debugfs_dir =debugfs_create_dir ("jbd2" ,NULL ); +if (jbd2_debugfs_dir) + jbd2_debug =debugfs_create_u8 (JBD2_DEBUG_NAME ,S_IRUGO , + jbd2_debugfs_dir, + &jbd2_journal_enable_debug); } -static int write_jbd_debug (struct file *file,const char __user *buffer, -unsigned long count,void *data) +static void __exit jbd2_remove_debugfs_entry(void) { -char buf[32 ]; - -if (count >ARRAY_SIZE (buf) -1 ) - count =ARRAY_SIZE (buf) -1 ; -if (copy_from_user (buf, buffer, count)) -return -EFAULT ; - buf[ARRAY_SIZE (buf) -1 ] ='\0' ; - jbd2_journal_enable_debug =simple_strtoul (buf,NULL ,10 ); -return count; +if (jbd2_debug) +debugfs_remove (jbd2_debug); +if (jbd2_debugfs_dir) +debugfs_remove (jbd2_debugfs_dir); } -#define JBD_PROC_NAME "sys/fs/jbd2-debug" +#else -static void __init create_jbd_proc_entry (void ) +static void __init jbd2_create_debugfs_entry (void ) { - proc_jbd_debug =create_proc_entry (JBD_PROC_NAME ,0644 ,NULL ); -if (proc_jbd_debug) { -/* Why is this so hard? */ - proc_jbd_debug->read_proc = read_jbd_debug; - proc_jbd_debug->write_proc = write_jbd_debug; - } +do { + }while (0 ); } -static void __exit jbd2_remove_jbd_proc_entry(void) +static void __exit jbd2_remove_debugfs_entry(void) { -if (proc_jbd_debug) -remove_proc_entry (JBD_PROC_NAME ,NULL ); +do { + }while (0 ); } -#else - -#define create_jbd_proc_entry () do {} while (0) -#define jbd2_remove_jbd_proc_entry () do {} while (0) -#endif struct kmem_cache *jbd2_handle_cache;
@@ -2067,7 +2054,7 @@ static int __init journal_init(void) ret =journal_init_caches ();if (ret !=0 )jbd2_journal_destroy_caches (); -create_jbd_proc_entry (); +jbd2_create_debugfs_entry ();return ret; }
@@ -2078,7 +2065,7 @@ static void __exit journal_exit(void)if (n)printk (KERN_EMERG "JBD: leaked %d journal_heads!\n" , n);#endif -jbd2_remove_jbd_proc_entry (); +jbd2_remove_debugfs_entry ();jbd2_journal_destroy_caches (); }
include/linux/jbd2.h +1 -1
@@ -57,7 +57,7 @@* CONFIG_JBD2_DEBUG is on. */ #define JBD_EXPENSIVE_CHECKING -extern int jbd2_journal_enable_debug; +extern u8 jbd2_journal_enable_debug; #define jbd_debug(n, f, a...) \ do { \
fs/Kconfig +5 -5
@@ -251,7 +251,7 @@ config JBD2 config JBD2_DEBUG bool "JBD2 (ext4dev/ext4) debugging support" - depends on JBD2 + depends on JBD2 && DEBUG_FS help If you are using the ext4dev/ext4 journaled file system (or potentially any other filesystem/device using JBD2), this option
@@ -260,10 +260,10 @@ config JBD2_DEBUG By default, the debugging output will be turned off. If you select Y here, then you will be able to turn on debugging - with "echo N > /proc/sys/fs/jbd2-debug", where N is a number between - 1 and 5. The higher the number, the more debugging output is - generated. To turn debugging off again, do - "echo 0 > /proc/sys/fs/jbd2-debug". + with "echo N > /sys/kernel/debug/jbd2/jbd2-debug", where N is a + number between 1 and 5. The higher the number, the more debugging + output is generated. To turn debugging off again, do + "echo 0 > /sys/kernel/debug/jbd2/jbd2-debug". config FS_MBCACHE # Meta block cache for Extended Attributes (ext2/ext3/ext4)
PATCH 1/1 ext4: JBD->JBD2 naming cleanups
In reply to Andrew MortonQuoted 11 lines · Andrew Morton
include/linux/jbd2.h line 59
Quoted 8 lines
Index:
linux-2.6.22-rc4/include/linux/jbd2.h
===================================================================include/linux/jbd2.h +0
-0@@ -57,7 +57,7 @@* CONFIG_JBD2_DEBUG is on. */ #define JBD_EXPENSIVE_CHECKING JBD2?
Some cleanups in ext4/JBD2 to follow the naming fules:change micros name from JBD_XXX to JBD2_XXX.
--- fs/ext4/extents.c | 2 +- fs/ext4/super.c | 2 +- fs/jbd2/commit.c | 2 +- fs/jbd2/journal.c | 26 +++++++++++++------------- fs/jbd2/recovery.c | 2 +- fs/jbd2/revoke.c | 4 ++-- include/linux/ext4_jbd2.h | 6 +++--- include/linux/jbd2.h | 30 +++++++++++++++--------------- 8 files changed, 37 insertions(+), 37 deletions(-)
fs/ext4/super.c +1 -1
@@ -967,7 +967,7 @@ static int parse_options (char *options,if (option <0 )return 0 ;if (option ==0 ) - option =JBD_DEFAULT_MAX_COMMIT_AGE ; + option =JBD2_DEFAULT_MAX_COMMIT_AGE ; sbi->s_commit_interval =HZ * option;break ;case Opt_data_journal:
include/linux/ext4_jbd2.h +3 -3
@@ -12,8 +12,8 @@* Ext4-specific journaling extensions. */ -#ifndef _LINUX_EXT4_JBD_H -#define _LINUX_EXT4_JBD_H +#ifndef _LINUX_EXT4_JBD2_H +#define _LINUX_EXT4_JBD2_H#include <linux/fs.h> #include <linux/jbd2.h>
@@ -228,4 +228,4 @@ static inline int ext4_should_writeback_ return 0; } -#endif /* _LINUX_EXT4_JBD_H */ +#endif /* _LINUX_EXT4_JBD2_H */
include/linux/jbd2.h +15 -15
@@ -13,8 +13,8 @@* filesystem journaling support. */ -#ifndef _LINUX_JBD_H -#define _LINUX_JBD_H +#ifndef _LINUX_JBD2_H +#define _LINUX_JBD2_H/* Allow this file to be included directly into e2fsprogs */ #ifndef __KERNEL__
@@ -37,26 +37,26 @@#define journal_oom_retry 1/* -* Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds +* Define JBD2_PARANIOD_IOFAIL to cause a kernel BUG() if ext4 finds * certain classes of error which can occur due to failed IOs. Under -* normal use we want ext3 to continue after such errors, because +* normal use we want ext4 to continue after such errors, because * hardware _can_ fail, but for debugging purposes when running tests on * known-good hardware we may want to trap these errors. */ -#undef JBD_PARANOID_IOFAIL +#undef JBD2_PARANOID_IOFAIL/* * The default maximum commit age, in seconds. */ -#define JBD_DEFAULT_MAX_COMMIT_AGE 5 +#define JBD2_DEFAULT_MAX_COMMIT_AGE 5#ifdef CONFIG_JBD2_DEBUG /* -* Define JBD_EXPENSIVE_CHECKING to enable more expensive internal +* Define JBD2_EXPENSIVE_CHECKING to enable more expensive internal * consistency checks. By default we don't do this unless * CONFIG_JBD2_DEBUG is on. */ -#define JBD_EXPENSIVE_CHECKING +#define JBD2_EXPENSIVE_CHECKING extern u8 jbd2_journal_enable_debug; #define jbd_debug(n, f, a...) \
@@ -185,8 +185,8 @@ typedef struct journal_block_tag_s__be32 t_blocknr_high;/* most-significant high 32bits. */ } journal_block_tag_t; -#define JBD_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) -#define JBD_TAG_SIZE64 (sizeof(journal_block_tag_t)) +#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) +#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))/* * The revoke descriptor: used on disk to describe a series of blocks to
@@ -282,8 +282,8 @@ typedef struct journal_superblock_s#include <linux/fs.h> #include <linux/sched.h> -#define JBD_ASSERTIONS -#ifdef JBD_ASSERTIONS +#define JBD2_ASSERTIONS +#ifdef JBD2_ASSERTIONS #define J_ASSERT (assert) \ do { \ if (!(assert)) { \
@@ -310,9 +310,9 @@ void buffer_assertion_failure(struct buf#else #define J_ASSERT (assert) do { } while (0) -#endif /* JBD_ASSERTIONS */ +#endif /* JBD2_ASSERTIONS */ -#if defined(JBD_PARANOID_IOFAIL ) +#if defined(JBD2_PARANOID_IOFAIL ) #define J_EXPECT(expr, why...) J_ASSERT(expr) #define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr) #define J_EXPECT_JH(jh, expr, why...) J_ASSERT_JH(jh, expr)
@@ -1224,4 +1224,4 @@ extern int jbd_blocks_per_page(struct in#endif /* __KERNEL__ */ -#endif /* _LINUX_JBD_H */ +#endif /* _LINUX_JBD2_H */
fs/jbd2/commit.c +1 -1
@@ -356,7 +356,7 @@ static inline void write_tag_block(int t unsigned long long block) { tag->t_blocknr =cpu_to_be32 (block & (u32 )~0 ); -if (tag_bytes >JBD_TAG_SIZE32 ) +if (tag_bytes >JBD2_TAG_SIZE32 ) tag->t_blocknr_high =cpu_to_be32 ((block >>31 ) >>1 ); }
fs/jbd2/journal.c +13 -13
@@ -974,7 +974,7 @@ static journal_t * journal_init_common (spin_lock_init (&journal->j_list_lock);spin_lock_init (&journal->j_state_lock); - journal->j_commit_interval = (HZ *JBD_DEFAULT_MAX_COMMIT_AGE ); + journal->j_commit_interval = (HZ *JBD2_DEFAULT_MAX_COMMIT_AGE );/* The journal is marked for error until we succeed with recovery! */ journal->j_flags =JBD2_ABORT ;
@@ -1957,9 +1957,9 @@ int jbd2_journal_blocks_per_page(structsize_t journal_tag_bytes (journal_t *journal) {if (JBD2_HAS_INCOMPAT_FEATURE (journal,JBD2_FEATURE_INCOMPAT_64BIT )) -return JBD_TAG_SIZE64 ; +return JBD2_TAG_SIZE64 ;else -return JBD_TAG_SIZE32 ; +return JBD2_TAG_SIZE32 ; }/*
@@ -1979,11 +1979,11 @@ void * __jbd2_kmalloc (const char *where* cause bh to cross page boundary. */ -#define JBD_MAX_SLABS 5 -#define JBD_SLAB_INDEX (size) (size >> 11) +#define JBD2_MAX_SLABS 5 +#define JBD2_SLAB_INDEX (size) (size >> 11) -static struct kmem_cache *jbd_slab[JBD_MAX_SLABS ]; -static const char *jbd_slab_names[JBD_MAX_SLABS ] = { +static struct kmem_cache *jbd_slab[JBD2_MAX_SLABS ]; +static const char *jbd_slab_names[JBD2_MAX_SLABS ] = {"jbd2_1k" ,"jbd2_2k" ,"jbd2_4k" ,NULL ,"jbd2_8k" };
@@ -1991,7 +1991,7 @@ static void jbd2_journal_destroy_jbd_sla {int i; -for (i =0 ; i <JBD_MAX_SLABS ; i++) { +for (i =0 ; i <JBD2_MAX_SLABS ; i++) {if (jbd_slab[i])kmem_cache_destroy (jbd_slab[i]); jbd_slab[i] =NULL ;
@@ -2000,9 +2000,9 @@ static void jbd2_journal_destroy_jbd_slastatic int jbd2_journal_create_jbd_slab (size_t slab_size) { -int i =JBD_SLAB_INDEX (slab_size); +int i =JBD2_SLAB_INDEX (slab_size); -BUG_ON (i >=JBD_MAX_SLABS ); +BUG_ON (i >=JBD2_MAX_SLABS );/* * Check if we already have a slab created for this size
@@ -2028,7 +2028,7 @@ void * jbd2_slab_alloc(size_t size, gfp_ {int idx; - idx =JBD_SLAB_INDEX (size); + idx =JBD2_SLAB_INDEX (size);BUG_ON (jbd_slab[idx] ==NULL );return kmem_cache_alloc (jbd_slab[idx], flags | __GFP_NOFAIL); }
@@ -2037,7 +2037,7 @@ void jbd2_slab_free(void *ptr, size_t s {int idx; - idx =JBD_SLAB_INDEX (size); + idx =JBD2_SLAB_INDEX (size);BUG_ON (jbd_slab[idx] ==NULL );kmem_cache_free (jbd_slab[idx], ptr); }
@@ -2107,7 +2107,7 @@ static void journal_free_journal_head(st {#ifdef CONFIG_JBD2_DEBUG atomic_dec (&nr_journal_heads); -memset (jh,JBD_POISON_FREE ,sizeof (*jh)); +memset (jh,JBD2_POISON_FREE ,sizeof (*jh));#endif kmem_cache_free (jbd2_journal_head_cache, jh); }
fs/jbd2/recovery.c +1 -1
@@ -312,7 +312,7 @@ int jbd2_journal_skip_recovery(journal_tstatic inline unsigned long long read_tag_block (int tag_bytes,journal_block_tag_t *tag) {unsigned long long block =be32_to_cpu (tag->t_blocknr); -if (tag_bytes >JBD_TAG_SIZE32 ) +if (tag_bytes >JBD2_TAG_SIZE32 ) block |= (u64 )be32_to_cpu (tag->t_blocknr_high) <<32 ;return block; }
fs/jbd2/revoke.c +2 -2
@@ -351,7 +351,7 @@ int jbd2_journal_revoke(handle_t *handleif (bh)BUFFER_TRACE (bh,"found on hash" ); } -#ifdef JBD_EXPENSIVE_CHECKING +#ifdef JBD2_EXPENSIVE_CHECKING else {struct buffer_head *bh2;
@@ -452,7 +452,7 @@ int jbd2_journal_cancel_revoke(handle_t } } -#ifdef JBD_EXPENSIVE_CHECKING +#ifdef JBD2_EXPENSIVE_CHECKING /* There better not be one left behind by now! */ record =find_revoke_record (journal, bh->b_blocknr);J_ASSERT_JH (jh, record ==NULL );
fs/ext4/extents.c +1 -1
@@ -33,7 +33,7 @@#include <linux/fs.h> #include <linux/time.h> #include <linux/ext4_jbd2.h> -#include <linux/jbd.h> +#include <linux/jbd2.h> #include <linux/highuid.h> #include <linux/pagemap.h> #include <linux/quotaops.h>
ext4 patch queue updated
I have updated ext4 patch queue. The updated ext4 patch queue includes updated patches from Kalpak, Jose, and me. It now addresses most of review comments from Andrew, including checkpatch.pl complains, add "diffstat" etc. Also I noticed Amit has updated fallocate() patch series as well.
The patches that still need more attentions are:
ext4-journal_chksum-2.6.20.patch
jbd-stats-through-procfs_fix.patch
and inode version patch series
Thanks,
Mingming Cao