Re: [PATCH] hfs: export dbg_flags in debugfs

From: Viacheslav Dubeyko
Date: Fri May 09 2025 - 13:39:30 EST


Hi Yangtao,

On Wed, 2025-05-07 at 08:55 -0600, Yangtao Li wrote:
> hfs currently has some function tracking points,
> which are helpful for problem analysis, but rely on
> modifying the DBG_MASK macro.
>
> Modifying the macro requires recompiling the kernel,
> and the control of the log is more troublesome.
>
> Let's export this debug facility to debugfs so that
> it can be easily controlled through the node.
>
> node:
> /sys/kernel/debug/hfs/dbg_flags
>
> for_each_bit:
>
> DBG_BNODE_REFS  0x00000001
> DBG_BNODE_MOD   0x00000002
> DBG_CAT_MOD     0x00000004
> DBG_INODE       0x00000008
> DBG_SUPER       0x00000010
> DBG_EXTENT      0x00000020
> DBG_BITMAP      0x00000040
>

Frankly speaking, if we would like to rework the debugging framework in
HFS/HFS+, then I prefer to switch on pr_debug() and to use dynamic
debug framework of Linux kernel [1]. It will provide the more flexible
solution.

Thanks,
Slava.

[1] https://www.kernel.org/doc/html/v4.14/admin-guide/dynamic-debug-howto.html