aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-04-30 18:27:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 20:04:05 -0400
commitc2b3e1f76e5c90215bc7f740b376c0220eb8a8e3 (patch)
tree4ffbb3029d06909e05621ebb96b66052640f3ff7 /fs
parent5f3726f9457d5a863721353786e3395cdbd0f943 (diff)
hfs/hfsplus: convert dprint to hfs_dbg
Use a more current logging style. Rename macro and uses. Add do {} while (0) to macro. Add DBG_ to macro. Add and use hfs_dbg_cont variant where appropriate. Signed-off-by: Joe Perches <joe@perches.com> Cc: Vyacheslav Dubeyko <slava@dubeyko.com> Cc: Hin-Tak Leung <htl10@users.sourceforge.net> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/hfs/bfind.c6
-rw-r--r--fs/hfs/bitmap.c4
-rw-r--r--fs/hfs/bnode.c35
-rw-r--r--fs/hfs/brec.c11
-rw-r--r--fs/hfs/btree.c2
-rw-r--r--fs/hfs/catalog.c8
-rw-r--r--fs/hfs/extent.c20
-rw-r--r--fs/hfs/hfs_fs.h14
-rw-r--r--fs/hfs/inode.c4
-rw-r--r--fs/hfsplus/attributes.c8
-rw-r--r--fs/hfsplus/bfind.c4
-rw-r--r--fs/hfsplus/bitmap.c10
-rw-r--r--fs/hfsplus/bnode.c30
-rw-r--r--fs/hfsplus/brec.c10
-rw-r--r--fs/hfsplus/btree.c4
-rw-r--r--fs/hfsplus/catalog.c7
-rw-r--r--fs/hfsplus/extents.c26
-rw-r--r--fs/hfsplus/hfsplus_fs.h14
-rw-r--r--fs/hfsplus/super.c8
19 files changed, 127 insertions, 98 deletions
diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index 571abe97b42a..e928f6cfb05b 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -22,7 +22,8 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)
22 return -ENOMEM; 22 return -ENOMEM;
23 fd->search_key = ptr; 23 fd->search_key = ptr;
24 fd->key = ptr + tree->max_key_len + 2; 24 fd->key = ptr + tree->max_key_len + 2;
25 dprint(DBG_BNODE_REFS, "find_init: %d (%p)\n", tree->cnid, __builtin_return_address(0)); 25 hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n",
26 tree->cnid, __builtin_return_address(0));
26 mutex_lock(&tree->tree_lock); 27 mutex_lock(&tree->tree_lock);
27 return 0; 28 return 0;
28} 29}
@@ -31,7 +32,8 @@ void hfs_find_exit(struct hfs_find_data *fd)
31{ 32{
32 hfs_bnode_put(fd->bnode); 33 hfs_bnode_put(fd->bnode);
33 kfree(fd->search_key); 34 kfree(fd->search_key);
34 dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", fd->tree->cnid, __builtin_return_address(0)); 35 hfs_dbg(BNODE_REFS, "find_exit: %d (%p)\n",
36 fd->tree->cnid, __builtin_return_address(0));
35 mutex_unlock(&fd->tree->tree_lock); 37 mutex_unlock(&fd->tree->tree_lock);
36 fd->tree = NULL; 38 fd->tree = NULL;
37} 39}
diff --git a/fs/hfs/bitmap.c b/fs/hfs/bitmap.c
index c6e97366e8ac..28307bc9ec1e 100644
--- a/fs/hfs/bitmap.c
+++ b/fs/hfs/bitmap.c
@@ -158,7 +158,7 @@ u32 hfs_vbm_search_free(struct super_block *sb, u32 goal, u32 *num_bits)
158 } 158 }
159 } 159 }
160 160
161 dprint(DBG_BITMAP, "alloc_bits: %u,%u\n", pos, *num_bits); 161 hfs_dbg(BITMAP, "alloc_bits: %u,%u\n", pos, *num_bits);
162 HFS_SB(sb)->free_ablocks -= *num_bits; 162 HFS_SB(sb)->free_ablocks -= *num_bits;
163 hfs_bitmap_dirty(sb); 163 hfs_bitmap_dirty(sb);
164out: 164out:
@@ -200,7 +200,7 @@ int hfs_clear_vbm_bits(struct super_block *sb, u16 start, u16 count)
200 if (!count) 200 if (!count)
201 return 0; 201 return 0;
202 202
203 dprint(DBG_BITMAP, "clear_bits: %u,%u\n", start, count); 203 hfs_dbg(BITMAP, "clear_bits: %u,%u\n", start, count);
204 /* are all of the bits in range? */ 204 /* are all of the bits in range? */
205 if ((start + count) > HFS_SB(sb)->fs_ablocks) 205 if ((start + count) > HFS_SB(sb)->fs_ablocks)
206 return -2; 206 return -2;
diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c
index cdb41a1f6a64..869391902575 100644
--- a/fs/hfs/bnode.c
+++ b/fs/hfs/bnode.c
@@ -100,7 +100,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst,
100 struct hfs_btree *tree; 100 struct hfs_btree *tree;
101 struct page *src_page, *dst_page; 101 struct page *src_page, *dst_page;
102 102
103 dprint(DBG_BNODE_MOD, "copybytes: %u,%u,%u\n", dst, src, len); 103 hfs_dbg(BNODE_MOD, "copybytes: %u,%u,%u\n", dst, src, len);
104 if (!len) 104 if (!len)
105 return; 105 return;
106 tree = src_node->tree; 106 tree = src_node->tree;
@@ -120,7 +120,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)
120 struct page *page; 120 struct page *page;
121 void *ptr; 121 void *ptr;
122 122
123 dprint(DBG_BNODE_MOD, "movebytes: %u,%u,%u\n", dst, src, len); 123 hfs_dbg(BNODE_MOD, "movebytes: %u,%u,%u\n", dst, src, len);
124 if (!len) 124 if (!len)
125 return; 125 return;
126 src += node->page_offset; 126 src += node->page_offset;
@@ -138,16 +138,16 @@ void hfs_bnode_dump(struct hfs_bnode *node)
138 __be32 cnid; 138 __be32 cnid;
139 int i, off, key_off; 139 int i, off, key_off;
140 140
141 dprint(DBG_BNODE_MOD, "bnode: %d\n", node->this); 141 hfs_dbg(BNODE_MOD, "bnode: %d\n", node->this);
142 hfs_bnode_read(node, &desc, 0, sizeof(desc)); 142 hfs_bnode_read(node, &desc, 0, sizeof(desc));
143 dprint(DBG_BNODE_MOD, "%d, %d, %d, %d, %d\n", 143 hfs_dbg(BNODE_MOD, "%d, %d, %d, %d, %d\n",
144 be32_to_cpu(desc.next), be32_to_cpu(desc.prev), 144 be32_to_cpu(desc.next), be32_to_cpu(desc.prev),
145 desc.type, desc.height, be16_to_cpu(desc.num_recs)); 145 desc.type, desc.height, be16_to_cpu(desc.num_recs));
146 146
147 off = node->tree->node_size - 2; 147 off = node->tree->node_size - 2;
148 for (i = be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i--) { 148 for (i = be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i--) {
149 key_off = hfs_bnode_read_u16(node, off); 149 key_off = hfs_bnode_read_u16(node, off);
150 dprint(DBG_BNODE_MOD, " %d", key_off); 150 hfs_dbg_cont(BNODE_MOD, " %d", key_off);
151 if (i && node->type == HFS_NODE_INDEX) { 151 if (i && node->type == HFS_NODE_INDEX) {
152 int tmp; 152 int tmp;
153 153
@@ -155,17 +155,18 @@ void hfs_bnode_dump(struct hfs_bnode *node)
155 tmp = (hfs_bnode_read_u8(node, key_off) | 1) + 1; 155 tmp = (hfs_bnode_read_u8(node, key_off) | 1) + 1;
156 else 156 else
157 tmp = node->tree->max_key_len + 1; 157 tmp = node->tree->max_key_len + 1;
158 dprint(DBG_BNODE_MOD, " (%d,%d", tmp, hfs_bnode_read_u8(node, key_off)); 158 hfs_dbg_cont(BNODE_MOD, " (%d,%d",
159 tmp, hfs_bnode_read_u8(node, key_off));
159 hfs_bnode_read(node, &cnid, key_off + tmp, 4); 160 hfs_bnode_read(node, &cnid, key_off + tmp, 4);
160 dprint(DBG_BNODE_MOD, ",%d)", be32_to_cpu(cnid)); 161 hfs_dbg_cont(BNODE_MOD, ",%d)", be32_to_cpu(cnid));
161 } else if (i && node->type == HFS_NODE_LEAF) { 162 } else if (i && node->type == HFS_NODE_LEAF) {
162 int tmp; 163 int tmp;
163 164
164 tmp = hfs_bnode_read_u8(node, key_off); 165 tmp = hfs_bnode_read_u8(node, key_off);
165 dprint(DBG_BNODE_MOD, " (%d)", tmp); 166 hfs_dbg_cont(BNODE_MOD, " (%d)", tmp);
166 } 167 }
167 } 168 }
168 dprint(DBG_BNODE_MOD, "\n"); 169 hfs_dbg_cont(BNODE_MOD, "\n");
169} 170}
170 171
171void hfs_bnode_unlink(struct hfs_bnode *node) 172void hfs_bnode_unlink(struct hfs_bnode *node)
@@ -257,8 +258,8 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
257 node->this = cnid; 258 node->this = cnid;
258 set_bit(HFS_BNODE_NEW, &node->flags); 259 set_bit(HFS_BNODE_NEW, &node->flags);
259 atomic_set(&node->refcnt, 1); 260 atomic_set(&node->refcnt, 1);
260 dprint(DBG_BNODE_REFS, "new_node(%d:%d): 1\n", 261 hfs_dbg(BNODE_REFS, "new_node(%d:%d): 1\n",
261 node->tree->cnid, node->this); 262 node->tree->cnid, node->this);
262 init_waitqueue_head(&node->lock_wq); 263 init_waitqueue_head(&node->lock_wq);
263 spin_lock(&tree->hash_lock); 264 spin_lock(&tree->hash_lock);
264 node2 = hfs_bnode_findhash(tree, cnid); 265 node2 = hfs_bnode_findhash(tree, cnid);
@@ -301,7 +302,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node)
301{ 302{
302 struct hfs_bnode **p; 303 struct hfs_bnode **p;
303 304
304 dprint(DBG_BNODE_REFS, "remove_node(%d:%d): %d\n", 305 hfs_dbg(BNODE_REFS, "remove_node(%d:%d): %d\n",
305 node->tree->cnid, node->this, atomic_read(&node->refcnt)); 306 node->tree->cnid, node->this, atomic_read(&node->refcnt));
306 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; 307 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)];
307 *p && *p != node; p = &(*p)->next_hash) 308 *p && *p != node; p = &(*p)->next_hash)
@@ -443,8 +444,9 @@ void hfs_bnode_get(struct hfs_bnode *node)
443{ 444{
444 if (node) { 445 if (node) {
445 atomic_inc(&node->refcnt); 446 atomic_inc(&node->refcnt);
446 dprint(DBG_BNODE_REFS, "get_node(%d:%d): %d\n", 447 hfs_dbg(BNODE_REFS, "get_node(%d:%d): %d\n",
447 node->tree->cnid, node->this, atomic_read(&node->refcnt)); 448 node->tree->cnid, node->this,
449 atomic_read(&node->refcnt));
448 } 450 }
449} 451}
450 452
@@ -455,8 +457,9 @@ void hfs_bnode_put(struct hfs_bnode *node)
455 struct hfs_btree *tree = node->tree; 457 struct hfs_btree *tree = node->tree;
456 int i; 458 int i;
457 459
458 dprint(DBG_BNODE_REFS, "put_node(%d:%d): %d\n", 460 hfs_dbg(BNODE_REFS, "put_node(%d:%d): %d\n",
459 node->tree->cnid, node->this, atomic_read(&node->refcnt)); 461 node->tree->cnid, node->this,
462 atomic_read(&node->refcnt));
460 BUG_ON(!atomic_read(&node->refcnt)); 463 BUG_ON(!atomic_read(&node->refcnt));
461 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock)) 464 if (!atomic_dec_and_lock(&node->refcnt, &tree->hash_lock))
462 return; 465 return;
diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
index 92fb358ce824..57642570c6d8 100644
--- a/fs/hfs/brec.c
+++ b/fs/hfs/brec.c
@@ -94,7 +94,8 @@ again:
94 end_rec_off = tree->node_size - (node->num_recs + 1) * 2; 94 end_rec_off = tree->node_size - (node->num_recs + 1) * 2;
95 end_off = hfs_bnode_read_u16(node, end_rec_off); 95 end_off = hfs_bnode_read_u16(node, end_rec_off);
96 end_rec_off -= 2; 96 end_rec_off -= 2;
97 dprint(DBG_BNODE_MOD, "insert_rec: %d, %d, %d, %d\n", rec, size, end_off, end_rec_off); 97 hfs_dbg(BNODE_MOD, "insert_rec: %d, %d, %d, %d\n",
98 rec, size, end_off, end_rec_off);
98 if (size > end_rec_off - end_off) { 99 if (size > end_rec_off - end_off) {
99 if (new_node) 100 if (new_node)
100 panic("not enough room!\n"); 101 panic("not enough room!\n");
@@ -190,7 +191,8 @@ again:
190 mark_inode_dirty(tree->inode); 191 mark_inode_dirty(tree->inode);
191 } 192 }
192 hfs_bnode_dump(node); 193 hfs_bnode_dump(node);
193 dprint(DBG_BNODE_MOD, "remove_rec: %d, %d\n", fd->record, fd->keylength + fd->entrylength); 194 hfs_dbg(BNODE_MOD, "remove_rec: %d, %d\n",
195 fd->record, fd->keylength + fd->entrylength);
194 if (!--node->num_recs) { 196 if (!--node->num_recs) {
195 hfs_bnode_unlink(node); 197 hfs_bnode_unlink(node);
196 if (!node->parent) 198 if (!node->parent)
@@ -240,7 +242,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
240 if (IS_ERR(new_node)) 242 if (IS_ERR(new_node))
241 return new_node; 243 return new_node;
242 hfs_bnode_get(node); 244 hfs_bnode_get(node);
243 dprint(DBG_BNODE_MOD, "split_nodes: %d - %d - %d\n", 245 hfs_dbg(BNODE_MOD, "split_nodes: %d - %d - %d\n",
244 node->this, new_node->this, node->next); 246 node->this, new_node->this, node->next);
245 new_node->next = node->next; 247 new_node->next = node->next;
246 new_node->prev = node->this; 248 new_node->prev = node->this;
@@ -374,7 +376,8 @@ again:
374 newkeylen = (hfs_bnode_read_u8(node, 14) | 1) + 1; 376 newkeylen = (hfs_bnode_read_u8(node, 14) | 1) + 1;
375 else 377 else
376 fd->keylength = newkeylen = tree->max_key_len + 1; 378 fd->keylength = newkeylen = tree->max_key_len + 1;
377 dprint(DBG_BNODE_MOD, "update_rec: %d, %d, %d\n", rec, fd->keylength, newkeylen); 379 hfs_dbg(BNODE_MOD, "update_rec: %d, %d, %d\n",
380 rec, fd->keylength, newkeylen);
378 381
379 rec_off = tree->node_size - (rec + 2) * 2; 382 rec_off = tree->node_size - (rec + 2) * 2;
380 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2; 383 end_rec_off = tree->node_size - (parent->num_recs + 1) * 2;
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 1cbdeea1db44..07d94ce1d278 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -316,7 +316,7 @@ void hfs_bmap_free(struct hfs_bnode *node)
316 u32 nidx; 316 u32 nidx;
317 u8 *data, byte, m; 317 u8 *data, byte, m;
318 318
319 dprint(DBG_BNODE_MOD, "btree_free_node: %u\n", node->this); 319 hfs_dbg(BNODE_MOD, "btree_free_node: %u\n", node->this);
320 tree = node->tree; 320 tree = node->tree;
321 nidx = node->this; 321 nidx = node->this;
322 node = hfs_bnode_find(tree, 0); 322 node = hfs_bnode_find(tree, 0);
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index 9569b39257ec..6ecb3d7efb78 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -87,7 +87,8 @@ int hfs_cat_create(u32 cnid, struct inode *dir, struct qstr *str, struct inode *
87 int entry_size; 87 int entry_size;
88 int err; 88 int err;
89 89
90 dprint(DBG_CAT_MOD, "create_cat: %s,%u(%d)\n", str->name, cnid, inode->i_nlink); 90 hfs_dbg(CAT_MOD, "create_cat: %s,%u(%d)\n",
91 str->name, cnid, inode->i_nlink);
91 if (dir->i_size >= HFS_MAX_VALENCE) 92 if (dir->i_size >= HFS_MAX_VALENCE)
92 return -ENOSPC; 93 return -ENOSPC;
93 94
@@ -214,7 +215,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, struct qstr *str)
214 struct list_head *pos; 215 struct list_head *pos;
215 int res, type; 216 int res, type;
216 217
217 dprint(DBG_CAT_MOD, "delete_cat: %s,%u\n", str ? str->name : NULL, cnid); 218 hfs_dbg(CAT_MOD, "delete_cat: %s,%u\n", str ? str->name : NULL, cnid);
218 sb = dir->i_sb; 219 sb = dir->i_sb;
219 res = hfs_find_init(HFS_SB(sb)->cat_tree, &fd); 220 res = hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
220 if (res) 221 if (res)
@@ -282,7 +283,8 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
282 int entry_size, type; 283 int entry_size, type;
283 int err; 284 int err;
284 285
285 dprint(DBG_CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", cnid, src_dir->i_ino, src_name->name, 286 hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n",
287 cnid, src_dir->i_ino, src_name->name,
286 dst_dir->i_ino, dst_name->name); 288 dst_dir->i_ino, dst_name->name);
287 sb = src_dir->i_sb; 289 sb = src_dir->i_sb;
288 err = hfs_find_init(HFS_SB(sb)->cat_tree, &src_fd); 290 err = hfs_find_init(HFS_SB(sb)->cat_tree, &src_fd);
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 813447b5b052..e33a0d36a93e 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -205,11 +205,12 @@ static void hfs_dump_extent(struct hfs_extent *extent)
205{ 205{
206 int i; 206 int i;
207 207
208 dprint(DBG_EXTENT, " "); 208 hfs_dbg(EXTENT, " ");
209 for (i = 0; i < 3; i++) 209 for (i = 0; i < 3; i++)
210 dprint(DBG_EXTENT, " %u:%u", be16_to_cpu(extent[i].block), 210 hfs_dbg_cont(EXTENT, " %u:%u",
211 be16_to_cpu(extent[i].count)); 211 be16_to_cpu(extent[i].block),
212 dprint(DBG_EXTENT, "\n"); 212 be16_to_cpu(extent[i].count));
213 hfs_dbg_cont(EXTENT, "\n");
213} 214}
214 215
215static int hfs_add_extent(struct hfs_extent *extent, u16 offset, 216static int hfs_add_extent(struct hfs_extent *extent, u16 offset,
@@ -404,10 +405,10 @@ int hfs_extend_file(struct inode *inode)
404 goto out; 405 goto out;
405 } 406 }
406 407
407 dprint(DBG_EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len); 408 hfs_dbg(EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len);
408 if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) { 409 if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) {
409 if (!HFS_I(inode)->first_blocks) { 410 if (!HFS_I(inode)->first_blocks) {
410 dprint(DBG_EXTENT, "first extents\n"); 411 hfs_dbg(EXTENT, "first extents\n");
411 /* no extents yet */ 412 /* no extents yet */
412 HFS_I(inode)->first_extents[0].block = cpu_to_be16(start); 413 HFS_I(inode)->first_extents[0].block = cpu_to_be16(start);
413 HFS_I(inode)->first_extents[0].count = cpu_to_be16(len); 414 HFS_I(inode)->first_extents[0].count = cpu_to_be16(len);
@@ -449,7 +450,7 @@ out:
449 return res; 450 return res;
450 451
451insert_extent: 452insert_extent:
452 dprint(DBG_EXTENT, "insert new extent\n"); 453 hfs_dbg(EXTENT, "insert new extent\n");
453 res = hfs_ext_write_extent(inode); 454 res = hfs_ext_write_extent(inode);
454 if (res) 455 if (res)
455 goto out; 456 goto out;
@@ -474,8 +475,9 @@ void hfs_file_truncate(struct inode *inode)
474 u32 size; 475 u32 size;
475 int res; 476 int res;
476 477
477 dprint(DBG_INODE, "truncate: %lu, %Lu -> %Lu\n", inode->i_ino, 478 hfs_dbg(INODE, "truncate: %lu, %Lu -> %Lu\n",
478 (long long)HFS_I(inode)->phys_size, inode->i_size); 479 inode->i_ino, (long long)HFS_I(inode)->phys_size,
480 inode->i_size);
479 if (inode->i_size > HFS_I(inode)->phys_size) { 481 if (inode->i_size > HFS_I(inode)->phys_size) {
480 struct address_space *mapping = inode->i_mapping; 482 struct address_space *mapping = inode->i_mapping;
481 void *fsdata; 483 void *fsdata;
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 67817af96f82..d363b1e81ae9 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -34,8 +34,18 @@
34//#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) 34//#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT)
35#define DBG_MASK (0) 35#define DBG_MASK (0)
36 36
37#define dprint(flg, fmt, args...) \ 37#define hfs_dbg(flg, fmt, ...) \
38 if (flg & DBG_MASK) printk(fmt , ## args) 38do { \
39 if (DBG_##flg & DBG_MASK) \
40 printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
41} while (0)
42
43#define hfs_dbg_cont(flg, fmt, ...) \
44do { \
45 if (DBG_##flg & DBG_MASK) \
46 printk(KERN_CONT fmt, ##__VA_ARGS__); \
47} while (0)
48
39 49
40/* 50/*
41 * struct hfs_inode_info 51 * struct hfs_inode_info
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 0847471ff04f..716e1aafb2e2 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -237,7 +237,7 @@ void hfs_delete_inode(struct inode *inode)
237{ 237{
238 struct super_block *sb = inode->i_sb; 238 struct super_block *sb = inode->i_sb;
239 239
240 dprint(DBG_INODE, "delete_inode: %lu\n", inode->i_ino); 240 hfs_dbg(INODE, "delete_inode: %lu\n", inode->i_ino);
241 if (S_ISDIR(inode->i_mode)) { 241 if (S_ISDIR(inode->i_mode)) {
242 HFS_SB(sb)->folder_count--; 242 HFS_SB(sb)->folder_count--;
243 if (HFS_I(inode)->cat_key.ParID == cpu_to_be32(HFS_ROOT_CNID)) 243 if (HFS_I(inode)->cat_key.ParID == cpu_to_be32(HFS_ROOT_CNID))
@@ -418,7 +418,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc)
418 hfs_cat_rec rec; 418 hfs_cat_rec rec;
419 int res; 419 int res;
420 420
421 dprint(DBG_INODE, "hfs_write_inode: %lu\n", inode->i_ino); 421 hfs_dbg(INODE, "hfs_write_inode: %lu\n", inode->i_ino);
422 res = hfs_ext_write_extent(inode); 422 res = hfs_ext_write_extent(inode);
423 if (res) 423 if (res)
424 return res; 424 return res;
diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c
index 8d691f124714..2043b50c5418 100644
--- a/fs/hfsplus/attributes.c
+++ b/fs/hfsplus/attributes.c
@@ -166,7 +166,7 @@ int hfsplus_find_attr(struct super_block *sb, u32 cnid,
166{ 166{
167 int err = 0; 167 int err = 0;
168 168
169 dprint(DBG_ATTR_MOD, "find_attr: %s,%d\n", name ? name : NULL, cnid); 169 hfs_dbg(ATTR_MOD, "find_attr: %s,%d\n", name ? name : NULL, cnid);
170 170
171 if (!HFSPLUS_SB(sb)->attr_tree) { 171 if (!HFSPLUS_SB(sb)->attr_tree) {
172 printk(KERN_ERR "hfs: attributes file doesn't exist\n"); 172 printk(KERN_ERR "hfs: attributes file doesn't exist\n");
@@ -228,7 +228,7 @@ int hfsplus_create_attr(struct inode *inode,
228 int entry_size; 228 int entry_size;
229 int err; 229 int err;
230 230
231 dprint(DBG_ATTR_MOD, "create_attr: %s,%ld\n", 231 hfs_dbg(ATTR_MOD, "create_attr: %s,%ld\n",
232 name ? name : NULL, inode->i_ino); 232 name ? name : NULL, inode->i_ino);
233 233
234 if (!HFSPLUS_SB(sb)->attr_tree) { 234 if (!HFSPLUS_SB(sb)->attr_tree) {
@@ -328,7 +328,7 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)
328 struct super_block *sb = inode->i_sb; 328 struct super_block *sb = inode->i_sb;
329 struct hfs_find_data fd; 329 struct hfs_find_data fd;
330 330
331 dprint(DBG_ATTR_MOD, "delete_attr: %s,%ld\n", 331 hfs_dbg(ATTR_MOD, "delete_attr: %s,%ld\n",
332 name ? name : NULL, inode->i_ino); 332 name ? name : NULL, inode->i_ino);
333 333
334 if (!HFSPLUS_SB(sb)->attr_tree) { 334 if (!HFSPLUS_SB(sb)->attr_tree) {
@@ -369,7 +369,7 @@ int hfsplus_delete_all_attrs(struct inode *dir, u32 cnid)
369 int err = 0; 369 int err = 0;
370 struct hfs_find_data fd; 370 struct hfs_find_data fd;
371 371
372 dprint(DBG_ATTR_MOD, "delete_all_attrs: %d\n", cnid); 372 hfs_dbg(ATTR_MOD, "delete_all_attrs: %d\n", cnid);
373 373
374 if (!HFSPLUS_SB(dir->i_sb)->attr_tree) { 374 if (!HFSPLUS_SB(dir->i_sb)->attr_tree) {
375 printk(KERN_ERR "hfs: attributes file doesn't exist\n"); 375 printk(KERN_ERR "hfs: attributes file doesn't exist\n");
diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c
index bbfdc1707725..d27f37f04ffc 100644
--- a/fs/hfsplus/bfind.c
+++ b/fs/hfsplus/bfind.c
@@ -22,7 +22,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)
22 return -ENOMEM; 22 return -ENOMEM;
23 fd->search_key = ptr; 23 fd->search_key = ptr;
24 fd->key = ptr + tree->max_key_len + 2; 24 fd->key = ptr + tree->max_key_len + 2;
25 dprint(DBG_BNODE_REFS, "find_init: %d (%p)\n", 25 hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n",
26 tree->cnid, __builtin_return_address(0)); 26 tree->cnid, __builtin_return_address(0));
27 switch (tree->cnid) { 27 switch (tree->cnid) {
28 case HFSPLUS_CAT_CNID: 28 case HFSPLUS_CAT_CNID:
@@ -44,7 +44,7 @@ void hfs_find_exit(struct hfs_find_data *fd)
44{ 44{
45 hfs_bnode_put(fd->bnode); 45 hfs_bnode_put(fd->bnode);
46 kfree(fd->search_key); 46 kfree(fd->search_key);
47 dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", 47 hfs_dbg(BNODE_REFS, "find_exit: %d (%p)\n",
48 fd->tree->cnid, __builtin_return_address(0)); 48 fd->tree->cnid, __builtin_return_address(0));
49 mutex_unlock(&fd->tree->tree_lock); 49 mutex_unlock(&fd->tree->tree_lock);
50 fd->tree = NULL; 50 fd->tree = NULL;
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c
index 6feefc0cb48a..7da6d46882a1 100644
--- a/fs/hfsplus/bitmap.c
+++ b/fs/hfsplus/bitmap.c
@@ -30,7 +30,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,
30 if (!len) 30 if (!len)
31 return size; 31 return size;
32 32
33 dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); 33 hfs_dbg(BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len);
34 mutex_lock(&sbi->alloc_mutex); 34 mutex_lock(&sbi->alloc_mutex);
35 mapping = sbi->alloc_file->i_mapping; 35 mapping = sbi->alloc_file->i_mapping;
36 page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL); 36 page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);
@@ -89,14 +89,14 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size,
89 else 89 else
90 end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32; 90 end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32;
91 } 91 }
92 dprint(DBG_BITMAP, "bitmap full\n"); 92 hfs_dbg(BITMAP, "bitmap full\n");
93 start = size; 93 start = size;
94 goto out; 94 goto out;
95 95
96found: 96found:
97 start = offset + (curr - pptr) * 32 + i; 97 start = offset + (curr - pptr) * 32 + i;
98 if (start >= size) { 98 if (start >= size) {
99 dprint(DBG_BITMAP, "bitmap full\n"); 99 hfs_dbg(BITMAP, "bitmap full\n");
100 goto out; 100 goto out;
101 } 101 }
102 /* do any partial u32 at the start */ 102 /* do any partial u32 at the start */
@@ -154,7 +154,7 @@ done:
154 *max = offset + (curr - pptr) * 32 + i - start; 154 *max = offset + (curr - pptr) * 32 + i - start;
155 sbi->free_blocks -= *max; 155 sbi->free_blocks -= *max;
156 hfsplus_mark_mdb_dirty(sb); 156 hfsplus_mark_mdb_dirty(sb);
157 dprint(DBG_BITMAP, "-> %u,%u\n", start, *max); 157 hfs_dbg(BITMAP, "-> %u,%u\n", start, *max);
158out: 158out:
159 mutex_unlock(&sbi->alloc_mutex); 159 mutex_unlock(&sbi->alloc_mutex);
160 return start; 160 return start;
@@ -173,7 +173,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
173 if (!count) 173 if (!count)
174 return 0; 174 return 0;
175 175
176 dprint(DBG_BITMAP, "block_free: %u,%u\n", offset, count); 176 hfs_dbg(BITMAP, "block_free: %u,%u\n", offset, count);
177 /* are all of the bits in range? */ 177 /* are all of the bits in range? */
178 if ((offset + count) > sbi->total_blocks) 178 if ((offset + count) > sbi->total_blocks)
179 return -ENOENT; 179 return -ENOENT;
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index f31ac6f404f1..1ca93044644c 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -130,7 +130,7 @@ void hfs_bnode_copy(struct hfs_bnode *dst_node, int dst,
130 struct page **src_page, **dst_page; 130 struct page **src_page, **dst_page;
131 int l; 131 int l;
132 132
133 dprint(DBG_BNODE_MOD, "copybytes: %u,%u,%u\n", dst, src, len); 133 hfs_dbg(BNODE_MOD, "copybytes: %u,%u,%u\n", dst, src, len);
134 if (!len) 134 if (!len)
135 return; 135 return;
136 tree = src_node->tree; 136 tree = src_node->tree;
@@ -188,7 +188,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)
188 struct page **src_page, **dst_page; 188 struct page **src_page, **dst_page;
189 int l; 189 int l;
190 190
191 dprint(DBG_BNODE_MOD, "movebytes: %u,%u,%u\n", dst, src, len); 191 hfs_dbg(BNODE_MOD, "movebytes: %u,%u,%u\n", dst, src, len);
192 if (!len) 192 if (!len)
193 return; 193 return;
194 src += node->page_offset; 194 src += node->page_offset;
@@ -302,16 +302,16 @@ void hfs_bnode_dump(struct hfs_bnode *node)
302 __be32 cnid; 302 __be32 cnid;
303 int i, off, key_off; 303 int i, off, key_off;
304 304
305 dprint(DBG_BNODE_MOD, "bnode: %d\n", node->this); 305 hfs_dbg(BNODE_MOD, "bnode: %d\n", node->this);
306 hfs_bnode_read(node, &desc, 0, sizeof(desc)); 306 hfs_bnode_read(node, &desc, 0, sizeof(desc));
307 dprint(DBG_BNODE_MOD, "%d, %d, %d, %d, %d\n", 307 hfs_dbg(BNODE_MOD, "%d, %d, %d, %d, %d\n",
308 be32_to_cpu(desc.next), be32_to_cpu(desc.prev), 308 be32_to_cpu(desc.next), be32_to_cpu(desc.prev),
309 desc.type, desc.height, be16_to_cpu(desc.num_recs)); 309 desc.type, desc.height, be16_to_cpu(desc.num_recs));
310 310
311 off = node->tree->node_size - 2; 311 off = node->tree->node_size - 2;
312 for (i = be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i--) { 312 for (i = be16_to_cpu(desc.num_recs); i >= 0; off -= 2, i--) {
313 key_off = hfs_bnode_read_u16(node, off); 313 key_off = hfs_bnode_read_u16(node, off);
314 dprint(DBG_BNODE_MOD, " %d", key_off); 314 hfs_dbg(BNODE_MOD, " %d", key_off);
315 if (i && node->type == HFS_NODE_INDEX) { 315 if (i && node->type == HFS_NODE_INDEX) {
316 int tmp; 316 int tmp;
317 317
@@ -320,17 +320,17 @@ void hfs_bnode_dump(struct hfs_bnode *node)
320 tmp = hfs_bnode_read_u16(node, key_off) + 2; 320 tmp = hfs_bnode_read_u16(node, key_off) + 2;
321 else 321 else
322 tmp = node->tree->max_key_len + 2; 322 tmp = node->tree->max_key_len + 2;
323 dprint(DBG_BNODE_MOD, " (%d", tmp); 323 hfs_dbg_cont(BNODE_MOD, " (%d", tmp);
324 hfs_bnode_read(node, &cnid, key_off + tmp, 4); 324 hfs_bnode_read(node, &cnid, key_off + tmp, 4);
325 dprint(DBG_BNODE_MOD, ",%d)", be32_to_cpu(cnid)); 325 hfs_dbg_cont(BNODE_MOD, ",%d)", be32_to_cpu(cnid));
326 } else if (i && node->type == HFS_NODE_LEAF) { 326 } else if (i && node->type == HFS_NODE_LEAF) {
327 int tmp; 327 int tmp;
328 328
329 tmp = hfs_bnode_read_u16(node, key_off); 329 tmp = hfs_bnode_read_u16(node, key_off);
330 dprint(DBG_BNODE_MOD, " (%d)", tmp); 330 hfs_dbg_cont(BNODE_MOD, " (%d)", tmp);
331 } 331 }
332 } 332 }
333 dprint(DBG_BNODE_MOD, "\n"); 333 hfs_dbg_cont(BNODE_MOD, "\n");
334} 334}
335 335
336void hfs_bnode_unlink(struct hfs_bnode *node) 336void hfs_bnode_unlink(struct hfs_bnode *node)
@@ -366,7 +366,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)
366 366
367 /* move down? */ 367 /* move down? */
368 if (!node->prev && !node->next) 368 if (!node->prev && !node->next)
369 dprint(DBG_BNODE_MOD, "hfs_btree_del_level\n"); 369 hfs_dbg(BNODE_MOD, "hfs_btree_del_level\n");
370 if (!node->parent) { 370 if (!node->parent) {
371 tree->root = 0; 371 tree->root = 0;
372 tree->depth = 0; 372 tree->depth = 0;
@@ -425,8 +425,8 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
425 node->this = cnid; 425 node->this = cnid;
426 set_bit(HFS_BNODE_NEW, &node->flags); 426 set_bit(HFS_BNODE_NEW, &node->flags);
427 atomic_set(&node->refcnt, 1); 427 atomic_set(&node->refcnt, 1);
428 dprint(DBG_BNODE_REFS, "new_node(%d:%d): 1\n", 428 hfs_dbg(BNODE_REFS, "new_node(%d:%d): 1\n",
429 node->tree->cnid, node->this); 429 node->tree->cnid, node->this);
430 init_waitqueue_head(&node->lock_wq); 430 init_waitqueue_head(&node->lock_wq);
431 spin_lock(&tree->hash_lock); 431 spin_lock(&tree->hash_lock);
432 node2 = hfs_bnode_findhash(tree, cnid); 432 node2 = hfs_bnode_findhash(tree, cnid);
@@ -470,7 +470,7 @@ void hfs_bnode_unhash(struct hfs_bnode *node)
470{ 470{
471 struct hfs_bnode **p; 471 struct hfs_bnode **p;
472 472
473 dprint(DBG_BNODE_REFS, "remove_node(%d:%d): %d\n", 473 hfs_dbg(BNODE_REFS, "remove_node(%d:%d): %d\n",
474 node->tree->cnid, node->this, atomic_read(&node->refcnt)); 474 node->tree->cnid, node->this, atomic_read(&node->refcnt));
475 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)]; 475 for (p = &node->tree->node_hash[hfs_bnode_hash(node->this)];
476 *p && *p != node; p = &(*p)->next_hash) 476 *p && *p != node; p = &(*p)->next_hash)
@@ -620,7 +620,7 @@ void hfs_bnode_get(struct hfs_bnode *node)
620{ 620{
621 if (node) { 621 if (node) {
622 atomic_inc(&node->refcnt); 622 atomic_inc(&node->refcnt);
623 dprint(DBG_BNODE_REFS, "get_node(%d:%d): %d\n", 623 hfs_dbg(BNODE_REFS, "get_node(%d:%d): %d\n",
624 node->tree->cnid, node->this, 624 node->tree->cnid, node->this,
625 atomic_read(&node->refcnt)); 625 atomic_read(&node->refcnt));
626 } 626 }
@@ -633,7 +633,7 @@ void hfs_bnode_put(struct hfs_bnode *node)
633 struct hfs_btree *tree = node->tree; 633 struct hfs_btree *tree = node->tree;
634 int i; 634 int i;
635 635
636 dprint(DBG_BNODE_REFS, "put_node(%d:%d): %d\n", 636 hfs_dbg(BNODE_REFS, "put_node(%d:%d): %d\n",
637 node->tree->cnid, node->this, 637 node->tree->cnid, node->this,
638 atomic_read(&node->refcnt)); 638 atomic_read(&node->refcnt));
639 BUG_ON(!atomic_read(&node->refcnt)); 639 BUG_ON(!atomic_read(&node->refcnt));
diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
index 298d4e45604b..e238ba8cce26 100644
--- a/fs/hfsplus/brec.c
+++ b/fs/hfsplus/brec.c
@@ -90,7 +90,7 @@ again:
90 end_rec_off = tree->node_size - (node->num_recs + 1) * 2; 90 end_rec_off = tree->node_size - (node->num_recs + 1) * 2;
91 end_off = hfs_bnode_read_u16(node, end_rec_off); 91 end_off = hfs_bnode_read_u16(node, end_rec_off);
92 end_rec_off -= 2; 92 end_rec_off -= 2;
93 dprint(DBG_BNODE_MOD, "insert_rec: %d, %d, %d, %d\n", 93 hfs_dbg(BNODE_MOD, "insert_rec: %d, %d, %d, %d\n",
94 rec, size, end_off, end_rec_off); 94 rec, size, end_off, end_rec_off);
95 if (size > end_rec_off - end_off) { 95 if (size > end_rec_off - end_off) {
96 if (new_node) 96 if (new_node)
@@ -191,7 +191,7 @@ again:
191 mark_inode_dirty(tree->inode); 191 mark_inode_dirty(tree->inode);
192 } 192 }
193 hfs_bnode_dump(node); 193 hfs_bnode_dump(node);
194 dprint(DBG_BNODE_MOD, "remove_rec: %d, %d\n", 194 hfs_dbg(BNODE_MOD, "remove_rec: %d, %d\n",
195 fd->record, fd->keylength + fd->entrylength); 195 fd->record, fd->keylength + fd->entrylength);
196 if (!--node->num_recs) { 196 if (!--node->num_recs) {
197 hfs_bnode_unlink(node); 197 hfs_bnode_unlink(node);
@@ -244,7 +244,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
244 if (IS_ERR(new_node)) 244 if (IS_ERR(new_node))
245 return new_node; 245 return new_node;
246 hfs_bnode_get(node); 246 hfs_bnode_get(node);
247 dprint(DBG_BNODE_MOD, "split_nodes: %d - %d - %d\n", 247 hfs_dbg(BNODE_MOD, "split_nodes: %d - %d - %d\n",
248 node->this, new_node->this, node->next); 248 node->this, new_node->this, node->next);
249 new_node->next = node->next; 249 new_node->next = node->next;
250 new_node->prev = node->this; 250 new_node->prev = node->this;
@@ -379,7 +379,7 @@ again:
379 newkeylen = hfs_bnode_read_u16(node, 14) + 2; 379 newkeylen = hfs_bnode_read_u16(node, 14) + 2;
380 else 380 else
381 fd->keylength = newkeylen = tree->max_key_len + 2; 381 fd->keylength = newkeylen = tree->max_key_len + 2;
382 dprint(DBG_BNODE_MOD, "update_rec: %d, %d, %d\n", 382 hfs_dbg(BNODE_MOD, "update_rec: %d, %d, %d\n",
383 rec, fd->keylength, newkeylen); 383 rec, fd->keylength, newkeylen);
384 384
385 rec_off = tree->node_size - (rec + 2) * 2; 385 rec_off = tree->node_size - (rec + 2) * 2;
@@ -391,7 +391,7 @@ again:
391 end_off = hfs_bnode_read_u16(parent, end_rec_off); 391 end_off = hfs_bnode_read_u16(parent, end_rec_off);
392 if (end_rec_off - end_off < diff) { 392 if (end_rec_off - end_off < diff) {
393 393
394 dprint(DBG_BNODE_MOD, "hfs: splitting index node.\n"); 394 hfs_dbg(BNODE_MOD, "splitting index node\n");
395 fd->bnode = parent; 395 fd->bnode = parent;
396 new_node = hfs_bnode_split(fd); 396 new_node = hfs_bnode_split(fd);
397 if (IS_ERR(new_node)) 397 if (IS_ERR(new_node))
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index efb689c21a95..c2fa4bf5629c 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -303,7 +303,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree)
303 kunmap(*pagep); 303 kunmap(*pagep);
304 nidx = node->next; 304 nidx = node->next;
305 if (!nidx) { 305 if (!nidx) {
306 dprint(DBG_BNODE_MOD, "hfs: create new bmap node.\n"); 306 hfs_dbg(BNODE_MOD, "create new bmap node\n");
307 next_node = hfs_bmap_new_bmap(node, idx); 307 next_node = hfs_bmap_new_bmap(node, idx);
308 } else 308 } else
309 next_node = hfs_bnode_find(tree, nidx); 309 next_node = hfs_bnode_find(tree, nidx);
@@ -329,7 +329,7 @@ void hfs_bmap_free(struct hfs_bnode *node)
329 u32 nidx; 329 u32 nidx;
330 u8 *data, byte, m; 330 u8 *data, byte, m;
331 331
332 dprint(DBG_BNODE_MOD, "btree_free_node: %u\n", node->this); 332 hfs_dbg(BNODE_MOD, "btree_free_node: %u\n", node->this);
333 BUG_ON(!node->this); 333 BUG_ON(!node->this);
334 tree = node->tree; 334 tree = node->tree;
335 nidx = node->this; 335 nidx = node->this;
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index 840d71edd193..12cea2370713 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -212,7 +212,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
212 int entry_size; 212 int entry_size;
213 int err; 213 int err;
214 214
215 dprint(DBG_CAT_MOD, "create_cat: %s,%u(%d)\n", 215 hfs_dbg(CAT_MOD, "create_cat: %s,%u(%d)\n",
216 str->name, cnid, inode->i_nlink); 216 str->name, cnid, inode->i_nlink);
217 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); 217 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
218 if (err) 218 if (err)
@@ -271,8 +271,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str)
271 int err, off; 271 int err, off;
272 u16 type; 272 u16 type;
273 273
274 dprint(DBG_CAT_MOD, "delete_cat: %s,%u\n", 274 hfs_dbg(CAT_MOD, "delete_cat: %s,%u\n", str ? str->name : NULL, cnid);
275 str ? str->name : NULL, cnid);
276 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); 275 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
277 if (err) 276 if (err)
278 return err; 277 return err;
@@ -361,7 +360,7 @@ int hfsplus_rename_cat(u32 cnid,
361 int entry_size, type; 360 int entry_size, type;
362 int err; 361 int err;
363 362
364 dprint(DBG_CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n", 363 hfs_dbg(CAT_MOD, "rename_cat: %u - %lu,%s - %lu,%s\n",
365 cnid, src_dir->i_ino, src_name->name, 364 cnid, src_dir->i_ino, src_name->name,
366 dst_dir->i_ino, dst_name->name); 365 dst_dir->i_ino, dst_name->name);
367 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &src_fd); 366 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &src_fd);
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index fe0a76213d9e..64a532acc5e2 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -265,7 +265,7 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock,
265 mutex_unlock(&hip->extents_lock); 265 mutex_unlock(&hip->extents_lock);
266 266
267done: 267done:
268 dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", 268 hfs_dbg(EXTENT, "get_block(%lu): %llu - %u\n",
269 inode->i_ino, (long long)iblock, dblock); 269 inode->i_ino, (long long)iblock, dblock);
270 270
271 mask = (1 << sbi->fs_shift) - 1; 271 mask = (1 << sbi->fs_shift) - 1;
@@ -288,11 +288,12 @@ static void hfsplus_dump_extent(struct hfsplus_extent *extent)
288{ 288{
289 int i; 289 int i;
290 290
291 dprint(DBG_EXTENT, " "); 291 hfs_dbg(EXTENT, " ");
292 for (i = 0; i < 8; i++) 292 for (i = 0; i < 8; i++)
293 dprint(DBG_EXTENT, " %u:%u", be32_to_cpu(extent[i].start_block), 293 hfs_dbg_cont(EXTENT, " %u:%u",
294 be32_to_cpu(extent[i].block_count)); 294 be32_to_cpu(extent[i].start_block),
295 dprint(DBG_EXTENT, "\n"); 295 be32_to_cpu(extent[i].block_count));
296 hfs_dbg_cont(EXTENT, "\n");
296} 297}
297 298
298static int hfsplus_add_extent(struct hfsplus_extent *extent, u32 offset, 299static int hfsplus_add_extent(struct hfsplus_extent *extent, u32 offset,
@@ -349,7 +350,7 @@ found:
349 err = hfsplus_block_free(sb, start, count); 350 err = hfsplus_block_free(sb, start, count);
350 if (err) { 351 if (err) {
351 printk(KERN_ERR "hfs: can't free extent\n"); 352 printk(KERN_ERR "hfs: can't free extent\n");
352 dprint(DBG_EXTENT, " start: %u count: %u\n", 353 hfs_dbg(EXTENT, " start: %u count: %u\n",
353 start, count); 354 start, count);
354 } 355 }
355 extent->block_count = 0; 356 extent->block_count = 0;
@@ -360,7 +361,7 @@ found:
360 err = hfsplus_block_free(sb, start + count, block_nr); 361 err = hfsplus_block_free(sb, start + count, block_nr);
361 if (err) { 362 if (err) {
362 printk(KERN_ERR "hfs: can't free extent\n"); 363 printk(KERN_ERR "hfs: can't free extent\n");
363 dprint(DBG_EXTENT, " start: %u count: %u\n", 364 hfs_dbg(EXTENT, " start: %u count: %u\n",
364 start, count); 365 start, count);
365 } 366 }
366 extent->block_count = cpu_to_be32(count); 367 extent->block_count = cpu_to_be32(count);
@@ -459,11 +460,11 @@ int hfsplus_file_extend(struct inode *inode)
459 } 460 }
460 } 461 }
461 462
462 dprint(DBG_EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len); 463 hfs_dbg(EXTENT, "extend %lu: %u,%u\n", inode->i_ino, start, len);
463 464
464 if (hip->alloc_blocks <= hip->first_blocks) { 465 if (hip->alloc_blocks <= hip->first_blocks) {
465 if (!hip->first_blocks) { 466 if (!hip->first_blocks) {
466 dprint(DBG_EXTENT, "first extents\n"); 467 hfs_dbg(EXTENT, "first extents\n");
467 /* no extents yet */ 468 /* no extents yet */
468 hip->first_extents[0].start_block = cpu_to_be32(start); 469 hip->first_extents[0].start_block = cpu_to_be32(start);
469 hip->first_extents[0].block_count = cpu_to_be32(len); 470 hip->first_extents[0].block_count = cpu_to_be32(len);
@@ -500,7 +501,7 @@ out:
500 return res; 501 return res;
501 502
502insert_extent: 503insert_extent:
503 dprint(DBG_EXTENT, "insert new extent\n"); 504 hfs_dbg(EXTENT, "insert new extent\n");
504 res = hfsplus_ext_write_extent_locked(inode); 505 res = hfsplus_ext_write_extent_locked(inode);
505 if (res) 506 if (res)
506 goto out; 507 goto out;
@@ -525,9 +526,8 @@ void hfsplus_file_truncate(struct inode *inode)
525 u32 alloc_cnt, blk_cnt, start; 526 u32 alloc_cnt, blk_cnt, start;
526 int res; 527 int res;
527 528
528 dprint(DBG_INODE, "truncate: %lu, %llu -> %llu\n", 529 hfs_dbg(INODE, "truncate: %lu, %llu -> %llu\n",
529 inode->i_ino, (long long)hip->phys_size, 530 inode->i_ino, (long long)hip->phys_size, inode->i_size);
530 inode->i_size);
531 531
532 if (inode->i_size > hip->phys_size) { 532 if (inode->i_size > hip->phys_size) {
533 struct address_space *mapping = inode->i_mapping; 533 struct address_space *mapping = inode->i_mapping;
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 05b11f36024c..910ea98e92df 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -32,9 +32,17 @@
32#endif 32#endif
33#define DBG_MASK (0) 33#define DBG_MASK (0)
34 34
35#define dprint(flg, fmt, args...) \ 35#define hfs_dbg(flg, fmt, ...) \
36 if (flg & DBG_MASK) \ 36do { \
37 printk(fmt , ## args) 37 if (DBG_##flg & DBG_MASK) \
38 printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
39} while (0)
40
41#define hfs_dbg_cont(flg, fmt, ...) \
42do { \
43 if (DBG_##flg & DBG_MASK) \
44 printk(KERN_CONT fmt, ##__VA_ARGS__); \
45} while (0)
38 46
39/* Runtime config options */ 47/* Runtime config options */
40#define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */ 48#define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 7b87284e46dc..4886fd37c082 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -145,7 +145,7 @@ static int hfsplus_write_inode(struct inode *inode,
145{ 145{
146 int err; 146 int err;
147 147
148 dprint(DBG_INODE, "hfsplus_write_inode: %lu\n", inode->i_ino); 148 hfs_dbg(INODE, "hfsplus_write_inode: %lu\n", inode->i_ino);
149 149
150 err = hfsplus_ext_write_extent(inode); 150 err = hfsplus_ext_write_extent(inode);
151 if (err) 151 if (err)
@@ -160,7 +160,7 @@ static int hfsplus_write_inode(struct inode *inode,
160 160
161static void hfsplus_evict_inode(struct inode *inode) 161static void hfsplus_evict_inode(struct inode *inode)
162{ 162{
163 dprint(DBG_INODE, "hfsplus_evict_inode: %lu\n", inode->i_ino); 163 hfs_dbg(INODE, "hfsplus_evict_inode: %lu\n", inode->i_ino);
164 truncate_inode_pages(&inode->i_data, 0); 164 truncate_inode_pages(&inode->i_data, 0);
165 clear_inode(inode); 165 clear_inode(inode);
166 if (HFSPLUS_IS_RSRC(inode)) { 166 if (HFSPLUS_IS_RSRC(inode)) {
@@ -179,7 +179,7 @@ static int hfsplus_sync_fs(struct super_block *sb, int wait)
179 if (!wait) 179 if (!wait)
180 return 0; 180 return 0;
181 181
182 dprint(DBG_SUPER, "hfsplus_sync_fs\n"); 182 hfs_dbg(SUPER, "hfsplus_sync_fs\n");
183 183
184 /* 184 /*
185 * Explicitly write out the special metadata inodes. 185 * Explicitly write out the special metadata inodes.
@@ -275,7 +275,7 @@ static void hfsplus_put_super(struct super_block *sb)
275{ 275{
276 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); 276 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
277 277
278 dprint(DBG_SUPER, "hfsplus_put_super\n"); 278 hfs_dbg(SUPER, "hfsplus_put_super\n");
279 279
280 cancel_delayed_work_sync(&sbi->sync_work); 280 cancel_delayed_work_sync(&sbi->sync_work);
281 281