hfs/hfsplus: rework debug output subsystem
Subsystems (3)
Viacheslav Dubeyko
maintainerPATCH v4 1/1 hfs/hfsplus: rework debug output subsystem
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: 00,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
v4
Debug messages have been reworked and information about new HFS/HFS+ shared declarations file has been added to MAINTAINERS file.
--- MAINTAINERS | 2 ++ 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 | 19 ++++++++++--------- 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 | 25 +++++++++++++------------ fs/hfsplus/hfsplus_fs.h | 35 +---------------------------------- fs/hfsplus/super.c | 17 +++++++++++++---- fs/hfsplus/xattr.c | 4 ++-- include/linux/hfs_common.h | 20 ++++++++++++++++++++ 22 files changed, 125 insertions(+), 156 deletions(-) create mode 100644 include/linux/hfs_common.h
MAINTAINERS +2 -0
@@ -10793,6 +10793,7 @@ L: [email protected] S: Maintained F: Documentation/filesystems/hfs.rst F: fs/hfs/ +F: include/linux/hfs_common.h HFSPLUS FILESYSTEM M: Viacheslav Dubeyko <[email protected]>
@@ -10802,6 +10803,7 @@ L: [email protected] S: Maintained F: Documentation/filesystems/hfsplus.rst F: fs/hfsplus/ +F: include/linux/hfs_common.h HGA FRAMEBUFFER DRIVER M: Ferenc Bakonyi <[email protected]>
fs/hfs/bfind.c +2 -2
@@ -26,7 +26,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)return -ENOMEM ; fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ; -hfs_dbg (BNODE_REFS ,"find_init: %d (%p)\n" , +hfs_dbg ("tree: CNID %d, caller %p\n" , tree->cnid,__builtin_return_address (0 ));switch (tree->cnid) {case HFS_CAT_CNID :
@@ -48,7 +48,7 @@ void hfs_find_exit(struct hfs_find_data *fd) {hfs_bnode_put (fd->bnode);kfree (fd->search_key); -hfs_dbg (BNODE_REFS ,"find_exit: %d (%p)\n" , +hfs_dbg ("tree: CNID %d, caller %p\n" , fd->tree->cnid,__builtin_return_address (0 ));mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ;
fs/hfs/bitmap.c +2 -2
@@ -158,7 +158,7 @@ u32 hfs_vbm_search_free(struct super_block *sb, u32 goal, u32 *num_bits) } } -hfs_dbg (BITMAP ,"alloc_bits: %u,%u\n" , pos, *num_bits); +hfs_dbg ("RANGE: pos %u, num_bits %u\n" , pos, *num_bits);HFS_SB (sb)->free_ablocks -= *num_bits;hfs_bitmap_dirty (sb); out:
@@ -200,7 +200,7 @@ int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count)if (!count)return 0 ; -hfs_dbg (BITMAP ,"clear_bits: %u,%u\n" , start, count); +hfs_dbg ("RANGE: start %u, count %u\n" , start, count);/* are all of the bits in range? */ if ((start + count) >HFS_SB (sb)->fs_ablocks)return -2 ;
fs/hfs/bnode.c +14 -14
@@ -200,7 +200,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, {struct page *src_page, *dst_page; -hfs_dbg (BNODE_MOD ,"copybytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("copybytes: dst %u, src %u, len %u\n" , dst, src, len);if (!len)return ;
@@ -221,7 +221,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)struct page *page;void *ptr; -hfs_dbg (BNODE_MOD ,"movebytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("movebytes: dst %u, src %u, len %u\n" , dst, src, len);if (!len)return ;
@@ -243,16 +243,16 @@ void hfs_bnode_dump(struct hfs_bnode *node)__be32 cnid;int i, off, key_off; -hfs_dbg (BNODE_MOD ,"bnode: %d\n" , node->this); +hfs_dbg ("node_id %d\n" , node->this);hfs_bnode_read (node, &desc,0 ,sizeof (desc)); -hfs_dbg (BNODE_MOD ,"%d, %d, %d, %d, %d\n" , +hfs_dbg ("next %d, prev %d, type %d, height %d, num_recs %d\n" ,be32_to_cpu (desc.next),be32_to_cpu (desc.prev), desc.type, desc.height,be16_to_cpu (desc.num_recs)); off = node->tree->node_size -2 ;for (i =be16_to_cpu (desc.num_recs); i >=0 ; off -=2 , i--) { key_off =hfs_bnode_read_u16 (node, off); -hfs_dbg_cont (BNODE_MOD ," %d" , key_off); +hfs_dbg (" key_off %d" , key_off);if (i && node->type ==HFS_NODE_INDEX ) {int tmp;
@@ -260,18 +260,18 @@ void hfs_bnode_dump(struct hfs_bnode *node) tmp = (hfs_bnode_read_u8 (node, key_off) |1 ) +1 ; else tmp = node->tree->max_key_len +1 ; -hfs_dbg_cont (BNODE_MOD ," (%d,%d" , - tmp,hfs_bnode_read_u8 (node, key_off)); +hfs_dbg (" (%d,%d" , + tmp,hfs_bnode_read_u8 (node, key_off));hfs_bnode_read (node, &cnid, key_off + tmp,4 ); -hfs_dbg_cont (BNODE_MOD ,",%d)" ,be32_to_cpu (cnid)); +hfs_dbg (", cnid %d)" ,be32_to_cpu (cnid)); }else if (i && node->type ==HFS_NODE_LEAF ) {int tmp; tmp =hfs_bnode_read_u8 (node, key_off); -hfs_dbg_cont (BNODE_MOD ," (%d)" , tmp); +hfs_dbg (" (%d)" , tmp); } } -hfs_dbg_cont (BNODE_MOD ,"\n" ); +hfs_dbg ("\n" ); }void hfs_bnode_unlink (struct hfs_bnode *node)
@@ -361,7 +361,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) node->this = cnid;set_bit (HFS_BNODE_NEW , &node->flags);atomic_set (&node->refcnt,1 ); -hfs_dbg (BNODE_REFS ,"new_node(%d:%d): 1\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt 1\n" , node->tree->cnid, node->this);init_waitqueue_head (&node->lock_wq);spin_lock (&tree->hash_lock);
@@ -401,7 +401,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node) {struct hfs_bnode **p; -hfs_dbg (BNODE_REFS ,"remove_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));for (p = &node->tree->node_hash[hfs_bnode_hash (node->this)]; *p && *p != node; p = &(*p)->next_hash)
@@ -546,7 +546,7 @@ void hfs_bnode_get(struct hfs_bnode *node) {if (node) {atomic_inc (&node->refcnt); -hfs_dbg (BNODE_REFS ,"get_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt)); }
@@ -559,7 +559,7 @@ void hfs_bnode_put(struct hfs_bnode *node)struct hfs_btree *tree = node->tree;int i; -hfs_dbg (BNODE_REFS ,"put_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));BUG_ON (!atomic_read (&node->refcnt));
fs/hfs/brec.c +4 -4
@@ -94,7 +94,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) end_rec_off = tree->node_size - (node->num_recs +1 ) *2 ; end_off =hfs_bnode_read_u16 (node, end_rec_off); end_rec_off -=2 ; -hfs_dbg (BNODE_MOD ,"insert_rec: %d, %d, %d, %d\n" , +hfs_dbg ("RECORD: rec %d, size %d, end_off %d, end_rec_off %d\n" , rec, size, end_off, end_rec_off);if (size > end_rec_off - end_off) {if (new_node)
@@ -191,7 +191,7 @@ int hfs_brec_remove(struct hfs_find_data *fd)mark_inode_dirty (tree->inode); }hfs_bnode_dump (node); -hfs_dbg (BNODE_MOD ,"remove_rec: %d, %d\n" , +hfs_dbg ("RECORD: rec %d, len %d\n" , fd->record, fd->keylength + fd->entrylength);if (!--node->num_recs) {hfs_bnode_unlink (node);
@@ -242,7 +242,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)if (IS_ERR (new_node))return new_node;hfs_bnode_get (node); -hfs_dbg (BNODE_MOD ,"split_nodes: %d - %d - %d\n" , +hfs_dbg ("NODES: this %d, new %d, next %d\n" , node->this, new_node->this, node->next); new_node->next = node->next; new_node->prev = node->this;
@@ -378,7 +378,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) newkeylen = (hfs_bnode_read_u8 (node,14 ) |1 ) +1 ; else fd->keylength = newkeylen = tree->max_key_len + 1; -hfs_dbg (BNODE_MOD ,"update_rec: %d, %d, %d\n" , +hfs_dbg ("RECORD: rec %d, keylength %d, newkeylen %d\n" , rec, fd->keylength, newkeylen); rec_off = tree->node_size - (rec +2 ) *2 ;
fs/hfs/btree.c +1 -1
@@ -364,7 +364,7 @@ void hfs_bmap_free(struct hfs_bnode *node)u32 nidx;u8 *data, byte, m; -hfs_dbg (BNODE_MOD ,"btree_free_node: %u\n" , node->this); +hfs_dbg ("node_id %u\n" , node->this); tree = node->tree; nidx = node->this; node =hfs_bnode_find (tree,0 );
fs/hfs/catalog.c +3 -3
@@ -87,7 +87,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct iint entry_size;int err; -hfs_dbg (CAT_MOD ,"create_cat: %s,%u(%d)\n" , +hfs_dbg ("entry: name %s, cnid %u, i_nlink %d\n" , str->name, cnid, inode->i_nlink);if (dir->i_size >=HFS_MAX_VALENCE )return -ENOSPC ;
@@ -225,7 +225,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str)struct hfs_readdir_data *rd;int res, type; -hfs_dbg (CAT_MOD ,"delete_cat: %s,%u\n" , str ? str->name :NULL , cnid); +hfs_dbg ("entry: name %s, cnid %u\n" , str ? str->name :NULL , cnid); sb = dir->i_sb; res =hfs_find_init (HFS_SB (sb)->cat_tree, &fd);if (res)
@@ -294,7 +294,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,int entry_size, type;int err; -hfs_dbg (CAT_MOD ,"rename_cat: %u - %lu,%s - %lu,%s\n" , +hfs_dbg ("CNID %u - entry1(ino %lu, name %s) - entry2(ino %lu, name %s)\n" , cnid, src_dir->i_ino, src_name->name, dst_dir->i_ino, dst_name->name); sb = src_dir->i_sb;
fs/hfs/extent.c +10 -9
@@ -209,12 +209,12 @@ static void hfs_dump_extent(struct hfs_extent *extent) {int i; -hfs_dbg (EXTENT ," " ); +hfs_dbg ("EXTENT: " );for (i =0 ; i <3 ; i++) -hfs_dbg_cont (EXTENT ," %u:%u" , -be16_to_cpu (extent[i].block), -be16_to_cpu (extent[i].count)); -hfs_dbg_cont (EXTENT ,"\n" ); +hfs_dbg (" block %u, count %u" , +be16_to_cpu (extent[i].block), +be16_to_cpu (extent[i].count)); +hfs_dbg ("\n" ); } static int hfs_add_extent(struct hfs_extent *extent, u16 offset,
@@ -411,10 +411,11 @@ int hfs_extend_file(struct inode *inode) goto out; } -hfs_dbg (EXTENT ,"extend %lu: %u,%u\n" , inode->i_ino, start, len); +hfs_dbg ("ino %lu: start %u, len %u\n" , inode->i_ino, start, len);if (HFS_I (inode)->alloc_blocks ==HFS_I (inode)->first_blocks) {if (!HFS_I (inode)->first_blocks) { -hfs_dbg (EXTENT ,"first extents\n" ); +hfs_dbg ("first_extents[0]: start %u, len %u\n" , + start, len);/* no extents yet */ HFS_I (inode)->first_extents[0 ].block =cpu_to_be16 (start);HFS_I (inode)->first_extents[0 ].count =cpu_to_be16 (len);
@@ -456,7 +457,7 @@ int hfs_extend_file(struct inode *inode)return res; insert_extent: -hfs_dbg (EXTENT ,"insert new extent\n" ); +hfs_dbg ("insert new extent\n" ); res =hfs_ext_write_extent (inode);if (res) goto out;
@@ -481,7 +482,7 @@ void hfs_file_truncate(struct inode *inode)u32 size;int res; -hfs_dbg (INODE ,"truncate: %lu, %Lu -> %Lu\n" , +hfs_dbg ("ino: %lu, phys_size %llu -> i_size %llu\n" , inode->i_ino, (long long )HFS_I (inode)->phys_size, inode->i_size);if (inode->i_size >HFS_I (inode)->phys_size) {
fs/hfs/hfs_fs.h +1 -32
@@ -9,12 +9,6 @@#ifndef _LINUX_HFS_FS_H#define _LINUX_HFS_FS_H -#ifdef pr_fmt -#undef pr_fmt -#endif - -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/slab.h> #include <linux/types.h> #include <linux/mutex.h>
@@ -24,35 +18,10 @@#include <asm/byteorder.h> #include <linux/uaccess.h> +#include <linux/hfs_common.h> #include "hfs.h" -#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 - -//#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD|DBG_CAT_MOD|DBG_BITMAP) -//#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) -//#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) -#define DBG_MASK (0) - -#define hfs_dbg (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ -} while (0) - -#define hfs_dbg_cont (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - pr_cont(fmt, ##__VA_ARGS__); \ -} while (0) - -/* * struct hfs_inode_info *
fs/hfs/inode.c +2 -2
@@ -241,7 +241,7 @@ void hfs_delete_inode(struct inode *inode) {struct super_block *sb = inode->i_sb; -hfs_dbg (INODE ,"delete_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);if (S_ISDIR (inode->i_mode)) {HFS_SB (sb)->folder_count--;if (HFS_I (inode)->cat_key.ParID ==cpu_to_be32 (HFS_ROOT_CNID ))
@@ -425,7 +425,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)hfs_cat_rec rec;int res; -hfs_dbg (INODE ,"hfs_write_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino); res =hfs_ext_write_extent (inode);if (res)return res;
fs/hfsplus/attributes.c +4 -4
@@ -139,7 +139,7 @@ int hfsplus_find_attr(struct super_block *sb, u32 cnid, {int err =0 ; -hfs_dbg (ATTR_MOD ,"find_attr: %s,%d\n" , name ? name :NULL , cnid); +hfs_dbg ("name %s, cnid %d\n" , name ? name :NULL , cnid);if (!HFSPLUS_SB (sb)->attr_tree) {pr_err ("attributes file doesn't exist\n" );
@@ -201,7 +201,7 @@ int hfsplus_create_attr(struct inode *inode,int entry_size;int err; -hfs_dbg (ATTR_MOD ,"create_attr: %s,%ld\n" , +hfs_dbg ("name %s, ino %ld\n" , name ? name :NULL , inode->i_ino);if (!HFSPLUS_SB (sb)->attr_tree) {
@@ -310,7 +310,7 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)struct super_block *sb = inode->i_sb;struct hfs_find_data fd; -hfs_dbg (ATTR_MOD ,"delete_attr: %s,%ld\n" , +hfs_dbg ("name %s, ino %ld\n" , name ? name :NULL , inode->i_ino);if (!HFSPLUS_SB (sb)->attr_tree) {
@@ -356,7 +356,7 @@ int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid)int err =0 ;struct hfs_find_data fd; -hfs_dbg (ATTR_MOD ,"delete_all_attrs: %d\n" , cnid); +hfs_dbg ("cnid: %d\n" , cnid);if (!HFSPLUS_SB (dir->i_sb)->attr_tree) {pr_err ("attributes file doesn't exist\n" );
fs/hfsplus/bfind.c +2 -2
@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)return -ENOMEM ; fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ; -hfs_dbg (BNODE_REFS ,"find_init: %d (%p)\n" , +hfs_dbg ("CNID %d, caller %p\n" , tree->cnid,__builtin_return_address (0 ));mutex_lock_nested (&tree->tree_lock,hfsplus_btree_lock_class (tree));
@@ -34,7 +34,7 @@ void hfs_find_exit(struct hfs_find_data *fd) {hfs_bnode_put (fd->bnode);kfree (fd->search_key); -hfs_dbg (BNODE_REFS ,"find_exit: %d (%p)\n" , +hfs_dbg ("CNID %d, caller %p\n" , fd->tree->cnid,__builtin_return_address (0 ));mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ;
fs/hfsplus/bitmap.c +5 -5
@@ -31,7 +31,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,if (!len)return size; -hfs_dbg (BITMAP ,"block_allocate: %u,%u,%u\n" , size, offset, len); +hfs_dbg ("RANGE: size %u, offset %u, len %u\n" , size, offset, len);mutex_lock (&sbi->alloc_mutex); mapping = sbi->alloc_file->i_mapping; page =read_mapping_page (mapping, offset /PAGE_CACHE_BITS ,NULL );
@@ -90,14 +90,14 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,else end = pptr + ((size +31 ) & (PAGE_CACHE_BITS -1 )) /32 ; } -hfs_dbg (BITMAP ,"bitmap full\n" ); +hfs_dbg ("bitmap full\n" ); start = size; goto out; found: start = offset + (curr - pptr) *32 + i;if (start >= size) { -hfs_dbg (BITMAP ,"bitmap full\n" ); +hfs_dbg ("bitmap full\n" ); goto out; }/* do any partial u32 at the start */
@@ -155,7 +155,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, *max = offset + (curr - pptr) *32 + i - start; sbi->free_blocks -= *max;hfsplus_mark_mdb_dirty (sb); -hfs_dbg (BITMAP ,"-> %u,%u\n" , start, *max); +hfs_dbg ("RANGE-> start %u, max %u\n" , start, *max); out:mutex_unlock (&sbi->alloc_mutex);return start;
@@ -174,7 +174,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)if (!count)return 0 ; -hfs_dbg (BITMAP ,"block_free: %u,%u\n" , offset, count); +hfs_dbg ("RANGE: offset %u, count %u\n" , offset, count);/* are all of the bits in range? */ if ((offset + count) > sbi->total_blocks)return -ENOENT ;
fs/hfsplus/bnode.c +14 -14
@@ -214,7 +214,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst,struct page **src_page, **dst_page;int l; -hfs_dbg (BNODE_MOD ,"copybytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("copybytes: dst %u, src %u, len %u\n" , dst, src, len);if (!len)return ;
@@ -272,7 +272,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)void *src_ptr, *dst_ptr;int l; -hfs_dbg (BNODE_MOD ,"movebytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("movebytes: dst %u, src %u, len %u\n" , dst, src, len);if (!len)return ;
@@ -392,16 +392,16 @@ void hfs_bnode_dump(struct hfs_bnode *node)__be32 cnid;int i, off, key_off; -hfs_dbg (BNODE_MOD ,"bnode: %d\n" , node->this); +hfs_dbg ("node_id %d\n" , node->this);hfs_bnode_read (node, &desc,0 ,sizeof (desc)); -hfs_dbg (BNODE_MOD ,"%d, %d, %d, %d, %d\n" , +hfs_dbg ("next %d, prev %d, type %d, height %d, num_recs %d\n" ,be32_to_cpu (desc.next),be32_to_cpu (desc.prev), desc.type, desc.height,be16_to_cpu (desc.num_recs)); off = node->tree->node_size -2 ;for (i =be16_to_cpu (desc.num_recs); i >=0 ; off -=2 , i--) { key_off =hfs_bnode_read_u16 (node, off); -hfs_dbg (BNODE_MOD ," %d" , key_off); +hfs_dbg (" key_off %d" , key_off);if (i && node->type ==HFS_NODE_INDEX ) {int tmp;
@@ -410,17 +410,17 @@ void hfs_bnode_dump(struct hfs_bnode *node) tmp =hfs_bnode_read_u16 (node, key_off) +2 ; else tmp = node->tree->max_key_len +2 ; -hfs_dbg_cont (BNODE_MOD ," (%d" , tmp); +hfs_dbg (" (%d" , tmp);hfs_bnode_read (node, &cnid, key_off + tmp,4 ); -hfs_dbg_cont (BNODE_MOD ,",%d)" ,be32_to_cpu (cnid)); +hfs_dbg (", cnid %d)" ,be32_to_cpu (cnid)); }else if (i && node->type ==HFS_NODE_LEAF ) {int tmp; tmp =hfs_bnode_read_u16 (node, key_off); -hfs_dbg_cont (BNODE_MOD ," (%d)" , tmp); +hfs_dbg (" (%d)" , tmp); } } -hfs_dbg_cont (BNODE_MOD ,"\n" ); +hfs_dbg ("\n" ); }void hfs_bnode_unlink (struct hfs_bnode *node)
@@ -456,7 +456,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)/* move down? */ if (!node->prev && !node->next) -hfs_dbg (BNODE_MOD ,"hfs_btree_del_level\n" ); +hfs_dbg ("btree delete level\n" );if (!node->parent) { tree->root =0 ; tree->depth =0 ;
@@ -511,7 +511,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) node->this = cnid;set_bit (HFS_BNODE_NEW , &node->flags);atomic_set (&node->refcnt,1 ); -hfs_dbg (BNODE_REFS ,"new_node(%d:%d): 1\n" , +hfs_dbg ("cnid%d, node_id %d, refcnt 1\n" , node->tree->cnid, node->this);init_waitqueue_head (&node->lock_wq);spin_lock (&tree->hash_lock);
@@ -551,7 +551,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node) {struct hfs_bnode **p; -hfs_dbg (BNODE_REFS ,"remove_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));for (p = &node->tree->node_hash[hfs_bnode_hash (node->this)]; *p && *p != node; p = &(*p)->next_hash)
@@ -697,7 +697,7 @@ void hfs_bnode_get(struct hfs_bnode *node) {if (node) {atomic_inc (&node->refcnt); -hfs_dbg (BNODE_REFS ,"get_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt)); }
@@ -710,7 +710,7 @@ void hfs_bnode_put(struct hfs_bnode *node)struct hfs_btree *tree = node->tree;int i; -hfs_dbg (BNODE_REFS ,"put_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));BUG_ON (!atomic_read (&node->refcnt));
fs/hfsplus/brec.c +5 -5
@@ -92,7 +92,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) end_rec_off = tree->node_size - (node->num_recs +1 ) *2 ; end_off =hfs_bnode_read_u16 (node, end_rec_off); end_rec_off -=2 ; -hfs_dbg (BNODE_MOD ,"insert_rec: %d, %d, %d, %d\n" , +hfs_dbg ("RECORD: rec %d, size %d, end_off %d, end_rec_off %d\n" , rec, size, end_off, end_rec_off);if (size > end_rec_off - end_off) {if (new_node)
@@ -193,7 +193,7 @@ int hfs_brec_remove(struct hfs_find_data *fd)mark_inode_dirty (tree->inode); }hfs_bnode_dump (node); -hfs_dbg (BNODE_MOD ,"remove_rec: %d, %d\n" , +hfs_dbg ("RECORD: rec %d, len %d\n" , fd->record, fd->keylength + fd->entrylength);if (!--node->num_recs) {hfs_bnode_unlink (node);
@@ -246,7 +246,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)if (IS_ERR (new_node))return new_node;hfs_bnode_get (node); -hfs_dbg (BNODE_MOD ,"split_nodes: %d - %d - %d\n" , +hfs_dbg ("bnodes: this %d - new %d - next %d\n" , node->this, new_node->this, node->next); new_node->next = node->next; new_node->prev = node->this;
@@ -383,7 +383,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) newkeylen =hfs_bnode_read_u16 (node,14 ) +2 ; else fd->keylength = newkeylen = tree->max_key_len + 2; -hfs_dbg (BNODE_MOD ,"update_rec: %d, %d, %d\n" , +hfs_dbg ("RECORD: rec %d, keylength %d, newkeylen %d\n" , rec, fd->keylength, newkeylen); rec_off = tree->node_size - (rec +2 ) *2 ;
@@ -395,7 +395,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) end_off =hfs_bnode_read_u16 (parent, end_rec_off);if (end_rec_off - end_off < diff) { -hfs_dbg (BNODE_MOD ,"splitting index node\n" ); +hfs_dbg ("splitting index node\n" ); fd->bnode = parent; new_node =hfs_bnode_split (fd);if (IS_ERR (new_node))
fs/hfsplus/btree.c +2 -2
@@ -428,7 +428,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree)kunmap_local (data); nidx = node->next;if (!nidx) { -hfs_dbg (BNODE_MOD ,"create new bmap node\n" ); +hfs_dbg ("create new bmap node\n" ); next_node =hfs_bmap_new_bmap (node, idx); }else next_node =hfs_bnode_find (tree, nidx);
@@ -454,7 +454,7 @@ void hfs_bmap_free(struct hfs_bnode *node)u32 nidx;u8 *data, byte, m; -hfs_dbg (BNODE_MOD ,"btree_free_node: %u\n" , node->this); +hfs_dbg ("node_id %u\n" , node->this);BUG_ON (!node->this); tree = node->tree; nidx = node->this;
fs/hfsplus/catalog.c +3 -3
@@ -259,7 +259,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,int entry_size;int err; -hfs_dbg (CAT_MOD ,"create_cat: %s,%u(%d)\n" , +hfs_dbg ("entry: name %s, cnid %u, i_nlink %d\n" , str->name, cnid, inode->i_nlink); err =hfs_find_init (HFSPLUS_SB (sb)->cat_tree, &fd);if (err)
@@ -336,7 +336,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)int err, off;u16 type; -hfs_dbg (CAT_MOD ,"delete_cat: %s,%u\n" , str ? str->name :NULL , cnid); +hfs_dbg ("entry: name %s, cnid %u\n" , str ? str->name :NULL , cnid); err =hfs_find_init (HFSPLUS_SB (sb)->cat_tree, &fd);if (err)return err;
@@ -441,7 +441,7 @@ int hfsplus_rename_cat(u32 cnid,int entry_size, type;int err; -hfs_dbg (CAT_MOD ,"rename_cat: %u - %lu,%s - %lu,%s\n" , +hfs_dbg ("entry: cnid %u - ino %lu, name %s - ino %lu, name %s\n" , cnid, src_dir->i_ino, src_name->name, dst_dir->i_ino, dst_name->name); err =hfs_find_init (HFSPLUS_SB (sb)->cat_tree, &src_fd);
fs/hfsplus/extents.c +13 -12
@@ -275,7 +275,7 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock,mutex_unlock (&hip->extents_lock); done: -hfs_dbg (EXTENT ,"get_block(%lu): %llu - %u\n" , +hfs_dbg ("ino(%lu): iblock %llu - dblock %u\n" , inode->i_ino, (long long )iblock, dblock); mask = (1 << sbi->fs_shift) -1 ;
@@ -298,12 +298,12 @@ static void hfsplus_dump_extent(struct hfsplus_extent *extent) {int i; -hfs_dbg (EXTENT ," " ); +hfs_dbg ("EXTENT " );for (i =0 ; i <8 ; i++) -hfs_dbg_cont (EXTENT ," %u:%u" , -be32_to_cpu (extent[i].start_block), -be32_to_cpu (extent[i].block_count)); -hfs_dbg_cont (EXTENT ,"\n" ); +hfs_dbg (" start_block %u, block_count%u" , +be32_to_cpu (extent[i].start_block), +be32_to_cpu (extent[i].block_count)); +hfs_dbg ("\n" ); } static int hfsplus_add_extent(struct hfsplus_extent *extent, u32 offset,
@@ -360,7 +360,7 @@ static int hfsplus_free_extents(struct super_block *sb, err =hfsplus_block_free (sb, start, count);if (err) {pr_err ("can't free extent\n" ); -hfs_dbg (EXTENT ," start: %u count: %u\n" , +hfs_dbg ("EXTENT: start: %u count: %u\n" , start, count); } extent->block_count =0 ;
@@ -371,7 +371,7 @@ static int hfsplus_free_extents(struct super_block *sb, err =hfsplus_block_free (sb, start + count, block_nr);if (err) {pr_err ("can't free extent\n" ); -hfs_dbg (EXTENT ," start: %u count: %u\n" , +hfs_dbg ("EXTENT: start: %u count: %u\n" , start, count); } extent->block_count =cpu_to_be32 (count);
@@ -478,11 +478,12 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout) goto out; } -hfs_dbg (EXTENT ,"extend %lu: %u,%u\n" , inode->i_ino, start, len); +hfs_dbg ("ino %lu: start %u, len %u\n" , inode->i_ino, start, len);if (hip->alloc_blocks <= hip->first_blocks) {if (!hip->first_blocks) { -hfs_dbg (EXTENT ,"first extents\n" ); +hfs_dbg ("first_extents[0]: start %u, len %u\n" , + start, len);/* no extents yet */ hip->first_extents[0 ].start_block =cpu_to_be32 (start); hip->first_extents[0 ].block_count =cpu_to_be32 (len);
@@ -521,7 +522,7 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout)return res; insert_extent: -hfs_dbg (EXTENT ,"insert new extent\n" ); +hfs_dbg ("insert new extent\n" ); res =hfsplus_ext_write_extent_locked (inode);if (res) goto out;
@@ -546,7 +547,7 @@ void hfsplus_file_truncate(struct inode *inode)u32 alloc_cnt, blk_cnt, start;int res; -hfs_dbg (INODE ,"truncate: %lu, %llu -> %llu\n" , +hfs_dbg ("ino: %lu, phys_size %llu -> i_size %llu\n" , inode->i_ino, (long long )hip->phys_size, inode->i_size);if (inode->i_size > hip->phys_size) {
fs/hfsplus/hfsplus_fs.h +1 -34
@@ -11,47 +11,14 @@#ifndef _LINUX_HFSPLUS_FS_H#define _LINUX_HFSPLUS_FS_H -#ifdef pr_fmt -#undef pr_fmt -#endif - -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/fs.h> #include <linux/mutex.h> #include <linux/buffer_head.h> #include <linux/blkdev.h> #include <linux/fs_context.h> +#include <linux/hfs_common.h> #include "hfsplus_raw.h" -#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 -#define DBG_ATTR_MOD 0x00000080 - -#if 0 -#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD) -#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) -#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) -#endif -#define DBG_MASK (0) - -#define hfs_dbg (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ -} while (0) - -#define hfs_dbg_cont (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - pr_cont(fmt, ##__VA_ARGS__); \ -} while (0) -/* Runtime config options */ #define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F/* '????' */
fs/hfsplus/super.c +13 -4
@@ -150,7 +150,7 @@ static int hfsplus_write_inode(struct inode *inode, {int err; -hfs_dbg (INODE ,"hfsplus_write_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino); err =hfsplus_ext_write_extent (inode);if (err)
@@ -165,7 +165,7 @@ static int hfsplus_write_inode(struct inode *inode,static void hfsplus_evict_inode (struct inode *inode) { -hfs_dbg (INODE ,"hfsplus_evict_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);truncate_inode_pages_final (&inode->i_data);clear_inode (inode);if (HFSPLUS_IS_RSRC (inode)) {
@@ -184,7 +184,7 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)if (!wait)return 0 ; -hfs_dbg (SUPER ,"hfsplus_sync_fs\n" ); +hfs_dbg ("starting...\n" );/* * Explicitly write out the special metadata inodes.
@@ -215,6 +215,11 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait) vhdr->folder_count =cpu_to_be32 (sbi->folder_count); vhdr->file_count =cpu_to_be32 (sbi->file_count); +hfs_dbg ("free_blocks %u, next_cnid %u, " +"folder_count %u, file_count %u\n" , + sbi->free_blocks, sbi->next_cnid, + sbi->folder_count, sbi->file_count); +if (test_and_clear_bit (HFSPLUS_SB_WRITEBACKUP , &sbi->flags)) {memcpy (sbi->s_backup_vhdr, sbi->s_vhdr,sizeof (*sbi->s_vhdr)); write_backup =1 ;
@@ -240,6 +245,8 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)if (!test_bit (HFSPLUS_SB_NOBARRIER , &sbi->flags))blkdev_issue_flush (sb->s_bdev); +hfs_dbg ("finished: err %d\n" , error); +return error; }
@@ -288,7 +295,7 @@ static void hfsplus_put_super(struct super_block *sb) {struct hfsplus_sb_info *sbi =HFSPLUS_SB (sb); -hfs_dbg (SUPER ,"hfsplus_put_super\n" ); +hfs_dbg ("starting...\n" );cancel_delayed_work_sync (&sbi->sync_work);
@@ -310,6 +317,8 @@ static void hfsplus_put_super(struct super_block *sb)kfree (sbi->s_vhdr_buf);kfree (sbi->s_backup_vhdr_buf);call_rcu (&sbi->rcu, delayed_free); + +hfs_dbg ("finished\n" ); }static int hfsplus_statfs (struct dentry *dentry,struct kstatfs *buf)
fs/hfsplus/xattr.c +2 -2
@@ -64,7 +64,7 @@ static void hfsplus_init_header_node(struct inode *attr_file,u32 used_bmp_bytes;u64 tmp; -hfs_dbg (ATTR_MOD ,"init_hdr_attr_file: clump %u, node_size %u\n" , +hfs_dbg ("clump %u, node_size %u\n" , clump_size, node_size);/* The end of the node contains list of record offsets */
@@ -132,7 +132,7 @@ static int hfsplus_create_attributes_file(struct super_block *sb)struct page *page;int old_state =HFSPLUS_EMPTY_ATTR_TREE ; -hfs_dbg (ATTR_MOD ,"create_attr_file: ino %d\n" ,HFSPLUS_ATTR_CNID ); +hfs_dbg ("ino %d\n" ,HFSPLUS_ATTR_CNID ); check_attr_tree_state_again:switch (atomic_read (&sbi->attr_tree_state)) {
include/linux/hfs_common.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* HFS/HFS+ common definitions, inline functions, +* and shared functionality. +*/ + +#ifndef _HFS_COMMON_H_ +#define _HFS_COMMON_H_ + +#ifdef pr_fmt +#undef pr_fmt +#endif + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#define hfs_dbg (fmt, ...) \ + pr_debug("pid %d:%s:%d %s(): " fmt, \ + current->pid, __FILE__, __LINE__, __func__, ##__VA_ARGS__) \ + +#endif /* _HFS_COMMON_H_ */
Signature · 1 line
2.43.0
Yangtao Li
maintainerHi Slava,
Quoted 85 lines · 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.hfor gathering common declarations, inline functions, and common short methods. Currently, this file contains onlyhfs_dbg()function that employspr_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/controlecho 'funchfsplus_evict_inode+p' >/proc/dynamic_debug/controlAnd debug output looks like this:
hfs: pid 5831:fs/hfs/catalog.c:228
hfs_cat_delete():delete_cat: 00,48
hfs: pid 5831:fs/hfs/extent.c:484hfs_file_truncate(): truncate: 48, 409600 -> 0
hfs: pid 5831:fs/hfs/extent.c:212hfs_dump_extent():
hfs: pid 5831:fs/hfs/extent.c:214hfs_dump_extent(): 78:4
hfs: pid 5831:fs/hfs/extent.c:214hfs_dump_extent(): 0:0
hfs: pid 5831:fs/hfs/extent.c:214hfs_dump_extent(): 0:0v4
Debug messages have been reworked and information about new HFS/HFS+ shared declarations file has been added toMAINTAINERSfile.Signed-off-by Viacheslav Dubeyko <[email protected]>cc John Paul Adrian Glaubitz <[email protected]>cc Yangtao Li <[email protected]>cc Johannes Thumshirn <[email protected]>--- MAINTAINERS | 2 ++ 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 | 19 ++++++++++--------- 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 | 25 +++++++++++++------------ fs/hfsplus/hfsplus_fs.h | 35 +---------------------------------- fs/hfsplus/super.c | 17 +++++++++++++---- fs/hfsplus/xattr.c | 4 ++-- include/linux/hfs_common.h | 20 ++++++++++++++++++++ 22 files changed, 125 insertions(+), 156 deletions(-)create mode 100644
include/linux/hfs_common.hMAINTAINERS +2
-0@@ -10793,6 +10793,7 @@ L: [email protected] S: Maintained F: Documentation/filesystems/hfs.rst F: fs/hfs/ +F: include/linux/hfs_common.h HFSPLUS FILESYSTEM M: Viacheslav Dubeyko <[email protected]>@@ -10802,6 +10803,7 @@ L: [email protected] S: Maintained F: Documentation/filesystems/hfsplus.rst F: fs/hfsplus/ +F: include/linux/hfs_common.h HGA FRAMEBUFFER DRIVER M: Ferenc Bakonyi <[email protected]>fs/hfs/bfind.c +0
-0
fs/hfs/bfind.c int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) · line 29
Quoted 5 lines
fs/hfs/bfind.c +1
-1@@ -26,7 +26,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)return -ENOMEM ; fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ; - hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n", + hfs_dbg("tree: CNID %d, caller %p\n",
I'm kinda confused about uppercase and lowercase here.
Why use CNID instead of cnid?
Since ',' aleardy act as identify for cnid and caller, Could we drop ':'?
And let's use %ps so we get func name?
[ 62.792107] hfs: pid 1023:fs/hfs/bfind.c:52 hfs_find_exit(): tree: CNID 4, caller 00000000b667808d [ 62.793808] hfs: pid 1023:fs/hfs/bfind.c:30 hfs_find_init(): tree: CNID 4, caller hfs_lookup
+ hfs_dbg("tree cnid %d, caller %ps\n",
fs/hfs/bfind.c void hfs_find_exit(struct hfs_find_data *fd) · line 51
Quoted 9 lines
fs/hfs/bfind.c +1
-1tree->cnid, __builtin_return_address(0));switch (tree->cnid) {case HFS_CAT_CNID :@@ -48,7 +48,7 @@ void hfs_find_exit(struct hfs_find_data *fd) {hfs_bnode_put (fd->bnode);kfree (fd->search_key); - hfs_dbg(BNODE_REFS, "find_exit: %d (%p)\n", + hfs_dbg("tree: CNID %d, caller %p\n",
Ditto.
fs/hfs/bitmap.c u32 hfs_vbm_search_free(struct super_block *sb, u32 goal, u32 *num_bits) · line 161
Quoted 13 lines
fs/hfs/bfind.c +0
-0fd->tree->cnid, __builtin_return_address(0));mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ;fs/hfs/bitmap.c +1
-1@@ -158,7 +158,7 @@ u32 hfs_vbm_search_free(struct super_block *sb, u32 goal, u32 *num_bits) } } -hfs_dbg (BITMAP ,"alloc_bits: %u,%u\n" , pos, *num_bits); +hfs_dbg ("RANGE: pos %u, num_bits %u\n" , pos, *num_bits);
We drop all those:
-#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
-#define DBG_ATTR_MOD 0x00000080
Not sure, why we need RANGE...
+ hfs_dbg("pos %u, num_bits %u\n", pos, *num_bits);
fs/hfs/bitmap.c int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count) · line 203
Quoted 9 lines
fs/hfs/bitmap.c +1
-1HFS_SB (sb)->free_ablocks -= *num_bits;hfs_bitmap_dirty (sb); out:@@ -200,7 +200,7 @@ int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count)if (!count)return 0 ; -hfs_dbg (BITMAP ,"clear_bits: %u,%u\n" , start, count); +hfs_dbg ("RANGE: start %u, count %u\n" , start, count);
Ditto.
fs/hfs/bnode.c void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, · line 203
Quoted 13 lines
fs/hfs/bitmap.c +0
-0/* are all of the bits in range? */ if ((start + count) >HFS_SB (sb)->fs_ablocks)return -2 ;fs/hfs/bnode.c +1
-1@@ -200,7 +200,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, {struct page *src_page, *dst_page; -hfs_dbg (BNODE_MOD ,"copybytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("copybytes: dst %u, src %u, len %u\n" , dst, src, len);
remove 'copybytes:' ?
fs/hfs/bnode.c void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) · line 224
Quoted 9 lines
fs/hfs/bnode.c +1
-1if (!len)return ;@@ -221,7 +221,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)struct page *page;void *ptr; -hfs_dbg (BNODE_MOD ,"movebytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("movebytes: dst %u, src %u, len %u\n" , dst, src, len);
Ditto.
Quoted 24 lines
fs/hfs/bnode.c +3
-3if (!len)return ;@@ -243,16 +243,16 @@ void hfs_bnode_dump(struct hfs_bnode *node)__be32 cnid;int i, off, key_off; -hfs_dbg (BNODE_MOD ,"bnode: %d\n" , node->this); +hfs_dbg ("node_id %d\n" , node->this);hfs_bnode_read (node, &desc,0 ,sizeof (desc)); -hfs_dbg (BNODE_MOD ,"%d, %d, %d, %d, %d\n" , +hfs_dbg ("next %d, prev %d, type %d, height %d, num_recs %d\n" ,be32_to_cpu (desc.next),be32_to_cpu (desc.prev), desc.type, desc.height,be16_to_cpu (desc.num_recs)); off = node->tree->node_size -2 ;for (i =be16_to_cpu (desc.num_recs); i >=0 ; off -=2 , i--) { key_off =hfs_bnode_read_u16 (node, off); -hfs_dbg_cont (BNODE_MOD ," %d" , key_off); +hfs_dbg (" key_off %d" , key_off);if (i && node->type ==HFS_NODE_INDEX ) {int tmp;
fs/hfs/bnode.c void hfs_bnode_dump(struct hfs_bnode *node) · line 264
Quoted 7 lines
fs/hfs/bnode.c +2
-2@@ -260,18 +260,18 @@ void hfs_bnode_dump(struct hfs_bnode *node) tmp = (hfs_bnode_read_u8 (node, key_off) |1 ) +1 ; else tmp = node->tree->max_key_len +1 ; -hfs_dbg_cont (BNODE_MOD ," (%d,%d" , - tmp,hfs_bnode_read_u8 (node, key_off)); +hfs_dbg (" (%d,%d" , + tmp,hfs_bnode_read_u8 (node, key_off));
Could we describe those information?
fs/hfs/bnode.c void hfs_bnode_dump(struct hfs_bnode *node) · line 271
Quoted 9 lines
fs/hfs/bnode.c +2
-2hfs_bnode_read (node, &cnid, key_off + tmp,4 ); -hfs_dbg_cont (BNODE_MOD ,",%d)" ,be32_to_cpu (cnid)); +hfs_dbg (", cnid %d)" ,be32_to_cpu (cnid)); }else if (i && node->type ==HFS_NODE_LEAF ) {int tmp; tmp =hfs_bnode_read_u8 (node, key_off); -hfs_dbg_cont (BNODE_MOD ," (%d)" , tmp); +hfs_dbg (" (%d)" , tmp);
Ditto.
Quoted 48 lines
fs/hfs/bnode.c +5
-5} } -hfs_dbg_cont (BNODE_MOD ,"\n" ); +hfs_dbg ("\n" ); }void hfs_bnode_unlink (struct hfs_bnode *node)@@ -361,7 +361,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) node->this = cnid;set_bit (HFS_BNODE_NEW , &node->flags);atomic_set (&node->refcnt,1 ); -hfs_dbg (BNODE_REFS ,"new_node(%d:%d): 1\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt 1\n" , node->tree->cnid, node->this);init_waitqueue_head (&node->lock_wq);spin_lock (&tree->hash_lock);@@ -401,7 +401,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node) {struct hfs_bnode **p; -hfs_dbg (BNODE_REFS ,"remove_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));for (p = &node->tree->node_hash[hfs_bnode_hash (node->this)]; *p && *p != node; p = &(*p)->next_hash)@@ -546,7 +546,7 @@ void hfs_bnode_get(struct hfs_bnode *node) {if (node) {atomic_inc (&node->refcnt); -hfs_dbg (BNODE_REFS ,"get_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt)); }@@ -559,7 +559,7 @@ void hfs_bnode_put(struct hfs_bnode *node)struct hfs_btree *tree = node->tree;int i; -hfs_dbg (BNODE_REFS ,"put_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));BUG_ON (!atomic_read (&node->refcnt));fs/hfs/brec.c +0
-0
fs/hfs/brec.c int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) · line 97
Quoted 5 lines
fs/hfs/brec.c +1
-1@@ -94,7 +94,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) end_rec_off = tree->node_size - (node->num_recs +1 ) *2 ; end_off =hfs_bnode_read_u16 (node, end_rec_off); end_rec_off -=2 ; - hfs_dbg(BNODE_MOD, "insert_rec: %d, %d, %d, %d\n", + hfs_dbg("RECORD: rec %d, size %d, end_off %d, end_rec_off %d\n",
We drop all those:
-#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
-#define DBG_ATTR_MOD 0x00000080
Not sure, why we need RECORD...
+ hfs_dbg("rec %d, size %d, end_off %d, end_rec_off %d\n",
fs/hfs/brec.c int hfs_brec_remove(struct hfs_find_data *fd) · line 194
Quoted 9 lines
fs/hfs/brec.c +1
-1rec, size, end_off, end_rec_off);if (size > end_rec_off - end_off) {if (new_node)@@ -191,7 +191,7 @@ int hfs_brec_remove(struct hfs_find_data *fd)mark_inode_dirty (tree->inode); }hfs_bnode_dump (node); - hfs_dbg(BNODE_MOD, "remove_rec: %d, %d\n", + hfs_dbg("RECORD: rec %d, len %d\n",
Dotto.
fs/hfs/brec.c static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) · line 245
Quoted 9 lines
fs/hfs/brec.c +1
-1fd->record, fd->keylength + fd->entrylength);if (!--node->num_recs) {hfs_bnode_unlink (node);@@ -242,7 +242,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)if (IS_ERR (new_node))return new_node;hfs_bnode_get (node); - hfs_dbg(BNODE_MOD, "split_nodes: %d - %d - %d\n", + hfs_dbg("NODES: this %d, new %d, next %d\n",
Dotto.
fs/hfs/brec.c static int hfs_brec_update_parent(struct hfs_find_data *fd) · line 381
Quoted 9 lines
fs/hfs/brec.c +1
-1node->this, new_node->this, node->next); new_node->next = node->next; new_node->prev = node->this;@@ -378,7 +378,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) newkeylen = (hfs_bnode_read_u8 (node,14 ) |1 ) +1 ; else fd->keylength = newkeylen = tree->max_key_len + 1; - hfs_dbg(BNODE_MOD, "update_rec: %d, %d, %d\n", + hfs_dbg("RECORD: rec %d, keylength %d, newkeylen %d\n",
Ditto.
fs/hfs/btree.c void hfs_bmap_free(struct hfs_bnode *node) · line 367
Quoted 13 lines
fs/hfs/brec.c +0
-0rec, fd->keylength, newkeylen); rec_off = tree->node_size - (rec +2 ) *2 ;fs/hfs/btree.c +1
-1@@ -364,7 +364,7 @@ void hfs_bmap_free(struct hfs_bnode *node)u32 nidx;u8 *data, byte, m; -hfs_dbg (BNODE_MOD ,"btree_free_node: %u\n" , node->this); +hfs_dbg ("node_id %u\n" , node->this);
node id?
fs/hfs/catalog.c int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct i · line 90
Quoted 13 lines
fs/hfs/btree.c +0
-0tree = node->tree; nidx = node->this; node =hfs_bnode_find (tree,0 );fs/hfs/catalog.c +1
-1@@ -87,7 +87,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct iint entry_size;int err; - hfs_dbg(CAT_MOD, "create_cat: %s,%u(%d)\n", + hfs_dbg("entry: name %s, cnid %u, i_nlink %d\n",
'entry: ' is redundant...
+ hfs_dbg("name %s, cnid %u, i_nlink %d\n",
fs/hfs/catalog.c int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str) · line 228
Quoted 9 lines
fs/hfs/catalog.c +1
-1str->name, cnid, inode->i_nlink);if (dir->i_size >=HFS_MAX_VALENCE )return -ENOSPC ;@@ -225,7 +225,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str)struct hfs_readdir_data *rd;int res, type; -hfs_dbg (CAT_MOD ,"delete_cat: %s,%u\n" , str ? str->name :NULL , cnid); +hfs_dbg ("entry: name %s, cnid %u\n" , str ? str->name :NULL , cnid);
Ditto.
fs/hfs/catalog.c int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name, · line 297
Quoted 9 lines
fs/hfs/catalog.c +1
-1sb = dir->i_sb; res =hfs_find_init (HFS_SB (sb)->cat_tree, &fd);if (res)@@ -294,7 +294,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,int entry_size, type;int err; - hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", + hfs_dbg("CNID %u - entry1(ino %lu, name %s) - entry2(ino %lu, name %s)\n",
hfs_dbg("cnid %u -(ino %lu, name %s) -> (ino %lu, name %s)\n", ?
fs/hfs/extent.c static void hfs_dump_extent(struct hfs_extent *extent) · line 212
Quoted 13 lines
fs/hfs/catalog.c +0
-0cnid, src_dir->i_ino, src_name->name, dst_dir->i_ino, dst_name->name); sb = src_dir->i_sb;fs/hfs/extent.c +1
-1@@ -209,12 +209,12 @@ static void hfs_dump_extent(struct hfs_extent *extent) {int i; -hfs_dbg (EXTENT ," " ); +hfs_dbg ("EXTENT: " );
Uppercase is kinda stange.
+ hfs_dbg("extent: "); ?
Quoted 13 lines
fs/hfs/extent.c +4
-4for (i =0 ; i <3 ; i++) -hfs_dbg_cont (EXTENT ," %u:%u" , -be16_to_cpu (extent[i].block), -be16_to_cpu (extent[i].count)); -hfs_dbg_cont (EXTENT ,"\n" ); +hfs_dbg (" block %u, count %u" , +be16_to_cpu (extent[i].block), +be16_to_cpu (extent[i].count)); +hfs_dbg ("\n" ); } static int hfs_add_extent(struct hfs_extent *extent, u16 offset,
fs/hfs/extent.c int hfs_extend_file(struct inode *inode) · line 414
Quoted 5 lines
fs/hfs/extent.c +1
-1@@ -411,10 +411,11 @@ int hfs_extend_file(struct inode *inode) goto out; } -hfs_dbg (EXTENT ,"extend %lu: %u,%u\n" , inode->i_ino, start, len); +hfs_dbg ("ino %lu: start %u, len %u\n" , inode->i_ino, start, len);
':' -> ',' ?
+ hfs_dbg("ino %lu, start %u, len %u\n", inode->i_ino, start, len);
fs/hfs/extent.c int hfs_extend_file(struct inode *inode) · line 417
Quoted 4 lines
fs/hfs/extent.c +1
-1if (HFS_I (inode)->alloc_blocks ==HFS_I (inode)->first_blocks) {if (!HFS_I (inode)->first_blocks) { -hfs_dbg (EXTENT ,"first extents\n" ); + hfs_dbg("first_extents[0]: start %u, len %u\n",
s/first_extents[0]:/first_extents ?
+ hfs_dbg("first_extents start %u, len %u\n",
Quoted 14 lines
fs/hfs/extent.c +2
-1+ start, len);/* no extents yet */ HFS_I (inode)->first_extents[0 ].block =cpu_to_be16 (start);HFS_I (inode)->first_extents[0 ].count =cpu_to_be16 (len);@@ -456,7 +457,7 @@ int hfs_extend_file(struct inode *inode)return res; insert_extent: -hfs_dbg (EXTENT ,"insert new extent\n" ); +hfs_dbg ("insert new extent\n" ); res =hfs_ext_write_extent (inode);if (res) goto out;
fs/hfs/extent.c void hfs_file_truncate(struct inode *inode) · line 485
Quoted 5 lines
fs/hfs/extent.c +1
-1@@ -481,7 +482,7 @@ void hfs_file_truncate(struct inode *inode)u32 size;int res; - hfs_dbg(INODE, "truncate: %lu, %Lu -> %Lu\n", + hfs_dbg("ino: %lu, phys_size %llu -> i_size %llu\n",
+ hfs_dbg("ino %lu, phys size %llu -> %llu\n", ?
Quoted 21 lines
fs/hfs/extent.c +0
-0inode->i_ino, (long long )HFS_I (inode)->phys_size, inode->i_size);if (inode->i_size >HFS_I (inode)->phys_size) {fs/hfs/hfs_fs.h +0
-6@@ -9,12 +9,6 @@#ifndef _LINUX_HFS_FS_H#define _LINUX_HFS_FS_H -#ifdef pr_fmt -#undef pr_fmt -#endif - -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/slab.h> #include <linux/types.h> #include <linux/mutex.h>
fs/hfs/hfs_fs.h line 21
Quoted 4 lines
fs/hfs/hfs_fs.h +1
-0@@ -24,35 +18,10 @@#include <asm/byteorder.h> #include <linux/uaccess.h> +#include <linux/hfs_common.h>
Alph sort?
#include <asm/byteorder.h>
+#include <linux/hfs_common.h>
#include <linux/uaccess.h>
Quoted 37 lines
fs/hfs/hfs_fs.h +0
-26#include "hfs.h" -#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 - -//#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD|DBG_CAT_MOD|DBG_BITMAP) -//#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) -//#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) -#define DBG_MASK (0) - -#define hfs_dbg (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ -} while (0) - -#define hfs_dbg_cont (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - pr_cont(fmt, ##__VA_ARGS__); \ -} while (0) - -/* * struct hfs_inode_info * fs/hfs/inode.c +0
-0
fs/hfs/inode.c void hfs_delete_inode(struct inode *inode) · line 244
Quoted 5 lines
fs/hfs/inode.c +1
-1@@ -241,7 +241,7 @@ void hfs_delete_inode(struct inode *inode) {struct super_block *sb = inode->i_sb; -hfs_dbg (INODE ,"delete_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);
remove ':'
fs/hfs/inode.c int hfs_write_inode(struct inode *inode, struct writeback_control *wbc) · line 428
Quoted 9 lines
fs/hfs/inode.c +1
-1if (S_ISDIR (inode->i_mode)) {HFS_SB (sb)->folder_count--;if (HFS_I (inode)->cat_key.ParID ==cpu_to_be32 (HFS_ROOT_CNID ))@@ -425,7 +425,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)hfs_cat_rec rec;int res; -hfs_dbg (INODE ,"hfs_write_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);
Ditto.
Quoted 35 lines
fs/hfs/inode.c +0
-0res =hfs_ext_write_extent (inode);if (res)return res;fs/hfsplus/attributes.c +3
-3@@ -139,7 +139,7 @@ int hfsplus_find_attr(struct super_block *sb, u32 cnid, {int err =0 ; -hfs_dbg (ATTR_MOD ,"find_attr: %s,%d\n" , name ? name :NULL , cnid); +hfs_dbg ("name %s, cnid %d\n" , name ? name :NULL , cnid);if (!HFSPLUS_SB (sb)->attr_tree) {pr_err ("attributes file doesn't exist\n" );@@ -201,7 +201,7 @@ int hfsplus_create_attr(struct inode *inode,int entry_size;int err; -hfs_dbg (ATTR_MOD ,"create_attr: %s,%ld\n" , +hfs_dbg ("name %s, ino %ld\n" , name ? name :NULL , inode->i_ino);if (!HFSPLUS_SB (sb)->attr_tree) {@@ -310,7 +310,7 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)struct super_block *sb = inode->i_sb;struct hfs_find_data fd; -hfs_dbg (ATTR_MOD ,"delete_attr: %s,%ld\n" , +hfs_dbg ("name %s, ino %ld\n" , name ? name :NULL , inode->i_ino);if (!HFSPLUS_SB (sb)->attr_tree) {
fs/hfsplus/attributes.c int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid) · line 359
Quoted 5 lines
fs/hfsplus/attributes.c +1
-1@@ -356,7 +356,7 @@ int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid)int err =0 ;struct hfs_find_data fd; -hfs_dbg (ATTR_MOD ,"delete_all_attrs: %d\n" , cnid); +hfs_dbg ("cnid: %d\n" , cnid);
Ditto.
fs/hfsplus/bfind.c int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) · line 26
Quoted 13 lines
fs/hfsplus/attributes.c +0
-0if (!HFSPLUS_SB (dir->i_sb)->attr_tree) {pr_err ("attributes file doesn't exist\n" );fs/hfsplus/bfind.c +1
-1@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)return -ENOMEM ; fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ; - hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n", + hfs_dbg("CNID %d, caller %p\n",
Ditto.
+ hfs_dbg("cnid %d, caller %ps\n", ?
fs/hfsplus/bfind.c void hfs_find_exit(struct hfs_find_data *fd) · line 37
Quoted 9 lines
fs/hfsplus/bfind.c +1
-1tree->cnid, __builtin_return_address(0));mutex_lock_nested (&tree->tree_lock,hfsplus_btree_lock_class (tree));@@ -34,7 +34,7 @@ void hfs_find_exit(struct hfs_find_data *fd) {hfs_bnode_put (fd->bnode);kfree (fd->search_key); - hfs_dbg(BNODE_REFS, "find_exit: %d (%p)\n", + hfs_dbg("CNID %d, caller %p\n",
Reference to hfs.
fs/hfsplus/bitmap.c int hfsplus_block_allocate(struct super_block *sb, u32 size, · line 34
Quoted 13 lines
fs/hfsplus/bfind.c +0
-0fd->tree->cnid, __builtin_return_address(0));mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ;fs/hfsplus/bitmap.c +1
-1@@ -31,7 +31,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,if (!len)return size; -hfs_dbg (BITMAP ,"block_allocate: %u,%u,%u\n" , size, offset, len); +hfs_dbg ("RANGE: size %u, offset %u, len %u\n" , size, offset, len);
Reference to hfs.
Quoted 21 lines
fs/hfsplus/bitmap.c +2
-2mutex_lock (&sbi->alloc_mutex); mapping = sbi->alloc_file->i_mapping; page =read_mapping_page (mapping, offset /PAGE_CACHE_BITS ,NULL );@@ -90,14 +90,14 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,else end = pptr + ((size +31 ) & (PAGE_CACHE_BITS -1 )) /32 ; } -hfs_dbg (BITMAP ,"bitmap full\n" ); +hfs_dbg ("bitmap full\n" ); start = size; goto out; found: start = offset + (curr - pptr) *32 + i;if (start >= size) { -hfs_dbg (BITMAP ,"bitmap full\n" ); +hfs_dbg ("bitmap full\n" ); goto out; }/* do any partial u32 at the start */
fs/hfsplus/bitmap.c int hfsplus_block_allocate(struct super_block *sb, u32 size, · line 158
Quoted 5 lines
fs/hfsplus/bitmap.c +1
-1@@ -155,7 +155,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, *max = offset + (curr - pptr) *32 + i - start; sbi->free_blocks -= *max;hfsplus_mark_mdb_dirty (sb); -hfs_dbg (BITMAP ,"-> %u,%u\n" , start, *max); +hfs_dbg ("RANGE-> start %u, max %u\n" , start, *max);
'RANGE->' is strange.
fs/hfsplus/bitmap.c int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) · line 177
Quoted 9 lines
fs/hfsplus/bitmap.c +1
-1out:mutex_unlock (&sbi->alloc_mutex);return start;@@ -174,7 +174,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)if (!count)return 0 ; -hfs_dbg (BITMAP ,"block_free: %u,%u\n" , offset, count); +hfs_dbg ("RANGE: offset %u, count %u\n" , offset, count);
remove 'RANGE: ' ?
fs/hfsplus/bnode.c void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, · line 217
Quoted 13 lines
fs/hfsplus/bitmap.c +0
-0/* are all of the bits in range? */ if ((offset + count) > sbi->total_blocks)return -ENOENT ;fs/hfsplus/bnode.c +1
-1@@ -214,7 +214,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst,struct page **src_page, **dst_page;int l; -hfs_dbg (BNODE_MOD ,"copybytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("copybytes: dst %u, src %u, len %u\n" , dst, src, len);
remove 'copybytes: ' ?
fs/hfsplus/bnode.c void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) · line 275
Quoted 9 lines
fs/hfsplus/bnode.c +1
-1if (!len)return ;@@ -272,7 +272,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)void *src_ptr, *dst_ptr;int l; -hfs_dbg (BNODE_MOD ,"movebytes: %u,%u,%u\n" , dst, src, len); +hfs_dbg ("movebytes: dst %u, src %u, len %u\n" , dst, src, len);
Ditto.
Quoted 24 lines
fs/hfsplus/bnode.c +3
-3if (!len)return ;@@ -392,16 +392,16 @@ void hfs_bnode_dump(struct hfs_bnode *node)__be32 cnid;int i, off, key_off; -hfs_dbg (BNODE_MOD ,"bnode: %d\n" , node->this); +hfs_dbg ("node_id %d\n" , node->this);hfs_bnode_read (node, &desc,0 ,sizeof (desc)); -hfs_dbg (BNODE_MOD ,"%d, %d, %d, %d, %d\n" , +hfs_dbg ("next %d, prev %d, type %d, height %d, num_recs %d\n" ,be32_to_cpu (desc.next),be32_to_cpu (desc.prev), desc.type, desc.height,be16_to_cpu (desc.num_recs)); off = node->tree->node_size -2 ;for (i =be16_to_cpu (desc.num_recs); i >=0 ; off -=2 , i--) { key_off =hfs_bnode_read_u16 (node, off); -hfs_dbg (BNODE_MOD ," %d" , key_off); +hfs_dbg (" key_off %d" , key_off);if (i && node->type ==HFS_NODE_INDEX ) {int tmp;
fs/hfsplus/bnode.c void hfs_bnode_dump(struct hfs_bnode *node) · line 413
Quoted 5 lines
fs/hfsplus/bnode.c +1
-1@@ -410,17 +410,17 @@ void hfs_bnode_dump(struct hfs_bnode *node) tmp =hfs_bnode_read_u16 (node, key_off) +2 ; else tmp = node->tree->max_key_len +2 ; -hfs_dbg_cont (BNODE_MOD ," (%d" , tmp); +hfs_dbg (" (%d" , tmp);
Could we describe those info ?
Quoted 26 lines
fs/hfsplus/bnode.c +4
-4hfs_bnode_read (node, &cnid, key_off + tmp,4 ); -hfs_dbg_cont (BNODE_MOD ,",%d)" ,be32_to_cpu (cnid)); +hfs_dbg (", cnid %d)" ,be32_to_cpu (cnid)); }else if (i && node->type ==HFS_NODE_LEAF ) {int tmp; tmp =hfs_bnode_read_u16 (node, key_off); -hfs_dbg_cont (BNODE_MOD ," (%d)" , tmp); +hfs_dbg (" (%d)" , tmp); } } -hfs_dbg_cont (BNODE_MOD ,"\n" ); +hfs_dbg ("\n" ); }void hfs_bnode_unlink (struct hfs_bnode *node)@@ -456,7 +456,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)/* move down? */ if (!node->prev && !node->next) -hfs_dbg (BNODE_MOD ,"hfs_btree_del_level\n" ); +hfs_dbg ("btree delete level\n" );if (!node->parent) { tree->root =0 ; tree->depth =0 ;
fs/hfsplus/bnode.c static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) · line 514
Quoted 5 lines
fs/hfsplus/bnode.c +1
-1@@ -511,7 +511,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) node->this = cnid;set_bit (HFS_BNODE_NEW , &node->flags);atomic_set (&node->refcnt,1 ); - hfs_dbg(BNODE_REFS, "new_node(%d:%d): 1\n", + hfs_dbg("cnid%d, node_id %d, refcnt 1\n",
add white space?
Quoted 35 lines
fs/hfsplus/bnode.c +3
-3node->tree->cnid, node->this);init_waitqueue_head (&node->lock_wq);spin_lock (&tree->hash_lock);@@ -551,7 +551,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node) {struct hfs_bnode **p; -hfs_dbg (BNODE_REFS ,"remove_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));for (p = &node->tree->node_hash[hfs_bnode_hash (node->this)]; *p && *p != node; p = &(*p)->next_hash)@@ -697,7 +697,7 @@ void hfs_bnode_get(struct hfs_bnode *node) {if (node) {atomic_inc (&node->refcnt); -hfs_dbg (BNODE_REFS ,"get_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt)); }@@ -710,7 +710,7 @@ void hfs_bnode_put(struct hfs_bnode *node)struct hfs_btree *tree = node->tree;int i; -hfs_dbg (BNODE_REFS ,"put_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this,atomic_read (&node->refcnt));BUG_ON (!atomic_read (&node->refcnt));fs/hfsplus/brec.c +0
-0
fs/hfsplus/brec.c int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) · line 95
Quoted 5 lines
fs/hfsplus/brec.c +1
-1@@ -92,7 +92,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) end_rec_off = tree->node_size - (node->num_recs +1 ) *2 ; end_off =hfs_bnode_read_u16 (node, end_rec_off); end_rec_off -=2 ; - hfs_dbg(BNODE_MOD, "insert_rec: %d, %d, %d, %d\n", + hfs_dbg("RECORD: rec %d, size %d, end_off %d, end_rec_off %d\n",
remove 'RECORD: '?
fs/hfsplus/brec.c int hfs_brec_remove(struct hfs_find_data *fd) · line 196
Quoted 9 lines
fs/hfsplus/brec.c +1
-1rec, size, end_off, end_rec_off);if (size > end_rec_off - end_off) {if (new_node)@@ -193,7 +193,7 @@ int hfs_brec_remove(struct hfs_find_data *fd)mark_inode_dirty (tree->inode); }hfs_bnode_dump (node); - hfs_dbg(BNODE_MOD, "remove_rec: %d, %d\n", + hfs_dbg("RECORD: rec %d, len %d\n",
Ditto.
fs/hfsplus/brec.c static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) · line 249
Quoted 9 lines
fs/hfsplus/brec.c +1
-1fd->record, fd->keylength + fd->entrylength);if (!--node->num_recs) {hfs_bnode_unlink (node);@@ -246,7 +246,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)if (IS_ERR (new_node))return new_node;hfs_bnode_get (node); - hfs_dbg(BNODE_MOD, "split_nodes: %d - %d - %d\n", + hfs_dbg("bnodes: this %d - new %d - next %d\n",
remove 'bnodes: ' ?
fs/hfsplus/brec.c static int hfs_brec_update_parent(struct hfs_find_data *fd) · line 386
Quoted 9 lines
fs/hfsplus/brec.c +1
-1node->this, new_node->this, node->next); new_node->next = node->next; new_node->prev = node->this;@@ -383,7 +383,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) newkeylen =hfs_bnode_read_u16 (node,14 ) +2 ; else fd->keylength = newkeylen = tree->max_key_len + 2; - hfs_dbg(BNODE_MOD, "update_rec: %d, %d, %d\n", + hfs_dbg("RECORD: rec %d, keylength %d, newkeylen %d\n",
remove 'RECORD: ' ?
Quoted 26 lines
fs/hfsplus/brec.c +1
-1rec, fd->keylength, newkeylen); rec_off = tree->node_size - (rec +2 ) *2 ;@@ -395,7 +395,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) end_off =hfs_bnode_read_u16 (parent, end_rec_off);if (end_rec_off - end_off < diff) { -hfs_dbg (BNODE_MOD ,"splitting index node\n" ); +hfs_dbg ("splitting index node\n" ); fd->bnode = parent; new_node =hfs_bnode_split (fd);if (IS_ERR (new_node))fs/hfsplus/btree.c +1
-1@@ -428,7 +428,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree)kunmap_local (data); nidx = node->next;if (!nidx) { -hfs_dbg (BNODE_MOD ,"create new bmap node\n" ); +hfs_dbg ("create new bmap node\n" ); next_node =hfs_bmap_new_bmap (node, idx); }else next_node =hfs_bnode_find (tree, nidx);
fs/hfsplus/btree.c void hfs_bmap_free(struct hfs_bnode *node) · line 457
Quoted 5 lines
fs/hfsplus/btree.c +1
-1@@ -454,7 +454,7 @@ void hfs_bmap_free(struct hfs_bnode *node)u32 nidx;u8 *data, byte, m; -hfs_dbg (BNODE_MOD ,"btree_free_node: %u\n" , node->this); +hfs_dbg ("node_id %u\n" , node->this);
node id?
fs/hfsplus/catalog.c int hfsplus_create_cat(u32 cnid, struct inode *dir, · line 262
Quoted 13 lines
fs/hfsplus/btree.c +0
-0BUG_ON (!node->this); tree = node->tree; nidx = node->this;fs/hfsplus/catalog.c +1
-1@@ -259,7 +259,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,int entry_size;int err; - hfs_dbg(CAT_MOD, "create_cat: %s,%u(%d)\n", + hfs_dbg("entry: name %s, cnid %u, i_nlink %d\n",
remove 'entry: ' ?
fs/hfsplus/catalog.c int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str) · line 339
Quoted 9 lines
fs/hfsplus/catalog.c +1
-1str->name, cnid, inode->i_nlink); err =hfs_find_init (HFSPLUS_SB (sb)->cat_tree, &fd);if (err)@@ -336,7 +336,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)int err, off;u16 type; -hfs_dbg (CAT_MOD ,"delete_cat: %s,%u\n" , str ? str->name :NULL , cnid); +hfs_dbg ("entry: name %s, cnid %u\n" , str ? str->name :NULL , cnid);
Ditto.
fs/hfsplus/catalog.c int hfsplus_rename_cat(u32 cnid, · line 444
Quoted 9 lines
fs/hfsplus/catalog.c +1
-1err =hfs_find_init (HFSPLUS_SB (sb)->cat_tree, &fd);if (err)return err;@@ -441,7 +441,7 @@ int hfsplus_rename_cat(u32 cnid,int entry_size, type;int err; - hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", + hfs_dbg("entry: cnid %u - ino %lu, name %s - ino %lu, name %s\n",
Ditto.
Quoted 20 lines
fs/hfsplus/catalog.c +0
-0cnid, src_dir->i_ino, src_name->name, dst_dir->i_ino, dst_name->name); err =hfs_find_init (HFSPLUS_SB (sb)->cat_tree, &src_fd);fs/hfsplus/extents.c +2
-1@@ -275,7 +275,7 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock,mutex_unlock (&hip->extents_lock); done: -hfs_dbg (EXTENT ,"get_block(%lu): %llu - %u\n" , +hfs_dbg ("ino(%lu): iblock %llu - dblock %u\n" , + hfs_dbg("ino %lu, iblock %llu - dblock %u\n", ? inode->i_ino, (long long)iblock, dblock); mask = (1 << sbi->fs_shift) -1 ;
fs/hfsplus/extents.c static void hfsplus_dump_extent(struct hfsplus_extent *extent) · line 301
Quoted 5 lines
fs/hfsplus/extents.c +1
-1@@ -298,12 +298,12 @@ static void hfsplus_dump_extent(struct hfsplus_extent *extent) {int i; -hfs_dbg (EXTENT ," " ); +hfs_dbg ("EXTENT " );
extent: ?
Quoted 13 lines
fs/hfsplus/extents.c +4
-4for (i =0 ; i <8 ; i++) -hfs_dbg_cont (EXTENT ," %u:%u" , -be32_to_cpu (extent[i].start_block), -be32_to_cpu (extent[i].block_count)); -hfs_dbg_cont (EXTENT ,"\n" ); +hfs_dbg (" start_block %u, block_count%u" , +be32_to_cpu (extent[i].start_block), +be32_to_cpu (extent[i].block_count)); +hfs_dbg ("\n" ); } static int hfsplus_add_extent(struct hfsplus_extent *extent, u32 offset,
fs/hfsplus/extents.c static int hfsplus_free_extents(struct super_block *sb, · line 363
Quoted 5 lines
fs/hfsplus/extents.c +1
-1@@ -360,7 +360,7 @@ static int hfsplus_free_extents(struct super_block *sb, err =hfsplus_block_free (sb, start, count);if (err) {pr_err ("can't free extent\n" ); - hfs_dbg(EXTENT, " start: %u count: %u\n", + hfs_dbg("EXTENT: start: %u count: %u\n",
convert to pr_err ?
fs/hfsplus/extents.c static int hfsplus_free_extents(struct super_block *sb, · line 374
Quoted 9 lines
fs/hfsplus/extents.c +1
-1start, count); } extent->block_count =0 ;@@ -371,7 +371,7 @@ static int hfsplus_free_extents(struct super_block *sb, err =hfsplus_block_free (sb, start + count, block_nr);if (err) {pr_err ("can't free extent\n" ); - hfs_dbg(EXTENT, " start: %u count: %u\n", + hfs_dbg("EXTENT: start: %u count: %u\n",
remove 'EXTENT:' ?
fs/hfsplus/extents.c int hfsplus_file_extend(struct inode *inode, bool zeroout) · line 481
Quoted 9 lines
fs/hfsplus/extents.c +1
-1start, count); } extent->block_count =cpu_to_be32 (count);@@ -478,11 +478,12 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout) goto out; } -hfs_dbg (EXTENT ,"extend %lu: %u,%u\n" , inode->i_ino, start, len); +hfs_dbg ("ino %lu: start %u, len %u\n" , inode->i_ino, start, len);
s/:/, ?
Quoted 88 lines
fs/hfsplus/extents.c +5
-3if (hip->alloc_blocks <= hip->first_blocks) {if (!hip->first_blocks) { -hfs_dbg (EXTENT ,"first extents\n" ); +hfs_dbg ("first_extents[0]: start %u, len %u\n" , + start, len);/* no extents yet */ hip->first_extents[0 ].start_block =cpu_to_be32 (start); hip->first_extents[0 ].block_count =cpu_to_be32 (len);@@ -521,7 +522,7 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout)return res; insert_extent: -hfs_dbg (EXTENT ,"insert new extent\n" ); +hfs_dbg ("insert new extent\n" ); res =hfsplus_ext_write_extent_locked (inode);if (res) goto out;@@ -546,7 +547,7 @@ void hfsplus_file_truncate(struct inode *inode)u32 alloc_cnt, blk_cnt, start;int res; -hfs_dbg (INODE ,"truncate: %lu, %llu -> %llu\n" , +hfs_dbg ("ino: %lu, phys_size %llu -> i_size %llu\n" , +hfs_dbg ("ino %lu, phys size %llu -> %llu\n" , inode->i_ino, (long long)hip->phys_size, inode->i_size);if (inode->i_size > hip->phys_size) {fs/hfsplus/hfsplus_fs.h +1
-34@@ -11,47 +11,14 @@#ifndef _LINUX_HFSPLUS_FS_H#define _LINUX_HFSPLUS_FS_H -#ifdef pr_fmt -#undef pr_fmt -#endif - -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/fs.h> #include <linux/mutex.h> #include <linux/buffer_head.h> #include <linux/blkdev.h> #include <linux/fs_context.h> +#include <linux/hfs_common.h> #include "hfsplus_raw.h" -#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 -#define DBG_ATTR_MOD 0x00000080 - -#if 0 -#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD) -#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) -#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) -#endif -#define DBG_MASK (0) - -#define hfs_dbg (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ -} while (0) - -#define hfs_dbg_cont (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - pr_cont(fmt, ##__VA_ARGS__); \ -} while (0) -/* Runtime config options */ #define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F/* '????' */ fs/hfsplus/super.c +0
-0
fs/hfsplus/super.c static int hfsplus_write_inode(struct inode *inode, · line 153
Quoted 5 lines
fs/hfsplus/super.c +1
-1@@ -150,7 +150,7 @@ static int hfsplus_write_inode(struct inode *inode, {int err; -hfs_dbg (INODE ,"hfsplus_write_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);
+ hfs_dbg("ino %lu\n", inode->i_ino); ?
fs/hfsplus/super.c static int hfsplus_write_inode(struct inode *inode, · line 168
Quoted 9 lines
fs/hfsplus/super.c +1
-1err =hfsplus_ext_write_extent (inode);if (err)@@ -165,7 +165,7 @@ static int hfsplus_write_inode(struct inode *inode,static void hfsplus_evict_inode (struct inode *inode) { -hfs_dbg (INODE ,"hfsplus_evict_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);
Ditto.
Quoted 25 lines
fs/hfsplus/super.c +6
-1truncate_inode_pages_final (&inode->i_data);clear_inode (inode);if (HFSPLUS_IS_RSRC (inode)) {@@ -184,7 +184,7 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)if (!wait)return 0 ; -hfs_dbg (SUPER ,"hfsplus_sync_fs\n" ); +hfs_dbg ("starting...\n" );/* * Explicitly write out the special metadata inodes. @@ -215,6 +215,11 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait) vhdr->folder_count =cpu_to_be32 (sbi->folder_count); vhdr->file_count =cpu_to_be32 (sbi->file_count); +hfs_dbg ("free_blocks %u, next_cnid %u, " +"folder_count %u, file_count %u\n" , + sbi->free_blocks, sbi->next_cnid, + sbi->folder_count, sbi->file_count); +if (test_and_clear_bit (HFSPLUS_SB_WRITEBACKUP , &sbi->flags)) {memcpy (sbi->s_backup_vhdr, sbi->s_vhdr,sizeof (*sbi->s_vhdr)); write_backup =1 ;
fs/hfsplus/super.c static int hfsplus_sync_fs(struct super_block *sb, int wait) · line 248
Quoted 4 lines
fs/hfsplus/super.c +1
-0@@ -240,6 +245,8 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)if (!test_bit (HFSPLUS_SB_NOBARRIER , &sbi->flags))blkdev_issue_flush (sb->s_bdev); +hfs_dbg ("finished: err %d\n" , error);
+ hfs_dbg("finished err %d\n", error); ?
Quoted 60 lines
fs/hfsplus/super.c +4
-1+return error; }@@ -288,7 +295,7 @@ static void hfsplus_put_super(struct super_block *sb) {struct hfsplus_sb_info *sbi =HFSPLUS_SB (sb); -hfs_dbg (SUPER ,"hfsplus_put_super\n" ); +hfs_dbg ("starting...\n" );cancel_delayed_work_sync (&sbi->sync_work);@@ -310,6 +317,8 @@ static void hfsplus_put_super(struct super_block *sb)kfree (sbi->s_vhdr_buf);kfree (sbi->s_backup_vhdr_buf);call_rcu (&sbi->rcu, delayed_free); + +hfs_dbg ("finished\n" ); }static int hfsplus_statfs (struct dentry *dentry,struct kstatfs *buf)fs/hfsplus/xattr.c +2
-2@@ -64,7 +64,7 @@ static void hfsplus_init_header_node(struct inode *attr_file,u32 used_bmp_bytes;u64 tmp; -hfs_dbg (ATTR_MOD ,"init_hdr_attr_file: clump %u, node_size %u\n" , +hfs_dbg ("clump %u, node_size %u\n" , clump_size, node_size);/* The end of the node contains list of record offsets */ @@ -132,7 +132,7 @@ static int hfsplus_create_attributes_file(struct super_block *sb)struct page *page;int old_state =HFSPLUS_EMPTY_ATTR_TREE ; -hfs_dbg (ATTR_MOD ,"create_attr_file: ino %d\n" ,HFSPLUS_ATTR_CNID ); +hfs_dbg ("ino %d\n" ,HFSPLUS_ATTR_CNID ); check_attr_tree_state_again:switch (atomic_read (&sbi->attr_tree_state)) {include/linux/hfs_common.h new file +10
-0@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* HFS/HFS+ common definitions, inline functions, +* and shared functionality. +*/ + +#ifndef _HFS_COMMON_H_ +#define _HFS_COMMON_H_ + +#ifdef pr_fmt
include/linux/hfs_common.h line 20
Quoted 10 lines
include/linux/hfs_common.h new file +10
-0+#undef pr_fmt +#endif + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#define hfs_dbg (fmt, ...) \ + pr_debug("pid %d:%s:%d %s(): " fmt, \ + current->pid, __FILE__, __LINE__, __func__, ##__VA_ARGS__) \ + +#endif /* _HFS_COMMON_H_ */
Thx,
Yangtao
Viacheslav Dubeyko
maintainerQuoted 100 lines · Yangtao Li
Hi Slava,
Quoted 88 lines · 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.hfor gathering common declarations, inline functions, and common short methods. Currently, this file contains onlyhfs_dbg()function that employspr_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/controlecho 'funchfsplus_evict_inode+p' >/proc/dynamic_debug/controlAnd debug output looks like this:
hfs: pid 5831:fs/hfs/catalog.c:228
hfs_cat_delete():delete_cat:
00,48
hfs: pid 5831:fs/hfs/extent.c:484hfs_file_truncate(): truncate:
48, 409600 -> 0
hfs: pid 5831:fs/hfs/extent.c:212hfs_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:0v4
Debug messages have been reworked and information about new HFS/HFS+ shared declarations file has been added toMAINTAINERSfile.Signed-off-by Viacheslav Dubeyko <[email protected]>cc John Paul Adrian Glaubitz <[email protected]>cc Yangtao Li <[email protected]>cc Johannes Thumshirn <[email protected]>---
MAINTAINERS | 2 ++
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 | 19 ++++++++++--------- 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 | 25 +++++++++++++------------ fs/hfsplus/hfsplus_fs.h | 35 +-------------------------------- --
fs/hfsplus/super.c | 17 +++++++++++++---- fs/hfsplus/xattr.c | 4 ++--include/linux/hfs_common.h| 20 ++++++++++++++++++++22 files changed, 125 insertions(+), 156 deletions(-)create mode 100644
include/linux/hfs_common.hMAINTAINERS +0
-0@@ -10793,6 +10793,7 @@ L: [email protected]S: Maintained
F:Documentation/filesystems/hfs.rst
F:fs/hfs/
+F:include/linux/hfs_common.h
HFSPLUS FILESYSTEM
M: Viacheslav Dubeyko <[email protected]>MAINTAINERS +0
-0@@ -10802,6 +10803,7 @@ L: [email protected]S: Maintained
F:Documentation/filesystems/hfsplus.rst
F:fs/hfsplus/
+F:include/linux/hfs_common.h
HGA FRAMEBUFFER DRIVER
M: Ferenc Bakonyi <[email protected]>fs/hfs/bfind.c +0
-0fs/hfs/bfind.c int hfs_find_init(struct hfs_btree *tree, struct · line 30
Quoted 6 lines
fs/hfs/bfind.c +1
-1@@ -26,7 +26,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) return -ENOMEM; fd->search_key = ptr; fd->key = ptr + tree->max_key_len + 2; - hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n", + hfs_dbg("tree: CNID %d, caller %p\n",I'm kinda confused about uppercase and lowercase here.
Quoted 1 line
Why use CNID instead of cnid?
I don't see principal difference between uppercase and lowercase. However, it's abbreviation Catalog Node ID (CNID). So, uppercase looks like more natural.
Quoted 3 lines
Since ',' aleardy act as identify for cnid and caller, Could we drop ':'?
The ':' point out that we showing info for tree and we have tree's items further;
tree: CNID 1, caller <some_info_here>
So, it looks pretty not bad for my taste. :) Otherwise, we need to drop "tree:" completely.
Quoted 3 lines
And let's use %ps so we get func name?
We can do this.
Quoted 8 lines
[ 62.792107] hfs: pid 1023:fs/hfs/bfind.c:52
hfs_find_exit(): tree:
CNID 4, caller00000000b667808d
[ 62.793808] hfs: pid 1023:fs/hfs/bfind.c:30hfs_find_init(): tree:
CNID 4, callerhfs_lookup+ hfs_dbg("tree cnid %d, caller %ps\n",
Quoted 11 lines
fs/hfs/bfind.c void hfs_find_exit(struct hfs_find_data *fd) · line 51
Quoted 9 lines
fs/hfs/bfind.c +0
-0tree->cnid, __builtin_return_address(0)); switch (tree->cnid) {case
HFS_CAT_CNID:fs/hfs/bfind.c +1
-1@@ -48,7 +48,7 @@ void hfs_find_exit(struct hfs_find_data *fd) { hfs_bnode_put(fd->bnode); kfree(fd->search_key); - hfs_dbg(BNODE_REFS, "find_exit: %d (%p)\n", + hfs_dbg("tree: CNID %d, caller %p\n",Ditto.
Please, see my answers above.
Quoted 27 lines
Quoted 13 lines
fs/hfs/bfind.c +0
-0fd->tree->cnid, __builtin_return_address(0)); mutex_unlock(&fd->tree->tree_lock); fd->tree = NULL;fs/hfs/bitmap.c +0
-0@@ -158,7 +158,7 @@ u32 hfs_vbm_search_free(struct super_block *sb, u32 goal, u32 *num_bits) } }fs/hfs/bitmap.c u32 hfs_vbm_search_free(struct super_block *sb, u32 goal, u32 *num_bits) · line 161
Quoted 2 lines
fs/hfs/bitmap.c +1
-1-hfs_dbg (BITMAP ,"alloc_bits: %u,%u\n" , pos, *num_bits); +hfs_dbg ("RANGE: pos %u, num_bits %u\n" , pos, *num_bits);We drop all those:
fs/hfsplus/hfsplus_fs.h +0
-8-#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 -#define DBG_ATTR_MOD 0x00000080
Quoted 1 line
Not sure, why we need RANGE...
The [pos, num_bits] sounds like a range. Not?
Quoted 15 lines
(quoted diff) +1
-0+ hfs_dbg("pos %u, num_bits %u\n", pos, *num_bits);fs/hfs/bitmap.c int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count) · line 203
Quoted 11 lines
HFS_SB(sb)->free_ablocks -=
*num_bits;hfs_bitmap_dirty(sb);
out:fs/hfs/bitmap.c +0
-0@@ -200,7 +200,7 @@ int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count) if (!count) return 0;fs/hfs/bitmap.c +1
-1-hfs_dbg (BITMAP ,"clear_bits: %u,%u\n" , start, count); +hfs_dbg ("RANGE: start %u, count %u\n" , start, count);Ditto.
The [pos, num_bits] sounds like a range. Not?
Quoted 11 lines
Quoted 11 lines
/* are all of the bits in range? */ if ((start + count) > HFS_SB(sb)->fs_ablocks) return -2;
fs/hfs/bnode.c +0
-0@@ -200,7 +200,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, {
Quoted 8 lines
Quoted 6 lines
fs/hfs/bnode.c +0
-0struct page *src_page, *dst_page;fs/hfs/bnode.c +0
-1- hfs_dbg(BNODE_MOD, "copybytes: %u,%u,%u\n", dst, src,len);
fs/hfs/bnode.c +1
-0+ hfs_dbg("copybytes: dst %u, src %u, len %u\n", dst, src,len);
remove 'copybytes:' ?
We can do this.
Quoted 15 lines
Quoted 12 lines
if (!len)
return;fs/hfs/bnode.c +0
-0@@ -221,7 +221,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) struct page *page; void *ptr;fs/hfs/bnode.c +0
-1- hfs_dbg(BNODE_MOD, "movebytes: %u,%u,%u\n", dst, src,len);
fs/hfs/bnode.c +1
-0+ hfs_dbg("movebytes: dst %u, src %u, len %u\n", dst, src,Quoted 1 line
len);
Ditto.
We can do this.
Quoted 33 lines
Quoted 33 lines
if (!len)
return;fs/hfs/bnode.c +0
-0@@ -243,16 +243,16 @@ void hfs_bnode_dump(struct hfs_bnode *node) __be32 cnid; int i, off, key_off;fs/hfs/bnode.c +1
-1-hfs_dbg (BNODE_MOD ,"bnode: %d\n" , node->this); +hfs_dbg ("node_id %d\n" , node->this);
hfs_bnode_read(node, &desc, 0, sizeof(desc));fs/hfs/bnode.c +1
-1- hfs_dbg(BNODE_MOD, "%d, %d, %d, %d, %d\n", + hfs_dbg("next %d, prev %d, type %d, height %d, num_recs%d\n",
be32_to_cpu(desc.next),be32_to_cpu(desc.prev), desc.type, desc.height,be16_to_cpu(desc.num_recs));
off =node->tree->node_size- 2;
for (i =be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i-- ) {
key_off=hfs_bnode_read_u16(node, off);fs/hfs/bnode.c +1
-1-hfs_dbg_cont (BNODE_MOD ," %d" , key_off); +hfs_dbg (" key_off %d" , key_off);if (i &&
node->type==HFS_NODE_INDEX) { int tmp;fs/hfs/bnode.c +0
-0@@ -260,18 +260,18 @@ void hfs_bnode_dump(struct hfs_bnode *node) tmp = (hfs_bnode_read_u8(node, key_off) |1 ) +1 ;else
tmp =node->tree->max_key_len+ 1;
Quoted 8 lines
Quoted 6 lines
fs/hfs/bnode.c +0
-2- hfs_dbg_cont(BNODE_MOD, " (%d,%d", - tmp, hfs_bnode_read_u8(node,
key_off));fs/hfs/bnode.c +2
-0+ hfs_dbg(" (%d,%d", + tmp, hfs_bnode_read_u8(node,
key_off));Could we describe those information?
I have no idea how to change this. What is your suggestion?
Quoted 14 lines
fs/hfs/bnode.c
Quoted 12 lines
hfs_bnode_read(node, &cnid, key_off + tmp, 4);fs/hfs/bnode.c +0
-1- hfs_dbg_cont(BNODE_MOD, ",%d)",
be32_to_cpu(cnid));fs/hfs/bnode.c +1
-0+hfs_dbg (", cnid %d)" ,be32_to_cpu (cnid));} else if (i &&
node->type==HFS_NODE_LEAF) { int tmp;
tmp =hfs_bnode_read_u8(node, key_off);fs/hfs/bnode.c +1
-1-hfs_dbg_cont (BNODE_MOD ," (%d)" , tmp); +hfs_dbg (" (%d)" , tmp);Ditto.
What is your suggestion?
Quoted 72 lines
Quoted 52 lines
}
}fs/hfs/bnode.c +1
-1-hfs_dbg_cont (BNODE_MOD ,"\n" ); +hfs_dbg ("\n" );}
voidhfs_bnode_unlink(struct hfs_bnode *node)fs/hfs/bnode.c +1
-1@@ -361,7 +361,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) node->this = cnid; set_bit(HFS_BNODE_NEW, &node->flags); atomic_set(&node->refcnt, 1); -hfs_dbg (BNODE_REFS ,"new_node(%d:%d): 1\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt 1\n" , node->tree->cnid, node->this); init_waitqueue_head(&node->lock_wq);
spin_lock(&tree->hash_lock);fs/hfs/bnode.c +0
-0@@ -401,7 +401,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node) { struct hfs_bnode **p;fs/hfs/bnode.c +1
-1- hfs_dbg(BNODE_REFS, "remove_node(%d:%d): %d\n", + hfs_dbg("cnid %d, node_id %d, refcnt %d\n",
node->tree->cnid,node->this, atomic_read(&node-Quoted 1 line
refcnt));
for (p = &node->tree->node_hash[hfs_bnode_hash(node-
Quoted 1 line
this)];
*p && *p != node; p = &(*p)->next_hash)
fs/hfs/bnode.c +1
-1@@ -546,7 +546,7 @@ void hfs_bnode_get(struct hfs_bnode *node) { if (node) { atomic_inc(&node->refcnt); -hfs_dbg (BNODE_REFS ,"get_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this, atomic_read(&node->refcnt)); }@@ -559,7 +559,7 @@ void hfs_bnode_put(struct hfs_bnode *node) struct hfs_btree *tree = node->tree; int i;fs/hfs/bnode.c +1
-1- hfs_dbg(BNODE_REFS, "put_node(%d:%d): %d\n", + hfs_dbg("cnid %d, node_id %d, refcnt %d\n",
node->tree->cnid,node->this,atomic_read(&node->refcnt)); BUG_ON(!atomic_read(&node->refcnt));fs/hfs/brec.c +0
-0fs/hfs/brec.c int hfs_brec_insert(struct hfs_find_data *fd, · line 99
Quoted 7 lines
fs/hfs/brec.c +1
-1@@ -94,7 +94,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) end_rec_off = tree->node_size - (node->num_recs + 1) * 2; end_off = hfs_bnode_read_u16(node, end_rec_off); end_rec_off -= 2; -hfs_dbg (BNODE_MOD ,"insert_rec: %d, %d, %d, %d\n" , + hfs_dbg("RECORD: rec %d, size %d, end_off %d, end_rec_off %d\n",We drop all those:
fs/hfsplus/hfsplus_fs.h +0
-8-#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 -#define DBG_ATTR_MOD 0x00000080
Quoted 1 line
Not sure, why we need RECORD...
Because, we shows record's details here. :)
Quoted 14 lines
(quoted diff) +1
-0+ hfs_dbg("rec %d, size %d, end_off %d, end_rec_off %d\n",fs/hfs/brec.c int hfs_brec_remove(struct hfs_find_data *fd) · line 194
Quoted 10 lines
fs/hfs/brec.c +0
-0rec, size, end_off, end_rec_off);if (size >
end_rec_off-end_off) {
if (new_node)fs/hfs/brec.c +1
-1@@ -191,7 +191,7 @@ int hfs_brec_remove(struct hfs_find_data *fd) mark_inode_dirty(tree->inode); } hfs_bnode_dump(node); - hfs_dbg(BNODE_MOD, "remove_rec: %d, %d\n", + hfs_dbg("RECORD: rec %d, len %d\n",Dotto.
Because, we shows record's details here. :)
Quoted 13 lines
fs/hfs/brec.c static struct hfs_bnode *hfs_bnode_split(struct · line 246
Quoted 11 lines
fs/hfs/brec.c +1
-1fd->record, fd->keylength + fd->entrylength); if (!--node->num_recs) { hfs_bnode_unlink(node);@@ -242,7 +242,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) if (IS_ERR(new_node)) return new_node; hfs_bnode_get(node); - hfs_dbg(BNODE_MOD, "split_nodes: %d - %d - %d\n", + hfs_dbg("NODES: this %d, new %d, next %d\n",Dotto.
Because, we shows nodes' details here. :)
Quoted 13 lines
fs/hfs/brec.c
Quoted 11 lines
fs/hfs/brec.c +0
-0node->this, new_node->this, node->next); new_node->next = node->next;
new_node->prev=node->this;fs/hfs/brec.c +0
-0@@ -378,7 +378,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) newkeylen = (hfs_bnode_read_u8(node, 14) | 1) + 1;else
fd->keylength= newkeylen =tree->max_key_len+ 1;fs/hfs/brec.c +1
-1- hfs_dbg(BNODE_MOD, "update_rec: %d, %d, %d\n", + hfs_dbg("RECORD: rec %d, keylength %d, newkeylen %d\n",Ditto.
Because, we shows record's details here. :)
Quoted 16 lines
Quoted 12 lines
rec,
fd->keylength, newkeylen);
rec_off=tree->node_size- (rec + 2) * 2;fs/hfs/btree.c +0
-0@@ -364,7 +364,7 @@ void hfs_bmap_free(struct hfs_bnode *node) u32 nidx; u8 *data, byte, m;fs/hfs/btree.c
Quoted 2 lines
fs/hfs/btree.c +1
-1-hfs_dbg (BNODE_MOD ,"btree_free_node: %u\n" , node->this); +hfs_dbg ("node_id %u\n" , node->this);node id?
We can do this. But I don't see principal difference here.
Quoted 17 lines
Quoted 13 lines
tree =
node->tree;
nidx =node->this;
node =hfs_bnode_find(tree, 0);fs/hfs/catalog.c +0
-0@@ -87,7 +87,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir,const struct qstr *str, struct i
intentry_size;
int err;fs/hfs/catalog.c
Quoted 2 lines
fs/hfs/catalog.c +1
-1- hfs_dbg(CAT_MOD, "create_cat: %s,%u(%d)\n", + hfs_dbg("entry: name %s, cnid %u, i_nlink %d\n",'entry: ' is redundant...
Maybe yes, maybe not. We show entry details here.
Quoted 17 lines
(quoted diff) +1
-0+ hfs_dbg("name %s, cnid %u, i_nlink %d\n",Quoted 12 lines
str->name, cnid,inode->i_nlink); if (dir->i_size>=HFS_MAX_VALENCE) return-ENOSPC;fs/hfs/catalog.c +0
-0@@ -225,7 +225,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str) struct hfs_readdir_data *rd; int res, type;fs/hfs/catalog.c +0
-1- hfs_dbg(CAT_MOD, "delete_cat: %s,%u\n", str ? str->name :NULL, cnid);
fs/hfs/catalog.c +1
-0+ hfs_dbg("entry: name %s, cnid %u\n", str ? str->name :Quoted 1 line
NULL, cnid);
Ditto.
Maybe yes, maybe not. We show entry details here.
Quoted 15 lines
Quoted 11 lines
sb =
dir->i_sb;
res =hfs_find_init(HFS_SB(sb)->cat_tree, &fd); if (res)fs/hfs/catalog.c +0
-0@@ -294,7 +294,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name, int entry_size, type; int err;fs/hfs/catalog.c +1
-1- hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", + hfs_dbg("CNID %u - entry1(ino %lu, name %s) - entry2(inoQuoted 1 line
%lu, name %s)\n",
hfs_dbg("cnid %u -(ino %lu, name %s) -> (ino %lu, name %s)\n", ?
Quoted 17 lines
Quoted 12 lines
cnid,
src_dir->i_ino,src_name->name,dst_dir->i_ino,dst_name->name); sb =src_dir->i_sb;fs/hfs/extent.c +0
-0@@ -209,12 +209,12 @@ static void hfs_dump_extent(struct hfs_extent *extent) { int i;fs/hfs/extent.c static void hfs_dump_extent(struct hfs_extent *extent) · line 212
Quoted 2 lines
fs/hfs/extent.c +1
-1-hfs_dbg (EXTENT ," " ); +hfs_dbg ("EXTENT: " );Uppercase is kinda stange.
I don't know. It looks natural to me. :)
Quoted 16 lines
(quoted diff) +1
-0+ hfs_dbg("extent: "); ?Quoted 15 lines
for (i = 0; i < 3; i++)
fs/hfs/extent.c +4
-4-hfs_dbg_cont (EXTENT ," %u:%u" , - be16_to_cpu(extent[i].block), - be16_to_cpu(extent[i].count)); -hfs_dbg_cont (EXTENT ,"\n" ); +hfs_dbg (" block %u, count %u" , +be16_to_cpu (extent[i].block), +be16_to_cpu (extent[i].count)); +hfs_dbg ("\n" );}
static int hfs_add_extent(structhfs_extent*extent, u16 offset,fs/hfs/extent.c +0
-0@@ -411,10 +411,11 @@ int hfs_extend_file(struct inode *inode) goto out;
Quoted 8 lines
Quoted 6 lines
fs/hfs/extent.c +0
-0}fs/hfs/extent.c +0
-1- hfs_dbg(EXTENT, "extend %lu: %u,%u\n", inode->i_ino,start, len);
fs/hfs/extent.c +1
-0+ hfs_dbg("ino %lu: start %u, len %u\n", inode->i_ino,start, len);
':' -> ',' ?
I used ':' here because start and len is for inode ID. But it is possible to use ',' too.
Quoted 5 lines
+ hfs_dbg("ino %lu, start %u, len %u\n",
inode->i_ino, start,
len);Quoted 1 line
if (HFS_I(inode)->alloc_blocks == HFS_I(inode)-
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
first_blocks) {if (!HFS_I(inode)->first_blocks) {
fs/hfs/extent.c +1
-1-hfs_dbg (EXTENT ,"first extents\n" ); + hfs_dbg("first_extents[0]: start %u, len%u\n",
s/first_extents[0]:/first_extents ?
We show only first extent of the array here.
Quoted 46 lines
(quoted diff) +1
-0+ hfs_dbg("first_extents start %u, len %u\n",Quoted 22 lines
fs/hfs/extent.c +1
-0+ start, len);/* no extents yet */ HFS_I(inode)->first_extents[0].block =
cpu_to_be16(start); HFS_I(inode)->first_extents[0].count =cpu_to_be16(len);fs/hfs/extent.c +0
-0@@ -456,7 +457,7 @@ int hfs_extend_file(struct inode *inode) return res;
insert_extent:fs/hfs/extent.c +1
-1-hfs_dbg (EXTENT ,"insert new extent\n" ); +hfs_dbg ("insert new extent\n" );res =
hfs_ext_write_extent(inode);
if (res)
goto out;fs/hfs/extent.c +0
-0@@ -481,7 +482,7 @@ void hfs_file_truncate(struct inode *inode) u32 size; int res;fs/hfs/extent.c +1
-1- hfs_dbg(INODE, "truncate: %lu, %Lu -> %Lu\n", + hfs_dbg("ino: %lu, phys_size %llu -> i_size %llu\n",(quoted diff) +1
-0+ hfs_dbg("ino %lu, phys size %llu -> %llu\n", ?Quoted 20 lines
inode->i_ino, (long long)HFS_I(inode)->phys_size,inode->i_size);
if (inode->i_size> HFS_I(inode)->phys_size) {fs/hfs/hfs_fs.h +0
-0@@ -9,12 +9,6 @@ #ifndef _LINUX_HFS_FS_H #define _LINUX_HFS_FS_Hfs/hfs/hfs_fs.h +0
-6-#ifdef pr_fmt -#undef pr_fmt -#endif - -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <
linux/slab.h>
#include <linux/types.h>
Quoted 8 lines
Quoted 6 lines
#include <
linux/mutex.h>fs/hfs/hfs_fs.h +0
-0@@ -24,35 +18,10 @@
#include <asm/byteorder.h>
#include <linux/uaccess.h>
+#include <linux/hfs_common.h>Alph sort?
It's not about alphabetical sorting. It's about dependencies of declarations. The hfs_common.h should be after any other system related declarations.
Quoted 44 lines
#include <
asm/byteorder.h>
+#include <linux/hfs_common.h>
#include <linux/uaccess.h>Quoted 38 lines
#include "hfs.h"fs/hfs/hfs_fs.h +0
-9-#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 - -//#define
DBG_MASK(DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD|DBG_CAT_MOD|DBG_BITMAP)fs/hfs/hfs_fs.h +0
-2-//#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) -//#define
DBG_MASK(DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT)fs/hfs/hfs_fs.h +0
-15-#define DBG_MASK (0) - -#define hfs_dbg (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ -} while (0) - -#define hfs_dbg_cont (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - pr_cont(fmt, ##__VA_ARGS__); \ -} while (0) - -/*
* structhfs_inode_info
*fs/hfs/inode.c +0
-0
Quoted 8 lines
fs/hfs/inode.c void hfs_delete_inode(struct inode *inode) · line 244
Quoted 6 lines
fs/hfs/inode.c +0
-0@@ -241,7 +241,7 @@ void hfs_delete_inode(struct inode *inode) { struct super_block *sb = inode->i_sb;fs/hfs/inode.c +1
-1-hfs_dbg (INODE ,"delete_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);remove ':'
We can do it.
Quoted 14 lines
fs/hfs/inode.c int hfs_write_inode(struct inode *inode, struct writeback_control *wbc) · line 428
Quoted 12 lines
if (
S_ISDIR(inode->i_mode)) { HFS_SB(sb)->folder_count--; if (HFS_I(inode)->cat_key.ParID ==cpu_to_be32(HFS_ROOT_CNID))fs/hfs/inode.c +0
-0@@ -425,7 +425,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc) hfs_cat_rec rec; int res;fs/hfs/inode.c +1
-1-hfs_dbg (INODE ,"hfs_write_inode: %lu\n" , inode->i_ino); +hfs_dbg ("ino: %lu\n" , inode->i_ino);Ditto.
We can do it.
Quoted 39 lines
Quoted 39 lines
res =
hfs_ext_write_extent(inode);
if (res)
return res;fs/hfsplus/attributes.c +0
-0@@ -139,7 +139,7 @@ int hfsplus_find_attr(struct super_block *sb,u32 cnid, { int err = 0;fs/hfsplus/attributes.c +0
-1- hfs_dbg(ATTR_MOD, "find_attr: %s,%d\n", name ? name :NULL, cnid);
fs/hfsplus/attributes.c +1
-0+hfs_dbg ("name %s, cnid %d\n" , name ? name :NULL , cnid);
if (!HFSPLUS_SB(sb)->attr_tree) {pr_err("attributes file doesn't exist\n");fs/hfsplus/attributes.c +0
-0@@ -201,7 +201,7 @@ int hfsplus_create_attr(struct inode *inode, int entry_size; int err;fs/hfsplus/attributes.c +1
-1- hfs_dbg(ATTR_MOD, "create_attr: %s,%ld\n", + hfs_dbg("name %s, ino %ld\n",name ? name : NULL,
inode->i_ino);
if (!HFSPLUS_SB(sb)->attr_tree) {fs/hfsplus/attributes.c +0
-0@@ -310,7 +310,7 @@ int hfsplus_delete_attr(struct inode *inode, const char *name) struct super_block *sb = inode->i_sb; struct hfs_find_data fd;fs/hfsplus/attributes.c +1
-1- hfs_dbg(ATTR_MOD, "delete_attr: %s,%ld\n", + hfs_dbg("name %s, ino %ld\n",name ? name : NULL,
inode->i_ino);
if (!HFSPLUS_SB(sb)->attr_tree) {fs/hfsplus/attributes.c +0
-0@@ -356,7 +356,7 @@ int hfsplus_delete_all_attrs(struct inode *dir,
Quoted 8 lines
fs/hfsplus/attributes.c int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid) · line 359
Quoted 6 lines
fs/hfsplus/attributes.c +0
-0u32 cnid) int err = 0; struct hfs_find_data fd;fs/hfsplus/attributes.c +1
-1-hfs_dbg (ATTR_MOD ,"delete_all_attrs: %d\n" , cnid); +hfs_dbg ("cnid: %d\n" , cnid);Ditto.
We can do it.
Quoted 17 lines
Quoted 9 lines
if (!HFSPLUS_SB(dir->i_sb)->attr_tree) {pr_err("attributes file doesn't exist\n");fs/hfsplus/bfind.c +0
-0fs/hfsplus/bfind.c int hfs_find_init(struct hfs_btree *tree, struct · line 27
Quoted 6 lines
fs/hfsplus/bfind.c +1
-1@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) return -ENOMEM; fd->search_key = ptr; fd->key = ptr + tree->max_key_len + 2; - hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n", + hfs_dbg("CNID %d, caller %p\n",Ditto.
Please, see my answers above.
Quoted 14 lines
+ hfs_dbg("cnid %d, caller %ps\n", ?
fs/hfsplus/bfind.c void hfs_find_exit(struct hfs_find_data *fd) · line 37
Quoted 9 lines
fs/hfsplus/bfind.c +0
-0tree->cnid, __builtin_return_address(0)); mutex_lock_nested(&tree->tree_lock,
hfsplus_btree_lock_class(tree));fs/hfsplus/bfind.c +1
-1@@ -34,7 +34,7 @@ void hfs_find_exit(struct hfs_find_data *fd) { hfs_bnode_put(fd->bnode); kfree(fd->search_key); - hfs_dbg(BNODE_REFS, "find_exit: %d (%p)\n", + hfs_dbg("CNID %d, caller %p\n",Reference to hfs.
Please, see my answers above.
Quoted 11 lines
Quoted 11 lines
fs/hfsplus/bfind.c +0
-0fd->tree->cnid, __builtin_return_address(0)); mutex_unlock(&fd->tree->tree_lock); fd->tree = NULL;fs/hfsplus/bitmap.c +0
-0@@ -31,7 +31,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, if (!len)
Quoted 8 lines
Quoted 6 lines
fs/hfsplus/bitmap.c +0
-0return size;fs/hfsplus/bitmap.c +0
-1- hfs_dbg(BITMAP, "block_allocate: %u,%u,%u\n", size,offset, len);
fs/hfsplus/bitmap.c +1
-0+ hfs_dbg("RANGE: size %u, offset %u, len %u\n", size,offset, len);
Reference to hfs.
Please, see my answers above.
Quoted 26 lines
Quoted 26 lines
mutex_lock(&sbi->alloc_mutex); mapping =sbi->alloc_file->i_mapping; page =read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);fs/hfsplus/bitmap.c +0
-0@@ -90,14 +90,14 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,else
end = pptr + ((size + 31) & (PAGE_CACHE_BITS- 1)) / 32;
}fs/hfsplus/bitmap.c +1
-1-hfs_dbg (BITMAP ,"bitmap full\n" ); +hfs_dbg ("bitmap full\n" );start = size;
goto out;
found:
start = offset + (curr - pptr) * 32 + i; if (start >= size) {fs/hfsplus/bitmap.c +1
-1-hfs_dbg (BITMAP ,"bitmap full\n" ); +hfs_dbg ("bitmap full\n" );goto out;
}
/* do any partial u32 at the start */fs/hfsplus/bitmap.c +0
-0@@ -155,7 +155,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,
Quoted 8 lines
fs/hfsplus/bitmap.c int hfsplus_block_allocate(struct super_block *sb, u32 size, · line 158
Quoted 5 lines
fs/hfsplus/bitmap.c +1
-1*max = offset + (curr - pptr) * 32 + i - start; sbi->free_blocks -= *max; hfsplus_mark_mdb_dirty(sb); -hfs_dbg (BITMAP ,"-> %u,%u\n" , start, *max); +hfs_dbg ("RANGE-> start %u, max %u\n" , start, *max);'RANGE->' is strange.
Please, see my answers above.
Quoted 13 lines
fs/hfsplus/bitmap.c int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) · line 177
Quoted 11 lines
out:
mutex_unlock(&sbi->alloc_mutex);
return start;fs/hfsplus/bitmap.c +0
-0@@ -174,7 +174,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) if (!count) return 0;fs/hfsplus/bitmap.c +1
-1-hfs_dbg (BITMAP ,"block_free: %u,%u\n" , offset, count); +hfs_dbg ("RANGE: offset %u, count %u\n" , offset, count);remove 'RANGE: ' ?
Please, see my answers above.
Quoted 11 lines
Quoted 11 lines
/* are all of the bits in range? */
if ((offset + count) >sbi->total_blocks) return-ENOENT;fs/hfsplus/bnode.c +0
-0@@ -214,7 +214,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst, struct page **src_page, **dst_page;
Quoted 8 lines
Quoted 6 lines
fs/hfsplus/bnode.c +0
-0int l;fs/hfsplus/bnode.c +0
-1- hfs_dbg(BNODE_MOD, "copybytes: %u,%u,%u\n", dst, src,len);
fs/hfsplus/bnode.c +1
-0+ hfs_dbg("copybytes: dst %u, src %u, len %u\n", dst, src,len);
remove 'copybytes: ' ?
Please, see my answers above.
Quoted 15 lines
Quoted 12 lines
if (!len)
return;fs/hfsplus/bnode.c +0
-0@@ -272,7 +272,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) void *src_ptr, *dst_ptr; int l;fs/hfsplus/bnode.c +0
-1- hfs_dbg(BNODE_MOD, "movebytes: %u,%u,%u\n", dst, src,len);
fs/hfsplus/bnode.c +1
-0+ hfs_dbg("movebytes: dst %u, src %u, len %u\n", dst, src,Quoted 1 line
len);
Ditto.
Please, see my answers above.
Quoted 28 lines
Quoted 28 lines
if (!len)
return;fs/hfsplus/bnode.c +0
-0@@ -392,16 +392,16 @@ void hfs_bnode_dump(struct hfs_bnode *node) __be32 cnid; int i, off, key_off;fs/hfsplus/bnode.c +1
-1-hfs_dbg (BNODE_MOD ,"bnode: %d\n" , node->this); +hfs_dbg ("node_id %d\n" , node->this);
hfs_bnode_read(node, &desc, 0, sizeof(desc));fs/hfsplus/bnode.c +1
-1- hfs_dbg(BNODE_MOD, "%d, %d, %d, %d, %d\n", + hfs_dbg("next %d, prev %d, type %d, height %d, num_recs%d\n",
be32_to_cpu(desc.next),be32_to_cpu(desc.prev), desc.type, desc.height,be16_to_cpu(desc.num_recs));
off =node->tree->node_size- 2;
for (i =be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i-- ) {
key_off=hfs_bnode_read_u16(node, off);fs/hfsplus/bnode.c +1
-1-hfs_dbg (BNODE_MOD ," %d" , key_off); +hfs_dbg (" key_off %d" , key_off);if (i &&
node->type==HFS_NODE_INDEX) { int tmp;fs/hfsplus/bnode.c +0
-0@@ -410,17 +410,17 @@ void hfs_bnode_dump(struct hfs_bnode *node)
Quoted 8 lines
fs/hfsplus/bnode.c void hfs_bnode_dump(struct hfs_bnode *node) · line 413
Quoted 6 lines
fs/hfsplus/bnode.c +0
-0tmp = hfs_bnode_read_u16(node, key_off) +2 ;else
tmp =node->tree->max_key_len+ 2;fs/hfsplus/bnode.c +1
-1-hfs_dbg_cont (BNODE_MOD ," (%d" , tmp); +hfs_dbg (" (%d" , tmp);Could we describe those info ?
Please, see my answers above.
Quoted 30 lines
Quoted 30 lines
hfs_bnode_read(node, &cnid, key_off + tmp, 4);fs/hfsplus/bnode.c +0
-1- hfs_dbg_cont(BNODE_MOD, ",%d)",
be32_to_cpu(cnid));fs/hfsplus/bnode.c +1
-0+hfs_dbg (", cnid %d)" ,be32_to_cpu (cnid));} else if (i &&
node->type==HFS_NODE_LEAF) { int tmp;
tmp =hfs_bnode_read_u16(node, key_off);fs/hfsplus/bnode.c +1
-1-hfs_dbg_cont (BNODE_MOD ," (%d)" , tmp); +hfs_dbg (" (%d)" , tmp);}
}fs/hfsplus/bnode.c +1
-1-hfs_dbg_cont (BNODE_MOD ,"\n" ); +hfs_dbg ("\n" );}
voidhfs_bnode_unlink(struct hfs_bnode *node)fs/hfsplus/bnode.c +0
-0@@ -456,7 +456,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)
/* move down? */
if (!node->prev && !node->next)fs/hfsplus/bnode.c +1
-1-hfs_dbg (BNODE_MOD ,"hfs_btree_del_level\n" ); +hfs_dbg ("btree delete level\n" );if (!node->parent) {
tree->root= 0;
tree->depth= 0;fs/hfsplus/bnode.c +0
-0@@ -511,7 +511,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
Quoted 8 lines
fs/hfsplus/bnode.c static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) · line 514
Quoted 5 lines
fs/hfsplus/bnode.c +1
-1node->this = cnid; set_bit(HFS_BNODE_NEW, &node->flags); atomic_set(&node->refcnt, 1); - hfs_dbg(BNODE_REFS, "new_node(%d:%d): 1\n", + hfs_dbg("cnid%d, node_id %d, refcnt 1\n",add white space?
Yes, we can do it.
Quoted 39 lines
Quoted 39 lines
fs/hfsplus/bnode.c +0
-0node->tree->cnid, node->this); init_waitqueue_head(&node->lock_wq);
spin_lock(&tree->hash_lock);fs/hfsplus/bnode.c +0
-0@@ -551,7 +551,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node) { struct hfs_bnode **p;fs/hfsplus/bnode.c +1
-1- hfs_dbg(BNODE_REFS, "remove_node(%d:%d): %d\n", + hfs_dbg("cnid %d, node_id %d, refcnt %d\n",
node->tree->cnid,node->this, atomic_read(&node-Quoted 1 line
refcnt));
for (p = &node->tree->node_hash[hfs_bnode_hash(node-
Quoted 1 line
this)];
*p && *p != node; p = &(*p)->next_hash)
fs/hfsplus/bnode.c +1
-1@@ -697,7 +697,7 @@ void hfs_bnode_get(struct hfs_bnode *node) { if (node) { atomic_inc(&node->refcnt); -hfs_dbg (BNODE_REFS ,"get_node(%d:%d): %d\n" , +hfs_dbg ("cnid %d, node_id %d, refcnt %d\n" , node->tree->cnid, node->this, atomic_read(&node->refcnt)); }@@ -710,7 +710,7 @@ void hfs_bnode_put(struct hfs_bnode *node) struct hfs_btree *tree = node->tree; int i;fs/hfsplus/bnode.c +1
-1- hfs_dbg(BNODE_REFS, "put_node(%d:%d): %d\n", + hfs_dbg("cnid %d, node_id %d, refcnt %d\n",
node->tree->cnid,node->this,atomic_read(&node->refcnt)); BUG_ON(!atomic_read(&node->refcnt));fs/hfsplus/brec.c +0
-0@@ -92,7 +92,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len)
Quoted 8 lines
fs/hfsplus/brec.c int hfs_brec_insert(struct hfs_find_data *fd, · line 97
Quoted 6 lines
fs/hfsplus/brec.c +1
-1end_rec_off = tree->node_size - (node->num_recs + 1) * 2; end_off = hfs_bnode_read_u16(node, end_rec_off); end_rec_off -= 2; -hfs_dbg (BNODE_MOD ,"insert_rec: %d, %d, %d, %d\n" , + hfs_dbg("RECORD: rec %d, size %d, end_off %d, end_rec_off %d\n",remove 'RECORD: '?
Please, see my answers above.
Quoted 13 lines
fs/hfsplus/brec.c int hfs_brec_remove(struct hfs_find_data *fd) · line 196
Quoted 10 lines
fs/hfsplus/brec.c +0
-0rec, size, end_off, end_rec_off);if (size >
end_rec_off-end_off) {
if (new_node)fs/hfsplus/brec.c +1
-1@@ -193,7 +193,7 @@ int hfs_brec_remove(struct hfs_find_data *fd) mark_inode_dirty(tree->inode); } hfs_bnode_dump(node); - hfs_dbg(BNODE_MOD, "remove_rec: %d, %d\n", + hfs_dbg("RECORD: rec %d, len %d\n",Ditto.
Please, see my answers above.
Quoted 13 lines
fs/hfsplus/brec.c static struct hfs_bnode *hfs_bnode_split(struct · line 250
Quoted 11 lines
fs/hfsplus/brec.c +1
-1fd->record, fd->keylength + fd->entrylength); if (!--node->num_recs) { hfs_bnode_unlink(node);@@ -246,7 +246,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) if (IS_ERR(new_node)) return new_node; hfs_bnode_get(node); - hfs_dbg(BNODE_MOD, "split_nodes: %d - %d - %d\n", + hfs_dbg("bnodes: this %d - new %d - next %d\n",remove 'bnodes: ' ?
Please, see my answers above.
Quoted 14 lines
fs/hfsplus/brec.c
Quoted 11 lines
fs/hfsplus/brec.c +0
-0node->this, new_node->this, node->next); new_node->next = node->next;
new_node->prev=node->this;fs/hfsplus/brec.c +0
-0@@ -383,7 +383,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) newkeylen = hfs_bnode_read_u16(node, 14) + 2;else
fd->keylength= newkeylen =tree->max_key_len+ 2;fs/hfsplus/brec.c +1
-1- hfs_dbg(BNODE_MOD, "update_rec: %d, %d, %d\n", + hfs_dbg("RECORD: rec %d, keylength %d, newkeylen %d\n",remove 'RECORD: ' ?
Please, see my answers above.
Quoted 30 lines
Quoted 30 lines
rec,
fd->keylength, newkeylen);
rec_off=tree->node_size- (rec + 2) * 2;fs/hfsplus/brec.c +0
-0@@ -395,7 +395,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) end_off = hfs_bnode_read_u16(parent, end_rec_off); if (end_rec_off - end_off < diff) {fs/hfsplus/brec.c +0
-1- hfs_dbg(BNODE_MOD, "splitting indexnode\n");
fs/hfsplus/brec.c +1
-0+hfs_dbg ("splitting index node\n" );
fd->bnode= parent;new_node=hfs_bnode_split(fd); if (IS_ERR(new_node))fs/hfsplus/btree.c +1
-1@@ -428,7 +428,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) kunmap_local(data); nidx = node->next; if (!nidx) { -hfs_dbg (BNODE_MOD ,"create new bmap node\n"); + hfs_dbg("create new bmap node\n" ); next_node = hfs_bmap_new_bmap(node, idx);} else
next_node=hfs_bnode_find(tree, nidx);
Quoted 8 lines
fs/hfsplus/btree.c
Quoted 6 lines
fs/hfsplus/btree.c +0
-0@@ -454,7 +454,7 @@ void hfs_bmap_free(struct hfs_bnode *node) u32 nidx; u8 *data, byte, m;fs/hfsplus/btree.c +1
-1-hfs_dbg (BNODE_MOD ,"btree_free_node: %u\n" , node->this); +hfs_dbg ("node_id %u\n" , node->this);node id?
Please, see my answers above.
Quoted 17 lines
Quoted 13 lines
BUG_ON(!node->this);
tree =node->tree;
nidx =node->this;fs/hfsplus/catalog.c +0
-0@@ -259,7 +259,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir, int entry_size; int err;fs/hfsplus/catalog.c
Quoted 2 lines
fs/hfsplus/catalog.c +1
-1- hfs_dbg(CAT_MOD, "create_cat: %s,%u(%d)\n", + hfs_dbg("entry: name %s, cnid %u, i_nlink %d\n",remove 'entry: ' ?
Please, see my answers above.
Quoted 16 lines
Quoted 13 lines
str->name, cnid,inode->i_nlink); err =hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); if (err)fs/hfsplus/catalog.c +0
-0@@ -336,7 +336,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str) int err, off; u16 type;fs/hfsplus/catalog.c +0
-1- hfs_dbg(CAT_MOD, "delete_cat: %s,%u\n", str ? str->name :NULL, cnid);
fs/hfsplus/catalog.c +1
-0+ hfs_dbg("entry: name %s, cnid %u\n", str ? str->name :Quoted 1 line
NULL, cnid);
Ditto.
Please, see my answers above.
Quoted 13 lines
Quoted 11 lines
err =
hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); if (err)
return err;fs/hfsplus/catalog.c +0
-0@@ -441,7 +441,7 @@ int hfsplus_rename_cat(u32 cnid, int entry_size, type; int err;fs/hfsplus/catalog.c +1
-1- hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", + hfs_dbg("entry: cnid %u - ino %lu, name %s - ino %lu, name%s\n",
Ditto.
Please, see my answers above.
Quoted 18 lines
Quoted 13 lines
cnid,
src_dir->i_ino,src_name->name,dst_dir->i_ino,dst_name->name);
err =hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &src_fd);fs/hfsplus/extents.c +0
-0@@ -275,7 +275,7 @@ int hfsplus_get_block(struct inode *inode,sector_t iblock, mutex_unlock(&hip->extents_lock);
done:fs/hfsplus/extents.c int hfsplus_get_block(struct inode *inode, sector_t iblock, · line 278
Quoted 2 lines
fs/hfsplus/extents.c +1
-1- hfs_dbg(EXTENT, "get_block(%lu): %llu - %u\n", + hfs_dbg("ino(%lu): iblock %llu - dblock %u\n",> + hfs_dbg("ino %lu, iblock %llu - dblock %u\n", ?
Quoted 12 lines
fs/hfsplus/extents.c static void hfsplus_dump_extent(struct hfsplus_extent *extent) · line 301
Quoted 10 lines
inode->i_ino, (long long)iblock, dblock);
mask = (1 <<sbi->fs_shift) - 1;fs/hfsplus/extents.c +0
-0@@ -298,12 +298,12 @@ static void hfsplus_dump_extent(struct hfsplus_extent *extent) { int i;fs/hfsplus/extents.c +1
-1-hfs_dbg (EXTENT ," " ); +hfs_dbg ("EXTENT " );extent: ?
Please, see my answers above.
Quoted 19 lines
Quoted 19 lines
for (i = 0; i < 8; i++)
fs/hfsplus/extents.c +4
-4-hfs_dbg_cont (EXTENT ," %u:%u" , - be32_to_cpu(extent[i].start_block), - be32_to_cpu(extent[i].block_count)); -hfs_dbg_cont (EXTENT ,"\n" ); +hfs_dbg (" start_block %u, block_count%u" , +be32_to_cpu (extent[i].start_block), +be32_to_cpu (extent[i].block_count)); +hfs_dbg ("\n" );}
static int hfsplus_add_extent(structhfsplus_extent*extent, u32 offset,fs/hfsplus/extents.c +0
-0@@ -360,7 +360,7 @@ static int hfsplus_free_extents(structsuper_block *sb, err = hfsplus_block_free(sb, start, count); if (err) {
Quoted 8 lines
Quoted 5 lines
fs/hfsplus/extents.c +1
-1pr_err("can't free extent\n"); - hfs_dbg(EXTENT, " start: %u count: %u\n", + hfs_dbg("EXTENT: start: %u count:%u\n",
convert to
pr_err?
Probably, makes sense.
Quoted 16 lines
Quoted 13 lines
start, count); }
extent->block_count= 0;fs/hfsplus/extents.c +0
-0@@ -371,7 +371,7 @@ static int hfsplus_free_extents(struct super_block *sb,err =
hfsplus_block_free(sb, start + count, block_nr);
if (err) {
pr_err("can't free extent\n");fs/hfsplus/extents.c +0
-1- hfs_dbg(EXTENT, " start: %u count:%u\n",
fs/hfsplus/extents.c +1
-0+ hfs_dbg("EXTENT: start: %u count:Quoted 1 line
%u\n",
remove 'EXTENT:' ?
Please, see my answers above.
Quoted 15 lines
Quoted 12 lines
start, count); }
extent->block_count=cpu_to_be32(count);fs/hfsplus/extents.c +0
-0@@ -478,11 +478,12 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout) goto out; }fs/hfsplus/extents.c +0
-1- hfs_dbg(EXTENT, "extend %lu: %u,%u\n", inode->i_ino,start, len);
fs/hfsplus/extents.c +1
-0+ hfs_dbg("ino %lu: start %u, len %u\n", inode->i_ino,Quoted 1 line
start, len);
s/:/, ?
Please, see my answers above.
Quoted 114 lines
Quoted 27 lines
if (hip->alloc_blocks<=hip->first_blocks) { if (!hip->first_blocks) {fs/hfsplus/extents.c +1
-1-hfs_dbg (EXTENT ,"first extents\n" ); + hfs_dbg("first_extents[0]: start %u, len%u\n",
fs/hfsplus/extents.c +1
-0+ start, len);/* no extents yet */ hip->first_extents[0].start_block =
cpu_to_be32(start); hip->first_extents[0].block_count =cpu_to_be32(len);fs/hfsplus/extents.c +0
-0@@ -521,7 +522,7 @@ int hfsplus_file_extend(struct inode *inode, bool zeroout) return res;
insert_extent:fs/hfsplus/extents.c +1
-1-hfs_dbg (EXTENT ,"insert new extent\n" ); +hfs_dbg ("insert new extent\n" );res =
hfsplus_ext_write_extent_locked(inode); if (res)
goto out;fs/hfsplus/extents.c +0
-0@@ -546,7 +547,7 @@ void hfsplus_file_truncate(struct inode *inode) u32 alloc_cnt, blk_cnt, start; int res;fs/hfsplus/extents.c void hfsplus_file_truncate(struct inode *inode) · line 550
Quoted 2 lines
fs/hfsplus/extents.c +1
-1- hfs_dbg(INODE, "truncate: %lu, %llu -> %llu\n", + hfs_dbg("ino: %lu, phys_size %llu -> i_size %llu\n",> + hfs_dbg("ino %lu, phys size %llu -> %llu\n",
Quoted 69 lines
inode->i_ino, (long long)hip->phys_size, inode-Quoted 1 line
i_size);
if (inode->i_size>hip->phys_size) {fs/hfsplus/hfsplus_fs.h +0
-0@@ -11,47 +11,14 @@ #ifndef _LINUX_HFSPLUS_FS_H #define _LINUX_HFSPLUS_FS_Hfs/hfsplus/hfsplus_fs.h +0
-6-#ifdef pr_fmt -#undef pr_fmt -#endif - -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <
linux/fs.h>
#include <linux/mutex.h>
#include <linux/buffer_head.h>
#include <linux/blkdev.h>
#include <linux/fs_context.h>
+#include <linux/hfs_common.h>
#include "hfsplus_raw.h"fs/hfsplus/hfsplus_fs.h +0
-13-#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 -#define DBG_ATTR_MOD 0x00000080 - -#if 0 -#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD) -#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) -#define
DBG_MASK(DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT)fs/hfsplus/hfsplus_fs.h +0
-15-#endif -#define DBG_MASK (0) - -#define hfs_dbg (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ -} while (0) - -#define hfs_dbg_cont (flg, fmt, ...) \ -do { \ - if (DBG_##flg & DBG_MASK) \ - pr_cont(fmt, ##__VA_ARGS__); \ -} while (0) -/* Runtime config options */
#define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */fs/hfsplus/super.c +0
-0@@ -150,7 +150,7 @@ static int hfsplus_write_inode(struct inode *inode, { int err;fs/hfsplus/super.c +0
-1- hfs_dbg(INODE, "hfsplus_write_inode: %lu\n", inode-Quoted 1 line
i_ino);fs/hfsplus/super.c
Quoted 1 line
fs/hfsplus/super.c +1
-0+hfs_dbg ("ino: %lu\n" , inode->i_ino);+
hfs_dbg("ino %lu\n", inode->i_ino); ?Quoted 9 lines
err =hfsplus_ext_write_extent(inode);
if (err)fs/hfsplus/super.c +0
-0@@ -165,7 +165,7 @@ static int hfsplus_write_inode(struct inode *inode,
static voidhfsplus_evict_inode(struct inode *inode){fs/hfsplus/super.c +0
-1- hfs_dbg(INODE, "hfsplus_evict_inode: %lu\n", inode-
Quoted 4 lines
fs/hfsplus/super.c
Quoted 2 lines
Quoted 1 line
i_ino);fs/hfsplus/super.c +1
-0+hfs_dbg ("ino: %lu\n" , inode->i_ino);Ditto.
Please, see my answers above.
Thanks,
Slava.
Quoted 122 lines
Quoted 34 lines
truncate_inode_pages_final(&inode->i_data);clear_inode(inode);
if (HFSPLUS_IS_RSRC(inode)) {fs/hfsplus/super.c +0
-0@@ -184,7 +184,7 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait) if (!wait) return 0;fs/hfsplus/super.c +1
-1-hfs_dbg (SUPER ,"hfsplus_sync_fs\n" ); +hfs_dbg ("starting...\n" );
/*
* Explicitly write out the special metadata inodes.fs/hfsplus/super.c +0
-0@@ -215,6 +215,11 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait) vhdr->folder_count = cpu_to_be32(sbi->folder_count); vhdr->file_count = cpu_to_be32(sbi->file_count);fs/hfsplus/super.c +5
-0+hfs_dbg ("free_blocks %u, next_cnid %u, " +"folder_count %u, file_count %u\n" , + sbi->free_blocks, sbi->next_cnid, + sbi->folder_count, sbi->file_count); +if (test_and_clear_bit(HFSPLUS_SB_WRITEBACKUP, &sbi-
Quoted 1 line
flags)) {
memcpy(sbi->s_backup_vhdr, sbi->s_vhdr, sizeof(*sbi->s_vhdr));
write_backup= 1;fs/hfsplus/super.c +0
-0@@ -240,6 +245,8 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait) if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) blkdev_issue_flush(sb->s_bdev);fs/hfsplus/super.c static int hfsplus_sync_fs(struct super_block *sb, int wait) · line 248
Quoted 1 line
fs/hfsplus/super.c +1
-0+hfs_dbg ("finished: err %d\n" , error);+
hfs_dbg("finished err %d\n", error); ?Quoted 79 lines
+
return error;
}fs/hfsplus/super.c +0
-0@@ -288,7 +295,7 @@ static void hfsplus_put_super(struct super_block *sb) { struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);fs/hfsplus/super.c +1
-1-hfs_dbg (SUPER ,"hfsplus_put_super\n" ); +hfs_dbg ("starting...\n" );
cancel_delayed_work_sync(&sbi->sync_work);fs/hfsplus/super.c +2
-0@@ -310,6 +317,8 @@ static void hfsplus_put_super(struct super_block *sb) kfree(sbi->s_vhdr_buf); kfree(sbi->s_backup_vhdr_buf); call_rcu(&sbi->rcu, delayed_free); + +hfs_dbg ("finished\n" ); }
static inthfsplus_statfs(struct dentry *dentry, struct kstatfs *buf)fs/hfsplus/xattr.c +0
-0@@ -64,7 +64,7 @@ static void hfsplus_init_header_node(struct inode *attr_file, u32 used_bmp_bytes; u64 tmp;fs/hfsplus/xattr.c +0
-1- hfs_dbg(ATTR_MOD, "init_hdr_attr_file: clump %u, node_size%u\n",
fs/hfsplus/xattr.c +1
-0+ hfs_dbg("clump %u, node_size %u\n",
clump_size,node_size);
/* The end of the node contains list of record offsets */fs/hfsplus/xattr.c +0
-0@@ -132,7 +132,7 @@ static int hfsplus_create_attributes_file(struct super_block *sb) struct page *page; int old_state = HFSPLUS_EMPTY_ATTR_TREE;fs/hfsplus/xattr.c +0
-1- hfs_dbg(ATTR_MOD, "create_attr_file: ino %d\n",
HFSPLUS_ATTR_CNID);fs/hfsplus/xattr.c +1
-0+hfs_dbg ("ino %d\n" ,HFSPLUS_ATTR_CNID );
check_attr_tree_state_again:
switch (atomic_read(&sbi->attr_tree_state)) {include/linux/hfs_common.h new file +16
-0@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* HFS/HFS+ common definitions, inline functions, +* and shared functionality. +*/ + +#ifndef _HFS_COMMON_H_ +#define _HFS_COMMON_H_ + +#ifdef pr_fmt +#undef pr_fmt +#endif + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#define hfs_dbg(fmt,...) \
include/linux/hfs_common.h new file +1
-0+ pr_debug("pid %d:%s:%d %s(): "fmt, \
include/linux/hfs_common.h new file +1
-0+ current->pid, __FILE__, __LINE__, __func__,##__VA_ARGS__) \
include/linux/hfs_common.h
Quoted 2 lines
include/linux/hfs_common.h new file +2
-0+ +#endif /* _HFS_COMMON_H_ */ Thx,
Yangtao