From 09bba903b5e99296c7b8072f9ff2b11458bdbfd3 Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy Enable UBIFS debugging support in the configuration menu
-(the "UBIFS debugging support" check-box). This will make sure that
-assertions, debugging messages, self-checks and test modes are compiled-in.
-The assertions will be enabled, but messages, self-checks and test modes
-will be disabled by default. This option will also make many error messages
-to be more verbose (e.g., include flash dumps). This option should not slow
-down UBIFS, so it is recommended to always have it switched on, unless you
-are very concerned about UBIFS code size. Sometimes it is necessary to make UBIFS print about what it is doing. You may
-enable various UBIFS debugging messages using the The nandsim
NAND simulator. Please, refer
the available fake MTD devices.
-Enable UBIFS debugging support
-
-Debugging messages
debug_msgs
-UBIFS module parameter, or using the ubifs.debug_msgs
kernel boot
-parameter if you have UBIFS compiled in. Alternatively, the same can be
-achieved by changing the /sys/module/ubifs/parameters/debug_tsts
-file.debug_msgs
option is a bit-mask which controls which message
-type has to be printed. You can combine the message types arbitrarily. The
-following message types are supported:CONFIG_DYNAMIC_DEBUG
kernel configuration option). Please, refer
+the Documentation/dynamic-debug-howto.txt
file in the Linux kernel
+sources tree for details, but here we only provide some useful recepies.
In the below table we use the fact that UBIFS prefixes all debugging messages
+with "UBIFS DBG", which is followed by the subsystem name (see
+fs/ubifs/debug.h
).
Message Type | -Value | +Magic string | +
All messages (very noisy) | +format "UBIFS DBG" +pf' | |
General messages | -1 | +format "UBIFS DBG gen" +pf' |
Journal messages | -2 | +format "UBIFS DBG jnl" +pf' |
Mount messages | -4 | +format "UBIFS DBG mnt" +pf' |
Commit messages | -8 | +format "UBIFS DBG cmt" +pf' |
LEB search messages | -16 | +format "UBIFS DBG find" +pf' |
Budgeting messages | -32 | +format "UBIFS DBG budg" +pf' |
Garbage collection messages | -64 | +format "UBIFS DBG gc" +pf' |
Tree Node Cache (TNC) messages | -128 | +format "UBIFS DBG tnc" +pf' |
LEB properties (lprops) messages | -256 | +format "UBIFS DBG lp" +pf' |
Input/output messages | -512 | +format "UBIFS DBG io" +pf' |
Log messages | -1024 | +format "UBIFS DBG log" +pf' |
Scan messages | -2048 | +format "UBIFS DBG scan" +pf' |
Recovery messages | -4096 | +format "UBIFS DBG rcvry" +pf' |
E.g., "echo 4097 > /sys/module/ubifs/parameters/debug_tsts
"
-enables general and recovery messages.
To enable the debugging messages you should just write the magic string to
+the /sys/kernel/debug/dynamic_debug/control
file (granted your
+debugfs is mounted at /sys/kernel/debug
):
+echo 'format "UBIFS DBG" +pf' > /sys/kernel/debug/dynamic_debug/control ++ +
If you are debugging an issue which happens boot time, you can pass the
+magic string with the ddebug_query
kernel boot parameter (and
+please, do not forget to add the ignore_loglevel
if you are
+relying on your default console output).
UBIFS may print huge amount of debugging messages and slow down your system considerably. You might also end up losing them if your ring buffer is not -large enough. This section explains -how to make the ring buffer larger.
+large enough. Use thelog_buf_len=
kernel boot parameter to make
+the ring buffer larger (e.g., log_buf_len=64M
).
Similarly to debugging messages, the self-checks can be switched on
-using the debug_chks
UBIFS module parameter or the
-/sys/module/ubifs/parameters/debug_chks
file. The
-debug_chks
option is a bit-mask which selects the check
-types to be enabled.
If your debugfs is mounted at /sys/kernel/debug
, then you
+should have global self-check switches at /sys/kernel/debug/ubifs
+(affect all mounted file-systems and available even when you do not have any
+file-system mounted) and per-file-system switches at
+/sys/kernel/debug/ubifs/ubiX_Y
, where X
is the
+mounted UBI device number and Y
is the mounted volume ID. E.g.,
+when I mount /dev/ubi0_1
, I have the following:
+$ cd /sys/kernel/debug/ubifs +$ ls +chk_fs chk_general chk_index chk_lprops chk_orphans tst_recovery ubi0_0 +$ ls ubi0_0/ +chk_fs chk_index chk_orphans dump_lprops ro_error +chk_general chk_lprops dump_budg dump_tnc tst_recovery ++ +
The self-check files start with "chk_" which follows by the UBIFS sub-system +name where the self-checks will be enabled. The below table provides some more +details.
Check type | -Value | -||
General checks | -1 | -||
Check Tree Node Cache (TNC) | -2 | +File name | |
Check indexing tree size | -4 | +General checks. Check correctness of inode size and link count, + buds accounting and node lists sorting, lprops categories, etc. + Also forces the "in-the-gaps" commit method whenever possible + (normally this method is used very rarely as the last resort method + when there is no enough free space to commit the normal way). | +chk_general |
Check orphan area | -8 | +Index checks. Quite heavy checks of index correctness. | +chk_index |
Check old indexing tree | -16 | +Orphans checks. | +chk_orphans |
Check LEB properties (lprops) | -32 | +LEB properties (lprops) checks. | +chk_lprops |
Check leaf nodes and inodes | -64 | +Full file-system data checks on every commit. | +chk_fs |
E.g., "echo 3 > /sys/module/ubifs/parameters/debug_chks
" enables
-general checks and TNC checks. But for testing, it is better to just enable
-all checks: "echo 127 > /sys/module/ubifs/parameters/debug_chks
".
UBIFS currently supports 2 test modes:
-UBIFS suppors the power-cut emulation infrastructure which emulates a +power-cut at random points. When a power-cut is emulated, UBIFS switches to +read-only mode and disallows any further write to the UBIFS volume, thus +emulating a power cut. The main idea of this mode is to emulate power cuts in +"interesting" places, e.g., when changing the log, or the orphans area. Indeed, +real power-cuts testing mostly interrupts UBIFS when it is writing data to the +journal.
+ +Use the tst_recovery
debugfs file to enable the power-cut
+recovery testing mode. Alternatively, you may switch UBIFS to R/O mode using
+the ro_error
file.
The integck
test program (part of the mtd-utils
+repository) is aware of UBIFS power cut recovery testing mode and can be used
+for UBIFS power-cut testing.
echo 127 > /sys/module/ubifs/parameters/debug_chks
".
CONFIG_KALLSYMS_ALL=y
in .config
);CONFIG_UBIFS_FS_DEBUG=y
in
- .config
); this option will make UBIFS print more
- informative error messages; note, you should enable UBIFS
- debugging, not UBI debugging - distinguish between UBI and UBIFS please,
- they are different things;dmesg
; or
before running your UBIFS test, which reproduces the error, just
@@ -1407,26 +1406,16 @@ all checks: "echo 127 > /sys/module/ubifs/parameters/debug_chks
".
with ignore_loglevel
option, in which makes the kernel
print all messages to the console unconditionally;
this section contains
- some more information about how the messages can be collected..config
file, or just attach whole file;mtdinfo -a
"
output (or the less useful "cat /proc/mtd
" output);The bugreport should be sent to the -- 2.49.0