aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/inode.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 08:47:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:03 -0400
commitabf5d15fd2e52517dd56a17a846d5a1f900b7db4 (patch)
treeea537760c201cea57b468044dc733e06781ece2b /fs/ufs/inode.c
parent5afb3145c9a733166174e1f5a07c46410b5c4091 (diff)
[PATCH] ufs: easy debug
Currently to turn on debug mode "user" has to edit ~10 files, to turn off he has to do it again. This patch introduce such changes: 1)turn on(off) debug messages via ".config" 2)remove unnecessary duplication of code 3)make "UFSD" macros more similar to function 4)fix some compiler warnings Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r--fs/ufs/inode.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index c28b7522c9e7..01f754462341 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -41,15 +41,6 @@
41#include "swab.h" 41#include "swab.h"
42#include "util.h" 42#include "util.h"
43 43
44#undef UFS_INODE_DEBUG
45#undef UFS_INODE_DEBUG_MORE
46
47#ifdef UFS_INODE_DEBUG
48#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
49#else
50#define UFSD(x)
51#endif
52
53static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t offsets[4]) 44static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t offsets[4])
54{ 45{
55 struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi; 46 struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi;
@@ -61,7 +52,7 @@ static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t off
61 int n = 0; 52 int n = 0;
62 53
63 54
64 UFSD(("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks)); 55 UFSD("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks);
65 if (i_block < 0) { 56 if (i_block < 0) {
66 ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0"); 57 ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0");
67 } else if (i_block < direct_blocks) { 58 } else if (i_block < direct_blocks) {
@@ -104,8 +95,8 @@ u64 ufs_frag_map(struct inode *inode, sector_t frag)
104 unsigned flags = UFS_SB(sb)->s_flags; 95 unsigned flags = UFS_SB(sb)->s_flags;
105 u64 temp = 0L; 96 u64 temp = 0L;
106 97
107 UFSD((": frag = %llu depth = %d\n", (unsigned long long)frag, depth)); 98 UFSD(": frag = %llu depth = %d\n", (unsigned long long)frag, depth);
108 UFSD((": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask)); 99 UFSD(": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask);
109 100
110 if (depth == 0) 101 if (depth == 0)
111 return 0; 102 return 0;
@@ -186,8 +177,8 @@ static struct buffer_head *ufs_inode_getfrag(struct inode *inode,
186 __fs32 * p, * p2; 177 __fs32 * p, * p2;
187 unsigned flags = 0; 178 unsigned flags = 0;
188 179
189 UFSD(("ENTER, ino %lu, fragment %u, new_fragment %u, required %u\n", 180 UFSD("ENTER, ino %lu, fragment %u, new_fragment %u, required %u\n",
190 inode->i_ino, fragment, new_fragment, required)) 181 inode->i_ino, fragment, new_fragment, required);
191 182
192 sb = inode->i_sb; 183 sb = inode->i_sb;
193 uspi = UFS_SB(sb)->s_uspi; 184 uspi = UFS_SB(sb)->s_uspi;
@@ -210,7 +201,7 @@ repeat:
210 if (metadata) { 201 if (metadata) {
211 result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); 202 result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff);
212 if (tmp == fs32_to_cpu(sb, *p)) { 203 if (tmp == fs32_to_cpu(sb, *p)) {
213 UFSD(("EXIT, result %u\n", tmp + blockoff)) 204 UFSD("EXIT, result %u\n", tmp + blockoff);
214 return result; 205 return result;
215 } 206 }
216 brelse (result); 207 brelse (result);
@@ -288,7 +279,7 @@ repeat:
288 if (IS_SYNC(inode)) 279 if (IS_SYNC(inode))
289 ufs_sync_inode (inode); 280 ufs_sync_inode (inode);
290 mark_inode_dirty(inode); 281 mark_inode_dirty(inode);
291 UFSD(("EXIT, result %u\n", tmp + blockoff)) 282 UFSD("EXIT, result %u\n", tmp + blockoff);
292 return result; 283 return result;
293 284
294 /* This part : To be implemented .... 285 /* This part : To be implemented ....
@@ -323,7 +314,7 @@ static struct buffer_head *ufs_block_getfrag(struct inode *inode, struct buffer_
323 block = ufs_fragstoblks (fragment); 314 block = ufs_fragstoblks (fragment);
324 blockoff = ufs_fragnum (fragment); 315 blockoff = ufs_fragnum (fragment);
325 316
326 UFSD(("ENTER, ino %lu, fragment %u, new_fragment %u\n", inode->i_ino, fragment, new_fragment)) 317 UFSD("ENTER, ino %lu, fragment %u, new_fragment %u\n", inode->i_ino, fragment, new_fragment);
327 318
328 result = NULL; 319 result = NULL;
329 if (!bh) 320 if (!bh)
@@ -377,10 +368,10 @@ repeat:
377 sync_dirty_buffer(bh); 368 sync_dirty_buffer(bh);
378 inode->i_ctime = CURRENT_TIME_SEC; 369 inode->i_ctime = CURRENT_TIME_SEC;
379 mark_inode_dirty(inode); 370 mark_inode_dirty(inode);
380 UFSD(("result %u\n", tmp + blockoff)); 371 UFSD("result %u\n", tmp + blockoff);
381out: 372out:
382 brelse (bh); 373 brelse (bh);
383 UFSD(("EXIT\n")); 374 UFSD("EXIT\n");
384 return result; 375 return result;
385} 376}
386 377
@@ -399,7 +390,7 @@ int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_hea
399 390
400 if (!create) { 391 if (!create) {
401 phys64 = ufs_frag_map(inode, fragment); 392 phys64 = ufs_frag_map(inode, fragment);
402 UFSD(("phys64 = %llu \n",phys64)); 393 UFSD("phys64 = %llu \n",phys64);
403 if (phys64) 394 if (phys64)
404 map_bh(bh_result, sb, phys64); 395 map_bh(bh_result, sb, phys64);
405 return 0; 396 return 0;
@@ -414,7 +405,7 @@ int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_hea
414 405
415 lock_kernel(); 406 lock_kernel();
416 407
417 UFSD(("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment)) 408 UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment);
418 if (fragment < 0) 409 if (fragment < 0)
419 goto abort_negative; 410 goto abort_negative;
420 if (fragment > 411 if (fragment >
@@ -514,7 +505,7 @@ struct buffer_head * ufs_bread (struct inode * inode, unsigned fragment,
514{ 505{
515 struct buffer_head * bh; 506 struct buffer_head * bh;
516 507
517 UFSD(("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment)) 508 UFSD("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment);
518 bh = ufs_getfrag (inode, fragment, create, err); 509 bh = ufs_getfrag (inode, fragment, create, err);
519 if (!bh || buffer_uptodate(bh)) 510 if (!bh || buffer_uptodate(bh))
520 return bh; 511 return bh;
@@ -586,7 +577,7 @@ void ufs_read_inode (struct inode * inode)
586 unsigned i; 577 unsigned i;
587 unsigned flags; 578 unsigned flags;
588 579
589 UFSD(("ENTER, ino %lu\n", inode->i_ino)) 580 UFSD("ENTER, ino %lu\n", inode->i_ino);
590 581
591 sb = inode->i_sb; 582 sb = inode->i_sb;
592 uspi = UFS_SB(sb)->s_uspi; 583 uspi = UFS_SB(sb)->s_uspi;
@@ -652,7 +643,7 @@ void ufs_read_inode (struct inode * inode)
652 643
653 brelse (bh); 644 brelse (bh);
654 645
655 UFSD(("EXIT\n")) 646 UFSD("EXIT\n");
656 return; 647 return;
657 648
658bad_inode: 649bad_inode:
@@ -660,7 +651,7 @@ bad_inode:
660 return; 651 return;
661 652
662ufs2_inode : 653ufs2_inode :
663 UFSD(("Reading ufs2 inode, ino %lu\n", inode->i_ino)) 654 UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino);
664 655
665 ufs2_inode = (struct ufs2_inode *)(bh->b_data + sizeof(struct ufs2_inode) * ufs_inotofsbo(inode->i_ino)); 656 ufs2_inode = (struct ufs2_inode *)(bh->b_data + sizeof(struct ufs2_inode) * ufs_inotofsbo(inode->i_ino));
666 657
@@ -712,7 +703,7 @@ ufs2_inode :
712 703
713 brelse(bh); 704 brelse(bh);
714 705
715 UFSD(("EXIT\n")) 706 UFSD("EXIT\n");
716 return; 707 return;
717} 708}
718 709
@@ -726,7 +717,7 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
726 unsigned i; 717 unsigned i;
727 unsigned flags; 718 unsigned flags;
728 719
729 UFSD(("ENTER, ino %lu\n", inode->i_ino)) 720 UFSD("ENTER, ino %lu\n", inode->i_ino);
730 721
731 sb = inode->i_sb; 722 sb = inode->i_sb;
732 uspi = UFS_SB(sb)->s_uspi; 723 uspi = UFS_SB(sb)->s_uspi;
@@ -787,7 +778,7 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
787 sync_dirty_buffer(bh); 778 sync_dirty_buffer(bh);
788 brelse (bh); 779 brelse (bh);
789 780
790 UFSD(("EXIT\n")) 781 UFSD("EXIT\n");
791 return 0; 782 return 0;
792} 783}
793 784