Hi Slava,
在 2025/7/12 01:24, Viacheslav Dubeyko 写道:
On Fri, 2025-07-11 at 10:41 +0800, Yangtao Li wrote:
Hi Slava,
在 2025/7/11 06:16, Viacheslav Dubeyko 写道:
Currently, HFS/HFS+ has very obsolete and inconvenient
debug output subsystem. Also, the code is duplicated
in HFS and HFS+ driver. This patch introduces
linux/hfs_common.h for gathering common declarations,
inline functions, and common short methods. Currently,
this file contains only hfs_dbg() function that
employs pr_debug() with the goal to print a debug-level
messages conditionally.
So, now, it is possible to enable the debug output
by means of:
echo 'file extent.c +p' > /proc/dynamic_debug/control
echo 'func hfsplus_evict_inode +p' > /proc/dynamic_debug/control
And debug output looks like this:
hfs: pid 5831:fs/hfs/catalog.c:228 hfs_cat_delete(): delete_cat:
m00,48
hfs: pid 5831:fs/hfs/extent.c:484 hfs_file_truncate(): truncate:
48, 409600 -> 0
hfs: pid 5831:fs/hfs/extent.c:212 hfs_dump_extent():
hfs: pid 5831:fs/hfs/extent.c:214 hfs_dump_extent(): 78:4
hfs: pid 5831:fs/hfs/extent.c:214 hfs_dump_extent(): 0:0
hfs: pid 5831:fs/hfs/extent.c:214 hfs_dump_extent(): 0:0
Signed-off-by: Viacheslav Dubeyko <slava@xxxxxxxxxxx>
cc: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>
cc: Yangtao Li <frank.li@xxxxxxxx>
cc: linux-fsdevel@xxxxxxxxxxxxxxx
cc: Johannes Thumshirn <Johannes.Thumshirn@xxxxxxx>
---
fs/hfs/bfind.c | 4 ++--
fs/hfs/bitmap.c | 4 ++--
fs/hfs/bnode.c | 28 ++++++++++++++--------------
fs/hfs/brec.c | 8 ++++----
fs/hfs/btree.c | 2 +-
fs/hfs/catalog.c | 6 +++---
fs/hfs/extent.c | 18 +++++++++---------
fs/hfs/hfs_fs.h | 33 +--------------------------------
fs/hfs/inode.c | 4 ++--
fs/hfsplus/attributes.c | 8 ++++----
fs/hfsplus/bfind.c | 4 ++--
fs/hfsplus/bitmap.c | 10 +++++-----
fs/hfsplus/bnode.c | 28 ++++++++++++++--------------
fs/hfsplus/brec.c | 10 +++++-----
fs/hfsplus/btree.c | 4 ++--
fs/hfsplus/catalog.c | 6 +++---
fs/hfsplus/extents.c | 24 ++++++++++++------------
fs/hfsplus/hfsplus_fs.h | 35 +--------------------------------
--
fs/hfsplus/super.c | 8 ++++----
fs/hfsplus/xattr.c | 4 ++--
include/linux/hfs_common.h | 20 ++++++++++++++++++++
For include/linux/hfs_common.h, it seems like to be a good start to
seperate common stuff for hfs&hfsplus.
Colud we rework msg to add value description?
There're too much values to identify what it is.
What do you mean by value description?
For example:
hfs_dbg(BNODE_MOD, "%d, %d, %d, %d, %d\n",
be32_to_cpu(desc.next), be32_to_cpu(desc.prev),
desc.type, desc.height, be16_to_cpu(desc.num_recs));
There are 5 %d. It's hard to recognize what it is. Changing it to
following style w/ description might be a bit more clear?
hfs_dbg(BNODE_MOD, "next:%d prev:%d, type:%s, height:%d
num_recs:%d\n", be32_to_cpu(desc.next), be32_to_cpu(desc.prev),
hfs_node_type(desc.type), desc.height, be16_to_cpu(desc.num_recs));
You ignore those msg type, maybe we don't need it?
Could you please explain what do you mean here? :)
-#define DBG_BNODE_REFS 0x00000001
-#define DBG_BNODE_MOD 0x00000002
-#define DBG_CAT_MOD 0x00000004
-#define DBG_INODE 0x00000008
-#define DBG_SUPER 0x00000010
-#define DBG_EXTENT 0x00000020
-#define DBG_BITMAP 0x00000040
I'm not sure whether we should keep those dbg type.
Thx,
Yangtao